ATLAS Offline Software
InDetRecStatisticsAlg.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 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"
18 #include "Identifier/Identifier.h"
24 
25 #include <vector>
26 #include <atomic>
27 
28 // forward declarations
29 
30 class AtlasDetectorID;
31 class PixelID;
32 class SCT_ID;
33 class TRT_ID;
34 class IdDictManager;
36 class McEventCollection;
37 class GenParticle;
38 
39 namespace Trk {
40  class ITrackSummaryTool;
41  class TrackSummary;
42 }
43 
44 namespace InDet {
45 
47 
48 
55  public:
57  InDetRecStatisticsAlg (const std::string& name, ISvcLocator* pSvcLocator);
61  StatusCode execute(const EventContext &ctx) const;
69  void printStatistics();
71  void printTrackSummary (MsgStream &out, enum eta_region );
72 
73 
74 
75  private:
76 
77  template <typename T_Int=int>
78  struct Counter;
80 
84  std::vector <std::pair<HepMC::ConstGenParticlePtr,int> > &,
85  unsigned int,
86  unsigned int,
87  CounterLocal &counter) const;
88 
90  void selectRecSignal (const TrackCollection*,
91  std::vector <const Trk::Track *> & ,
92  std::vector <const Trk::Track *> &,
93  CounterLocal &counter) const;
94 
95 
96 
97  std::vector <class TrackStatHelper *> m_SignalCounters;
99  const PixelID* m_pixelID;
100  const SCT_ID* m_sctID;
101  const TRT_ID* m_trtID;
102  // added to check TRT existence (SLHC geo check)
104  ToolHandle<Trk::ITruthToTrack> m_truthToTrack;
105  ToolHandle<Trk::IExtendedTrackSummaryTool> m_trkSummaryTool;
106 
107  ToolHandle<Trk::IUpdator> m_updatorHandle;
109  ToolHandle<Trk::IResidualPullCalculator> m_residualPullCalculator;
110 
111  // steering parameters of Algorithm
113  ToolHandle<Trk::ITrackSelectorTool> m_trackSelectorTool;
114 
117  float m_minPt;
118  float m_maxEta;
125  // float m_maxRIndet;
135  bool m_doTruth;
140 
141  mutable std::atomic<bool> m_pullWarning {};
142  mutable std::atomic<bool> m_UpdatorWarning {};
143  mutable std::atomic<int> m_isUnbiased ;
144 
145  mutable std::atomic<long> m_events_processed ;
146  // statistics counters
147  enum ECounter {
153  kNCounter
154  };
155 
156  template <typename T_Int>
157  struct Counter {
158  Counter() { reset(); }
159  void reset() {
160  for (unsigned int i=0; i<kNCounter; ++i) { m_counter[i]=0; }
161  }
162  template <typename T_IntB>
164  for (unsigned int i=0; i<kNCounter; ++i) { m_counter[i] += b.m_counter[i]; }
165  return *this;
166  }
168  };
169 
172  static float calculatePull(const float, const float, const float); //vv
175  Identifier getIdentifier(const Trk::MeasurementBase* measurement );
176  };
177 
178 } // close of namespace
179 
180 #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:819
InDet::InDetRecStatisticsAlg::Counter::Counter
Counter()
Definition: InDetRecStatisticsAlg.h:158
InDet::InDetRecStatisticsAlg::m_pixelID
const PixelID * m_pixelID
get pixel layer from hit ID
Definition: InDetRecStatisticsAlg.h:99
InDet::InDetRecStatisticsAlg::m_idHelper
const AtlasDetectorID * m_idHelper
Used to find out the sub-det from PRD->identify().
Definition: InDetRecStatisticsAlg.h:98
InDet::InDetRecStatisticsAlg::m_maxEtaFORWARD
float m_maxEtaFORWARD
Definition: InDetRecStatisticsAlg.h:137
InDet::InDetRecStatisticsAlg::kN_rec_tracks_processed
@ kN_rec_tracks_processed
number of reconstructed tracks processed
Definition: InDetRecStatisticsAlg.h:150
InDet::InDetRecStatisticsAlg::m_pullWarning
std::atomic< bool > m_pullWarning
warn only once, if pull cannot be calculated
Definition: InDetRecStatisticsAlg.h:141
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:133
InDet::InDetRecStatisticsAlg::m_residualPullCalculator
ToolHandle< Trk::IResidualPullCalculator > m_residualPullCalculator
The residual and pull calculator tool handle.
Definition: InDetRecStatisticsAlg.h:109
InDet::InDetRecStatisticsAlg::calculatePull
static float calculatePull(const float, const float, const float)
Calculate pull from residual, track and hit error.
Definition: InDetRecStatisticsAlg.cxx:769
InDet::InDetRecStatisticsAlg::m_trkSummaryTool
ToolHandle< Trk::IExtendedTrackSummaryTool > m_trkSummaryTool
tool to get track summary information from track
Definition: InDetRecStatisticsAlg.h:105
InDet::InDetRecStatisticsAlg::resetStatistics
StatusCode resetStatistics()
Clear statistics counters, called before each track collection is processed.
Definition: InDetRecStatisticsAlg.cxx:489
InDet::InDetRecStatisticsAlg::m_maxRStartPrimary
float m_maxRStartPrimary
Maximum R of start vertex to be considered primary.
Definition: InDetRecStatisticsAlg.h:126
InDet::InDetRecStatisticsAlg::ECounter
ECounter
Definition: InDetRecStatisticsAlg.h:147
InDet::InDetRecStatisticsAlg::m_trtID
const TRT_ID * m_trtID
get trt layer from hit ID
Definition: InDetRecStatisticsAlg.h:101
InDet
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:398
InDet::InDetRecStatisticsAlg::m_UpdatorWarning
std::atomic< bool > m_UpdatorWarning
warn only once, if unbiased track states can not be calculated
Definition: InDetRecStatisticsAlg.h:142
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:528
InDet::InDetRecStatisticsAlg::kNCounter
@ kNCounter
Definition: InDetRecStatisticsAlg.h:153
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:148
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:131
InDet::InDetRecStatisticsAlg
Definition: InDetRecStatisticsAlg.h:46
InDet::InDetRecStatisticsAlg::m_UseTrackSummary
bool m_UseTrackSummary
Flag to print detailed statistics for each track collection.
Definition: InDetRecStatisticsAlg.h:115
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:747
InDet::InDetRecStatisticsAlg::m_useTrackSelection
bool m_useTrackSelection
Use track selector tool.
Definition: InDetRecStatisticsAlg.h:134
InDet::InDetRecStatisticsAlg::Counter::operator+=
Counter & operator+=(const Counter< T_IntB > &b)
Definition: InDetRecStatisticsAlg.h:163
InDet::InDetRecStatisticsAlg::execute
StatusCode execute(const EventContext &ctx) const
Calculation of statistics.
Definition: InDetRecStatisticsAlg.cxx:263
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:112
InDet::InDetRecStatisticsAlg::printStatistics
void printStatistics()
Print tracking statistics calculated with TrackStatHelper.
Definition: InDetRecStatisticsAlg.cxx:581
TrackTruthCollection
Definition: TrackTruthCollection.h:21
lumiFormat.i
int i
Definition: lumiFormat.py:85
InDet::InDetRecStatisticsAlg::m_printSecondary
bool m_printSecondary
Flag to print hit information for secondary tracks.
Definition: InDetRecStatisticsAlg.h:116
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:107
InDet::InDetRecStatisticsAlg::Counter::m_counter
T_Int m_counter[kNCounter]
Definition: InDetRecStatisticsAlg.h:167
TrackCollection.h
InDet::InDetRecStatisticsAlg::m_events_processed
std::atomic< long > m_events_processed
number of events processed
Definition: InDetRecStatisticsAlg.h:145
InDet::InDetRecStatisticsAlg::m_sctID
const SCT_ID * m_sctID
get sct layer from hit ID
Definition: InDetRecStatisticsAlg.h:100
InDet::InDetRecStatisticsAlg::m_truthToTrack
ToolHandle< Trk::ITruthToTrack > m_truthToTrack
tool to create track parameters from a gen particle
Definition: InDetRecStatisticsAlg.h:104
InDet::InDetRecStatisticsAlg::m_SignalCounters
std::vector< class TrackStatHelper * > m_SignalCounters
Vector of TrackStatHelper objects, one for each track collection.
Definition: InDetRecStatisticsAlg.h:97
InDet::InDetRecStatisticsAlg::m_maxEta
float m_maxEta
Maximum Eta cut for tracks used by the algorithm.
Definition: InDetRecStatisticsAlg.h:118
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:124
InDet::InDetRecStatisticsAlg::m_updator
Trk::IUpdator * m_updator
updator for unbiased states
Definition: InDetRecStatisticsAlg.h:108
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:120
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:117
InDet::InDetRecStatisticsAlg::m_trackSelectorTool
ToolHandle< Trk::ITrackSelectorTool > m_trackSelectorTool
Definition: InDetRecStatisticsAlg.h:113
InDet::InDetRecStatisticsAlg::kN_gen_tracks_processed
@ kN_gen_tracks_processed
number of generated tracks processed
Definition: InDetRecStatisticsAlg.h:151
InDet::InDetRecStatisticsAlg::ATLAS_THREAD_SAFE
Counter< std::atomic< long > > m_counter ATLAS_THREAD_SAFE
Definition: InDetRecStatisticsAlg.h:170
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
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:380
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:103
IResidualPullCalculator.h
InDet::InDetRecStatisticsAlg::Counter::reset
void reset()
Definition: InDetRecStatisticsAlg.h:159
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:123
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:132
ITruthToTrack.h
InDet::InDetRecStatisticsAlg::m_maxRStartSecondary
float m_maxRStartSecondary
Maximum R of start vertex to be considered secondary.
Definition: InDetRecStatisticsAlg.h:127
TrackStatHelper.h
InDet::InDetRecStatisticsAlg::m_maxZStartSecondary
float m_maxZStartSecondary
Maximum Z of start vertex to be considered secondary.
Definition: InDetRecStatisticsAlg.h:129
InDet::InDetRecStatisticsAlg::m_maxEtaEndcap
float m_maxEtaEndcap
define max eta of eta region
Definition: InDetRecStatisticsAlg.h:121
InDet::InDetRecStatisticsAlg::initialize
StatusCode initialize()
Initialization of services, track collections, creates TrackStatHelper for each Track Collection.
Definition: InDetRecStatisticsAlg.cxx:154
InDet::InDetRecStatisticsAlg::m_TrackTruthCollection_keys
SG::ReadHandleKeyArray< TrackTruthCollection > m_TrackTruthCollection_keys
Definition: InDetRecStatisticsAlg.h:139
InDet::InDetRecStatisticsAlg::m_minEtaFORWARD
float m_minEtaFORWARD
Definition: InDetRecStatisticsAlg.h:136
InDet::InDetRecStatisticsAlg::m_doTruth
bool m_doTruth
Use truth information.
Definition: InDetRecStatisticsAlg.h:135
InDet::InDetRecStatisticsAlg::m_isUnbiased
std::atomic< int > m_isUnbiased
if can get unbiased residuals
Definition: InDetRecStatisticsAlg.h:143
InDet::InDetRecStatisticsAlg::m_maxZStartPrimary
float m_maxZStartPrimary
Maximum Z of start vertex to be considered primary.
Definition: InDetRecStatisticsAlg.h:128
InDet::InDetRecStatisticsAlg::m_fakeTrackCut
float m_fakeTrackCut
Maximum probability for which a track will be considered a fake.
Definition: InDetRecStatisticsAlg.h:122
InDet::InDetRecStatisticsAlg::m_maxEtaBarrel
float m_maxEtaBarrel
define max eta of barrel region
Definition: InDetRecStatisticsAlg.h:119
InDet::InDetRecStatisticsAlg::InDetRecStatisticsAlg
InDetRecStatisticsAlg(const std::string &name, ISvcLocator *pSvcLocator)
Default Constructor.
Definition: InDetRecStatisticsAlg.cxx:72
ITrackSelectorTool.h
test_pyathena.counter
counter
Definition: test_pyathena.py:15
PixelID
Definition: PixelID.h:67
InDet::InDetRecStatisticsAlg::Counter
Definition: InDetRecStatisticsAlg.h:78
InDet::InDetRecStatisticsAlg::kN_unknown_hits
@ kN_unknown_hits
number of hits without track
Definition: InDetRecStatisticsAlg.h:149
InDet::InDetRecStatisticsAlg::m_RecTrackCollection_keys
SG::ReadHandleKeyArray< TrackCollection > m_RecTrackCollection_keys
Definition: InDetRecStatisticsAlg.h:138
InDet::InDetRecStatisticsAlg::getUnbiasedTrackParameters
const Trk::TrackParameters * getUnbiasedTrackParameters(const Trk::TrackParameters *, const Trk::MeasurementBase *)
Get Unbiased Track Parameters.
Definition: InDetRecStatisticsAlg.cxx:778
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:130
InDet::InDetRecStatisticsAlg::kN_spacepoints_processed
@ kN_spacepoints_processed
number of space points processed
Definition: InDetRecStatisticsAlg.h:152
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:501
GenParticle
@ GenParticle
Definition: TruthClasses.h:30
Identifier
Definition: IdentifierFieldParser.cxx:14