ATLAS Offline Software
Loading...
Searching...
No Matches
HGTD_TrkTimePerformanceStudies Class Reference

#include <HGTD_TrkTimePerformanceStudies.h>

Inheritance diagram for HGTD_TrkTimePerformanceStudies:
Collaboration diagram for HGTD_TrkTimePerformanceStudies:

Public Member Functions

 HGTD_TrkTimePerformanceStudies (const std::string &name, ISvcLocator *svc_locator)
virtual ~HGTD_TrkTimePerformanceStudies ()
virtual StatusCode initialize () override
virtual StatusCode execute (const EventContext &ctx) override
 Execute method.
template<typename T = TH1F, typename... Ts>
void bookSubdir (const std::string &trk_sel_name, const std::string &time_wp, const std::string &hist_name, const std::string &title, Ts... args)
 Templated function for booking histograms The type of the histogram is passed as a template parameter The function call takes a path (with terminating "/") as well as the name and title of the histogram Any additional parameters are passed as additonal parameters to the constructor i.e.
template<typename T, typename... Ts>
void book (const std::string &name, const std::string &title, Ts... args)
template<typename... Ts>
void bookEffSubdir (const std::string &trk_sel_name, const std::string &time_wp, const std::string &hist_name, const std::string &title, Ts... args)
template<typename... Ts>
void bookEff (const std::string &name, const std::string &title, Ts... args)
template<typename T, typename... Ts>
void fill (const std::string &name, Ts... args)
 Templated function for filling histograms The type of the histogram is passed as a template parameter The function takes the name (including the path) as well as any arguments to be passed to the histogram Fill method.
template<typename T, typename... Ts>
void fillSubdir (const std::string &trk_sel_name, const std::string &time_wp, const std::string &hist_name, Ts... args)
template<typename... Ts>
void fillEff (const std::string &name, Ts... args)
template<typename... Ts>
void fillEffSubDir (const std::string &trk_sel_name, const std::string &wp_name, const std::string &hist_name, Ts... args)
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual bool isClonable () const override
 Specify if the algorithm is clonable.
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
virtual bool filterPassed (const EventContext &ctx) const
 Get filter decision:
virtual void setFilterPassed (bool state, const EventContext &ctx) const
 Set filter decision:
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Public Attributes

Gaudi::Property< std::string > m_directory_name

Protected Member Functions

virtual bool isReEntrant () const override final
 Legacy algorithms are not thread-safe.
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Protected Attributes

ServiceHandle< ITHistSvc > m_hist_svc {this, "THistSvc", "THistSvc"}

Private Types

enum  PrimesFractions {
  AllPrimes , HalfPrimesHasPrimes , LessThanHalfPrimes , MoreThanHalfPrimes ,
  NoPrimesNoPossiblePrimes , NoPrimes1PossiblePrimes , NoPrimes2PossiblePrimes , NoPrimes3PossiblePrimes ,
  NoPrimes4PossiblePrimes
}
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

const xAOD::TruthVertexgetTruthVertex (const xAOD::TruthParticle *truth_particle)
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ToolHandleArray< IHGTD_ExpertTrackTimeAccessorm_track_time_tools
ToolHandleArray< IHGTD_TrackSelectionToolm_track_sel_tools
SG::ReadHandleKey< xAOD::TrackParticleContainerm_track_particles_key
SG::ReadHandleKey< xAOD::TruthEventContainerm_truth_event_container_key
SG::ReadHandleKey< xAOD::TruthPileupEventContainerm_pileup_truth_container_key
const std::vector< std::string > m_primes_fractions
 Histogram-name suffixes, indexed by PrimesFractions.
std::map< std::string, TObject * > m_histos
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 35 of file HGTD_TrkTimePerformanceStudies.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Member Enumeration Documentation

◆ PrimesFractions

Enumerator
AllPrimes 
HalfPrimesHasPrimes 
LessThanHalfPrimes 
MoreThanHalfPrimes 
NoPrimesNoPossiblePrimes 
NoPrimes1PossiblePrimes 
NoPrimes2PossiblePrimes 
NoPrimes3PossiblePrimes 
NoPrimes4PossiblePrimes 

Definition at line 47 of file HGTD_TrkTimePerformanceStudies.h.

