10#include <cdc/modules/CDCDedxHadronCollector/CDCDedxHadronCollectorModule.h>
25 setDescription(
"A collector module for CDC dE/dx hadron calibrations");
29 addParam(
"maxcut",
m_maxCut,
"high cut on dedx curve for proton sample ",
double(1.2));
30 addParam(
"mincut",
m_minCut,
"low cut on dedx curve for proton sample ",
double(0.35));
40 std::vector<TTree* > ttree;
43 m_pdgMap = {{
"pi+",
"pion"}, {
"K+",
"kaon"}, {
"mu+",
"muon"}, {
"e+",
"electron"}, {
"p+",
"proton"}, {
"deuteron",
"deutron"}};
48 std::string pdg = x.second;
50 ttree.push_back(
new TTree(Form(
"%s", pdg.data()), Form(
"%s dE/dx information", pdg.data())));
51 int tt = ttree.size() - 1;
53 ttree[tt]->Branch<
double>(
"dedxnosat", &
m_dedxnosat);
54 ttree[tt]->Branch<
double>(
"dedx", &
m_dedx);
55 ttree[tt]->Branch<
double>(
"costh", &
m_costh);
56 ttree[tt]->Branch<
double>(
"p", &
m_p);
57 ttree[tt]->Branch<
int>(
"charge", &
m_charge);
58 ttree[tt]->Branch<
int>(
"nhits", &
m_nhits);
59 ttree[tt]->Branch<
double>(
"timereso", &
m_timeReso);
60 ttree[tt]->Branch<
double>(
"injtime", &
m_injTime);
61 ttree[tt]->Branch<
double>(
"injring", &
m_injRing);
76 for (
int iList = 0; iList < nParticleList; iList++) {
85 if (!particlelist or particlelist->getListSize() == 0)
continue;
88 for (
unsigned int iPart = 0; iPart < particlelist->getListSize(
true); iPart++) {
90 Particle* part = particlelist->getParticle(iPart,
true);
92 B2WARNING(
"No particles...");
97 B2WARNING(
"No related PID likelihood...");
102 B2WARNING(
"No related track...");
108 B2WARNING(
"No related CDCDedxTrack...");
115 if (ptype !=
"pi+") {
116 if (ptype ==
"K+") fitResult = track->getTrackFitResultWithClosestMass(
Const::kaon);
117 else if (ptype ==
"p+") fitResult = track->getTrackFitResultWithClosestMass(
Const::proton);
118 else if (ptype ==
"deuteron") fitResult = track->getTrackFitResultWithClosestMass(
Const::deuteron);
119 else if (ptype ==
"mu+") fitResult = track->getTrackFitResultWithClosestMass(
Const::muon);
120 else if (ptype ==
"e+") fitResult = track->getTrackFitResultWithClosestMass(
Const::electron);
124 B2WARNING(
"No related fit for this track...");
128 if (dedxTrack->
size() == 0 || dedxTrack->
size() > 200)
continue;
130 if (dedxTrack->
getCosTheta() < TMath::Cos(150.0 * TMath::DegToRad()))
continue;
131 if (dedxTrack->
getCosTheta() > TMath::Cos(17.0 * TMath::DegToRad()))
continue;
142 {
if (
m_p < 0.05)
continue;}
147 if (
m_dedx < 1.00)
continue;
148 if (std::abs(
m_p) > 1.0)
continue;
151 if (ptype ==
"pi+") {
152 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.
void registerObject(std::string name, T *obj)
Register object with a name, takes ownership, do not access the pointer beyond prepare()
CalibrationCollectorModule()
Constructor. Sets the default prefix for calibration dataobjects.
T * getObjectPtr(std::string name)
Calls the CalibObjManager to get the requested stored collector data.
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.