Belle II Software development
TrackSelector Class Reference

Utility for the track selection - used in various calibration modules. More...

#include <TrackSelector.h>

Public Types

enum  EType {
  c_undefined = 0 ,
  c_dimuon = 1 ,
  c_bhabha = 2 ,
  c_cosmics = 3
}
 enumerators for possible data sample types (skims) More...
 

Public Member Functions

 TrackSelector ()
 Default constructor.
 
 TrackSelector (const std::string &sampleName)
 Useful constructor.
 
void setMinMomentum (double minMomentum)
 Sets momentum cut (used for "cosmics" only)
 
void setDeltaEcms (double deltaEcms)
 Sets cut on c.m.s.
 
void setCutOnPOCA (double dr, double dz)
 Sets cut on point of closest approach to (0, 0, 0)
 
void setCutOnLocalZ (double minZ, double maxZ)
 Sets cut on local z coordinate (module frame) of the track extrapolated to TOP.
 
const std::string & getSampleName () const
 Returns sample name.
 
double getMinMomentum () const
 Returns momentum cut.
 
double getDeltaEcms () const
 Returns c.m.s.
 
double getDr () const
 Returns POCA cut in r.
 
double getDz () const
 Returns POCA cut in z.
 
double getMinZ () const
 Returns cut on local z.
 
double getMaxZ () const
 Returns cut on local z.
 
const Const::ChargedStablegetChargedStable () const
 Returns track hypothesis.
 
const ROOT::Math::XYZVector & getPOCAPosition () const
 Returns position of POCA of the track in last isSelected call.
 
const ROOT::Math::XYZVector & getPOCAMomentum () const
 Returns momentum vector at POCA of the track in last isSelected call.
 
double getCMSEnergy () const
 Returns c.m.s energy of the track in last isSelected call.
 
const ROOT::Math::XYZPoint & getLocalPosition () const
 Returns position at TOP in local frame of the track in last isSelected call.
 
const ROOT::Math::XYZVector & getLocalMomentum () const
 Returns momentum at TOP in local frame of the track in last isSelected call.
 
bool isSelected (const TOPTrack &track) const
 Returns selection status.
 

Private Attributes

EType m_sampleType = c_undefined
 data sample (skim) type
 
std::string m_sampleName
 data sample (skim) name
 
double m_minMomentum = 0
 minimal track momentum if sample is "cosmics"
 
double m_deltaEcms = 0
 c.m.s energy window for "dimuon" or "bhabha"
 
double m_dr = 0
 cut on POCA in r
 
double m_dz = 0
 cut on POCA in z
 
double m_minZ = 0
 minimal local z of extrapolated hit
 
double m_maxZ = 0
 maximal local z of extrapolated hit
 
Const::ChargedStable m_chargedStable = Const::muon
 track hypothesis
 
ROOT::Math::XYZVector m_pocaPosition
 position of POCA
 
ROOT::Math::XYZVector m_pocaMomentum
 momentum at POCA
 
double m_cmsEnergy = 0
 c.m.s.
 
ROOT::Math::XYZPoint m_localPosition
 position at TOP in local (module) frame
 
ROOT::Math::XYZVector m_localMomentum
 momentum at TOP in local (module) frame
 

Detailed Description

Utility for the track selection - used in various calibration modules.

Definition at line 27 of file TrackSelector.h.

Member Enumeration Documentation

◆ EType

enum EType

enumerators for possible data sample types (skims)

Definition at line 34 of file TrackSelector.h.

34 {
35 c_undefined = 0,
36 c_dimuon = 1,
37 c_bhabha = 2,
38 c_cosmics = 3
39 };

Constructor & Destructor Documentation

◆ TrackSelector() [1/2]

TrackSelector ( )
inline

Default constructor.

Definition at line 44 of file TrackSelector.h.

45 {}

◆ TrackSelector() [2/2]

TrackSelector ( const std::string &  sampleName)
explicit

Useful constructor.

Parameters
sampleNamedata sample name, one of dimuon, bhabha or cosmics

Definition at line 23 of file TrackSelector.cc.

23 : m_sampleName(sampleName)
24 {
25 if (sampleName == "dimuon") {
26 m_sampleType = c_dimuon;
28 } else if (sampleName == "bhabha") {
29 m_sampleType = c_bhabha;
31 } else if (sampleName == "cosmics") {
32 m_sampleType = c_cosmics;
34 } else {
35 m_sampleType = c_undefined;
36 m_sampleName = "undefined";
37 B2ERROR("TOP::TrackSelector: unknown data sample."
38 << LogVar("name", sampleName));
39 }
40 }
static const ChargedStable muon
muon particle
Definition: Const.h:660
static const ChargedStable electron
electron particle
Definition: Const.h:659
Const::ChargedStable m_chargedStable
track hypothesis
EType m_sampleType
data sample (skim) type
std::string m_sampleName
data sample (skim) name
Class to store variables with their name which were sent to the logging service.

Member Function Documentation