Constructor & Destructor Documentation

◆ HGTD_TrkTimePerformanceStudies()

HGTD_TrkTimePerformanceStudies::HGTD_TrkTimePerformanceStudies ( const std::string & name,
ISvcLocator * svc_locator )

Definition at line 12 of file HGTD_TrkTimePerformanceStudies.cxx.

14 : HGTD_AnalysisAlgBase(name, svc_locator) {}
HGTD_AnalysisAlgBase(const std::string &name, ISvcLocator *svc_locator)

◆ ~HGTD_TrkTimePerformanceStudies()

HGTD_TrkTimePerformanceStudies::~HGTD_TrkTimePerformanceStudies ( )
virtual

Definition at line 16 of file HGTD_TrkTimePerformanceStudies.cxx.

16{}

Member Function Documentation

◆ book()

template<typename T, typename... Ts>
void HGTD_AnalysisAlgBase::book ( const std::string & name,
const std::string & title,
Ts... args )
inlineinherited

Definition at line 74 of file HGTD_AnalysisAlgBase.h.

74 {
75 // check if hist exists already and warn for duplication
76 // doesn't do anything then...
77 if (m_histos.find(name) != m_histos.end()) {
78 ATH_MSG_WARNING("You are duplicating histogram: "
79 << name << ", this is not a good idea\n");
80 return;
81 }
82 m_histos[name] = new T(name.c_str(), title.c_str(), args...);
83 dynamic_cast<T*>(m_histos[name])->Sumw2();
84 if (not m_hist_svc
85 ->regHist(m_directory_name + name,
86 dynamic_cast<T*>(m_histos[name]))
87 .isSuccess()) {
88 ATH_MSG_WARNING("Failed to book " << name);
89 }
90 }
#define ATH_MSG_WARNING(x,...)
Gaudi::Property< std::string > m_directory_name
std::map< std::string, TObject * > m_histos
ServiceHandle< ITHistSvc > m_hist_svc
unsigned long long T

◆ bookEff()

template<typename... Ts>
void HGTD_AnalysisAlgBase::bookEff ( const std::string & name,
const std::string & title,
Ts... args )
inlineinherited

Definition at line 114 of file HGTD_AnalysisAlgBase.h.

114 {
115 // check if hist exists already and warn for duplication
116 // doesn't do anything then...
117 if (m_histos.find(name) != m_histos.end()) {
118 ATH_MSG_WARNING("You are duplicating histogram: "
119 << name << ", this is not a good idea\n");
120 return;
121 }
122 m_histos[name] = new TEfficiency(name.c_str(), title.c_str(), args...);
123 if (not m_hist_svc
124 ->regGraph(m_directory_name + name,
125 reinterpret_cast<TGraph*>(m_histos[name]))
126 .isSuccess()) {
127 ATH_MSG_WARNING("Failed to book " << name);
128 }
129 }

◆ bookEffSubdir()

template<typename... Ts>
void HGTD_AnalysisAlgBase::bookEffSubdir ( const std::string & trk_sel_name,
const std::string & time_wp,
const std::string & hist_name,
const std::string & title,
Ts... args )
inlineinherited

Definition at line 93 of file HGTD_AnalysisAlgBase.h.

95 {
96 // check if hist exists already and warn for duplication
97 // doesn't do anything then...
98 std::string name = trk_sel_name + "/" + time_wp + "/" + hist_name;
99 if (m_histos.find(name) != m_histos.end()) {
100 ATH_MSG_WARNING("You are duplicating histogram: "
101 << name << ", this is not a good idea\n");
102 return;
103 }
104 m_histos[name] = new TEfficiency(hist_name.c_str(), title.c_str(), args...);
105 if (not m_hist_svc
106 ->regGraph(m_directory_name + name,
107 reinterpret_cast<TGraph*>(m_histos[name]))
108 .isSuccess()) {
109 ATH_MSG_WARNING("Failed to book " << name);
110 }
111 }

◆ bookSubdir()

template<typename T = TH1F, typename... Ts>
void HGTD_AnalysisAlgBase::bookSubdir ( const std::string & trk_sel_name,
const std::string & time_wp,
const std::string & hist_name,
const std::string & title,
Ts... args )
inlineinherited

