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
21
25
28#include "AtlasHepMC/GenEvent.h"
32
33
37
39
44
46// #include "TrkParameters/Perigee.h"
48#include "TrkTrack/Track.h"
51#include "GaudiKernel/ToolHandle.h"
52#include "TMath.h"
53
56
58
59public:
60
61 typedef std::vector< ElementLink< xAOD::TrackParticleContainer > > TrackParticleLinks_t;
62
63public:
64
68
69 TrigTrackSelector( TrackFilter* selector ) : TrigTrackSelector( selector, default_radius(), 0, 0 ) { }
70
71 TrigTrackSelector( TrackFilter* selector, double radius ) : TrigTrackSelector( selector, radius, 0, 0 ) { }
72
73 TrigTrackSelector( TrackFilter* selector, int selectPdgId, int selectParentPdgId ) : TrigTrackSelector( selector, default_radius(), selectPdgId, selectParentPdgId ) { }
74
75 TrigTrackSelector( TrackFilter* selector, double radius, int selectPdgId, int selectParentPdgId );
76
77 template<typename T>
78 TrigTrackSelector( T& tm, TrackFilter* selector, double radius=default_radius(), int selectPdgId=0, int selectParentPdgId=0 ) :
79 TrigTrackSelector( tm.begin(), tm.end(), selector, radius, selectPdgId, selectParentPdgId ) {
80 }
81
82 template<typename T>
83 TrigTrackSelector( T tbegin, T tend, TrackFilter* selector, double radius=default_radius(), int selectPdgId=0, int selectParentPdgId=0 ) :
84 TrigTrackSelector( selector, radius, selectPdgId, selectParentPdgId ) {
85 selectTracks( tbegin, tend );
86 }
87
88
90
91
92 void setBeamline( double x, double y, double z=0) { m_xBeam = x; m_yBeam = y; m_zBeam=z; }
93
94 double getBeamX() const { return m_xBeam; }
95 double getBeamY() const { return m_yBeam; }
96 double getBeamZ() const { return m_zBeam; }
97
98 void correctTracks(bool b=true) { m_correctTrkTracks = b; }
99
100 virtual void clear() override { for ( size_t i=m_tracks.size() ; i-- ; ) delete m_tracks[i]; m_tracks.clear(); }
101
102
103 bool selectTrack( const TrigInDetTrack* track, const TrigInDetTrackTruthMap* truthMap=0 );
104
105
106 // extract all the tracks from a TrigInDetTrack collection and associated TruthMap and convert them
107 void selectTracks( const TrigInDetTrackCollection* trigtracks, const TrigInDetTrackTruthMap* truthMap=0 );
108
109 // add a TrackParticle
110 bool selectTrack( const Rec::TrackParticle* track );
111
112
113 // extract all the tracks from a TrackParticle collection and add them
114 void selectTracks( const Rec::TrackParticleContainer* trigtracks );
115
116
117 // extract all the tracks from a TrackParticle collection and add them
118 void selectTracks( const TruthParticleContainer* truthtracks );
119
120 // extract all the tracks from a TrackParticle collection and add them
121 void selectTracks( const xAOD::TruthParticleContainer* truthtracks );
122
123 // extract all the tracks from a TrackParticle collection and add them
124 void truthBeamline( const xAOD::TruthParticleContainer* truthtracks, double& x0, double& y0 );
125
126
128
129
130 // add a TruthParticle
131 bool selectTrack( const TruthParticle& track );
132
133 // add a TruthParticle
134 bool selectTrack( const TruthParticle* track );
135
136 bool selectTrack( const xAOD::TruthParticle* track, double x0=0, double y0=0 );
137
138
139 // make a TIDA::Track from a GenParticle
141
142 // make a TIDA::Track from a TruthParticle
143 TIDA::Track* makeTrack( const TruthParticle* track, unsigned long tid=0 );
144
145
146 // add a Trk::Track
147 bool selectTrack( const Trk::Track* track );
148
149
150 // extract all the tracks from a TrackCollection and add them
151 void selectTracks( const TrackCollection* trigtracks );
152
153
155
156 bool selectTrack( const xAOD::TrackParticle* track, void* =0);
157
158 void selectTracks( const xAOD::TrackParticleContainer* tracks, void* =0);
159
161
164
165
167
168 void correctToBeamline( double& z0, double& dz0,
169 double& d0, double& dd0,
170 double theta, double phi );
171
172
173protected:
174
179
180 const xAOD::TruthParticle* fromAncestor( const int pdg_id, const xAOD::TruthParticle *p) const;
181
182 const xAOD::TruthParticle* fromAncestor( const std::vector<int>& ids, const xAOD::TruthParticle *p) const;
183
184public:
185
186 static double default_radius() { return s_default_radius; }
187
188private:
189
190 unsigned long m_id;
191
192 double m_xBeam;
193 double m_yBeam;
194 double m_zBeam;
195
197
198 double m_radius;
199
202
203 static const double s_default_radius;
204
205};
206
207#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
represents a LVL2 ID track
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)
bool selectTrack(const TrigInDetTrack *track, const TrigInDetTrackTruthMap *truthMap=0)
neater code to make use of vector function also for a single ancestor pdgid, instead of the full code...
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,...
void selectTracks(const TrigInDetTrackCollection *trigtracks, const TrigInDetTrackTruthMap *truthMap=0)
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()
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...
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 ...