 |
Belle II Software
release-05-01-25
|
11 #include <reconstruction/modules/CDCDedxElectronCollector/CDCDedxElectronCollectorModule.h>
13 #include <framework/dataobjects/EventMetaData.h>
14 #include <mdst/dataobjects/ECLCluster.h>
33 setDescription(
"A collector module for CDC dE/dx electron calibrations");
36 addParam(
"cleanupCuts", m_cuts,
"Boolean to apply cleanup cuts",
true);
37 addParam(
"maxNumHits", m_maxNumHits,
38 "Maximum number of hits per track. If there is more than this the track will not be collected. ",
int(100));
39 addParam(
"fSetEoverP", fSetEoverP,
"Set E over p Cut values. ",
double(0.25));
40 addParam(
"IsCosth", IsCosth,
"true for adding costh tree branch. ",
false);
41 addParam(
"IsMom", IsMom,
"true for adding momentum tree branch. ",
false);
42 addParam(
"IsCharge", IsCharge,
"true for charge dedx tree branch. ",
false);
43 addParam(
"IsRun", IsRun,
"true for adding run number tree branch. ",
false);
44 addParam(
"IsWire", IsWire,
"true for adding wires tree branch. ",
false);
45 addParam(
"IsLayer", IsLayer,
"true for adding layers tree branch. ",
false);
46 addParam(
"IsDoca", IsDoca,
"true for adding doca tree branch. ",
false);
47 addParam(
"IsEnta", IsEnta,
"true for adding enta tree branch. ",
false);
48 addParam(
"IsDocaRS", IsDocaRS,
"true for adding doca tree branch. ",
false);
49 addParam(
"IsEntaRS", IsEntaRS,
"true for adding enta tree branch. ",
false);
50 addParam(
"Isdedxhit", Isdedxhit,
"true for adding dedxhit tree branch. ",
false);
51 addParam(
"IsBhabhaEvt", IsBhabhaEvt,
"true for bhabha events",
true);
52 addParam(
"IsRadBhabhaEvt", IsRadBhabhaEvt,
"true for radee events",
false);
53 addParam(
"enableTrgSel", enableTrgSel,
"true to enable trigger sel inside module",
false);
68 auto means =
new TH1D(
"means",
"CDC dE/dx truncated means", 250, 0, 2.5);
69 auto ttree =
new TTree(
"tree",
"Tree with dE/dx information");
71 auto hestats =
new TH1I(
"hestats",
"Event Stats", 6, -0.5, 5.5);
72 hestats->SetFillColor(kYellow);
73 hestats->GetXaxis()->SetBinLabel(1,
"all");
74 hestats->GetXaxis()->SetBinLabel(2,
"notrig");
75 hestats->GetXaxis()->SetBinLabel(3,
"noskim");
76 hestats->GetXaxis()->SetBinLabel(4,
"wrongskim");
77 hestats->GetXaxis()->SetBinLabel(5,
"unclean");
78 hestats->GetXaxis()->SetBinLabel(6,
"selected");
80 auto htstats =
new TH1I(
"htstats",
"track Stats", 7, -0.5, 6.5);
81 htstats->SetFillColor(kYellow);
82 htstats->GetXaxis()->SetBinLabel(1,
"alltrk");
83 htstats->GetXaxis()->SetBinLabel(2,
"vtx");
84 htstats->GetXaxis()->SetBinLabel(3,
"inCDC");
85 htstats->GetXaxis()->SetBinLabel(4,
"whits");
86 htstats->GetXaxis()->SetBinLabel(5,
"weop");
87 htstats->GetXaxis()->SetBinLabel(6,
"radee");
88 htstats->GetXaxis()->SetBinLabel(7,
"selected");
90 ttree->Branch<
double>(
"dedx", &
m_dedx);
92 if (
IsMom)ttree->Branch<
double>(
"p", &
m_p);
105 registerObject<TH1D>(
"means", means);
106 registerObject<TTree>(
"tree", ttree);
107 registerObject<TH1I>(
"hestats", hestats);
108 registerObject<TH1I>(
"htstats", htstats);
117 auto hestats = getObjectPtr<TH1I>(
"hestats");
122 B2WARNING(
"SoftwareTriggerResult required to select bhabha/radee event is not found");
128 const std::map<std::string, int>& fresults =
m_TrgResult->getResults();
129 if (fresults.find(
"software_trigger_cut&skim&accept_bhabha") == fresults.end() and
130 fresults.find(
"software_trigger_cut&skim&accept_radee") == fresults.end()) {
131 B2WARNING(
"Can't find required bhabha/radee trigger identifiers");
136 const bool eBhabha = (
m_TrgResult->getResult(
"software_trigger_cut&skim&accept_bhabha") ==
139 const bool eRadBhabha = (
m_TrgResult->getResult(
"software_trigger_cut&skim&accept_radee") ==
143 B2WARNING(
"requested not-supported event type: going back");
147 B2WARNING(
"requested bhabha only but event not found: going back");
151 B2WARNING(
"requested radee only but event not found: going back");
156 hestats->GetXaxis()->SetBinLabel(2,
"inact1");
157 hestats->GetXaxis()->SetBinLabel(3,
"inact2");
158 hestats->GetXaxis()->SetBinLabel(4,
"inact3");
162 int run = eventMetaDataPtr->getRun();
167 B2WARNING(
"too many tracks: unclean bhabha or radee event: " << nTracks);
175 auto tree = getObjectPtr<TTree>(
"tree");
176 auto htstats = getObjectPtr<TH1I>(
"htstats");
177 auto hmeans = getObjectPtr<TH1D>(
"means");
179 for (
int idedx = 0; idedx < nTracks; idedx++) {
183 B2WARNING(
"No dedx track: Going back: " << idedx);
189 B2WARNING(
"No track: Going back: " << idedx);
195 B2WARNING(
"No related fit for this track...");
207 if (fabs(fitResult->
getD0()) >= 1.0)
continue;
208 if (fabs(fitResult->
getZ0()) >= 1.0)
continue;
212 if (
m_costh < TMath::Cos(150.0 * TMath::DegToRad()))
continue;
213 if (
m_costh > TMath::Cos(17.0 * TMath::DegToRad()))
continue;
220 if (m_costh <= -0.62 || m_costh >= 0.880) {
232 if (abs(TrkEoverP - 1.0) >
fSetEoverP)
continue;
238 if (nTracks != 2)
continue;
239 bool goodradee =
false;
242 for (
int jdedx = 0; jdedx < nTracks; jdedx++) {
244 if (!dedxOtherTrack)
continue;
245 if (abs(dedxOtherTrack->
getDedxNoSat() - 1.0) > 0.25)
continue;
249 if (!goodradee)
continue;
269 for (
int i = 0; i <
m_nhits; ++i) {
Calibration collector module base class.
double getDedxNoSat() const
Get dE/dx truncated mean without the saturation correction for this track.
int getHitLayer(int i) const
Return the (global) layer number for a hit.
double m_dedx
track level information
bool IsCharge
flag to write charge in treet
int m_nhits
number of dE/dx hits on the track
bool IsEntaRS
flag to write rescaled enta in tree
double getDedx() const
Get dE/dx truncated mean for this track.
double getEntaRS(int i) const
Return rescaled enta value for cell height=width assumption.
TVector3 getMomentum() const
Getter for vector of momentum at closest approach of track in r/phi projection.
int getWire(int i) const
Return the sensor ID for this hit: wire number for CDC (0-14336)
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
StoreArray< TrackFitResult > m_trackFitResults
Required array for TrackFitResults.
double getMomentum() const
Return the track momentum valid in the CDC.
std::vector< double > m_entaRS
rescaled entrance angle for the hit
int m_charge
track momentum
@ c_nPhotons
CR is split into n photons (N1)
bool IsDocaRS
flag to write rescaled doca in tree
std::vector< double > m_doca
distance of closest approach for the hit
A collector module for CDC dE/dx electron calibrations.
bool hasHypothesis(EHypothesisBit bitmask) const
Return if specific hypothesis bit is set.
double getEnta(int i) const
Return the entrance angle in the CDC cell for this hit.
int size() const
Return the number of hits for this track.
Values of the result of a track fit with a given particle hypothesis.
bool IsBhabhaEvt
flag to select bhabha event
std::vector< double > m_docaRS
rescaled distance of closest approach for the hit
@ c_accept
Accept this event.
bool IsEnta
flag to write enta in tree
StoreArray< CDCDedxTrack > m_dedxTracks
Required array for CDCDedxTracks.
double getZ0() const
Getter for z0.
bool IsWire
flag to write wire number in tree
double getEnergy(const EHypothesisBit &hypothesis) const
Return Energy (GeV).
double m_costh
track cos(theta)
std::vector< int > m_wire
hit level information
static const ChargedStable pion
charged pion particle
bool IsRadBhabhaEvt
flag to select radee event
Abstract base class for different kinds of events.
Type-safe access to single objects in the data store.
bool m_cuts
Electron collector variables.
double getDoca(int i) const
Return the distance of closest approach to the sense wire for this hit.
std::vector< double > m_dedxhit
dE/dx for the hit
double fSetEoverP
Cut of E over P value.
virtual void prepare() override
Create and book ROOT objects.
double getCellHalfWidth(int i) const
Return the half-width of the CDC cell.
bool IsMom
flag to write momentum in treet
bool IsRun
flag to write run number in tree
bool Isdedxhit
flag to write dedxhits in tree
std::vector< double > m_enta
entrance angle for the hit
bool IsLayer
flag to write layer number in tree
double getCosTheta() const
Return cos(theta) for this track.
bool IsDoca
flag to write doca in tree
Class that bundles various TrackFitResults.
StoreArray< Track > m_tracks
Required array for Tracks.
std::vector< int > m_layer
continuous layer number for the hit
Debug output for CDCDedxPID module.
int getNLayerHits() const
Return the number of layer hits for this track.
bool IsCosth
flag to write costh in tree
virtual void collect() override
Fill ROOT objects.
double getDocaRS(int i) const
Return rescaled doca value for cell height=width assumption.
short getChargeSign() const
Return track charge (1 or -1).
FROM * getRelatedFrom(const std::string &name="", const std::string &namedRelation="") const
Get the object from which this object has a relation.
bool enableTrgSel
flag to enable trigger skim selected in the module (off deafult)
double getD0() const
Getter for d0.
int m_maxNumHits
module params
StoreObjPtr< SoftwareTriggerResult > m_TrgResult
required input