Templated function for booking histograms The type of the histogram is passed as a template parameter The function call takes a path (with terminating "/") as well as the name and title of the histogram Any additional parameters are passed as additonal parameters to the constructor i.e.

the binning

Definition at line 52 of file HGTD_AnalysisAlgBase.h.

54 {
55 // check if hist exists already and warn for duplication
56 // doesn't do anything then...
57 std::string name = trk_sel_name + "/" + time_wp + "/" + hist_name;
58 if (m_histos.find(name) != m_histos.end()) {
59 ATH_MSG_WARNING("You are duplicating histogram: "
60 << name << ", this is not a good idea\n");
61 return;
62 }
63 m_histos[name] = new T(hist_name.c_str(), title.c_str(), args...);
64 dynamic_cast<T*>(m_histos[name])->Sumw2();
65 if (not m_hist_svc
66 ->regHist(m_directory_name + name,
67 dynamic_cast<T*>(m_histos[name]))
68 .isSuccess()) {
69 ATH_MSG_WARNING("Failed to book " << name);
70 }
71 }

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode HGTD_TrkTimePerformanceStudies::execute ( const EventContext & ctx)
overridevirtual

Execute method.

Implements AthAlgorithm.

Definition at line 59 of file HGTD_TrkTimePerformanceStudies.cxx.

