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
19#include "AtlasHepMC/GenEvent.h"
23
24
28
30
35
37// #include "TrkParameters/Perigee.h"
39#include "TrkTrack/Track.h"
42#include "GaudiKernel/ToolHandle.h"
43#include "TMath.h"
44
47
49
50public:
51
52 typedef std::vector< ElementLink< xAOD::TrackParticleContainer > > TrackParticleLinks_t;
53
54public:
55
59
60 TrigTrackSelector( TrackFilter* selector ) : TrigTrackSelector( selector, default_radius(), 0, 0 ) { }
61
62 TrigTrackSelector( TrackFilter* selector, double radius ) : TrigTrackSelector( selector, radius, 0, 0 ) { }
63
64 TrigTrackSelector( TrackFilter* selector, int selectPdgId, int selectParentPdgId ) : TrigTrackSelector( selector, default_radius(), selectPdgId, selectParentPdgId ) { }
65
66 TrigTrackSelector( TrackFilter* selector, double radius, int selectPdgId, int selectParentPdgId );
67
68 template<typename T>
69 TrigTrackSelector( T& tm, TrackFilter* selector, double radius=default_radius(), int selectPdgId=0, int selectParentPdgId=0 ) :
70 TrigTrackSelector( tm.begin(), tm.end(), selector, radius, selectPdgId, selectParentPdgId ) {
71 }
72
73 template<typename T>
74 TrigTrackSelector( T tbegin, T tend, TrackFilter* selector, double radius=default_radius(), int selectPdgId=0, int selectParentPdgId=0 ) :
75 TrigTrackSelector( selector, radius, selectPdgId, selectParentPdgId ) {
76 selectTracks( tbegin, tend );
77 }
78
79
81
82
83 void setBeamline( double x, double y, double z=0) { m_xBeam = x; m_yBeam = y; m_zBeam=z; }
84
85 double getBeamX() const { return m_xBeam; }
86 double getBeamY() const { return m_yBeam; }
87 double getBeamZ() const { return m_zBeam; }
88
89 void correctTracks(bool b=true) { m_correctTrkTracks = b; }
90
91 virtual void clear() override { for ( size_t i=m_tracks.size() ; i-- ; ) delete m_tracks[i]; m_tracks.clear(); }
92
93 // extract all the tracks from a TrackParticle collection and add them
94 void selectTracks( const TruthParticleContainer* truthtracks );
95
96 // extract all the tracks from a TrackParticle collection and add them
97 void selectTracks( const xAOD::TruthParticleContainer* truthtracks );
98
99 // extract all the tracks from a TrackParticle collection and add them
100 void truthBeamline( const xAOD::TruthParticleContainer* truthtracks, double& x0, double& y0 );
101
102
104
105
106 // add a TruthParticle
107 bool selectTrack( const TruthParticle& track );
108
109 // add a TruthParticle
110 bool selectTrack( const TruthParticle* track );
111
112 bool selectTrack( const xAOD::TruthParticle* track, double x0=0, double y0=0 );
113
114
115 // make a TIDA::Track from a GenParticle
117
118 // make a TIDA::Track from a TruthParticle
119 TIDA::Track* makeTrack( const TruthParticle* track, unsigned long tid=0 );
120
121
122 // add a Trk::Track
123 bool selectTrack( const Trk::Track* track );
124
125
126 // extract all the tracks from a TrackCollection and add them
127 void selectTracks( const TrackCollection* trigtracks );
128
129
131
132 bool selectTrack( const xAOD::TrackParticle* track, void* =0);
133
134 void selectTracks( const xAOD::TrackParticleContainer* tracks, void* =0);
135
137
140
141
143
144 void correctToBeamline( double& z0, double& dz0,
145 double& d0, double& dd0,
146 double theta, double phi );
147
148
149protected:
150
155
156 const xAOD::TruthParticle* fromAncestor( const int pdg_id, const xAOD::TruthParticle *p) const;
157
158 const xAOD::TruthParticle* fromAncestor( const std::vector<int>& ids, const xAOD::TruthParticle *p) const;
159
160public:
161
162 static double default_radius() { return s_default_radius; }
163
164private:
165
166 unsigned long m_id;
167
168 double m_xBeam;
169 double m_yBeam;
170 double m_zBeam;
171
173
174 double m_radius;
175
178
179 static const double s_default_radius;
180
181};
182
183#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:861
const std::vector< TIDA::Track * > & tracks() const
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(HepMC::ConstGenParticlePtr track)
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()
void selectTracks(const TruthParticleContainer *truthtracks)
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...
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 ...