10#include <cdc/modules/CDCDedxHadronCollector/CDCDedxHadronCollectorModule.h>
24 setDescription(
"A collector module for CDC dE/dx hadron calibrations");
28 addParam(
"maxcut",
m_maxCut,
"high cut on dedx curve for proton sample ",
double(1.2));
29 addParam(
"mincut",
m_minCut,
"low cut on dedx curve for proton sample ",
double(0.35));
39 std::vector<TTree* > ttree;
42 m_pdgMap = {{
"pi+",
"pion"}, {
"K+",
"kaon"}, {
"mu+",
"muon"}, {
"e+",
"electron"}, {
"p+",
"proton"}, {
"deuteron",
"deutron"}};
47 std::string pdg = x.second;
49 ttree.push_back(
new TTree(Form(
"%s", pdg.data()), Form(
"%s dE/dx information", pdg.data())));
50 int tt = ttree.size() - 1;
52 ttree[tt]->Branch<
double>(
"dedxnosat", &
m_dedxnosat);
53 ttree[tt]->Branch<
double>(
"dedx", &
m_dedx);
54 ttree[tt]->Branch<
double>(
"costh", &
m_costh);
55 ttree[tt]->Branch<
double>(
"p", &
m_p);
56 ttree[tt]->Branch<
int>(
"charge", &
m_charge);
57 ttree[tt]->Branch<
int>(
"nhits", &
m_nhits);
58 ttree[tt]->Branch<
double>(
"timereso", &
m_timeReso);
59 ttree[tt]->Branch<
double>(
"injtime", &
m_injTime);
60 ttree[tt]->Branch<
double>(
"injring", &
m_injRing);
63 registerObject<TTree>(Form(
"%s", pdg.data()), ttree[tt]);
75 for (
int iList = 0; iList < nParticleList; iList++) {
79 auto tree = getObjectPtr<TTree>(Form(
"%s", pdg.data()));
84 if (!particlelist or particlelist->getListSize() == 0)
continue;
87 for (
unsigned int iPart = 0; iPart < particlelist->getListSize(
true); iPart++) {
89 Particle* part = particlelist->getParticle(iPart,
true);
91 B2WARNING(
"No particles...");
96 B2WARNING(
"No related PID likelihood...");
101 B2WARNING(
"No related track...");
107 B2WARNING(
"No related CDCDedxTrack...");
114 if (ptype !=
"pi+") {
115 if (ptype ==
"K+") fitResult = track->getTrackFitResultWithClosestMass(
Const::kaon);
116 else if (ptype ==
"p+") fitResult = track->getTrackFitResultWithClosestMass(
Const::proton);
117 else if (ptype ==
"deuteron") fitResult = track->getTrackFitResultWithClosestMass(
Const::deuteron);
118 else if (ptype ==
"mu+") fitResult = track->getTrackFitResultWithClosestMass(
Const::muon);
119 else if (ptype ==
"e+") fitResult = track->getTrackFitResultWithClosestMass(
Const::electron);
123 B2WARNING(
"No related fit for this track...");
127 if (dedxTrack->
size() == 0 || dedxTrack->
size() > 200)
continue;
129 if (dedxTrack->
getCosTheta() < TMath::Cos(150.0 * TMath::DegToRad()))
continue;
130 if (dedxTrack->
getCosTheta() > TMath::Cos(17.0 * TMath::DegToRad()))
continue;
141 {
if (
m_p < 0.05)
continue;}
145 if (
m_dedx < 1.00)
continue;
146 if (abs(
m_p) > 1.0)
continue;
149 if (ptype ==
"pi+") {
150 if (
m_dedx > 20)
continue;
double m_dedx
track level information
std::map< std::string, std::string > m_pdgMap
map to relate input strings to the right particle type
double m_maxCut
high cut dedx curve for proton sample
int m_nhits
number of dE/dx hits on the track
virtual void collect() override
Fill ROOT objects.
double m_timeReso
injection time resolution
double m_injRing
event level information
virtual void prepare() override
Create and book ROOT objects.
double m_costh
track cos(theta)
double m_dedxnosat
dE/dx truncated mean no-saturation
CDCDedxHadronCollectorModule()
Constructor: Sets the description, the properties and the parameters of the module.
DBObjPtr< CDCDedxInjectionTime > m_DBInjectTime
Injection time DB object.
std::vector< std::string > m_strParticleList
Hadron collector variables.
double m_minCut
module params
double m_injTime
time since last injection
Debug output for CDCDedxPID module.
double getDedx() const
Get dE/dx truncated mean for this track.
double getCosTheta() const
Return cos(theta) for this track.
double getInjectionRing() const
Return cos(theta) for this track.
double getInjectionTime() const
Return cos(theta) for this track.
double getDedxNoSat() const
Get dE/dx truncated mean without the saturation correction for this track.
int size() const
Return the number of hits for this track.
double getNLayerHitsUsed() const
Return the number of hits used to determine the truncated mean.
double getMomentum() const
Return the track momentum valid in the CDC.
Calibration collector module base class.
static const ChargedStable muon
muon particle
static const ChargedStable pion
charged pion particle
static const ChargedStable proton
proton particle
static const ChargedStable kaon
charged kaon particle
static const ChargedStable electron
electron particle
static const ChargedStable deuteron
deuteron particle
void setDescription(const std::string &description)
Sets the description of the module.
Class to collect log likelihoods from TOP, ARICH, dEdx, ECL and KLM aimed for output to mdst includes...
Class to store reconstructed particles.
TO * getRelatedTo(const std::string &name="", const std::string &namedRelation="") const
Get the object to which this object has a relation.
Type-safe access to single objects in the data store.
Values of the result of a track fit with a given particle hypothesis.
short getChargeSign() const
Return track charge (1 or -1).
Class that bundles various TrackFitResults.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.