59 {
60
61 SG::ReadHandle<xAOD::TrackParticleContainer> track_particles_hdl(
63 const xAOD::TrackParticleContainer* track_particles =
64 track_particles_hdl.cptr();
65
66 for (const auto* track : *track_particles) {
67 for (const auto& track_tool : m_track_sel_tools) {
68 for (const auto& time_tool : m_track_time_tools) {
69
70 const float trk_eta = track->eta();
71
72 if (!track_tool->trackPassesSelection(track)) {
73 continue;
74 }
75
76 const xAOD::TruthParticle* truth_particle =
78
79 auto purity = time_tool->fracPrimaryHits(*track);
80 int n_potential_primes = time_tool->numberPotentialPrimaryHits(*track);
81 bool has_time = time_tool->expertHasTime(*track);
82
84 if (purity < 0.01) {
85 switch (n_potential_primes) {
86 case 0:
88 break;
89 case 1:
91 break;
92 case 2:
94 break;
95 case 3:
97 break;
98 case 4:
100 break;
101 }
102 } else if (purity > 0.01 and purity < 0.48) {
103 primes_fraction = PrimesFractions::LessThanHalfPrimes;
104 } else if (purity > 0.48 and purity < 0.52) {
105 primes_fraction = PrimesFractions::HalfPrimesHasPrimes;
106 } else if (purity > 0.52 and purity < 0.98) {
107 primes_fraction = PrimesFractions::MoreThanHalfPrimes;
108 } else if (purity > 0.98) {
109 primes_fraction = PrimesFractions::AllPrimes;
110 }
111
112 bool morethanhalfprimes =
113 primes_fraction == PrimesFractions::AllPrimes or
114 primes_fraction == PrimesFractions::MoreThanHalfPrimes;
115
116 fillEffSubDir(track_tool->name(), time_tool->name(), "m_eff_vs_eta",
117 has_time, std::abs(trk_eta));
118
119 bool count_primesfrac_category_as_good = false;
120 for (size_t i = 0; i < m_primes_fractions.size(); i++) {
121 if (i == static_cast<size_t>(primes_fraction)) {
122 count_primesfrac_category_as_good = has_time;
123 } else {
124 count_primesfrac_category_as_good = false;
125 }
126 fillEffSubDir(track_tool->name(), time_tool->name(),
127 "m_eff_vs_eta_primesfrac" + m_primes_fractions.at(i),
128 count_primesfrac_category_as_good, std::abs(trk_eta));
129 }
130
131 if (has_time) {
132 auto truth_vertex = getTruthVertex(truth_particle);
133 if (truth_particle and truth_vertex) {
134 float track_time = time_tool->expertTime(*track);
135 float truth_time = time_tool->getTruthTime(*truth_vertex);
136 float time_res = track_time - truth_time;
137 fillSubdir<TH1F>(track_tool->name(), time_tool->name(),
138 "m_hist_timeres_outlier_cases" +
139 m_primes_fractions.at(primes_fraction),
140 time_res);
141 }
142 fillEffSubDir(track_tool->name(), time_tool->name(),
143 "m_eff_gt50pcprimes_vs_eta", morethanhalfprimes,
144 std::abs(trk_eta));
145 fillEffSubDir(track_tool->name(), time_tool->name(),
146 "m_eff_gt50pcprimes_vs_eta_mistag",
147 not morethanhalfprimes, std::abs(trk_eta));
148 } else {
149 fillEffSubDir(track_tool->name(), time_tool->name(),
150 "m_eff_gt50pcprimes_vs_eta", false, std::abs(trk_eta));
151 fillEffSubDir(track_tool->name(), time_tool->name(),
152 "m_eff_gt50pcprimes_vs_eta_mistag", false,
153 std::abs(trk_eta));
154 }
155 } // loop over track-time tools
156 } // loop over track selection tools
157 } // loop over tracks
158
159 return StatusCode::SUCCESS;
160}
void fillEffSubDir(const std::string &trk_sel_name, const std::string &wp_name, const std::string &hist_name, Ts... args)
void fillSubdir(const std::string &trk_sel_name, const std::string &time_wp, const std::string &hist_name, Ts... args)
const std::vector< std::string > m_primes_fractions
Histogram-name suffixes, indexed by PrimesFractions.
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_track_particles_key
ToolHandleArray< IHGTD_ExpertTrackTimeAccessor > m_track_time_tools
ToolHandleArray< IHGTD_TrackSelectionTool > m_track_sel_tools
const xAOD::TruthVertex * getTruthVertex(const xAOD::TruthParticle *truth_particle)
const xAOD::TruthParticle * getTruthParticle(const xAOD::IParticle &p)
Return the truthParticle associated to the given IParticle (if any).
TruthParticle_v1 TruthParticle
Typedef to implementation.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthCommonAlgorithm< Gaudi::Algorithm >::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 89 of file AthCommonAlgorithm.cxx.

54{
55 // If we didn't find any symlinks to add, just return the collection
56 // from the base class. Otherwise, return the extended collection.
57 if (!m_extendedExtraObjects.empty()) {
59 }
61}
Common base class for algorithms.

◆ fill()

template<typename T, typename... Ts>
void HGTD_AnalysisAlgBase::fill ( const std::string & name,
Ts... args )
inlineinherited

Templated function for filling histograms The type of the histogram is passed as a template parameter The function takes the name (including the path) as well as any arguments to be passed to the histogram Fill method.

Definition at line 136 of file HGTD_AnalysisAlgBase.h.

136 {
137 if (m_histos[name] == nullptr or m_histos.find(name) == m_histos.end()) {
139 "[HistogramHandler::fill] ERROR: you are attempting to fill "
140 "a histogram with name "
141 << name << " which doesn't exist!\n");
142 return;
143 }
144 dynamic_cast<T*>(m_histos[name])->Fill(args...);
145 }

◆ fillEff()

template<typename... Ts>
void HGTD_AnalysisAlgBase::fillEff ( const std::string & name,
Ts... args )
inlineinherited

Definition at line 161 of file HGTD_AnalysisAlgBase.h.

161 {
162 if (m_histos[name] == nullptr or m_histos.find(name) == m_histos.end()) {
164 "[HistogramHandler::fill] ERROR: you are attempting to fill "
165 "a histogram with name "
166 << name << " which doesn't exist!\n");
167 return;
168 }
169 dynamic_cast<TEfficiency*>(m_histos[name])->Fill(args...);
170 }

◆ fillEffSubDir()

template<typename... Ts>
void HGTD_AnalysisAlgBase::fillEffSubDir ( const std::string & trk_sel_name,
const std::string & wp_name,
const std::string & hist_name,
Ts... args )
inlineinherited

Definition at line 173 of file HGTD_AnalysisAlgBase.h.

175 {
176 std::string name = trk_sel_name + "/" + wp_name + "/" + hist_name;
177 if (m_histos[name] == nullptr or m_histos.find(name) == m_histos.end()) {
179 "[HistogramHandler::fill] ERROR: you are attempting to fill "
180 "a histogram with name "
181 << name << " which doesn't exist!\n");
182 return;
183 }
184 dynamic_cast<TEfficiency*>(m_histos[name])->Fill(args...);
185 }

