ATLAS Offline Software
TrackTruthMatchingBaseAlg.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ACTSTRK_TRACKTRUTHMATCHINGBASEALG_H
6 #define ACTSTRK_TRACKTRUTHMATCHINGBASEALG_H 1
7 
8 // Base Class
10 
11 // Gaudi includes
12 #include "Gaudi/Property.h"
13 
14 // Handle Keys
17 
22 
23 #include <mutex>
24 #include "ActsInterop/StatUtils.h"
25 #include "ActsInterop/TableUtils.h"
26 
27 #include <string>
28 #include <memory>
29 #include <array>
30 #include <atomic>
31 #include <type_traits>
32 
33 #include <cmath>
34 #include <iomanip>
35 #include <ostream>
36 #include <sstream>
37 #include <vector>
38 
39 namespace ActsTrk
40 {
41  constexpr bool TrackFindingValidationDebugHists = false;
42  constexpr bool TrackFindingValidationDetailedStat = true;
43 
45  {
46  template <bool DetailEnabled>
47  struct BaseStat;
48 
49  template <bool DetailEnabled>
50  friend struct BaseStat;
51 
52  public:
53  TrackTruthMatchingBaseAlg(const std::string &name,
54  ISvcLocator *pSvcLocator);
55 
56  virtual StatusCode initialize() override;
57  virtual StatusCode finalize() override;
58 
59  protected:
60  const TruthParticleHitCounts &getTruthParticleHitCounts(const EventContext &ctx) const {
61  SG::ReadHandle<TruthParticleHitCounts> truth_particle_hit_counts_handle = SG::makeHandle(m_truthHitCounts, ctx);
62  if (!truth_particle_hit_counts_handle.isValid()) {
63  ATH_MSG_ERROR("No truth particle hit count map for key " << m_truthHitCounts.key() );
64  std::runtime_error("Failed to get truth particle hit count map");
65  }
66  return *truth_particle_hit_counts_handle;
67  }
68 
70 
71  std::size_t perEtaSize() const {
72  return m_detailedStat.perEtaSize();
73  }
74  std::size_t perPdgIdSize() const {
75  return m_detailedStat.perPdgIdSize();
76  }
77 
78  template <bool DetailEnabled>
79  struct EventStatBase : public BaseStat<DetailEnabled> {
80  static constexpr bool doDetail = DetailEnabled;
81 
82  EventStatBase(const IAthSelectionTool &truth_selection_tool,
83  std::size_t per_eta_size,
84  std::size_t per_pdg_size,
85  [[maybe_unused]] std::size_t track_to_truth_size)
86  : BaseStat<DetailEnabled>(truth_selection_tool, per_eta_size, per_pdg_size),
87  m_nTruthCuts(truth_selection_tool.nCuts())
88  {
89  if constexpr(DetailEnabled) {
90  m_truthParticlesWithAssociatedTrack.reserve(track_to_truth_size);
91  }
92 
93  };
94  void fill([[maybe_unused]] unsigned int eta_category_i,
95  [[maybe_unused]] unsigned int pdg_id_category_i,
96  [[maybe_unused]] float hit_efficiency,
97  [[maybe_unused]] float hit_purity,
98  [[maybe_unused]] float match_prob,
99  [[maybe_unused]] const xAOD::TruthParticle *best_match) {
100  BaseStat<DetailEnabled>::fill(eta_category_i,
101  pdg_id_category_i,
102  hit_efficiency,
103  hit_purity,
104  match_prob);
105  if constexpr(DetailEnabled) {
106  if (!m_truthParticlesWithAssociatedTrack.insert(best_match).second) {
107  // truth particle already had a best match
109  ++this->m_counterPerPdgId[pdg_id_category_i][kNParticleWithMultipleAssociatedTracks];
110  }
111  else {
112  ++this->m_counterPerEta[eta_category_i][kNParticleWithAssociatedTrack];
113  ++this->m_counterPerPdgId[pdg_id_category_i][kNParticleWithAssociatedTrack];
114  }
115  }
116  }
117  using TruthParticleSet = std::conditional< DetailEnabled,
118  std::unordered_set<const xAOD::TruthParticle *>,
121 
126 
127  unsigned int m_nTruthCuts;
128  };
130 
136  float m_hitPurity;
138  };
143  analyseTrackTruth(const TruthParticleHitCounts &truth_particle_hit_counts,
144  const HitCountsPerTrack &track_hit_counts,
145  EventStat &event_stat) const;
146 
147  void postProcessEventStat(const TruthParticleHitCounts &truth_particle_hit_counts,
148  std::size_t n_tracks,
149  EventStat &event_stat) const;
150 
151  private:
153  {this, "TruthParticleHitCounts","", "Map from truth particle to hit counts." };
154 
155  Gaudi::Property<std::vector<float> > m_weightsForProb
156  {this, "MatchWeights", {}, "Weights applied to the counts per measurement type for weighted sums"
157  " which are used compute the match probability." };
158  Gaudi::Property<std::vector<float> > m_weights
159  {this, "CountWeights", {}, "Weights applied to the counts per measurement type for weighted sums"
160  " which are used to compute hit efficiencies and purities." };
161 
162  // Empty struct emulating the interface of a Gaudi property to replace optional properties if disabled.
163  template <class Base>
164  struct DummyProperty {
165  template <class OWNER>
166  DummyProperty( OWNER*, std::string, Base&&, std::string ) {}
167  Base value() const { return Base{}; }
168  operator Base() const { return Base{}; }
169 
170  // some dummy implementations for vector properties:
171  std::size_t size() const {return 0u; }
172  bool empty() const {return true; }
173  auto operator[](std::size_t /*idx*/) { throw std::out_of_range("DummyProperty");}
174 
175  // Delegate operator() to the value
176  template <class... Args>
177  decltype( std::declval<Base>()( std::declval<Args&&>()... ) ) operator()( Args&&... args ) const
178  noexcept( noexcept( std::declval<Base>()( std::declval<Args&&>()... ) ) ) {
179  return value()( std::forward<Args>( args )... );
180  }
181  };
182 
183  template <class Base>
184  using Property = std::conditional< TrackFindingValidationDetailedStat, Gaudi::Property<Base>, DummyProperty<Base> >::type;
185 
187  {this, "StatisticEtaBins", {-4, -2.6, -2, 0, 2., 2.6, 4}, "Gather statistics separately for these eta bins."};
189  {this, "StatisticPtBins", {1.e3,2.5e3,10e3, 100e3}, "Gather statistics separately for these pt bins."};
191  {this, "PdgIdCategorisation", false, "Categorise by pdg id."};
193  {this, "ShowRawCounts", false, "Show all counters."};
195  {this, "ShowDetailedTables", false, "Show more details; stat. uncert., RMS, entries"};
197  {this, "ComputeTrackRecoEfficiency", true, "Compute and print track reconstruction efficiency."};
198 
199  ToolHandle<IAthSelectionTool> m_truthSelectionTool{this, "TruthSelectionTool","AthTruthSelectionTool", "Truth selection tool (for efficiencies and resolutions)"};
200 
201 
202  // helper struct for compile time optional statistics
203  template <bool IsDebug>
204  struct DebugCounter {
205  struct Empty {
206  template <typename... T_Args>
207  Empty(T_Args... ) {}
208  };
209  mutable typename std::conditional<IsDebug,
210  std::mutex,
211  Empty>::type m_mutex ATLAS_THREAD_SAFE;
212  mutable typename std::conditional<IsDebug,
214  Empty>::type m_measPerTruthParticleWithoutCounts ATLAS_THREAD_SAFE {20,-.5,20.-.5};
215  mutable typename std::conditional<IsDebug,
217  Empty>::type m_bestMatchProb ATLAS_THREAD_SAFE {20,0.,1.};
218  mutable typename std::conditional<IsDebug,
220  Empty>::type m_nextToBestMatchProb ATLAS_THREAD_SAFE {20,0.,1.};
221 
222  template <class T_OutStream>
223  void dumpStatistics(T_OutStream &out) const;
224  void fillMeasForTruthParticleWithoutCount(double weighted_measurement_sum) const;
225  void fillTruthMatchProb(const std::array<float,2> &best_match_prob) const;
226  };
228 
229  // s_NMeasurementTypes is equal to the number of UncalibMeasType, but we have to remove the "Other" option, which
230  // corresponds to an unknown type
231  constexpr static unsigned int s_NMeasurementTypes = static_cast<unsigned int>(xAOD::UncalibMeasType::nTypes) - 1u;
232 
233  // statistics counter
234  enum ECounter {
241  kNCounter
242  };
243 
250  };
256  };
257 
258  constexpr static int s_pdgIdMax = 1000000000; // categorise all truth particles with this or larger PDG ID as "Other"
259 
260 
261  bool m_useAbsEtaForStat = false;
262 
263  template <bool DetailEnabled>
264  struct BaseStat {
265  BaseStat() = default;
266  BaseStat([[maybe_unused]] const IAthSelectionTool &truth_selection_tool,
267  [[maybe_unused]] std::size_t per_eta_size,
268  [[maybe_unused]] std::size_t per_pdg_size)
269  : m_truthSelectionCuts(truth_selection_tool.nCuts()+1, -0.5,truth_selection_tool.nCuts()+.5)
270  {
271  if constexpr(DetailEnabled) {
272  m_counterPerEta.resize(per_eta_size);
273  m_counterPerPdgId.resize( per_pdg_size);
274  m_statPerEta.resize( per_eta_size );
275  m_statPerPdgId.resize( per_pdg_size );
276  }
277 
278  }
279  void reset(const IAthSelectionTool &truth_selection_tool,
280  [[maybe_unused]] std::size_t per_eta_size,
281  [[maybe_unused]] std::size_t per_pdg_size)
282  {
283  m_truthSelectionCuts.setBinning(truth_selection_tool.nCuts()+1, -0.5,truth_selection_tool.nCuts()+.5);
284  if constexpr(DetailEnabled) {
285  m_counterPerEta.clear();
286  m_counterPerPdgId.clear();
287  m_statPerEta.clear();
288  m_statPerPdgId.clear();
289  m_counterPerEta.resize(per_eta_size);
290  m_counterPerPdgId.resize( per_pdg_size);
291  m_statPerEta.resize( per_eta_size );
292  m_statPerPdgId.resize( per_pdg_size );
293  }
294  }
295  void fill([[maybe_unused]] unsigned int eta_category_i,
296  [[maybe_unused]] unsigned int pdg_id_category_i,
297  [[maybe_unused]] float hit_efficiency,
298  [[maybe_unused]] float hit_purity,
299  [[maybe_unused]] float match_prob) {
300  if (DetailEnabled) {
301  assert( eta_category_i <m_statPerEta.size());
302  m_statPerEta[eta_category_i][kHitEfficiency].add( hit_efficiency);
303  m_statPerEta[eta_category_i][kHitPurity].add( hit_purity);
304  m_statPerEta[eta_category_i][kMatchProbability].add( match_prob);
305  assert( pdg_id_category_i <m_statPerPdgId.size());
306  m_statPerPdgId[pdg_id_category_i][kHitEfficiency].add( hit_efficiency);
307  m_statPerPdgId[pdg_id_category_i][kHitPurity].add( hit_purity);
308  m_statPerPdgId[pdg_id_category_i][kMatchProbability].add( match_prob);
309  assert( eta_category_i < m_counterPerEta.size());
310  assert( pdg_id_category_i <m_counterPerPdgId.size());
311  ++m_counterPerEta[eta_category_i][kNTotalTracks];
312  ++m_counterPerPdgId[pdg_id_category_i][kNTotalTracks];
313  }
314  }
315  void incrementTotal([[maybe_unused]] unsigned int eta_category_i,
316  [[maybe_unused]] unsigned int pdg_id_category_i) {
317  if constexpr(DetailEnabled) {
318  ++m_counterPerEta[eta_category_i][kNTotalParticles];
319  ++m_counterPerPdgId[pdg_id_category_i][kNTotalParticles];
320  }
321  }
322 
324 
326  const std::vector<float> &statPtBins,
327  const std::vector<float> &statEtaBins,
328  std::vector< int > &pdgId,
329  bool printDetails,
330  bool pdgIdCategorisation,
331  bool useAbsEtaForStat);
332 
333 
334  std::size_t perEtaSize() const {
335  if constexpr(DetailEnabled) { return m_counterPerEta.size(); }
336  else { return 0u; }
337  }
338  std::size_t perPdgIdSize() const {
339  if constexpr(DetailEnabled) { return m_counterPerPdgId.size(); }
340  else { return 0u; }
341  }
343  // per event statistics
344  struct Empty {};
345  using CounterArrayVec = std::conditional< DetailEnabled,
346  std::vector< std::array< std::size_t, kNCategorisedCounter> >,
347  Empty >::type;
348  using StatArrayVec = std::conditional< DetailEnabled,
349  std::vector< std::array<ActsUtils::Stat, kNCategorisedStat> >,
350  Empty >::type;
355 
356  };
357 
358 
359  mutable std::mutex m_statMutex ATLAS_THREAD_SAFE;
360  mutable std::array< std::size_t, kNCounter > m_counter ATLAS_THREAD_SAFE {};
361  mutable std::vector< int > m_pdgId ATLAS_THREAD_SAFE;
363 
366  void checkBinOrder( const std::vector<float> &bin_edges, const std::string &bin_label) const;
367 
372  std::size_t getPtEtaStatCategory(float pt, float eta) const;
373 
378  std::size_t getPtPdgIdStatCategory(float pt, int pdg_id) const;
379  void initStatTables();
380  void printStatTables() const;
381  void printCategories(const std::vector<std::string> &pt_category_labels,
382  const std::vector<std::string> &eta_category_labels,
383  std::vector<std::string> &counter_labels,
384  std::vector< std::array< ActsUtils::Stat, kNCategorisedStat> > &stat_per_category,
385  std::vector< std::array< std::size_t, kNCategorisedCounter> > &counts_per_category,
386  const std::string &top_left_label,
387  bool print_sub_categories) const;
388  void printData2D(const std::vector<std::string> &row_category_labels,
389  const std::vector<std::string> &col_category_labels,
390  const std::string &top_left_label,
391  std::vector< std::array< ActsUtils::Stat, kNCategorisedStat> > &stat_per_category,
392  std::vector< std::array< std::size_t, kNCategorisedCounter> > &counts_per_category,
393  bool rotate) const;
394 
396 
397  static double weightedCountSum(const ActsTrk::HitCounterArray &counts,
398  const std::vector<float> &weights);
399  static double noiseCorrection(const ActsTrk::HitCounterArray &noise_counts,
400  const std::vector<float> &weights);
401 
402  };
403 
404 } // namespace
405 
406 #endif
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
ActsTrk::TrackTruthMatchingBaseAlg::postProcessEventStat
void postProcessEventStat(const TruthParticleHitCounts &truth_particle_hit_counts, std::size_t n_tracks, EventStat &event_stat) const
Definition: TrackTruthMatchingBaseAlg.cxx:331
ActsTrk::TrackTruthMatchingBaseAlg::EventStatBase::m_nTruthCuts
unsigned int m_nTruthCuts
Definition: TrackTruthMatchingBaseAlg.h:127
ActsTrk::TrackTruthMatchingBaseAlg::kNParticleWithMultipleAssociatedTracks
@ kNParticleWithMultipleAssociatedTracks
Definition: TrackTruthMatchingBaseAlg.h:247
ActsTrk::TrackTruthMatchingBaseAlg::BaseStat::perEtaSize
std::size_t perEtaSize() const
Definition: TrackTruthMatchingBaseAlg.h:334
ActsTrk::TrackTruthMatchingBaseAlg::BaseStat::fill
void fill([[maybe_unused]] unsigned int eta_category_i, [[maybe_unused]] unsigned int pdg_id_category_i, [[maybe_unused]] float hit_efficiency, [[maybe_unused]] float hit_purity, [[maybe_unused]] float match_prob)
Definition: TrackTruthMatchingBaseAlg.h:295
ActsTrk::TrackTruthMatchingBaseAlg::TruthMatchResult
Match result returned by analyseTrackTruth.
Definition: TrackTruthMatchingBaseAlg.h:133
rotate
void rotate(double angler, GeoTrf::Vector2D &vector)
Definition: TRTDetectorFactory_Full.cxx:63
createSimpleDistributions.IsDebug
bool IsDebug
Definition: createSimpleDistributions.py:12
ActsTrk::TrackTruthMatchingBaseAlg::m_weightsForProb
Gaudi::Property< std::vector< float > > m_weightsForProb
Definition: TrackTruthMatchingBaseAlg.h:156
ActsTrk::TrackTruthMatchingBaseAlg::NTracksTotal
@ NTracksTotal
Definition: TrackTruthMatchingBaseAlg.h:235
ActsTrk::HitCountsPerTrack
Container for hit counts per track Contains hit counts per associated truth particle and the total hi...
Definition: TrackToTruthParticleAssociation.h:37
ActsTrk::TrackTruthMatchingBaseAlg::EventStatBase::TruthParticleSet
std::conditional< DetailEnabled, std::unordered_set< const xAOD::TruthParticle * >, typename BaseStat< DetailEnabled >::Empty >::type TruthParticleSet
Definition: TrackTruthMatchingBaseAlg.h:119
ActsTrk::TrackTruthMatchingBaseAlg::ATLAS_THREAD_SAFE
std::vector< int > m_pdgId ATLAS_THREAD_SAFE
Definition: TrackTruthMatchingBaseAlg.h:361
ActsTrk::TrackTruthMatchingBaseAlg::BaseStat::BaseStat
BaseStat()=default
ActsTrk::TrackTruthMatchingBaseAlg::BaseStat::operator+=
BaseStat< DetailEnabled > & operator+=(const BaseStat< DetailEnabled > &event_stat)
Definition: TrackTruthMatchingBaseAlg.cxx:440
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
ActsTrk::TrackTruthMatchingBaseAlg::EventStatBase::m_nTracksWithoutAssociatedTruthParticle
unsigned int m_nTracksWithoutAssociatedTruthParticle
Definition: TrackTruthMatchingBaseAlg.h:123
ActsTrk::TrackTruthMatchingBaseAlg::printData2D
void printData2D(const std::vector< std::string > &row_category_labels, const std::vector< std::string > &col_category_labels, const std::string &top_left_label, std::vector< std::array< ActsUtils::Stat, kNCategorisedStat > > &stat_per_category, std::vector< std::array< std::size_t, kNCategorisedCounter > > &counts_per_category, bool rotate) const
Definition: TrackTruthMatchingBaseAlg.cxx:717
ActsTrk::TrackTruthMatchingBaseAlg::initialize
virtual StatusCode initialize() override
Definition: TrackTruthMatchingBaseAlg.cxx:135
ActsTrk::TrackTruthMatchingBaseAlg::kHitEfficiency
@ kHitEfficiency
Definition: TrackTruthMatchingBaseAlg.h:252
ActsTrk::TrackTruthMatchingBaseAlg::DummyProperty::operator[]
auto operator[](std::size_t)
Definition: TrackTruthMatchingBaseAlg.h:173
IAthSelectionTool::nCuts
virtual unsigned int nCuts() const =0
return the number of cuts.
StatUtils.h
ActsTrk::TrackTruthMatchingBaseAlg::m_printDetails
Property< bool > m_printDetails
Definition: TrackTruthMatchingBaseAlg.h:195
test_pyathena.pt
pt
Definition: test_pyathena.py:11
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
ActsUtils::StatHist
Extend Stat helper by an equidistant binned histogram.
Definition: StatUtils.h:80
ActsTrk::TrackTruthMatchingBaseAlg::kMatchProbability
@ kMatchProbability
Definition: TrackTruthMatchingBaseAlg.h:254
IAthSelectionTool.h
ActsTrk::TrackTruthMatchingBaseAlg::EventStatBase::EventStatBase
EventStatBase(const IAthSelectionTool &truth_selection_tool, std::size_t per_eta_size, std::size_t per_pdg_size, [[maybe_unused]] std::size_t track_to_truth_size)
Definition: TrackTruthMatchingBaseAlg.h:82
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
SG::ReadHandleKey< TruthParticleHitCounts >
Args
Definition: test_lwtnn_fastgraph.cxx:12
ActsTrk::TrackTruthMatchingBaseAlg::BaseStat< TrackFindingValidationDetailedStat >::StatArrayVec
std::conditional< DetailEnabled, std::vector< std::array< ActsUtils::Stat, kNCategorisedStat > >, Empty >::type StatArrayVec
Definition: TrackTruthMatchingBaseAlg.h:350
ActsTrk::TrackTruthMatchingBaseAlg::truthSelectionTool
const IAthSelectionTool & truthSelectionTool() const
Definition: TrackTruthMatchingBaseAlg.h:69
Property
Support class for PropertyMgr.
Definition: Property.h:23
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
ActsTrk::TrackTruthMatchingBaseAlg::BaseStat::m_truthSelectionCuts
ActsUtils::StatHist m_truthSelectionCuts
Definition: TrackTruthMatchingBaseAlg.h:342
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
ActsTrk::TrackTruthMatchingBaseAlg::TruthMatchResult::m_hitEfficiency
float m_hitEfficiency
fraction of hits originting from best match over total best match hits
Definition: TrackTruthMatchingBaseAlg.h:137
ActsTrk::TrackTruthMatchingBaseAlg::DebugCounter::Empty
Definition: TrackTruthMatchingBaseAlg.h:205
ActsTrk::HitCounterArray
Definition: TrackToTruthParticleAssociation.h:25
ActsTrk::TrackTruthMatchingBaseAlg::weightedCountSum
static double weightedCountSum(const ActsTrk::HitCounterArray &counts, const std::vector< float > &weights)
Definition: TrackTruthMatchingBaseAlg.cxx:798
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
ActsTrk::TrackTruthMatchingBaseAlg::getPtPdgIdStatCategory
std::size_t getPtPdgIdStatCategory(float pt, int pdg_id) const
Return the category based on the PDG ID.
Definition: TrackTruthMatchingBaseAlg.cxx:379
ActsTrk::TrackTruthMatchingBaseAlg::DebugCounter::fillTruthMatchProb
void fillTruthMatchProb(const std::array< float, 2 > &best_match_prob) const
Definition: TrackTruthMatchingBaseAlg.cxx:164
ActsTrk::TrackTruthMatchingBaseAlg::NoAssociatedTruthParticle
@ NoAssociatedTruthParticle
Definition: TrackTruthMatchingBaseAlg.h:238
ActsTrk::TrackTruthMatchingBaseAlg::EventStatBase::fill
void fill([[maybe_unused]] unsigned int eta_category_i, [[maybe_unused]] unsigned int pdg_id_category_i, [[maybe_unused]] float hit_efficiency, [[maybe_unused]] float hit_purity, [[maybe_unused]] float match_prob, [[maybe_unused]] const xAOD::TruthParticle *best_match)
Definition: TrackTruthMatchingBaseAlg.h:94
TrackToTruthParticleAssociation.h
ActsTrk::TrackTruthMatchingBaseAlg::EventStatBase::m_nTruthParticleWithoutAssociatedCounts
unsigned int m_nTruthParticleWithoutAssociatedCounts
Definition: TrackTruthMatchingBaseAlg.h:122
ActsTrk::TrackTruthMatchingBaseAlg::m_statEtaBins
Property< std::vector< float > > m_statEtaBins
Definition: TrackTruthMatchingBaseAlg.h:187
ActsTrk::TrackTruthMatchingBaseAlg::printStatTables
void printStatTables() const
Definition: TrackTruthMatchingBaseAlg.cxx:548
ActsTrk::TrackTruthMatchingBaseAlg::s_NMeasurementTypes
constexpr static unsigned int s_NMeasurementTypes
Definition: TrackTruthMatchingBaseAlg.h:231
TruthParticleHitCounts.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
CheckAppliedSFs.e3
e3
Definition: CheckAppliedSFs.py:264
ActsTrk::TrackTruthMatchingBaseAlg::ECategorisedCounter
ECategorisedCounter
Definition: TrackTruthMatchingBaseAlg.h:244
ActsTrk::TrackTruthMatchingBaseAlg::BaseStat::reset
void reset(const IAthSelectionTool &truth_selection_tool, [[maybe_unused]] std::size_t per_eta_size, [[maybe_unused]] std::size_t per_pdg_size)
Definition: TrackTruthMatchingBaseAlg.h:279
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ActsTrk::TrackTruthMatchingBaseAlg::BaseStat::Empty
Definition: TrackTruthMatchingBaseAlg.h:344
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:37
ActsTrk::TrackTruthMatchingBaseAlg::EventStatBase::m_truthParticlesWithAssociatedTrack
TruthParticleSet m_truthParticlesWithAssociatedTrack
Definition: TrackTruthMatchingBaseAlg.h:120
ActsTrk::TrackTruthMatchingBaseAlg::NTruthWithCountsTotal
@ NTruthWithCountsTotal
Definition: TrackTruthMatchingBaseAlg.h:236
ActsTrk::TrackTruthMatchingBaseAlg::getPtEtaStatCategory
std::size_t getPtEtaStatCategory(float pt, float eta) const
Return the category based on the provided eta value.
Definition: TrackTruthMatchingBaseAlg.cxx:368
Base
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ActsTrk::TrackTruthMatchingBaseAlg::TruthParticleNoNoiseMismatch
@ TruthParticleNoNoiseMismatch
Definition: TrackTruthMatchingBaseAlg.h:240
ActsTrk::TrackTruthMatchingBaseAlg::checkBinOrder
void checkBinOrder(const std::vector< float > &bin_edges, const std::string &bin_label) const
check that bins are in increasing order.
Definition: TrackTruthMatchingBaseAlg.cxx:403
ActsTrk::TrackTruthMatchingBaseAlg::BaseStat::m_counterPerPdgId
CounterArrayVec m_counterPerPdgId
Definition: TrackTruthMatchingBaseAlg.h:352
ActsTrk::TrackTruthMatchingBaseAlg::m_statPtBins
Property< std::vector< float > > m_statPtBins
Definition: TrackTruthMatchingBaseAlg.h:189
ActsTrk::TrackTruthMatchingBaseAlg::EventStatBase::m_nTruthParticleNonoiseMismatches
unsigned int m_nTruthParticleNonoiseMismatches
Definition: TrackTruthMatchingBaseAlg.h:125
ActsTrk::TrackTruthMatchingBaseAlg::EventStatBase
Definition: TrackTruthMatchingBaseAlg.h:79
ActsTrk::TrackTruthMatchingBaseAlg::DebugCounter::fillMeasForTruthParticleWithoutCount
void fillMeasForTruthParticleWithoutCount(double weighted_measurement_sum) const
Definition: TrackTruthMatchingBaseAlg.cxx:157
ActsTrk::TrackTruthMatchingBaseAlg::kHitPurity
@ kHitPurity
Definition: TrackTruthMatchingBaseAlg.h:253
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
AthReentrantAlgorithm.h
ActsTrk::TrackTruthMatchingBaseAlg::DebugCounter::Empty::Empty
Empty(T_Args...)
Definition: TrackTruthMatchingBaseAlg.h:207
WriteHandleKey.h
Property holding a SG store/key/clid from which a WriteHandle is made.
xAOD::UncalibMeasType::nTypes
@ nTypes
ActsTrk::TrackTruthMatchingBaseAlg::perEtaSize
std::size_t perEtaSize() const
Definition: TrackTruthMatchingBaseAlg.h:71
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ActsTrk::TrackTruthMatchingBaseAlg::m_computeTrackRecoEfficiency
Property< bool > m_computeTrackRecoEfficiency
Definition: TrackTruthMatchingBaseAlg.h:197
ActsTrk::TrackFindingValidationDebugHists
constexpr bool TrackFindingValidationDebugHists
Definition: TrackTruthMatchingBaseAlg.h:41
ActsTrk::TrackTruthMatchingBaseAlg::TruthMatchResult::m_hitPurity
float m_hitPurity
fraction of hits originting from best match over total reco hits
Definition: TrackTruthMatchingBaseAlg.h:136
weights
Definition: herwig7_interface.h:44
ActsTrk::TrackTruthMatchingBaseAlg::kNCategorisedCounter
@ kNCategorisedCounter
Definition: TrackTruthMatchingBaseAlg.h:249
ActsTrk::TrackTruthMatchingBaseAlg::DummyProperty::DummyProperty
DummyProperty(OWNER *, std::string, Base &&, std::string)
Definition: TrackTruthMatchingBaseAlg.h:166
ActsTrk::TrackTruthMatchingBaseAlg::EventStatBase::m_nTracksWithoutSelectedTruthParticle
unsigned int m_nTracksWithoutSelectedTruthParticle
Definition: TrackTruthMatchingBaseAlg.h:124
ActsTrk::TrackTruthMatchingBaseAlg::checkMatchWeights
StatusCode checkMatchWeights()
Definition: TrackTruthMatchingBaseAlg.cxx:777
ActsTrk::TrackTruthMatchingBaseAlg::initStatTables
void initStatTables()
Definition: TrackTruthMatchingBaseAlg.cxx:417
ActsTrk::TrackTruthMatchingBaseAlg::kNTotalTracks
@ kNTotalTracks
Definition: TrackTruthMatchingBaseAlg.h:248
ActsTrk::TruthParticleHitCounts
std::unordered_map< const xAOD::TruthParticle *, HitCounterArray > TruthParticleHitCounts
Definition: TruthParticleHitCounts.h:19
ActsTrk::TrackTruthMatchingBaseAlg::kNCounter
@ kNCounter
Definition: TrackTruthMatchingBaseAlg.h:241
ActsTrk::TrackTruthMatchingBaseAlg::DummyProperty::empty
bool empty() const
Definition: TrackTruthMatchingBaseAlg.h:172
ActsTrk::TrackTruthMatchingBaseAlg::BaseStat::printStatTables
void printStatTables(const TrackTruthMatchingBaseAlg &parent, const std::vector< float > &statPtBins, const std::vector< float > &statEtaBins, std::vector< int > &pdgId, bool printDetails, bool pdgIdCategorisation, bool useAbsEtaForStat)
Definition: TrackTruthMatchingBaseAlg.cxx:452
ActsTrk::TrackTruthMatchingBaseAlg::kNParticleWithAssociatedTrack
@ kNParticleWithAssociatedTrack
Definition: TrackTruthMatchingBaseAlg.h:246
ActsTrk::TrackTruthMatchingBaseAlg::DummyProperty
Definition: TrackTruthMatchingBaseAlg.h:164
ActsTrk::TrackFindingValidationDetailedStat
constexpr bool TrackFindingValidationDetailedStat
Definition: TrackTruthMatchingBaseAlg.h:42
ActsTrk::TrackTruthMatchingBaseAlg::s_pdgIdMax
constexpr static int s_pdgIdMax
Definition: TrackTruthMatchingBaseAlg.h:258
IAthSelectionTool
IAthSelectionTool is a virtual baseclass for selection methods.
Definition: IAthSelectionTool.h:27
ActsTrk::TrackTruthMatchingBaseAlg::BaseStat::m_statPerPdgId
StatArrayVec m_statPerPdgId
Definition: TrackTruthMatchingBaseAlg.h:354
ActsUtils::StatHist::setBinning
void setBinning(unsigned int n_bins, float xmin, float xmax)
Define histogramm bins and enable histogramming.
Definition: StatUtils.h:98
ActsTrk::TrackTruthMatchingBaseAlg::m_truthSelectionTool
ToolHandle< IAthSelectionTool > m_truthSelectionTool
Definition: TrackTruthMatchingBaseAlg.h:199
ActsTrk::TrackTruthMatchingBaseAlg::m_showRawCounts
Property< bool > m_showRawCounts
Definition: TrackTruthMatchingBaseAlg.h:193
ActsTrk::TrackTruthMatchingBaseAlg::MissingTruthParticleHitCounts
@ MissingTruthParticleHitCounts
Definition: TrackTruthMatchingBaseAlg.h:237
ActsTrk::TrackTruthMatchingBaseAlg::kNTotalParticles
@ kNTotalParticles
Definition: TrackTruthMatchingBaseAlg.h:245
ActsTrk::TrackTruthMatchingBaseAlg::EventStatBase::doDetail
static constexpr bool doDetail
Definition: TrackTruthMatchingBaseAlg.h:80
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
ActsTrk::TrackTruthMatchingBaseAlg::TrackTruthMatchingBaseAlg
TrackTruthMatchingBaseAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TrackTruthMatchingBaseAlg.cxx:129
ActsTrk::TrackTruthMatchingBaseAlg::BaseStat::perPdgIdSize
std::size_t perPdgIdSize() const
Definition: TrackTruthMatchingBaseAlg.h:338
ActsTrk::TrackTruthMatchingBaseAlg::DummyProperty::value
Base value() const
Definition: TrackTruthMatchingBaseAlg.h:167
ActsTrk::TrackTruthMatchingBaseAlg::ECounter
ECounter
Definition: TrackTruthMatchingBaseAlg.h:234
ActsTrk::TrackTruthMatchingBaseAlg::BaseStat
Definition: TrackTruthMatchingBaseAlg.h:47
ActsTrk::TrackTruthMatchingBaseAlg::kNCategorisedStat
@ kNCategorisedStat
Definition: TrackTruthMatchingBaseAlg.h:255
ActsTrk::TrackTruthMatchingBaseAlg::printCategories
void printCategories(const std::vector< std::string > &pt_category_labels, const std::vector< std::string > &eta_category_labels, std::vector< std::string > &counter_labels, std::vector< std::array< ActsUtils::Stat, kNCategorisedStat > > &stat_per_category, std::vector< std::array< std::size_t, kNCategorisedCounter > > &counts_per_category, const std::string &top_left_label, bool print_sub_categories) const
Definition: TrackTruthMatchingBaseAlg.cxx:570
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MuonDetectorBuilderTool.cxx:49
ActsTrk::TrackTruthMatchingBaseAlg::DebugCounter
Definition: TrackTruthMatchingBaseAlg.h:204
ActsTrk::TrackTruthMatchingBaseAlg::BaseStat< TrackFindingValidationDetailedStat >::CounterArrayVec
std::conditional< DetailEnabled, std::vector< std::array< std::size_t, kNCategorisedCounter > >, Empty >::type CounterArrayVec
Definition: TrackTruthMatchingBaseAlg.h:347
ActsTrk::TrackTruthMatchingBaseAlg::m_truthHitCounts
SG::ReadHandleKey< TruthParticleHitCounts > m_truthHitCounts
Definition: TrackTruthMatchingBaseAlg.h:153
ActsTrk::TrackTruthMatchingBaseAlg::ATLAS_THREAD_SAFE
std::mutex m_statMutex ATLAS_THREAD_SAFE
Definition: TrackTruthMatchingBaseAlg.h:359
TableUtils.h
ActsTrk::TrackTruthMatchingBaseAlg::m_weights
Gaudi::Property< std::vector< float > > m_weights
Definition: TrackTruthMatchingBaseAlg.h:159
ActsTrk::TrackTruthMatchingBaseAlg::m_debugCounter
DebugCounter< TrackFindingValidationDebugHists > m_debugCounter
Definition: TrackTruthMatchingBaseAlg.h:227
ActsTrk::TrackTruthMatchingBaseAlg::analyseTrackTruth
TruthMatchResult analyseTrackTruth(const TruthParticleHitCounts &truth_particle_hit_counts, const HitCountsPerTrack &track_hit_counts, EventStat &event_stat) const
Definition: TrackTruthMatchingBaseAlg.cxx:209
ActsTrk::TrackTruthMatchingBaseAlg::noiseCorrection
static double noiseCorrection(const ActsTrk::HitCounterArray &noise_counts, const std::vector< float > &weights)
Definition: TrackTruthMatchingBaseAlg.cxx:808
ActsTrk::TrackTruthMatchingBaseAlg::ECategorisedStat
ECategorisedStat
Definition: TrackTruthMatchingBaseAlg.h:251
ActsTrk::TrackTruthMatchingBaseAlg::BaseStat::m_counterPerEta
CounterArrayVec m_counterPerEta
Definition: TrackTruthMatchingBaseAlg.h:351
ActsTrk::TrackTruthMatchingBaseAlg::DebugCounter::dumpStatistics
void dumpStatistics(T_OutStream &out) const
Definition: TrackTruthMatchingBaseAlg.cxx:145
ActsTrk::TrackTruthMatchingBaseAlg::BaseStat::m_statPerEta
StatArrayVec m_statPerEta
Definition: TrackTruthMatchingBaseAlg.h:353
ActsTrk::TrackTruthMatchingBaseAlg
Definition: TrackTruthMatchingBaseAlg.h:45
ActsTrk::TrackTruthMatchingBaseAlg::BaseStat::BaseStat
BaseStat([[maybe_unused]] const IAthSelectionTool &truth_selection_tool, [[maybe_unused]] std::size_t per_eta_size, [[maybe_unused]] std::size_t per_pdg_size)
Definition: TrackTruthMatchingBaseAlg.h:266
ActsTrk::TrackTruthMatchingBaseAlg::TruthMatchResult::m_matchProbability
float m_matchProbability
the matching probability based on weighted hit sums
Definition: TrackTruthMatchingBaseAlg.h:135
ActsTrk::TrackTruthMatchingBaseAlg::NoSelectedTruthParticle
@ NoSelectedTruthParticle
Definition: TrackTruthMatchingBaseAlg.h:239
ActsTrk::TrackTruthMatchingBaseAlg::ATLAS_THREAD_SAFE
BaseStat< TrackFindingValidationDetailedStat > m_detailedStat ATLAS_THREAD_SAFE
Definition: TrackTruthMatchingBaseAlg.h:362
ActsTrk::TrackTruthMatchingBaseAlg::TruthMatchResult::m_truthParticle
const xAOD::TruthParticle * m_truthParticle
best matching truth particle or nullptr
Definition: TrackTruthMatchingBaseAlg.h:134
ActsTrk::TrackTruthMatchingBaseAlg::DebugCounter::ATLAS_THREAD_SAFE
std::conditional< IsDebug, std::mutex, Empty >::type m_mutex ATLAS_THREAD_SAFE
Definition: TrackTruthMatchingBaseAlg.h:211
ActsTrk::TrackTruthMatchingBaseAlg::getTruthParticleHitCounts
const TruthParticleHitCounts & getTruthParticleHitCounts(const EventContext &ctx) const
Definition: TrackTruthMatchingBaseAlg.h:60
ActsTrk::TrackTruthMatchingBaseAlg::m_useAbsEtaForStat
bool m_useAbsEtaForStat
Definition: TrackTruthMatchingBaseAlg.h:261
IActsTrackingGeometryTool.h
python.CaloScaleNoiseConfig.args
args
Definition: CaloScaleNoiseConfig.py:80
ActsTrk::TrackTruthMatchingBaseAlg::BaseStat::incrementTotal
void incrementTotal([[maybe_unused]] unsigned int eta_category_i, [[maybe_unused]] unsigned int pdg_id_category_i)
Definition: TrackTruthMatchingBaseAlg.h:315
ActsTrk::TrackTruthMatchingBaseAlg::perPdgIdSize
std::size_t perPdgIdSize() const
Definition: TrackTruthMatchingBaseAlg.h:74
ActsTrk::TrackTruthMatchingBaseAlg::m_pdgIdCategorisation
Property< bool > m_pdgIdCategorisation
Definition: TrackTruthMatchingBaseAlg.h:191
ActsTrk::TrackTruthMatchingBaseAlg::DummyProperty::size
std::size_t size() const
Definition: TrackTruthMatchingBaseAlg.h:171
ActsTrk::TrackTruthMatchingBaseAlg::finalize
virtual StatusCode finalize() override
Definition: TrackTruthMatchingBaseAlg.cxx:173