ATLAS Offline Software
ElasticDecayUtil.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ELASTICDECAYUTIL_H
6 #define ELASTICDECAYUTIL_H 1
7 
9 
10 // for debugging
12 #include <type_traits>
13 #include <initializer_list>
14 #include <mutex>
15 #include "ActsInterop/StatUtils.h"
16 
17 // Empty struct emulating enough of the interface to be used as a dummy replacement for a Gaudi property
18 struct EmptyProperty {
19  template <typename... T_Args>
20  EmptyProperty(T_Args... ) {}
21  // to match empty or some non-empty initializer list
22  template <typename T_Arg1, typename T_Arg2, typename... T_Args>
23  EmptyProperty(T_Arg1, T_Arg2, std::initializer_list<int> &&, T_Args... ) {}
24  template <typename T_Arg1, typename T_Arg2, typename... T_Args>
25  EmptyProperty(T_Arg1, T_Arg2, std::initializer_list<double> &&, T_Args... ) {}
26  const EmptyProperty &value() { return *this; }
27 };
28 
29 template <bool IsDebug=false>
38  const xAOD::TruthParticle *getMother(const xAOD::TruthParticle &truth_particle, float max_energy_loss) const;
39 
40  // only used if IsDebug=true
41  template <class T_OutStream>
42  void dumpStatistics(T_OutStream &out) const;
43 
44  // @param binning number of bins, lower edge, upper edge in MeV
45  void setEnergyLossBinning(const typename std::conditional<IsDebug, std::vector<float>, EmptyProperty>::type &binning);
46 
47  struct Empty {
48  template <typename... T_Args>
49  Empty(T_Args... ) {}
50  };
52 
53  // PDG IDs of siblings.
54  mutable typename std::conditional<IsDebug,std::set<int>, Empty>::type m_outgoingPdgIds ATLAS_THREAD_SAFE;
55 
57  mutable typename std::conditional<IsDebug,std::set<int>, Empty>::type m_outgoingMotherPdgIds ATLAS_THREAD_SAFE;
64  };
66  mutable typename std::conditional<IsDebug,std::array<ActsUtils::StatHist,kNParticleTypes>, Empty>::type m_energyLossStat ATLAS_THREAD_SAFE;
67 
68  // number of parents in a decay chain.
69  mutable typename std::conditional<IsDebug,ActsUtils::StatHist,Empty>::type m_nParentsStat ATLAS_THREAD_SAFE {20,-.5,20.-.5};
70 };
71 
72 #include "ElasticDecayUtil.icc"
73 #endif
ElasticDecayUtil
Definition: ElasticDecayUtil.h:30
ElasticDecayUtil::ATLAS_THREAD_SAFE
std::conditional< IsDebug, std::set< int >, Empty >::type m_outgoingMotherPdgIds ATLAS_THREAD_SAFE
PDG IDs of parents.
Definition: ElasticDecayUtil.h:57
ElasticDecayUtil::ATLAS_THREAD_SAFE
std::conditional< IsDebug, std::mutex, Empty >::type m_mutex ATLAS_THREAD_SAFE
Definition: ElasticDecayUtil.h:51
EmptyProperty::EmptyProperty
EmptyProperty(T_Arg1, T_Arg2, std::initializer_list< int > &&, T_Args...)
Definition: ElasticDecayUtil.h:23
AddEmptyComponent.binning
binning
Definition: AddEmptyComponent.py:34
createSimpleDistributions.IsDebug
bool IsDebug
Definition: createSimpleDistributions.py:12
ElasticDecayUtil::getMother
const xAOD::TruthParticle * getMother(const xAOD::TruthParticle &truth_particle, float max_energy_loss) const
follow decay chain upwards assuming quasi elastic processes.
ElasticDecayUtil< TruthParticleHitCountDebugHists >::ParticleTypes
ParticleTypes
Definition: ElasticDecayUtil.h:58
ElasticDecayUtil::ATLAS_THREAD_SAFE
std::conditional< IsDebug, std::array< ActsUtils::StatHist, kNParticleTypes >, Empty >::type m_energyLossStat ATLAS_THREAD_SAFE
energy less per vertex.
Definition: ElasticDecayUtil.h:66
EmptyProperty::EmptyProperty
EmptyProperty(T_Args...)
Definition: ElasticDecayUtil.h:20
StatUtils.h
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
ElasticDecayUtil::kOther
@ kOther
Definition: ElasticDecayUtil.h:62
ElasticDecayUtil::kPhoton
@ kPhoton
Definition: ElasticDecayUtil.h:61
EmptyProperty::EmptyProperty
EmptyProperty(T_Arg1, T_Arg2, std::initializer_list< double > &&, T_Args...)
Definition: ElasticDecayUtil.h:25
ElasticDecayUtil::dumpStatistics
void dumpStatistics(T_OutStream &out) const
ElasticDecayUtil::kElectron
@ kElectron
Definition: ElasticDecayUtil.h:60
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:41
ElasticDecayUtil::kNParticleTypes
@ kNParticleTypes
Definition: ElasticDecayUtil.h:63
ElasticDecayUtil.icc
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
ElasticDecayUtil::Empty
Definition: ElasticDecayUtil.h:47
TruthParticle.h
checker_macros.h
Define macros for attributes used to control the static checker.
ElasticDecayUtil::kNoSibling
@ kNoSibling
Definition: ElasticDecayUtil.h:59
EmptyProperty::value
const EmptyProperty & value()
Definition: ElasticDecayUtil.h:26
EmptyProperty
Definition: ElasticDecayUtil.h:18
ElasticDecayUtil::setEnergyLossBinning
void setEnergyLossBinning(const typename std::conditional< IsDebug, std::vector< float >, EmptyProperty >::type &binning)
ElasticDecayUtil::Empty::Empty
Empty(T_Args...)
Definition: ElasticDecayUtil.h:49
ElasticDecayUtil::ATLAS_THREAD_SAFE
std::conditional< IsDebug, std::set< int >, Empty >::type m_outgoingPdgIds ATLAS_THREAD_SAFE
Definition: ElasticDecayUtil.h:54