◆ fillSubdir()

template<typename T, typename... Ts>
void HGTD_AnalysisAlgBase::fillSubdir ( const std::string & trk_sel_name,
const std::string & time_wp,
const std::string & hist_name,
Ts... args )
inlineinherited

Definition at line 148 of file HGTD_AnalysisAlgBase.h.

149 {
150 std::string name = trk_sel_name + "/" + time_wp + "/" + hist_name;
151 if (m_histos[name] == nullptr or m_histos.find(name) == m_histos.end()) {
153 "[HistogramHandler::fill] ERROR: you are attempting to fill "
154 "a histogram with name "
155 << name << " which doesn't exist!\n");
156 return;
157 }
158 dynamic_cast<T*>(m_histos[name])->Fill(args...);
159 }

◆ filterPassed()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::filterPassed ( const EventContext & ctx) const
inlinevirtualinherited

Get filter decision:

Definition at line 93 of file AthCommonAlgorithm.h.

93 {
94 return execState( ctx ).filterPassed();
95 }
virtual bool filterPassed(const EventContext &ctx) const
Get filter decision:

◆ getTruthVertex()

const xAOD::TruthVertex * HGTD_TrkTimePerformanceStudies::getTruthVertex ( const xAOD::TruthParticle * truth_particle)
private

Definition at line 162 of file HGTD_TrkTimePerformanceStudies.cxx.

