ATLAS Offline Software
Loading...
Searching...
No Matches
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>
16
17// Empty struct emulating enough of the interface to be used as a dummy replacement for a Gaudi property
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
29template <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 };
51 mutable typename std::conditional<IsDebug,std::mutex,Empty>::type m_mutex ATLAS_THREAD_SAFE;
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;
65
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
Define macros for attributes used to control the static checker.
TruthParticle_v1 TruthParticle
Typedef to implementation.
std::conditional< IsDebug, std::mutex, Empty >::type m_mutex ATLAS_THREAD_SAFE
void dumpStatistics(T_OutStream &out) const
const xAOD::TruthParticle * getMother(const xAOD::TruthParticle &truth_particle, float max_energy_loss) const
follow decay chain upwards assuming quasi elastic processes.
void setEnergyLossBinning(const typename std::conditional< IsDebug, std::vector< float >, EmptyProperty >::type &binning)
const EmptyProperty & value()
EmptyProperty(T_Args...)
EmptyProperty(T_Arg1, T_Arg2, std::initializer_list< int > &&, T_Args...)
EmptyProperty(T_Arg1, T_Arg2, std::initializer_list< double > &&, T_Args...)