9#include <cdc/modules/CDCDedxValidationCollector/ElectronValCollectorModule.h>
11#include <mdst/dataobjects/EventLevelTriggerTimeInfo.h>
12#include <mdst/dataobjects/ECLCluster.h>
13#include <framework/dataobjects/EventMetaData.h>
35 addParam(
"cleanupCuts",
m_cuts,
"boolean to apply cleanup cuts",
true);
52 auto means =
new TH1D(
"means",
"CDC dE/dx truncated means", 250, 0, 2.5);
54 auto tBhabha =
new TTree(
"tBhabha",
"Tree with dE/dx information for electrons");
55 auto tRadee =
new TTree(
"tRadee",
"Tree with dE/dx information for radiative electrons");
57 auto hestats =
new TH1I(
"hestats",
"Event Stats", 8, -0.5, 7.5);
58 hestats->SetFillColor(kYellow);
59 hestats->GetXaxis()->SetBinLabel(1,
"all");
60 hestats->GetXaxis()->SetBinLabel(2,
"notrig");
61 hestats->GetXaxis()->SetBinLabel(3,
"noskim");
62 hestats->GetXaxis()->SetBinLabel(4,
"bhabha");
63 hestats->GetXaxis()->SetBinLabel(5,
"radee");
64 hestats->GetXaxis()->SetBinLabel(6,
"wrong skim");
65 hestats->GetXaxis()->SetBinLabel(7,
"unclean");
66 hestats->GetXaxis()->SetBinLabel(8,
"selected");
68 auto htstats =
new TH1I(
"htstats",
"track Stats", 7, -0.5, 6.5);
69 htstats->SetFillColor(kYellow);
70 htstats->GetXaxis()->SetBinLabel(1,
"alltrk");
71 htstats->GetXaxis()->SetBinLabel(2,
"vtx");
72 htstats->GetXaxis()->SetBinLabel(3,
"inCDC");
73 htstats->GetXaxis()->SetBinLabel(4,
"whits");
74 htstats->GetXaxis()->SetBinLabel(5,
"weop");
75 htstats->GetXaxis()->SetBinLabel(6,
"radee");
76 htstats->GetXaxis()->SetBinLabel(7,
"selected");
78 tRadee->Branch<
double>(
"injtime", &
m_injTime);
79 tRadee->Branch<
double>(
"injring", &
m_injRing);
80 tRadee->Branch<
double>(
"costh", &
m_costh);
81 tRadee->Branch<
int>(
"charge", &
m_charge);
82 tRadee->Branch<
int>(
"run", &
m_run);
83 tRadee->Branch<
double>(
"p", &
m_p);
84 tRadee->Branch<
double>(
"pt", &
m_pt);
85 tRadee->Branch<
double>(
"dedx", &
m_dedx);
86 tRadee->Branch(
"enta", &
m_enta);
88 tRadee->Branch(
"layer", &
m_layer);
92 tBhabha->Branch<
double>(
"dedx", &
m_dedx);
93 tBhabha->Branch<
double>(
"costh", &
m_costh);
94 tBhabha->Branch<
double>(
"p", &
m_p);
95 tBhabha->Branch<
int>(
"charge", &
m_charge);
96 tBhabha->Branch<
int>(
"run", &
m_run);
97 tBhabha->Branch(
"wire", &
m_wire);
118 B2ERROR(
"Failed to retrieve histogram 'hestats'");
125 B2WARNING(
"SoftwareTriggerResult required to select bhabha/radee event is not found");
131 const std::map<std::string, int>& fresults =
m_trgResult->getResults();
134 if (fresults.find(
"software_trigger_cut&skim&accept_bhabha") == fresults.end() &&
135 (fresults.find(
"software_trigger_cut&skim&accept_radee") == fresults.end()
136 || fresults.find(
"software_trigger_cut&skim&accept_bhabha_cdc") == fresults.end())) {
137 B2WARNING(
"Can't find required bhabha/radee trigger identifiers");
144 const bool eRadBhabha = (
m_trgResult->getResult(
"software_trigger_cut&skim&accept_bhabha_cdc") ==
149 B2INFO(
"Bhabha events");
151 }
else if (eRadBhabha) {
152 B2INFO(
"Radiative Bhabha events");
155 B2WARNING(
"Requested event not found: going back");
162 if (!eventMetaDataPtr) {
163 B2ERROR(
"Failed to retrieve event metadata");
167 int run = eventMetaDataPtr->getRun();
172 B2WARNING(
"too many tracks: unclean bhabha or radee event: " << nTracks);
185 for (
int idedx = 0; idedx < nTracks; idedx++) {
189 B2WARNING(
"No dedx track: Going back: " << idedx);
195 B2WARNING(
"No track: Going back: " << idedx);
201 B2WARNING(
"No related fit for this track...");
218 if (std::fabs(fitResult->
getD0()) >= 1.0)
continue;
219 if (std::fabs(fitResult->
getZ0()) >= 1.0)
continue;
223 if (
m_costh < TMath::Cos(150.0 * TMath::DegToRad()))
continue;
224 if (
m_costh > TMath::Cos(17.0 * TMath::DegToRad()))
continue;
245 if (std::abs(TrkEoverP - 1.0) >
m_setEoP)
continue;
252 if (nTracks != 2)
continue;
253 bool goodradee =
false;
256 for (
int jdedx = 0; jdedx < nTracks; jdedx++) {
258 if (!dedxOtherTrack)
continue;
259 if (std::abs(dedxOtherTrack->
getDedxNoSat() - 1.0) > 0.25)
continue;
263 if (!goodradee)
continue;
274 for (
int i = 0; i <
m_nhits; ++i) {
285 if (eBhabha) tBhabha->Fill();
286 if (eRadBhabha) tRadee->Fill();
Debug output for CDCDedxPID module.
int getHitLayer(int i) const
Return the (global) layer number for a hit.
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.
int getNLayerHits() const
Return the number of layer hits for this track.
double getCosTheta() const
Return cos(theta) for this track.
double getInjectionRing() const
Return cos(theta) for this track.
int getWire(int i) const
Return the sensor ID for this hit: wire number for CDC (0-14336)
double getEnta(int i) const
Return the entrance angle in the CDC cell for this hit.
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 getMomentum() const
Return the track momentum valid in the CDC.
void registerObject(const std::string &name, T *obj)
Register object with a name, takes ownership, do not access the pointer beyond prepare()
T * getObjectPtr(const std::string &name)
Calls the CalibObjManager to get the requested stored collector data.
CalibrationCollectorModule()
Constructor. Sets the default prefix for calibration dataobjects.
static const ChargedStable pion
charged pion particle
bool hasHypothesis(EHypothesisBit bitmask) const
Return if specific hypothesis bit is set.
double getEnergy(EHypothesisBit hypothesis) const
Return Energy (GeV).
@ c_nPhotons
CR is split into n photons (N1)
int m_maxHits
module params
double m_dedx
dE/dx truncated mean
std::vector< int > m_wire
hit level information
std::vector< int > m_layer
continuous layer number for the hit
bool m_cuts
Electron collector variables.
StoreArray< TrackFitResult > m_trackFitResults
Required array for TrackFitResults.
StoreObjPtr< SoftwareTriggerResult > m_trgResult
required input
std::vector< double > m_dedxhit
dE/dx for the hit
int m_nhits
number of dE/dx hits on the track
virtual void collect() override
Fill ROOT objects.
StoreArray< Track > m_tracks
Required array for Tracks.
ElectronValCollectorModule()
Constructor: Sets the description, the properties and the parameters of the module.
double m_injRing
event level information
virtual void prepare() override
Create and book ROOT objects.
double m_costh
track cos(theta)
std::vector< double > m_entaRS
rescaled entrance angle for the hit
int m_charge
track momentum
std::vector< double > m_enta
entrance angle for the hit
StoreArray< CDCDedxTrack > m_dedxTracks
Required array for CDCDedxTracks.
double m_pt
track level information
double m_setEoP
Cut of E over P value.
double m_injTime
time since last injection
void setDescription(const std::string &description)
Sets the description of the module.
FROM * getRelatedFrom(const std::string &name="", const std::string &namedRelation="") const
Get the object from 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).
double getD0() const
Getter for d0.
double getTransverseMomentum() const
Getter for the absolute value of the transverse momentum at the perigee.
double getZ0() const
Getter for z0.
ROOT::Math::XYZVector getMomentum() const
Getter for vector of momentum at closest approach of track in r/phi projection.
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.
@ c_accept
Accept this event.
Abstract base class for different kinds of events.