163 {
164 if (not truth_particle) {
165 return nullptr;
166 }
167
168 SG::ReadHandle<xAOD::TruthEventContainer> truth_event_container_hdl(
170 const xAOD::TruthEventContainer* truth_event_container =
171 truth_event_container_hdl.cptr();
172
173 if (not truth_event_container or truth_event_container->empty()) {
174 ATH_MSG_DEBUG("getTruthVertex: no " << m_truth_event_container_key.key()
175 << " container in this event");
176 return nullptr;
177 }
178
179 // check if truth particle is from HS event
180 auto truth_hs_event = truth_event_container->at(0);
181 if (not truth_hs_event) {
182 return nullptr;
183 }
184 int n_hs_truthparticles = truth_hs_event->nTruthParticles();
185 auto truth_hs_vtx = truth_event_container->at(0)->signalProcessVertex();
186
187 for (int i = 0; i < n_hs_truthparticles; i++) {
188 if (not truth_hs_event->truthParticle(i)) {
189 continue;
190 }
191 if (not truth_hs_event->truthParticle(i)->isSimulationParticle() and
192 truth_hs_event->truthParticle(i)->isStable() and
193 truth_hs_event->truthParticle(i)->isCharged() and
194 truth_hs_event->truthParticle(i)->index() == truth_particle->index()) {
195 return truth_hs_vtx;
196 }
197 }
198
199 SG::ReadHandle<xAOD::TruthPileupEventContainer> pileup_truth_container_hdl(
201 const xAOD::TruthPileupEventContainer* pileup_truth_container =
202 pileup_truth_container_hdl.cptr();
203
204 ATH_MSG_DEBUG("getTruthVertex: no HS vertex found");
205
206 // TruthPileupEvents is only written to the AOD for samples digitised with
207 // pile-up, so on a no-pile-up sample there is simply no pile-up vertex to
208 // associate the track to.
209 if (not pileup_truth_container) {
210 ATH_MSG_DEBUG("getTruthVertex: no " << m_pileup_truth_container_key.key()
211 << " container in this event");
212 return nullptr;
213 }
214
215 // if not, then check if from PU event
216 for (size_t pu_event = 0; pu_event < pileup_truth_container->size();
217 pu_event++) {
218 auto truth_pu_event = pileup_truth_container->at(pu_event);
219 auto truth_pu_vertex = truth_pu_event->truthVertex(1);
220 int n_pu_truthparticles = truth_pu_event->nTruthParticles();
221
222 for (int i = 0; i < n_pu_truthparticles; i++) {
223 if (not truth_pu_event->truthParticle(i)) {
224 continue;
225 }
226 if (not truth_pu_event->truthParticle(i)->isSimulationParticle() and
227 truth_pu_event->truthParticle(i)->isStable() and
228 truth_pu_event->truthParticle(i)->isCharged() and
229 truth_particle->index() ==
230 truth_pu_event->truthParticle(i)->index()) {
231 return truth_pu_vertex;
232 }
233 }
234 } // LOOP PU events
235 // can't be associated to any vertex
236 return nullptr;
237}
#define ATH_MSG_DEBUG(x,...)
const T * at(size_type n) const
Access an element, as an rvalue.
bool empty() const noexcept
Returns true if the collection is empty.
SG::ReadHandleKey< xAOD::TruthEventContainer > m_truth_event_container_key
SG::ReadHandleKey< xAOD::TruthPileupEventContainer > m_pileup_truth_container_key
TruthEventContainer_v1 TruthEventContainer
Declare the latest version of the truth event container.
TruthPileupEventContainer_v1 TruthPileupEventContainer
Declare the latest version of the truth event container.

◆ initialize()

StatusCode HGTD_TrkTimePerformanceStudies::initialize ( )
overridevirtual

Reimplemented from HGTD_AnalysisAlgBase.

Definition at line 18 of file HGTD_TrkTimePerformanceStudies.cxx.

18 {
20
21 ATH_MSG_INFO("Initializing HGTD_TrkTimePerformanceStudies ...");
22
23 ATH_CHECK(m_track_sel_tools.retrieve());
24 ATH_CHECK(m_track_time_tools.retrieve());
25
26 for (const auto& track_tool : m_track_sel_tools) {
27 for (const auto& time_tool : m_track_time_tools) {
28
29 bookEffSubdir(track_tool->name(), time_tool->name(), "m_eff_vs_eta",
30 ";|#eta| ;frequency", 32, 2.4, 4.0);
31 bookEffSubdir(track_tool->name(), time_tool->name(),
32 "m_eff_gt50pcprimes_vs_eta", ";|#eta| ;frequency", 32, 2.4,
33 4.0);
34 bookEffSubdir(track_tool->name(), time_tool->name(),
35 "m_eff_gt50pcprimes_vs_eta_mistag", ";|#eta| ;frequency",
36 32, 2.4, 4.0);
37
38 for (const auto& primes_fraction_i : m_primes_fractions) {
39 std::string name = "m_eff_vs_eta_primesfrac" + primes_fraction_i;
40 bookEffSubdir(track_tool->name(), time_tool->name(), name,
41 ";|#eta| ;frequency", 32, 2.4, 4.0);
42
43 std::string name_res =
44 "m_hist_timeres_outlier_cases" + primes_fraction_i;
45 bookSubdir<TH1F>(track_tool->name(), time_tool->name(), name_res,
46 ";t_{reco} - t_{truth} [ns]; number of tracks", 200,
47 -.4, 0.4);
48 }
49 }
50 }
51
52 ATH_CHECK(m_track_particles_key.initialize());
55
56 return StatusCode::SUCCESS;
57}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x,...)
void bookSubdir(const std::string &trk_sel_name, const std::string &time_wp, const std::string &hist_name, const std::string &title, Ts... args)
Templated function for booking histograms The type of the histogram is passed as a template parameter...
virtual StatusCode initialize()
void bookEffSubdir(const std::string &trk_sel_name, const std::string &time_wp, const std::string &hist_name, const std::string &title, Ts... args)

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isClonable()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::isClonable ( ) const
inlineoverridevirtualinherited

Specify if the algorithm is clonable.

Only relevant for non-reentrant algorithms. Actual number of clones needs to be set via the "Cardinality" property.

Reimplemented in AFP_DigiTop, AlgB, AlgT, BCM_Digitization, CscDigitBuilder, CscDigitToCscRDO, G4AtlasAlg, G4RunAlg, HGTD_Digitization, HiveAlgBase, InDet::GNNSeedingTrackMaker, InDet::SCT_Clusterization, InDet::SiSPGNNTrackMaker, InDet::SiSPSeededTrackFinder, InDet::SiTrackerSpacePointFinder, ISF::SimKernelMT, ITk::StripDigitization, ITkPixelCablingAlg, ITkStripCablingAlg, LArHitEMapMaker, LArTTL1Maker, LUCID_DigiTop, LVL1::L1TopoSimulation, MergeCalibHits, MergeGenericMuonSimHitColl, MergeHijingPars, MergeMcEventCollection, MergeTrackRecordCollection, MergeTruthJets, MergeTruthParticles, MuonDigitizer, PileUpMTAlg, PixelDigitization, RoIBResultToxAOD, SCT_ByteStreamErrorsTestAlg, SCT_CablingCondAlgFromCoraCool, SCT_CablingCondAlgFromText, SCT_ConditionsParameterTestAlg, SCT_ConditionsSummaryTestAlg, SCT_ConfigurationConditionsTestAlg, SCT_Digitization, SCT_FlaggedConditionTestAlg, SCT_LinkMaskingTestAlg, SCT_MajorityConditionsTestAlg, SCT_ModuleVetoTestAlg, SCT_MonitorConditionsTestAlg, SCT_PrepDataToxAOD, SCT_RawDataToxAOD, SCT_ReadCalibChipDataTestAlg, SCT_ReadCalibDataTestAlg, SCT_RODVetoTestAlg, SCT_SensorsTestAlg, SCT_SiliconConditionsTestAlg, SCT_StripVetoTestAlg, SCT_TdaqEnabledTestAlg, SCT_TestCablingAlg, SCTEventFlagWriter, SCTRawDataProvider, SCTSiLorentzAngleTestAlg, SCTSiPropertiesTestAlg, SGInputLoader, Simulation::BeamEffectsAlg, TileHitVecToCnt, TileMuonFitter, TilePulseForTileMuonReceiver, TileRawChannelMaker, TRTDigitization, and ZDC_DigiTop.

Definition at line 68 of file AthCommonAlgorithm.h.

68 {
69 return true;
70 }

◆ isReEntrant()

virtual bool AthAlgorithm::isReEntrant ( ) const
inlinefinaloverrideprotectedvirtualinherited

Legacy algorithms are not thread-safe.

Definition at line 47 of file AthAlgorithm.h.

47{ return false; }

◆ msg()

MsgStream & AthCommonMsg< Gaudi::Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Gaudi::Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setFilterPassed()

virtual void AthCommonAlgorithm< Gaudi::Algorithm >::setFilterPassed ( bool state,
const EventContext & ctx ) const
inlinevirtualinherited

Set filter decision:

Reimplemented in AthFilterAlgorithm.

Definition at line 99 of file AthCommonAlgorithm.h.

99 {
101 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const
Set filter decision:

◆ sysExecute()

StatusCode AthCommonAlgorithm< Gaudi::Algorithm >::sysExecute ( const EventContext & ctx)
overridevirtualinherited

Execute an algorithm.

We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.

Reimplemented in AthAnalysisAlgorithm.

Definition at line 80 of file AthCommonAlgorithm.cxx.

41{
42 return BaseAlg::sysExecute (ctx);
43}

◆ sysInitialize()

StatusCode AthCommonAlgorithm< Gaudi::Algorithm >::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, HypoBase, InputMakerBase, and PyAthena::Alg.

Definition at line 60 of file AthCommonAlgorithm.cxx.

71 {
73
74 if (sc.isFailure()) {
75 return sc;
76 }
77
78 ServiceHandle<ICondSvc> cs("CondSvc",name());
79 for (auto h : outputHandles()) {
80 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
81 // do this inside the loop so we don't create the CondSvc until needed
82 if ( cs.retrieve().isFailure() ) {
83 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
85 }
86 if (cs->regHandle(this,*h).isFailure()) {
88 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
89 << " with CondSvc");
90 }
91 }
92 }
93 return sc;
94}
#define ATH_MSG_ERROR(x,...)
virtual StatusCode sysInitialize() override
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 393 of file AthCommonDataStore.h.

