9#include "reconstruction/modules/CDCDedxSkim/CDCDedxSkimModule.h"
11#include "framework/datastore/StoreArray.h"
13#include <mdst/dataobjects/TrackFitResult.h>
15#include <tracking/dataobjects/RecoTrack.h>
19#define mass_e 0.511e-3
20#define mass_mu 105.658e-3
21#define mass_pi 139.570e-3
22#define mass_k 493.677e-3
23#define mass_p 938.272e-3
40 "Event type: (-1) clean up tracks, (0) bhabha, (1) radiative bhabha, (2) two photon (e+e-), (3) di-muon, (4) radiative di-muon (5) D-decays (D*->D0 pi; D0 -> K pi)",
45 addParam(
"EccOverEcm",
m_EccOverEcm,
"ranger for total energy depostied in the calorimeter divided by the cm energy per event",
70 bool m_Bhabha(
false), m_RadBhabha(
false), m_TwoPhoton(
false);
71 bool m_DiMuon(
false), m_RadDiMuon(
false);
74 for (
unsigned int i = 0; i <
m_eventType.size(); i++) {
99 int nGoodElectrons = 0;
104 for (
int iTrack = 0; iTrack <
m_tracks.getEntries(); iTrack++) {
116 if (m_Bhabha ==
true || m_RadBhabha ==
true || m_TwoPhoton ==
true) {
121 ROOT::Math::XYZVector trackMom = fitResult->
getMomentum();
122 double trackEnergy =
sqrt(trackMom.Mag2() + mass_e * mass_e);
123 double EoverP = trackEnergy / trackMom.R();
132 if (m_DiMuon ==
true || m_RadDiMuon ==
true) {
137 ROOT::Math::XYZVector trackMom = fitResult->
getMomentum();
138 double trackEnergy =
sqrt(trackMom.Mag2() + mass_mu * mass_mu);
139 double EoverP = trackEnergy / trackMom.R();
147 if ((m_Bhabha ==
true || m_RadBhabha ==
true || m_TwoPhoton ==
true) && nGoodElectrons != 2)
149 if ((m_DiMuon ==
true || m_RadDiMuon ==
true) && nGoodMuons != 2)
159 const TrackFitResult* fitResult = track->getTrackFitResultWithClosestMass(chargedStable);
161 B2WARNING(
"No related fit for this track, skipping");
168 B2WARNING(
"Track has no associated hits, skipping");
173 double trackPVal = fitResult->
getPValue();
174 double d0 = fitResult->
getD0();
175 double z0 = fitResult->
getZ0();
178 if (trackPVal < 0.00001 || std::abs(d0) <= 0.1 || std::abs(z0) <= 10) {
188 B2INFO(
"CDCDedxSkimModule exiting after processing " <<
m_trackID <<
189 " tracks in " <<
m_eventID + 1 <<
" events.");
CDCDedxSkimModule()
Constructor, for setting module description and parameters.
std::vector< double > m_EoverP
range for E/p per track
int m_trackID
the track number (for one event)
virtual void initialize() override
Initialize routine.
virtual void event() override
Check the event and track quality and apply clean up cuts.
virtual void terminate() override
End of the event processing.
std::vector< int > m_eventType
Event type: (0) bhabha, (1) radiative bhabha, (2) two photon (e+e-), (3) di-muon, (4) radiative di-mu...
bool isGoodTrack(const Track *track, const Const::ChargedStable &chargedStable)
A method to check whether a track passes some nominal cuts.
int m_eventID
the event number
StoreArray< Track > m_tracks
Required array of input tracks.
virtual ~CDCDedxSkimModule()
Destructor.
int m_unmatchedCluster
number of unmatched clusters per event
std::vector< double > m_EccOverEcm
range for Ecc/Ecm
Provides a type-safe way to pass members of the chargedStableSet set.
static const ChargedStable muon
muon particle
static const ChargedStable pion
charged pion particle
static const ChargedStable electron
electron particle
void setDescription(const std::string &description)
Sets the description of the module.
void setReturnValue(int value)
Sets the return value for this module as integer.
This is the Reconstruction Event-Data Model Track.
unsigned int getNumberOfTotalHits() const
Return the number of cdc + svd + pxd + bklm + eklm hits.
Values of the result of a track fit with a given particle hypothesis.
double getPValue() const
Getter for Chi2 Probability of the track fit.
double getD0() const
Getter for d0.
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.
double sqrt(double a)
sqrt for double
Abstract base class for different kinds of events.