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) { return value().at(idx);}
174  auto begin() const {return value().end(); }
175  auto end() const {return value().end(); }
176 
177  // Delegate operator() to the value
178  template <class... Args>
179  decltype( std::declval<Base>()( std::declval<Args&&>()... ) ) operator()( Args&&... args ) const
180  noexcept( noexcept( std::declval<Base>()( std::declval<Args&&>()... ) ) ) {
181  return value()( std::forward<Args>( args )... );
182  }
183  };
184 
185  template <class Base>
186  using Property = std::conditional< TrackFindingValidationDetailedStat, Gaudi::Property<Base>, DummyProperty<Base> >::type;
187 
189  {this, "StatisticEtaBins", {-4, -2.6, -2, 0, 2., 2.6, 4}, "Gather statistics separately for these eta bins."};
191  {this, "StatisticPtBins", {1.e3,2.5e3,10e3, 100e3}, "Gather statistics separately for these pt bins."};
193  {this, "PdgIdCategorisation", false, "Categorise by pdg id."};
195  {this, "ShowRawCounts", false, "Show all counters."};
197  {this, "ShowDetailedTables", false, "Show more details; stat. uncert., RMS, entries"};
199  {this, "ComputeTrackRecoEfficiency", true, "Compute and print track reconstruction efficiency."};
200 
201  ToolHandle<IAthSelectionTool> m_truthSelectionTool{this, "TruthSelectionTool","AthTruthSelectionTool", "Truth selection tool (for efficiencies and resolutions)"};
202 
203 
204  // helper struct for compile time optional statistics
205  template <bool IsDebug>
206  struct DebugCounter {
207  struct Empty {
208  template <typename... T_Args>
209  Empty(T_Args... ) {}
210  };
211  mutable typename std::conditional<IsDebug,
212  std::mutex,
213  Empty>::type m_mutex ATLAS_THREAD_SAFE;
214  mutable typename std::conditional<IsDebug,
216  Empty>::type m_measPerTruthParticleWithoutCounts ATLAS_THREAD_SAFE {20,-.5,20.-.5};
217  mutable typename std::conditional<IsDebug,
219  Empty>::type m_bestMatchProb ATLAS_THREAD_SAFE {20,0.,1.};
220  mutable typename std::conditional<IsDebug,
222  Empty>::type m_nextToBestMatchProb ATLAS_THREAD_SAFE {20,0.,1.};
223 
224  template <class T_OutStream>
225  void dumpStatistics(T_OutStream &out) const;
226  void fillMeasForTruthParticleWithoutCount(double weighted_measurement_sum) const;
227  void fillTruthMatchProb(const std::array<float,2> &best_match_prob) const;
228  };
230 
231  // s_NMeasurementTypes is equal to the number of UncalibMeasType, but we have to remove the "Other" option, which
232  // corresponds to an unknown type
233  constexpr static unsigned int s_NMeasurementTypes = static_cast<unsigned int>(xAOD::UncalibMeasType::nTypes) - 1u;
234 
235  // statistics counter
236  enum ECounter {
243  kNCounter
244  };
245 
252  };
258  };
259 
260  constexpr static int s_pdgIdMax = 1000000000; // categorise all truth particles with this or larger PDG ID as "Other"
261 
262 
263  bool m_useAbsEtaForStat = false;
264 
265  template <bool DetailEnabled>
266  struct BaseStat {
267  BaseStat() = default;
268  BaseStat([[maybe_unused]] const IAthSelectionTool &truth_selection_tool,
269  [[maybe_unused]] std::size_t per_eta_size,
270  [[maybe_unused]] std::size_t per_pdg_size)
271  : m_truthSelectionCuts(truth_selection_tool.nCuts()+1, -0.5,truth_selection_tool.nCuts()+.5)
272  {
273  if constexpr(DetailEnabled) {
274  m_counterPerEta.resize(per_eta_size);
275  m_counterPerPdgId.resize( per_pdg_size);
276  m_statPerEta.resize( per_eta_size );
277  m_statPerPdgId.resize( per_pdg_size );
278  }
279 
280  }
281  void reset(const IAthSelectionTool &truth_selection_tool,
282  [[maybe_unused]] std::size_t per_eta_size,
283  [[maybe_unused]] std::size_t per_pdg_size)
284  {
285  m_truthSelectionCuts.setBinning(truth_selection_tool.nCuts()+1, -0.5,truth_selection_tool.nCuts()+.5);
286  if constexpr(DetailEnabled) {
287  m_counterPerEta.clear();
288  m_counterPerPdgId.clear();
289  m_statPerEta.clear();
290  m_statPerPdgId.clear();
291  m_counterPerEta.resize(per_eta_size);
292  m_counterPerPdgId.resize( per_pdg_size);
293  m_statPerEta.resize( per_eta_size );
294  m_statPerPdgId.resize( per_pdg_size );
295  }
296  }
297  void fill([[maybe_unused]] unsigned int eta_category_i,
298  [[maybe_unused]] unsigned int pdg_id_category_i,
299  [[maybe_unused]] float hit_efficiency,
300  [[maybe_unused]] float hit_purity,
301  [[maybe_unused]] float match_prob) {
302  if (DetailEnabled) {
303  assert( eta_category_i <m_statPerEta.size());
304  m_statPerEta[eta_category_i][kHitEfficiency].add( hit_efficiency);
305  m_statPerEta[eta_category_i][kHitPurity].add( hit_purity);
306  m_statPerEta[eta_category_i][kMatchProbability].add( match_prob);
307  assert( pdg_id_category_i <m_statPerPdgId.size());
308  m_statPerPdgId[pdg_id_category_i][kHitEfficiency].add( hit_efficiency);
309  m_statPerPdgId[pdg_id_category_i][kHitPurity].add( hit_purity);
310  m_statPerPdgId[pdg_id_category_i][kMatchProbability].add( match_prob);
311  assert( eta_category_i < m_counterPerEta.size());
312  assert( pdg_id_category_i <m_counterPerPdgId.size());
313  ++m_counterPerEta[eta_category_i][kNTotalTracks];
314  ++m_counterPerPdgId[pdg_id_category_i][kNTotalTracks];
315  }
316  }
317  void incrementTotal([[maybe_unused]] unsigned int eta_category_i,
318  [[maybe_unused]] unsigned int pdg_id_category_i) {
319  if constexpr(DetailEnabled) {
320  ++m_counterPerEta[eta_category_i][kNTotalParticles];
321  ++m_counterPerPdgId[pdg_id_category_i][kNTotalParticles];
322  }
323  }
324 
326 
328  const std::vector<float> &statPtBins,
329  const std::vector<float> &statEtaBins,
330  std::vector< int > &pdgId,
331  bool printDetails,
332  bool pdgIdCategorisation,
333  bool useAbsEtaForStat);
334 
335 
336  std::size_t perEtaSize() const {
337  if constexpr(DetailEnabled) { return m_counterPerEta.size(); }
338  else { return 0u; }
339  }
340  std::size_t perPdgIdSize() const {
341  if constexpr(DetailEnabled) { return m_counterPerPdgId.size(); }
342  else { return 0u; }
343  }
345  // per event statistics
346  struct Empty {};
347  using CounterArrayVec = std::conditional< DetailEnabled,
348  std::vector< std::array< std::size_t, kNCategorisedCounter> >,
349  Empty >::type;
350  using StatArrayVec = std::conditional< DetailEnabled,
351  std::vector< std::array<ActsUtils::Stat, kNCategorisedStat> >,
352  Empty >::type;
357 
358  };
359 
360 
361  mutable std::mutex m_statMutex ATLAS_THREAD_SAFE;
362  mutable std::array< std::size_t, kNCounter > m_counter ATLAS_THREAD_SAFE {};
363  mutable std::vector< int > m_pdgId ATLAS_THREAD_SAFE;
365 
368  void checkBinOrder( const std::vector<float> &bin_edges, const std::string &bin_label) const;
369 
374  std::size_t getPtEtaStatCategory(float pt, float eta) const;
375 
380  std::size_t getPtPdgIdStatCategory(float pt, int pdg_id) const;
381  void initStatTables();
382  void printStatTables() const;
383  void printCategories(const std::vector<std::string> &pt_category_labels,
384  const std::vector<std::string> &eta_category_labels,
385  std::vector<std::string> &counter_labels,
386  std::vector< std::array< ActsUtils::Stat, kNCategorisedStat> > &stat_per_category,
387  std::vector< std::array< std::size_t, kNCategorisedCounter> > &counts_per_category,
388  const std::string &top_left_label,
389  bool print_sub_categories) const;
390  void printData2D(const std::vector<std::string> &row_category_labels,
391  const std::vector<std::string> &col_category_labels,
392  const std::string &top_left_label,
393  std::vector< std::array< ActsUtils::Stat, kNCategorisedStat> > &stat_per_category,
394  std::vector< std::array< std::size_t, kNCategorisedCounter> > &counts_per_category,
395  bool rotate) const;
396 
398 
399  static double weightedCountSum(const ActsTrk::HitCounterArray &counts,
400  const std::vector<float> &weights);
401  static double noiseCorrection(const ActsTrk::HitCounterArray &noise_counts,
402  const std::vector<float> &weights);
403 
404  };
405 
406 } // namespace
407 
408 #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:249
ActsTrk::TrackTruthMatchingBaseAlg::BaseStat::perEtaSize
std::size_t perEtaSize() const
Definition: TrackTruthMatchingBaseAlg.h:336
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:297
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:237
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:363
ActsTrk::TrackTruthMatchingBaseAlg::BaseStat::BaseStat
BaseStat()=default
ActsTrk::TrackTruthMatchingBaseAlg::BaseStat::operator+=
BaseStat< DetailEnabled > & operator+=(const BaseStat< DetailEnabled > &event_stat)
Definition: TrackTruthMatchingBaseAlg.cxx:440
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
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:254
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:197
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::DummyProperty::end
auto end() const
Definition: TrackTruthMatchingBaseAlg.h:175
ActsTrk::TrackTruthMatchingBaseAlg::kMatchProbability
@ kMatchProbability
Definition: TrackTruthMatchingBaseAlg.h:256
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:562
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:352
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:83
PowhegPy8EG_H2a.pdgId
dictionary pdgId
Definition: PowhegPy8EG_H2a.py:128
ActsTrk::TrackTruthMatchingBaseAlg::BaseStat::m_truthSelectionCuts
ActsUtils::StatHist m_truthSelectionCuts
Definition: TrackTruthMatchingBaseAlg.h:344
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:207
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:269
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:240
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:189
ActsTrk::TrackTruthMatchingBaseAlg::printStatTables
void printStatTables() const
Definition: TrackTruthMatchingBaseAlg.cxx:548
ActsTrk::TrackTruthMatchingBaseAlg::s_NMeasurementTypes
constexpr static unsigned int s_NMeasurementTypes
Definition: TrackTruthMatchingBaseAlg.h:233
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:246
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:281
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ActsTrk::TrackTruthMatchingBaseAlg::BaseStat::Empty
Definition: TrackTruthMatchingBaseAlg.h:346
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:41
ActsTrk::TrackTruthMatchingBaseAlg::EventStatBase::m_truthParticlesWithAssociatedTrack
TruthParticleSet m_truthParticlesWithAssociatedTrack
Definition: TrackTruthMatchingBaseAlg.h:120
ActsTrk::TrackTruthMatchingBaseAlg::NTruthWithCountsTotal
@ NTruthWithCountsTotal
Definition: TrackTruthMatchingBaseAlg.h:238
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:242
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:354
ActsTrk::TrackTruthMatchingBaseAlg::m_statPtBins
Property< std::vector< float > > m_statPtBins
Definition: TrackTruthMatchingBaseAlg.h:191
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:255
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
ActsTrk::TrackTruthMatchingBaseAlg::DummyProperty::begin
auto begin() const
Definition: TrackTruthMatchingBaseAlg.h:174
AthReentrantAlgorithm.h
ActsTrk::TrackTruthMatchingBaseAlg::DebugCounter::Empty::Empty
Empty(T_Args...)
Definition: TrackTruthMatchingBaseAlg.h:209
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:195
ActsTrk::TrackTruthMatchingBaseAlg::m_computeTrackRecoEfficiency
Property< bool > m_computeTrackRecoEfficiency
Definition: TrackTruthMatchingBaseAlg.h:199
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
ActsTrk::TrackTruthMatchingBaseAlg::kNCategorisedCounter
@ kNCategorisedCounter
Definition: TrackTruthMatchingBaseAlg.h:251
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:250
ActsTrk::TruthParticleHitCounts
std::unordered_map< const xAOD::TruthParticle *, HitCounterArray > TruthParticleHitCounts
Definition: TruthParticleHitCounts.h:19
ActsTrk::TrackTruthMatchingBaseAlg::kNCounter
@ kNCounter
Definition: TrackTruthMatchingBaseAlg.h:243
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:248
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:260
IAthSelectionTool
IAthSelectionTool is a virtual baseclass for selection methods.
Definition: IAthSelectionTool.h:27
ActsTrk::TrackTruthMatchingBaseAlg::BaseStat::m_statPerPdgId
StatArrayVec m_statPerPdgId
Definition: TrackTruthMatchingBaseAlg.h:356
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:201
ActsTrk::TrackTruthMatchingBaseAlg::m_showRawCounts
Property< bool > m_showRawCounts
Definition: TrackTruthMatchingBaseAlg.h:195
ActsTrk::TrackTruthMatchingBaseAlg::MissingTruthParticleHitCounts
@ MissingTruthParticleHitCounts
Definition: TrackTruthMatchingBaseAlg.h:239
ActsTrk::TrackTruthMatchingBaseAlg::kNTotalParticles
@ kNTotalParticles
Definition: TrackTruthMatchingBaseAlg.h:247
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:340
ActsTrk::TrackTruthMatchingBaseAlg::DummyProperty::value
Base value() const
Definition: TrackTruthMatchingBaseAlg.h:167
ActsTrk::TrackTruthMatchingBaseAlg::ECounter
ECounter
Definition: TrackTruthMatchingBaseAlg.h:236
ActsTrk::TrackTruthMatchingBaseAlg::BaseStat
Definition: TrackTruthMatchingBaseAlg.h:47
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
ActsTrk::TrackTruthMatchingBaseAlg::kNCategorisedStat
@ kNCategorisedStat
Definition: TrackTruthMatchingBaseAlg.h:257
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:34
ActsTrk::TrackTruthMatchingBaseAlg::DebugCounter
Definition: TrackTruthMatchingBaseAlg.h:206
ActsTrk::TrackTruthMatchingBaseAlg::BaseStat< TrackFindingValidationDetailedStat >::CounterArrayVec
std::conditional< DetailEnabled, std::vector< std::array< std::size_t, kNCategorisedCounter > >, Empty >::type CounterArrayVec
Definition: TrackTruthMatchingBaseAlg.h:349
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:361
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:229
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:253
ActsTrk::TrackTruthMatchingBaseAlg::BaseStat::m_counterPerEta
CounterArrayVec m_counterPerEta
Definition: TrackTruthMatchingBaseAlg.h:353
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:355
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:268
ActsTrk::TrackTruthMatchingBaseAlg::DummyProperty::operator[]
auto operator[](std::size_t idx)
Definition: TrackTruthMatchingBaseAlg.h:173
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:241
ActsTrk::TrackTruthMatchingBaseAlg::ATLAS_THREAD_SAFE
BaseStat< TrackFindingValidationDetailedStat > m_detailedStat ATLAS_THREAD_SAFE
Definition: TrackTruthMatchingBaseAlg.h:364
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:213
ActsTrk::TrackTruthMatchingBaseAlg::getTruthParticleHitCounts
const TruthParticleHitCounts & getTruthParticleHitCounts(const EventContext &ctx) const
Definition: TrackTruthMatchingBaseAlg.h:60
ActsTrk::TrackTruthMatchingBaseAlg::m_useAbsEtaForStat
bool m_useAbsEtaForStat
Definition: TrackTruthMatchingBaseAlg.h:263
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:317
ActsTrk::TrackTruthMatchingBaseAlg::perPdgIdSize
std::size_t perPdgIdSize() const
Definition: TrackTruthMatchingBaseAlg.h:74
ActsTrk::TrackTruthMatchingBaseAlg::m_pdgIdCategorisation
Property< bool > m_pdgIdCategorisation
Definition: TrackTruthMatchingBaseAlg.h:193
ActsTrk::TrackTruthMatchingBaseAlg::DummyProperty::size
std::size_t size() const
Definition: TrackTruthMatchingBaseAlg.h:171
ActsTrk::TrackTruthMatchingBaseAlg::finalize
virtual StatusCode finalize() override
Definition: TrackTruthMatchingBaseAlg.cxx:173