◆ m_directory_name

Gaudi::Property<std::string> HGTD_AnalysisAlgBase::m_directory_name
inherited
Initial value:
{
this, "DirectoryName", "/HGTD_ANA/", "The output directory name"}

Definition at line 40 of file HGTD_AnalysisAlgBase.h.

40 {
41 this, "DirectoryName", "/HGTD_ANA/", "The output directory name"};

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthCommonAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 108 of file AthCommonAlgorithm.h.

◆ m_hist_svc

ServiceHandle<ITHistSvc> HGTD_AnalysisAlgBase::m_hist_svc {this, "THistSvc", "THistSvc"}
protectedinherited

Definition at line 188 of file HGTD_AnalysisAlgBase.h.

188{this, "THistSvc", "THistSvc"};

◆ m_histos

std::map<std::string, TObject*> HGTD_AnalysisAlgBase::m_histos
privateinherited

Definition at line 191 of file HGTD_AnalysisAlgBase.h.

◆ m_pileup_truth_container_key

SG::ReadHandleKey<xAOD::TruthPileupEventContainer> HGTD_TrkTimePerformanceStudies::m_pileup_truth_container_key
private
Initial value:
{
this, "TruthPileupEventsContainerName", "TruthPileupEvents",
"Name of the pileup truth event container that should be retrieved"}