◆ getChargedStable()

const Const::ChargedStable & getChargedStable ( ) const
inline

Returns track hypothesis.

Definition at line 132 of file TrackSelector.h.

132{return m_chargedStable;}

◆ getCMSEnergy()

double getCMSEnergy ( ) const
inline

Returns c.m.s energy of the track in last isSelected call.

Returns
c.m.s. energy if track is selected, otherwise undefined

Definition at line 150 of file TrackSelector.h.

150{return m_cmsEnergy;}

◆ getDeltaEcms()

double getDeltaEcms ( ) const
inline

Returns c.m.s.

energy cut

Returns
size of the energy window

Definition at line 103 of file TrackSelector.h.

103{return m_deltaEcms;}
double m_deltaEcms
c.m.s energy window for "dimuon" or "bhabha"

◆ getDr()

double getDr ( ) const
inline

Returns POCA cut in r.

Returns
maximal radius in x-y plane

Definition at line 109 of file TrackSelector.h.

109{return m_dr;}
double m_dr
cut on POCA in r

◆ getDz()

double getDz ( ) const
inline

Returns POCA cut in z.

Returns
cut in z coordinate (|z| < dz/2)

Definition at line 115 of file TrackSelector.h.

115{return m_dz;}
double m_dz
cut on POCA in z

◆ getLocalMomentum()

const ROOT::Math::XYZVector & getLocalMomentum ( ) const
inline

Returns momentum at TOP in local frame of the track in last isSelected call.

Returns
momentum vector in local frame if track is selected, otherwise undefined

Definition at line 162 of file TrackSelector.h.

162{return m_localMomentum;}
ROOT::Math::XYZVector m_localMomentum
momentum at TOP in local (module) frame

◆ getLocalPosition()

const ROOT::Math::XYZPoint & getLocalPosition ( ) const
inline

Returns position at TOP in local frame of the track in last isSelected call.

Returns
position in local frame if track is selected, otherwise undefined

Definition at line 156 of file TrackSelector.h.

156{return m_localPosition;}
ROOT::Math::XYZPoint m_localPosition
position at TOP in local (module) frame

◆ getMaxZ()

double getMaxZ ( ) const
inline

Returns cut on local z.

Returns
maximal local z of extrapolated hit

Definition at line 127 of file TrackSelector.h.

127{return m_maxZ;}
double m_maxZ
maximal local z of extrapolated hit

◆ getMinMomentum()

double getMinMomentum ( ) const
inline

Returns momentum cut.

Returns
minimal momentum

Definition at line 97 of file TrackSelector.h.

97{return m_minMomentum;}
double m_minMomentum
minimal track momentum if sample is "cosmics"

◆ getMinZ()

double getMinZ ( ) const
inline

Returns cut on local z.

Returns
minimal local z of extrapolated hit

Definition at line 121 of file TrackSelector.h.

121{return m_minZ;}
double m_minZ
minimal local z of extrapolated hit

◆ getPOCAMomentum()

const ROOT::Math::XYZVector & getPOCAMomentum ( ) const
inline

Returns momentum vector at POCA of the track in last isSelected call.

Returns
momentum vector if track is selected, otherwise undefined

Definition at line 144 of file TrackSelector.h.

144{return m_pocaMomentum;}
ROOT::Math::XYZVector m_pocaMomentum
momentum at POCA

◆ getPOCAPosition()

const ROOT::Math::XYZVector & getPOCAPosition ( ) const
inline

Returns position of POCA of the track in last isSelected call.

Returns
POCA if track is selected, otherwise undefined

Definition at line 138 of file TrackSelector.h.

138{return m_pocaPosition;}
ROOT::Math::XYZVector m_pocaPosition
position of POCA

◆ getSampleName()

const std::string & getSampleName ( ) const
inline

Returns sample name.

Returns
sample name

Definition at line 91 of file TrackSelector.h.

91{return m_sampleName;}

◆ isSelected()

bool isSelected ( const TOPTrack track) const

Returns selection status.

Parameters
tracktrack extrapolated to TOP
Returns
true if track passes selection criteria

Definition at line 43 of file TrackSelector.cc.

44 {
45
46 if (m_sampleType == c_undefined) {
47 B2ERROR("TOP::TrackSelector:isSelected sample type is undefined, returning false");
48 return false;
49 }
50
51 if (not trk.isValid()) return false;
52
53 const auto* fit = trk.getTrack()->getTrackFitResultWithClosestMass(m_chargedStable);
54 if (not fit) return false;
55
56 // cut on POCA
57 m_pocaPosition = fit->getPosition();
58 if (m_pocaPosition.Rho() > m_dr) return false;
59 if (fabs(m_pocaPosition.Z()) > m_dz) return false;
60
61 // momentum/energy cut
62 m_pocaMomentum = fit->getMomentum();
63 if (m_sampleType == c_cosmics) {
64 if (m_pocaMomentum.R() < m_minMomentum) return false;
65 } else if (m_sampleType == c_dimuon or m_sampleType == c_bhabha) {
66 ROOT::Math::PxPyPzMVector lorentzLab(m_pocaMomentum.X(), m_pocaMomentum.Y(), m_pocaMomentum.Z(), m_chargedStable.getMass());
67 PCmsLabTransform T;
68 auto lorentzCms = T.labToCms(lorentzLab);
69 m_cmsEnergy = lorentzCms.energy();
70 double dE = m_cmsEnergy - T.getCMSEnergy() / 2;
71 if (fabs(dE) > m_deltaEcms) return false;
72 } else {
73 return false;
74 }
75
76 // cut on local z
77 const auto* geo = TOPGeometryPar::Instance()->getGeometry();
78 const auto& module = geo->getModule(trk.getModuleID());
79 m_localPosition = module.pointToLocal(static_cast<ROOT::Math::XYZPoint>(trk.getExtHit()->getPosition()));
80 m_localMomentum = module.momentumToLocal(trk.getExtHit()->getMomentum());
81 if (m_localPosition.Z() < m_minZ or m_localPosition.Z() > m_maxZ) return false;
82
83 return true;
84 }
double getMass() const
Particle mass.
Definition: UnitConst.cc:356
const TOPGeometry * getGeometry() const
Returns pointer to geometry object using basf2 units.
static TOPGeometryPar * Instance()
Static method to obtain the pointer to its instance.

◆ setCutOnLocalZ()

void setCutOnLocalZ ( double  minZ,
double  maxZ 
)
inline

Sets cut on local z coordinate (module frame) of the track extrapolated to TOP.

Parameters
minZminimal z
maxZmaximal z

Definition at line 81 of file TrackSelector.h.

82 {
83 m_minZ = minZ;
84 m_maxZ = maxZ;
85 }

◆ setCutOnPOCA()

void setCutOnPOCA ( double  dr,
double  dz 
)
inline

Sets cut on point of closest approach to (0, 0, 0)

Parameters
drmaximal radius in x-y plane
dzcut in z coordinate (|z| < dz/2)

Definition at line 70 of file TrackSelector.h.

71 {
72 m_dr = dr;
73 m_dz = dz;
74 }

◆ setDeltaEcms()

void setDeltaEcms ( double  deltaEcms)
inline

Sets cut on c.m.s.

energy (used for "dimuon" and "bhabha")

Parameters
deltaEcmssize of energy window

Definition at line 63 of file TrackSelector.h.

63{m_deltaEcms = deltaEcms;}

◆ setMinMomentum()

void setMinMomentum ( double  minMomentum)
inline

Sets momentum cut (used for "cosmics" only)

Parameters
minMomentumminimal track momentum

Definition at line 57 of file TrackSelector.h.

57{m_minMomentum = minMomentum;}

Member Data Documentation

◆ m_chargedStable

Const::ChargedStable m_chargedStable = Const::muon
private

track hypothesis

Definition at line 181 of file TrackSelector.h.

◆ m_cmsEnergy

double m_cmsEnergy = 0
mutableprivate

c.m.s.

energy of track

Definition at line 186 of file TrackSelector.h.

◆ m_deltaEcms

double m_deltaEcms = 0
private

c.m.s energy window for "dimuon" or "bhabha"

Definition at line 176 of file TrackSelector.h.

◆ m_dr

double m_dr = 0
private

cut on POCA in r

Definition at line 177 of file TrackSelector.h.

◆ m_dz

double m_dz = 0
private

cut on POCA in z

Definition at line 178 of file TrackSelector.h.

◆ m_localMomentum

ROOT::Math::XYZVector m_localMomentum
mutableprivate

momentum at TOP in local (module) frame

Definition at line 188 of file TrackSelector.h.

◆ m_localPosition

ROOT::Math::XYZPoint m_localPosition
mutableprivate

position at TOP in local (module) frame

Definition at line 187 of file TrackSelector.h.

◆ m_maxZ

double m_maxZ = 0
private

maximal local z of extrapolated hit

Definition at line 180 of file TrackSelector.h.

◆ m_minMomentum

double m_minMomentum = 0
private

minimal track momentum if sample is "cosmics"

Definition at line 175 of file TrackSelector.h.

◆ m_minZ

double m_minZ = 0
private

minimal local z of extrapolated hit

Definition at line 179 of file TrackSelector.h.

◆ m_pocaMomentum

ROOT::Math::XYZVector m_pocaMomentum
mutableprivate

momentum at POCA

Definition at line 185 of file TrackSelector.h.

◆ m_pocaPosition

ROOT::Math::XYZVector m_pocaPosition
mutableprivate

position of POCA

Definition at line 184 of file TrackSelector.h.

◆ m_sampleName

std::string m_sampleName
private

data sample (skim) name

Definition at line 174 of file TrackSelector.h.

◆ m_sampleType

EType m_sampleType = c_undefined
private

data sample (skim) type

Definition at line 173 of file TrackSelector.h.


The documentation for this class was generated from the following files: