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
38
40
45
47// #include "TrkParameters/Perigee.h"
49#include "TrkTrack/Track.h"
52#include "GaudiKernel/ToolHandle.h"
53#include "TMath.h"
54
57
59
60public:
61
62 typedef std::vector< ElementLink< xAOD::TrackParticleContainer > > TrackParticleLinks_t;
63
64public:
65
69
70 TrigTrackSelector( TrackFilter* selector ) : TrigTrackSelector( selector, default_radius(), 0, 0 ) { }
71
72 TrigTrackSelector( TrackFilter* selector, double radius ) : TrigTrackSelector( selector, radius, 0, 0 ) { }
73
74 TrigTrackSelector( TrackFilter* selector, int selectPdgId, int selectParentPdgId ) : TrigTrackSelector( selector, default_radius(), selectPdgId, selectParentPdgId ) { }
75
76 TrigTrackSelector( TrackFilter* selector, double radius, int selectPdgId, int selectParentPdgId );
77
78 template<typename T>
79 TrigTrackSelector( T& tm, TrackFilter* selector, double radius=default_radius(), int selectPdgId=0, int selectParentPdgId=0 ) :
80 TrigTrackSelector( tm.begin(), tm.end(), selector, radius, selectPdgId, selectParentPdgId ) {
81 }
82
83 template<typename T>
84 TrigTrackSelector( T tbegin, T tend, TrackFilter* selector, double radius=default_radius(), int selectPdgId=0, int selectParentPdgId=0 ) :
85 TrigTrackSelector( selector, radius, selectPdgId, selectParentPdgId ) {
86 selectTracks( tbegin, tend );
87 }
88
89
91
92 virtual TrackSelector* clone() override { return new TrigTrackSelector(*this); }
93
94 void setBeamline( double x, double y, double z=0) { m_xBeam = x; m_yBeam = y; m_zBeam=z; }
95
96 double getBeamX() const { return m_xBeam; }
97 double getBeamY() const { return m_yBeam; }
98 double getBeamZ() const { return m_zBeam; }
99
100 void correctTracks(bool b=true) { m_correctTrkTracks = b; }
101
102 virtual void clear() override { for ( size_t i=m_tracks.size() ; i-- ; ) delete m_tracks[i]; m_tracks.clear(); }
103
104
105 bool selectTrack( const TrigInDetTrack* track, const TrigInDetTrackTruthMap* truthMap=0 );
106
107
108 // extract all the tracks from a TrigInDetTrack collection and associated TruthMap and convert them
109 void selectTracks( const TrigInDetTrackCollection* trigtracks, const TrigInDetTrackTruthMap* truthMap=0 );
110
111 // add a TrackParticle
112 bool selectTrack( const Rec::TrackParticle* track );
113
114
115 // extract all the tracks from a TrackParticle collection and add them
116 void selectTracks( const Rec::TrackParticleContainer* trigtracks );
117
118
119 // extract all the tracks from a TrackParticle collection and add them
120 void selectTracks( const TruthParticleContainer* truthtracks );
121
122 // extract all the tracks from a TrackParticle collection and add them
123 void selectTracks( const xAOD::TruthParticleContainer* truthtracks );
124
125 // extract all the tracks from a TrackParticle collection and add them
126 void truthBeamline( const xAOD::TruthParticleContainer* truthtracks, double& x0, double& y0 );
127
128
130
131
132 // add a TruthParticle
133 bool selectTrack( const TruthParticle& track );
134
135 // add a TruthParticle
136 bool selectTrack( const TruthParticle* track );
137
138 bool selectTrack( const xAOD::TruthParticle* track, double x0=0, double y0=0 );
139
140
141 // make a TIDA::Track from a GenParticle
143
144 // make a TIDA::Track from a TruthParticle
145 TIDA::Track* makeTrack( const TruthParticle* track, unsigned long tid=0 );
146
147
148 // add a Trk::Track
149 bool selectTrack( const Trk::Track* track );
150
151
152 // extract all the tracks from a TrackCollection and add them
153 void selectTracks( const TrackCollection* trigtracks );
154
155
157
158 bool selectTrack( const xAOD::TrackParticle* track, void* =0);
159
160 void selectTracks( const xAOD::TrackParticleContainer* tracks, void* =0);
161
163
166
167
169
170 void correctToBeamline( double& z0, double& dz0,
171 double& d0, double& dd0,
172 double theta, double phi );
173
174
175protected:
176
181
182 const xAOD::TruthParticle* fromAncestor( const int pdg_id, const xAOD::TruthParticle *p) const;
183
184 const xAOD::TruthParticle* fromAncestor( const std::vector<int>& ids, const xAOD::TruthParticle *p) const;
185
186public:
187
188 static double default_radius() { return s_default_radius; }
189
190private:
191
192 unsigned long m_id;
193
194 double m_xBeam;
195 double m_yBeam;
196 double m_zBeam;
197
199
200 double m_radius;
201
204
205 static const double s_default_radius;
206
207};
208
209#endif // TIDAUTILS_TRIGTRACKSELECTOR_H
Scalar phi() const
phi method
Scalar theta() const
theta method
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...
virtual TrackSelector * clone() override
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
const GenParticle * ConstGenParticlePtr
Definition GenParticle.h:38
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 ...
std::vector< ElementLink< xAOD::TrackParticleContainer > > TrackParticleLinks_t