ATLAS Offline Software
InDetRecStatisticsAlg.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // InDetRecStatisticsAlg.h
7 // Authors: Sven Vahsen, Lauren Tompkins
9 
10 #ifndef INDETRECSTATISTICS_TrackStatistics_H
11 #define INDETRECSTATISTICS_TrackStatistics_H
12 
13 
15 #include "GaudiKernel/ToolHandle.h"
17 #include "HepPDT/ParticleDataTable.hh"
19 #include "Identifier/Identifier.h"
25 
26 #include <vector>
27 #include <atomic>
28 
29 // forward declarations
30 
31 class AtlasDetectorID;
32 class PixelID;
33 class SCT_ID;
34 class TRT_ID;
35 class IdDictManager;
37 class McEventCollection;
38 class GenParticle;
39 
40 namespace Trk {
41  class ITrackSummaryTool;
42  class TrackSummary;
43 }
44 
45 namespace InDet {
46 
48 
49 
56  public:
58  InDetRecStatisticsAlg (const std::string& name, ISvcLocator* pSvcLocator);
62  StatusCode execute(const EventContext &ctx) const;
70  void printStatistics();
72  void printTrackSummary (MsgStream &out, enum eta_region );
73 
74 
75 
76  private:
77 
78  template <typename T_Int=int>
79  struct Counter;
81 
85  std::vector <std::pair<HepMC::ConstGenParticlePtr,int> > &,
86  unsigned int,
87  unsigned int,
88  CounterLocal &counter) const;
89 
91  void selectRecSignal (const TrackCollection*,
92  std::vector <const Trk::Track *> & ,
93  std::vector <const Trk::Track *> &,
94  CounterLocal &counter) const;
95 
96 
97 
98  std::vector <class TrackStatHelper *> m_SignalCounters;
99  const HepPDT::ParticleDataTable* m_particleDataTable;
102  const SCT_ID* m_sctID;
103  const TRT_ID* m_trtID;
104  // added to check TRT existence (SLHC geo check)
106  ToolHandle<Trk::ITruthToTrack> m_truthToTrack;
107  ToolHandle<Trk::IExtendedTrackSummaryTool> m_trkSummaryTool;
108 
109  ToolHandle<Trk::IUpdator> m_updatorHandle;
111  ToolHandle<Trk::IResidualPullCalculator> m_residualPullCalculator;
112 
113  // steering parameters of Algorithm
115  ToolHandle<Trk::ITrackSelectorTool> m_trackSelectorTool;
116 
119  float m_minPt;
120  float m_maxEta;
127  // float m_maxRIndet;
137  bool m_doTruth;
142 
143  mutable std::atomic<bool> m_pullWarning {};
144  mutable std::atomic<bool> m_UpdatorWarning {};
145  mutable std::atomic<int> m_isUnbiased ;
146 
147  mutable std::atomic<long> m_events_processed ;
148  // statistics counters
149  enum ECounter {
155  kNCounter
156  };
157 
158  template <typename T_Int>
159  struct Counter {
160  Counter() { reset(); }
161  void reset() {
162  for (unsigned int i=0; i<kNCounter; ++i) { m_counter[i]=0; }
163  }
164  template <typename T_IntB>
166  for (unsigned int i=0; i<kNCounter; ++i) { m_counter[i] += b.m_counter[i]; }
167  return *this;
168  }
170  };
171 
174  static float calculatePull(const float, const float, const float); //vv
177  Identifier getIdentifier(const Trk::MeasurementBase* measurement );
178  };
179 
180 } // close of namespace
181 
182 #endif // INDETRECSTATISTICS_TrackStatistics_H
InDet::eta_region
eta_region
Definition: TrackStatHelper.h:74
InDet::InDetRecStatisticsAlg::getIdentifier
Identifier getIdentifier(const Trk::MeasurementBase *measurement)
Definition: InDetRecStatisticsAlg.cxx:838
InDet::InDetRecStatisticsAlg::Counter::Counter
Counter()
Definition: InDetRecStatisticsAlg.h:160
InDet::InDetRecStatisticsAlg::m_pixelID
const PixelID * m_pixelID
get pixel layer from hit ID
Definition: InDetRecStatisticsAlg.h:101
InDet::InDetRecStatisticsAlg::m_idHelper
const AtlasDetectorID * m_idHelper
Used to find out the sub-det from PRD->identify().
Definition: InDetRecStatisticsAlg.h:100
InDet::InDetRecStatisticsAlg::m_maxEtaFORWARD
float m_maxEtaFORWARD
Definition: InDetRecStatisticsAlg.h:139
InDet::InDetRecStatisticsAlg::kN_rec_tracks_processed
@ kN_rec_tracks_processed
number of reconstructed tracks processed
Definition: InDetRecStatisticsAlg.h:152
InDet::InDetRecStatisticsAlg::m_pullWarning
std::atomic< bool > m_pullWarning
warn only once, if pull cannot be calculated
Definition: InDetRecStatisticsAlg.h:143
InDet::InDetRecStatisticsAlg::m_minZEndSecondary
float m_minZEndSecondary
If track has end vertex, this is min Z of end vertex to be considered secondary.
Definition: InDetRecStatisticsAlg.h:135
InDet::InDetRecStatisticsAlg::m_residualPullCalculator
ToolHandle< Trk::IResidualPullCalculator > m_residualPullCalculator
The residual and pull calculator tool handle.
Definition: InDetRecStatisticsAlg.h:111
InDet::InDetRecStatisticsAlg::calculatePull
static float calculatePull(const float, const float, const float)
Calculate pull from residual, track and hit error.
Definition: InDetRecStatisticsAlg.cxx:788
InDet::InDetRecStatisticsAlg::m_trkSummaryTool
ToolHandle< Trk::IExtendedTrackSummaryTool > m_trkSummaryTool
tool to get track summary information from track
Definition: InDetRecStatisticsAlg.h:107
InDet::InDetRecStatisticsAlg::resetStatistics
StatusCode resetStatistics()
Clear statistics counters, called before each track collection is processed.
Definition: InDetRecStatisticsAlg.cxx:503
InDet::InDetRecStatisticsAlg::m_maxRStartPrimary
float m_maxRStartPrimary
Maximum R of start vertex to be considered primary.
Definition: InDetRecStatisticsAlg.h:128
InDet::InDetRecStatisticsAlg::ECounter
ECounter
Definition: InDetRecStatisticsAlg.h:149
InDet::InDetRecStatisticsAlg::m_trtID
const TRT_ID * m_trtID
get trt layer from hit ID
Definition: InDetRecStatisticsAlg.h:103
InDet
DUMMY Primary Vertex Finder.
Definition: VP1ErrorUtils.h:36
InDet::InDetRecStatisticsAlg::getServices
StatusCode getServices()
Get various services such as StoreGate, dictionaries, detector managers etc.
Definition: InDetRecStatisticsAlg.cxx:401
InDet::InDetRecStatisticsAlg::m_UpdatorWarning
std::atomic< bool > m_UpdatorWarning
warn only once, if unbiased track states can not be calculated
Definition: InDetRecStatisticsAlg.h:144
InDet::InDetRecStatisticsAlg::selectGenSignal
void selectGenSignal(const McEventCollection *, std::vector< std::pair< HepMC::ConstGenParticlePtr, int > > &, unsigned int, unsigned int, CounterLocal &counter) const
Select charged,stable particles which pass pt and eta cuts for analysis.
Definition: InDetRecStatisticsAlg.cxx:542
InDet::InDetRecStatisticsAlg::kNCounter
@ kNCounter
Definition: InDetRecStatisticsAlg.h:155
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
InDet::InDetRecStatisticsAlg::kN_rec_tracks_without_perigee
@ kN_rec_tracks_without_perigee
number of tracks w/o perigee
Definition: InDetRecStatisticsAlg.h:150
SG::HandleKeyArray
Definition: StoreGate/StoreGate/HandleKeyArray.h:38
InDet::InDetRecStatisticsAlg::m_minREndSecondary
float m_minREndSecondary
If track has end vertex, this is min R of end vertex to be considered secondary.
Definition: InDetRecStatisticsAlg.h:133
InDet::InDetRecStatisticsAlg
Definition: InDetRecStatisticsAlg.h:47
InDet::InDetRecStatisticsAlg::m_UseTrackSummary
bool m_UseTrackSummary
Flag to print detailed statistics for each track collection.
Definition: InDetRecStatisticsAlg.h:117
SG::ReadHandleKey< McEventCollection >
InDet::InDetRecStatisticsAlg::printTrackSummary
void printTrackSummary(MsgStream &out, enum eta_region)
Print track statistics for all and low proability tracks.
Definition: InDetRecStatisticsAlg.cxx:766
InDet::InDetRecStatisticsAlg::m_useTrackSelection
bool m_useTrackSelection
Use track selector tool.
Definition: InDetRecStatisticsAlg.h:136
InDet::InDetRecStatisticsAlg::Counter::operator+=
Counter & operator+=(const Counter< T_IntB > &b)
Definition: InDetRecStatisticsAlg.h:165
InDet::InDetRecStatisticsAlg::m_particleDataTable
const HepPDT::ParticleDataTable * m_particleDataTable
Atlas particle ID table.
Definition: InDetRecStatisticsAlg.h:99
InDet::InDetRecStatisticsAlg::execute
StatusCode execute(const EventContext &ctx) const
Calculation of statistics.
Definition: InDetRecStatisticsAlg.cxx:266
IUpdator.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
InDet::InDetRecStatisticsAlg::m_McTrackCollection_key
SG::ReadHandleKey< McEventCollection > m_McTrackCollection_key
Definition: InDetRecStatisticsAlg.h:114
InDet::InDetRecStatisticsAlg::printStatistics
void printStatistics()
Print tracking statistics calculated with TrackStatHelper.
Definition: InDetRecStatisticsAlg.cxx:600
TrackTruthCollection
Definition: TrackTruthCollection.h:21
lumiFormat.i
int i
Definition: lumiFormat.py:92
InDet::InDetRecStatisticsAlg::m_printSecondary
bool m_printSecondary
Flag to print hit information for secondary tracks.
Definition: InDetRecStatisticsAlg.h:118
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
InDet::InDetRecStatisticsAlg::m_updatorHandle
ToolHandle< Trk::IUpdator > m_updatorHandle
Tool handle of updator for unbiased states.
Definition: InDetRecStatisticsAlg.h:109
InDet::InDetRecStatisticsAlg::Counter::m_counter
T_Int m_counter[kNCounter]
Definition: InDetRecStatisticsAlg.h:169
TrackCollection.h
InDet::InDetRecStatisticsAlg::m_events_processed
std::atomic< long > m_events_processed
number of events processed
Definition: InDetRecStatisticsAlg.h:147
InDet::InDetRecStatisticsAlg::m_sctID
const SCT_ID * m_sctID
get sct layer from hit ID
Definition: InDetRecStatisticsAlg.h:102
InDet::InDetRecStatisticsAlg::m_truthToTrack
ToolHandle< Trk::ITruthToTrack > m_truthToTrack
tool to create track parameters from a gen particle
Definition: InDetRecStatisticsAlg.h:106
InDet::InDetRecStatisticsAlg::m_SignalCounters
std::vector< class TrackStatHelper * > m_SignalCounters
Vector of TrackStatHelper objects, one for each track collection.
Definition: InDetRecStatisticsAlg.h:98
InDet::InDetRecStatisticsAlg::m_maxEta
float m_maxEta
Maximum Eta cut for tracks used by the algorithm.
Definition: InDetRecStatisticsAlg.h:120
Trk::ParametersBase
Definition: ParametersBase.h:55
McEventCollection
This defines the McEventCollection, which is really just an ObjectVector of McEvent objects.
Definition: McEventCollection.h:33
InDet::InDetRecStatisticsAlg::m_matchTrackCut
float m_matchTrackCut
Minimum number of hits from a truth track to be considered a matched reco track.
Definition: InDetRecStatisticsAlg.h:126
InDet::InDetRecStatisticsAlg::m_updator
Trk::IUpdator * m_updator
updator for unbiased states
Definition: InDetRecStatisticsAlg.h:110
DataVector< Trk::Track >
AthReentrantAlgorithm.h
Trk::MeasurementBase
Definition: MeasurementBase.h:58
InDet::InDetRecStatisticsAlg::m_maxEtaTransition
float m_maxEtaTransition
define max eta of transition region
Definition: InDetRecStatisticsAlg.h:122
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
InDet::InDetRecStatisticsAlg::m_minPt
float m_minPt
Minimum Pt cut for tracks used by the algorithm.
Definition: InDetRecStatisticsAlg.h:119
InDet::InDetRecStatisticsAlg::m_trackSelectorTool
ToolHandle< Trk::ITrackSelectorTool > m_trackSelectorTool
Definition: InDetRecStatisticsAlg.h:115
InDet::InDetRecStatisticsAlg::kN_gen_tracks_processed
@ kN_gen_tracks_processed
number of generated tracks processed
Definition: InDetRecStatisticsAlg.h:153
InDet::InDetRecStatisticsAlg::ATLAS_THREAD_SAFE
Counter< std::atomic< long > > m_counter ATLAS_THREAD_SAFE
Definition: InDetRecStatisticsAlg.h:172
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
IdDictManager
IdDictManager is the interface to identifier dictionaries.
Definition: IdDictManager.h:36
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
IPRDtoTrackMapTool.h
InDet::InDetRecStatisticsAlg::finalize
StatusCode finalize()
Statistics table printed, collection cleared.
Definition: InDetRecStatisticsAlg.cxx:383
Trk::IUpdator
Set of interfaces for methods operating on track states, mainly for Kalman filtering.
Definition: IUpdator.h:64
InDet::InDetRecStatisticsAlg::m_idDictMgr
const IdDictManager * m_idDictMgr
Definition: InDetRecStatisticsAlg.h:105
IResidualPullCalculator.h
InDet::InDetRecStatisticsAlg::Counter::reset
void reset()
Definition: InDetRecStatisticsAlg.h:161
TRT_ID
Definition: TRT_ID.h:84
InDet::InDetRecStatisticsAlg::m_fakeTrackCut2
float m_fakeTrackCut2
Second definition of maximum probability for which a track will be considered a fake.
Definition: InDetRecStatisticsAlg.h:125
SCT_ID
Definition: SCT_ID.h:68
InDet::InDetRecStatisticsAlg::m_minZEndPrimary
float m_minZEndPrimary
If track has end vertex, this is min Z of end vertex to be considered primary.
Definition: InDetRecStatisticsAlg.h:134
ITruthToTrack.h
InDet::InDetRecStatisticsAlg::m_maxRStartSecondary
float m_maxRStartSecondary
Maximum R of start vertex to be considered secondary.
Definition: InDetRecStatisticsAlg.h:129
TrackStatHelper.h
InDet::InDetRecStatisticsAlg::m_maxZStartSecondary
float m_maxZStartSecondary
Maximum Z of start vertex to be considered secondary.
Definition: InDetRecStatisticsAlg.h:131
InDet::InDetRecStatisticsAlg::m_maxEtaEndcap
float m_maxEtaEndcap
define max eta of eta region
Definition: InDetRecStatisticsAlg.h:123
InDet::InDetRecStatisticsAlg::initialize
StatusCode initialize()
Initialization of services, track collections, creates TrackStatHelper for each Track Collection.
Definition: InDetRecStatisticsAlg.cxx:157
InDet::InDetRecStatisticsAlg::m_TrackTruthCollection_keys
SG::ReadHandleKeyArray< TrackTruthCollection > m_TrackTruthCollection_keys
Definition: InDetRecStatisticsAlg.h:141
InDet::InDetRecStatisticsAlg::m_minEtaFORWARD
float m_minEtaFORWARD
Definition: InDetRecStatisticsAlg.h:138
InDet::InDetRecStatisticsAlg::m_doTruth
bool m_doTruth
Use truth information.
Definition: InDetRecStatisticsAlg.h:137
InDet::InDetRecStatisticsAlg::m_isUnbiased
std::atomic< int > m_isUnbiased
if can get unbiased residuals
Definition: InDetRecStatisticsAlg.h:145
InDet::InDetRecStatisticsAlg::m_maxZStartPrimary
float m_maxZStartPrimary
Maximum Z of start vertex to be considered primary.
Definition: InDetRecStatisticsAlg.h:130
InDet::InDetRecStatisticsAlg::m_fakeTrackCut
float m_fakeTrackCut
Maximum probability for which a track will be considered a fake.
Definition: InDetRecStatisticsAlg.h:124
InDet::InDetRecStatisticsAlg::m_maxEtaBarrel
float m_maxEtaBarrel
define max eta of barrel region
Definition: InDetRecStatisticsAlg.h:121
InDet::InDetRecStatisticsAlg::InDetRecStatisticsAlg
InDetRecStatisticsAlg(const std::string &name, ISvcLocator *pSvcLocator)
Default Constructor.
Definition: InDetRecStatisticsAlg.cxx:74
ITrackSelectorTool.h
test_pyathena.counter
counter
Definition: test_pyathena.py:15
PixelID
Definition: PixelID.h:67
InDet::InDetRecStatisticsAlg::Counter
Definition: InDetRecStatisticsAlg.h:79
InDet::InDetRecStatisticsAlg::kN_unknown_hits
@ kN_unknown_hits
number of hits without track
Definition: InDetRecStatisticsAlg.h:151
InDet::InDetRecStatisticsAlg::m_RecTrackCollection_keys
SG::ReadHandleKeyArray< TrackCollection > m_RecTrackCollection_keys
Definition: InDetRecStatisticsAlg.h:140
InDet::InDetRecStatisticsAlg::getUnbiasedTrackParameters
const Trk::TrackParameters * getUnbiasedTrackParameters(const Trk::TrackParameters *, const Trk::MeasurementBase *)
Get Unbiased Track Parameters.
Definition: InDetRecStatisticsAlg.cxx:797
InDet::InDetRecStatisticsAlg::m_minREndPrimary
float m_minREndPrimary
If track has end vertex, this is min R of end vertex to be considered primary.
Definition: InDetRecStatisticsAlg.h:132
InDet::InDetRecStatisticsAlg::kN_spacepoints_processed
@ kN_spacepoints_processed
number of space points processed
Definition: InDetRecStatisticsAlg.h:154
AtlasDetectorID
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
Definition: AtlasDetectorID.h:57
xAOD::TrackSummary
TrackSummary_v1 TrackSummary
Definition: Event/xAOD/xAODTracking/xAODTracking/TrackSummary.h:10
InDet::InDetRecStatisticsAlg::selectRecSignal
void selectRecSignal(const TrackCollection *, std::vector< const Trk::Track * > &, std::vector< const Trk::Track * > &, CounterLocal &counter) const
Select for analysis reconstructed tracks passing Pt and eta cuts.
Definition: InDetRecStatisticsAlg.cxx:515
GenParticle
@ GenParticle
Definition: TruthClasses.h:30