ATLAS Offline Software
TrigTrackSelector.h
Go to the documentation of this file.
1 /* emacs: this is -*- c++ -*- */
12 #ifndef TIDAUTILS_TRIGTRACKSELECTOR_H
13 #define TIDAUTILS_TRIGTRACKSELECTOR_H
14 
16 
21 
23 #include "Particle/TrackParticle.h"
25 
28 #include "AtlasHepMC/GenEvent.h"
29 #include "AtlasHepMC/GenVertex.h"
30 #include "AtlasHepMC/GenParticle.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 
60 public:
61 
62  typedef std::vector< ElementLink< xAOD::TrackParticleContainer > > TrackParticleLinks_t;
63 
64 public:
65 
69 
71 
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 
175 protected:
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 
186 public:
187 
188  static double default_radius() { return s_default_radius; }
189 
190 private:
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
TrigTrackSelector::m_radius
double m_radius
Definition: TrigTrackSelector.h:200
Track.h
ITrackSummaryTool.h
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
TrigTrackSelector::m_id
unsigned long m_id
Definition: TrigTrackSelector.h:192
GenEvent.h
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
TrackParameters.h
TrackParticle.h
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
TrigTrackSelector::clear
virtual void clear() override
Definition: TrigTrackSelector.h:102
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
TrigInDetTrackCollection
Definition: TrigInDetTrackCollection.h:13
TruthParticleContainer.h
TrackFilter
Definition: TrackFilter.h:26
TruthParticleContainer.h
GenVertex.h
TrackFilter.h
base class for a single track selection filter allowing parameter setting for complex track selection
theta
Scalar theta() const
theta method
Definition: AmgMatrixBasePlugin.h:71
TrigTrackSelector::clone
virtual TrackSelector * clone() override
Definition: TrigTrackSelector.h:92
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
TruthParticle
Definition: PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h:58
TrigInDetTrackCollection.h
TrigTrackSelector
L2 tracks.
Definition: TrigTrackSelector.h:58
TrigTrackSelector::correctTracks
void correctTracks(bool b=true)
Definition: TrigTrackSelector.h:100
TruthParticleContainer
Definition: PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h:42
x
#define x
TrigTrackSelector::TrigTrackSelector
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,...
Definition: TrigTrackSelector.h:70
GenParticle.h
TrigInDetTrack
Definition: TrigInDetTrack.h:34
TrackSelector
Definition: Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/TrackSelector.h:24
TrigTrackSelector::correctToBeamline
void correctToBeamline(double &z0, double &dz0, double &d0, double &dd0, double theta, double phi)
Definition: TrigTrackSelector.cxx:1276
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
Track.h
TrigTrackSelector::getBeamX
double getBeamX() const
Definition: TrigTrackSelector.h:96
TrackSelector::m_tracks
std::vector< TIDA::Track * > m_tracks
Definition: Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/TrackSelector.h:82
python.TriggerHandler.tend
string tend
Definition: TriggerHandler.py:300
lumiFormat.i
int i
Definition: lumiFormat.py:92
z
#define z
TrackParticleLinks_t
std::vector< ElementLink< xAOD::TrackParticleContainer > > TrackParticleLinks_t
Definition: DiTauIDVarCalculator.cxx:36
TrackSelector.h
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:41
TrackCollection.h
TrigInDetTrackTruthMap
Definition: TrigInDetTrackTruthMap.h:38
TRT::Track::d0
@ d0
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:62
TIDA_newtracking.h
TrackSummary.h
TRT::Track::z0
@ z0
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:63
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
TrigTrackSelector::m_zBeam
double m_zBeam
Definition: TrigTrackSelector.h:196
TrigTrackSelector::TrigTrackSelector
TrigTrackSelector(TrackFilter *selector, double radius)
Definition: TrigTrackSelector.h:72
TrigTrackSelector::m_xBeam
double m_xBeam
Definition: TrigTrackSelector.h:194
TrigTrackSelector::selectTrack
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...
Definition: TrigTrackSelector.cxx:116
HepMC::ConstGenParticlePtr
const GenParticle * ConstGenParticlePtr
Definition: GenParticle.h:38
TrigTrackSelector::default_radius
static double default_radius()
Definition: TrigTrackSelector.h:188
TrigTrackSelector::fromAncestor
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,...
Definition: TrigTrackSelector.cxx:39
TrackSelector::tracks
const std::vector< TIDA::Track * > & tracks() const
Definition: Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/TrackSelector.h:53
python.subdetectors.mmg.ids
ids
Definition: mmg.py:8
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
TrigInDetTrackTruthMap.h
Rec::TrackParticleContainer
Definition: Reconstruction/Particle/Particle/TrackParticleContainer.h:33
particleType.h
a class of my own because ttying to access the ParticleDataTable in athena is frankly more trouble ...
TrigTrackSelector::m_selectParentPdgId
int m_selectParentPdgId
Definition: TrigTrackSelector.h:203
TrigTrackSelector::selectTracks
void selectTracks(const TrigInDetTrackCollection *trigtracks, const TrigInDetTrackTruthMap *truthMap=0)
Definition: TrigTrackSelector.cxx:188
ParticleGun_SamplingFraction.radius
radius
Definition: ParticleGun_SamplingFraction.py:96
Rec::TrackParticle
Definition: Reconstruction/Particle/Particle/TrackParticle.h:47
TrackParticle.h
TrigTrackSelector::TrigTrackSelector
TrigTrackSelector(TrackFilter *selector, int selectPdgId, int selectParentPdgId)
Definition: TrigTrackSelector.h:74
TrigTrackSelector::TrigTrackSelector
TrigTrackSelector(T tbegin, T tend, TrackFilter *selector, double radius=default_radius(), int selectPdgId=0, int selectParentPdgId=0)
Definition: TrigTrackSelector.h:84
TrigTrackSelector::m_correctTrkTracks
bool m_correctTrkTracks
Definition: TrigTrackSelector.h:198
python.selector.AtlRunQuerySelectorLhcOlc.selector
selector
Definition: AtlRunQuerySelectorLhcOlc.py:611
y
#define y
TrigTrackSelector::setBeamline
void setBeamline(double x, double y, double z=0)
Definition: TrigTrackSelector.h:94
TIDA::Track
Definition: Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/Track.h:26
TrigTrackSelector::getBeamZ
double getBeamZ() const
Definition: TrigTrackSelector.h:98
TrigTrackSelector::getBeamY
double getBeamY() const
Definition: TrigTrackSelector.h:97
TrigTrackSelector::TrigTrackSelector
TrigTrackSelector(T &tm, TrackFilter *selector, double radius=default_radius(), int selectPdgId=0, int selectParentPdgId=0)
Definition: TrigTrackSelector.h:79
TrigTrackSelector::truthBeamline
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...
Definition: TrigTrackSelector.cxx:381
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
TrigTrackSelector::m_yBeam
double m_yBeam
Definition: TrigTrackSelector.h:195
TrigTrackSelector::m_selectPdgId
int m_selectPdgId
Definition: TrigTrackSelector.h:202
TrigTrackSelector::makeTrack
TIDA::Track * makeTrack(HepMC::ConstGenParticlePtr track)
Definition: TrigTrackSelector.cxx:688
TrigTrackSelector::~TrigTrackSelector
~TrigTrackSelector()
Definition: TrigTrackSelector.h:90
TrigTrackSelector::TrackParticleLinks_t
std::vector< ElementLink< xAOD::TrackParticleContainer > > TrackParticleLinks_t
Definition: TrigTrackSelector.h:62
TrackParticleContainer.h
TrigTrackSelector::s_default_radius
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...
Definition: TrigTrackSelector.h:205
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
TrackParticleContainer.h