Definition at line 81 of file HGTD_TrkTimePerformanceStudies.h.

81 {
82 this, "TruthPileupEventsContainerName", "TruthPileupEvents",
83 "Name of the pileup truth event container that should be retrieved"};

◆ m_primes_fractions

const std::vector<std::string> HGTD_TrkTimePerformanceStudies::m_primes_fractions
private
Initial value:
= {
"AllPrimes",
"HalfPrimesHasPrimes",
"LessThanHalfPrimes",
"MoreThanHalfPrimes",
"NoPrimesNoPossiblePrimes",
"NoPrimes1PossiblePrimes",
"NoPrimes2PossiblePrimes",
"NoPrimes3PossiblePrimes",
"NoPrimes4PossiblePrimes"}

Histogram-name suffixes, indexed by PrimesFractions.

Definition at line 86 of file HGTD_TrkTimePerformanceStudies.h.

86 {
87 "AllPrimes",
88 "HalfPrimesHasPrimes",
89 "LessThanHalfPrimes",
90 "MoreThanHalfPrimes",
91 "NoPrimesNoPossiblePrimes",
92 "NoPrimes1PossiblePrimes",
93 "NoPrimes2PossiblePrimes",
94 "NoPrimes3PossiblePrimes",
95 "NoPrimes4PossiblePrimes"};

◆ m_track_particles_key

SG::ReadHandleKey<xAOD::TrackParticleContainer> HGTD_TrkTimePerformanceStudies::m_track_particles_key
private
Initial value:
{
this, "TrackParticleContainerName", "InDetTrackParticles",
"Name of the track particle container that should be retrieved in the "
"execute"}

Definition at line 71 of file HGTD_TrkTimePerformanceStudies.h.

71 {
72 this, "TrackParticleContainerName", "InDetTrackParticles",
73 "Name of the track particle container that should be retrieved in the "
74 "execute"};

◆ m_track_sel_tools

ToolHandleArray<IHGTD_TrackSelectionTool> HGTD_TrkTimePerformanceStudies::m_track_sel_tools
private
Initial value:
{
this,
"TrackSelectionTools",
{},
"Tools to retrieve a HGTD specified track selection"}

Definition at line 65 of file HGTD_TrkTimePerformanceStudies.h.

65 {
66 this,
67 "TrackSelectionTools",
68 {},
69 "Tools to retrieve a HGTD specified track selection"};

◆ m_track_time_tools

ToolHandleArray<IHGTD_ExpertTrackTimeAccessor> HGTD_TrkTimePerformanceStudies::m_track_time_tools
private
Initial value:
{
this,
"TrackTimeTools",
{},
"Tools to retrieve a specified track-time working point"}

Definition at line 59 of file HGTD_TrkTimePerformanceStudies.h.

59 {
60 this,
61 "TrackTimeTools",
62 {},
63 "Tools to retrieve a specified track-time working point"};

◆ m_truth_event_container_key

SG::ReadHandleKey<xAOD::TruthEventContainer> HGTD_TrkTimePerformanceStudies::m_truth_event_container_key
private
Initial value:
{
this, "TruthEventsContainerName", "TruthEvents",
"Name of the truth event container that should be retrieved"}

Definition at line 76 of file HGTD_TrkTimePerformanceStudies.h.

76 {
77 this, "TruthEventsContainerName", "TruthEvents",
78 "Name of the truth event container that should be retrieved"};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: