ATLAS Offline Software
Loading...
Searching...
No Matches
TrigTrackSelector.h
Go to the documentation of this file.
1/* emacs: this is -*- c++ -*- */
10
11
12#ifndef TIDAUTILS_TRIGTRACKSELECTOR_H
13#define TIDAUTILS_TRIGTRACKSELECTOR_H
14
16
17
21
24#include "AtlasHepMC/GenEvent.h"
28
29
33
35
40
42// #include "TrkParameters/Perigee.h"
44#include "TrkTrack/Track.h"
47#include "GaudiKernel/ToolHandle.h"
48#include "TMath.h"
49
52
54
55public:
56
57 typedef std::vector< ElementLink< xAOD::TrackParticleContainer > > TrackParticleLinks_t;
58
59public:
60
64
65 TrigTrackSelector( TrackFilter* selector ) : TrigTrackSelector( selector, default_radius(), 0, 0 ) { }
66
67 TrigTrackSelector( TrackFilter* selector, double radius ) : TrigTrackSelector( selector, radius, 0, 0 ) { }
68
69 TrigTrackSelector( TrackFilter* selector, int selectPdgId, int selectParentPdgId ) : TrigTrackSelector( selector, default_radius(), selectPdgId, selectParentPdgId ) { }
70
71 TrigTrackSelector( TrackFilter* selector, double radius, int selectPdgId, int selectParentPdgId );
72
73 template<typename T>
74 TrigTrackSelector( T& tm, TrackFilter* selector, double radius=default_radius(), int selectPdgId=0, int selectParentPdgId=0 ) :
75 TrigTrackSelector( tm.begin(), tm.end(), selector, radius, selectPdgId, selectParentPdgId ) {
76 }
77
78 template<typename T>
79 TrigTrackSelector( T tbegin, T tend, TrackFilter* selector, double radius=default_radius(), int selectPdgId=0, int selectParentPdgId=0 ) :
80 TrigTrackSelector( selector, radius, selectPdgId, selectParentPdgId ) {
81 selectTracks( tbegin, tend );
82 }
83
84
86
87
88 void setBeamline( double x, double y, double z=0) { m_xBeam = x; m_yBeam = y; m_zBeam=z; }
89
90 double getBeamX() const { return m_xBeam; }
91 double getBeamY() const { return m_yBeam; }
92 double getBeamZ() const { return m_zBeam; }
93
94 void correctTracks(bool b=true) { m_correctTrkTracks = b; }
95
96 virtual void clear() override { for ( size_t i=m_tracks.size() ; i-- ; ) delete m_tracks[i]; m_tracks.clear(); }
97
98
99 // add a TrackParticle
100 bool selectTrack( const Rec::TrackParticle* track );
101
102
103 // extract all the tracks from a TrackParticle collection and add them
104 void selectTracks( const Rec::TrackParticleContainer* trigtracks );
105
106
107 // extract all the tracks from a TrackParticle collection and add them
108 void selectTracks( const TruthParticleContainer* truthtracks );
109
110 // extract all the tracks from a TrackParticle collection and add them
111 void selectTracks( const xAOD::TruthParticleContainer* truthtracks );
112
113 // extract all the tracks from a TrackParticle collection and add them
114 void truthBeamline( const xAOD::TruthParticleContainer* truthtracks, double& x0, double& y0 );
115
116
118
119
120 // add a TruthParticle
121 bool selectTrack( const TruthParticle& track );
122
123 // add a TruthParticle
124 bool selectTrack( const TruthParticle* track );
125
126 bool selectTrack( const xAOD::TruthParticle* track, double x0=0, double y0=0 );
127
128
129 // make a TIDA::Track from a GenParticle
131
132 // make a TIDA::Track from a TruthParticle
133 TIDA::Track* makeTrack( const TruthParticle* track, unsigned long tid=0 );
134
135
136 // add a Trk::Track
137 bool selectTrack( const Trk::Track* track );
138
139
140 // extract all the tracks from a TrackCollection and add them
141 void selectTracks( const TrackCollection* trigtracks );
142
143
145
146 bool selectTrack( const xAOD::TrackParticle* track, void* =0);
147
148 void selectTracks( const xAOD::TrackParticleContainer* tracks, void* =0);
149
151
154
155
157
158 void correctToBeamline( double& z0, double& dz0,
159 double& d0, double& dd0,
160 double theta, double phi );
161
162
163protected:
164
169
170 const xAOD::TruthParticle* fromAncestor( const int pdg_id, const xAOD::TruthParticle *p) const;
171
172 const xAOD::TruthParticle* fromAncestor( const std::vector<int>& ids, const xAOD::TruthParticle *p) const;
173
174public:
175
176 static double default_radius() { return s_default_radius; }
177
178private:
179
180 unsigned long m_id;
181
182 double m_xBeam;
183 double m_yBeam;
184 double m_zBeam;
185
187
188 double m_radius;
189
192
193 static const double s_default_radius;
194
195};
196
197#endif // TIDAUTILS_TRIGTRACKSELECTOR_H
Scalar phi() const
phi method
Scalar theta() const
theta method
std::vector< ElementLink< xAOD::TrackParticleContainer > > TrackParticleLinks_t
simply defines a token to flag whether we want to use the new offline tracking EDM
DataVector< Trk::Track > TrackCollection
This typedef represents a collection of Trk::Track objects.
base class for a single track selection filter allowing parameter setting for complex track selection
#define y
#define x
#define z
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
TrigTrackSelector(TrackFilter *selector, double radius)
void setBeamline(double x, double y, double z=0)
const xAOD::TruthParticle * fromAncestor(const int pdg_id, const xAOD::TruthParticle *p) const
recursive functions to identify whether a particle comes from some particle of a specific PDG ID,...
void correctTracks(bool b=true)
TrigTrackSelector(T tbegin, T tend, TrackFilter *selector, double radius=default_radius(), int selectPdgId=0, int selectParentPdgId=0)
double getBeamY() const
virtual void clear() override
void truthBeamline(const xAOD::TruthParticleContainer *truthtracks, double &x0, double &y0)
extract all the tracks from a xAOD::TruthParticle collection and histogram the x and y production coo...
double getBeamX() const
TrigTrackSelector(T &tm, TrackFilter *selector, double radius=default_radius(), int selectPdgId=0, int selectParentPdgId=0)
TrigTrackSelector(TrackFilter *selector)
use a radius of 47 mm corresponding to the Run 1 pixel inner radius For the IBL it should be 32 mm,...
TIDA::Track * makeTrack(HepMC::ConstGenParticlePtr track)
double getBeamZ() const
void correctToBeamline(double &z0, double &dz0, double &d0, double &dd0, double theta, double phi)
static double default_radius()
bool selectTrack(const Rec::TrackParticle *track)
neater code to make use of vector function also for a single ancestor pdgid, instead of the full code...
TrigTrackSelector(TrackFilter *selector, int selectPdgId, int selectParentPdgId)
static const double s_default_radius
NB: This was 47 for Run 2, but with the addition of the IBL it should be 32 It was kept at 47 for all...
void selectTracks(const Rec::TrackParticleContainer *trigtracks)
std::vector< ElementLink< xAOD::TrackParticleContainer > > TrackParticleLinks_t
HepMC3::ConstGenParticlePtr ConstGenParticlePtr
Definition GenParticle.h:20
TrackParticle_v1 TrackParticle
Reference the current persistent version:
TruthParticle_v1 TruthParticle
Typedef to implementation.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.
a class of my own because ttying to access the ParticleDataTable in athena is frankly more trouble ...