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 (std::string_view 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 (std::string_view trk_sel_name, std::string_view time_wp, std::string_view hist_name, Ts... args)
template<typename... Ts>
void fillEff (std::string_view name, Ts... args)
template<typename... Ts>
void fillEffSubDir (std::string_view trk_sel_name, std::string_view wp_name, std::string_view 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< StoreGateSvc > StoreGateSvc_t

Private Member Functions

const xAOD::TruthVertex * getTruthVertex (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_ExpertTrackTimeAccessor > m_track_time_tools
ToolHandleArray< IHGTD_TrackSelectionTool > m_track_sel_tools
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_track_particles_key
SG::ReadHandleKey< xAOD::TruthEventContainer > m_truth_event_container_key
SG::ReadHandleKey< xAOD::TruthPileupEventContainer > m_pileup_truth_container_key
const std::vector< std::string > m_primes_fractions
 Histogram-name suffixes, indexed by PrimesFractions.
std::map< std::string, TObject *, std::less<> > 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 376 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.contains(name)) {
78 ATH_MSG_WARNING("You are duplicating histogram: "
79 << name << ", this is not a good idea");
80 return;
81 }
82 auto * ptrT = new T(name.c_str(), title.c_str(), args...);
83 m_histos.emplace(name, ptrT);
84 ptrT->Sumw2();
85 if (not m_hist_svc->regHist(m_directory_name + name,ptrT).isSuccess()) {
86 ATH_MSG_WARNING("Failed to book " << name);
87 }
88 }
#define ATH_MSG_WARNING(x,...)
Gaudi::Property< std::string > m_directory_name
std::map< std::string, TObject *, std::less<> > 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 110 of file HGTD_AnalysisAlgBase.h.

110 {
111 // check if hist exists already and warn for duplication
112 // doesn't do anything then...
113 if (m_histos.contains(name)) {
114 ATH_MSG_WARNING("You are duplicating histogram: "
115 << name << ", this is not a good idea");
116 return;
117 }
118 auto * ptrT = new TEfficiency(name.c_str(), title.c_str(), args...);
119 m_histos.emplace(name,ptrT);
120 if (not m_hist_svc->regEfficiency(m_directory_name + name,ptrT).isSuccess()) {
121 ATH_MSG_WARNING("Failed to book " << name);
122 }
123 }

◆ 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 91 of file HGTD_AnalysisAlgBase.h.

93 {
94 // check if hist exists already and warn for duplication
95 // doesn't do anything then...
96 const std::string name = trk_sel_name + "/" + time_wp + "/" + hist_name;
97 if (m_histos.contains(name)) {
98 ATH_MSG_WARNING("You are duplicating histogram: "
99 << name << ", this is not a good idea");
100 return;
101 }
102 auto * ptrT = new TEfficiency(hist_name.c_str(), title.c_str(), args...);
103 m_histos.emplace(name, ptrT);
104 if (not m_hist_svc->regEfficiency(m_directory_name + name, ptrT).isSuccess()) {
105 ATH_MSG_WARNING("Failed to book " << name);
106 }
107 }

◆ 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 54 of file HGTD_AnalysisAlgBase.h.

56 {
57 // check if hist exists already and warn for duplication
58 // doesn't do anything then...
59 const std::string name = trk_sel_name + "/" + time_wp + "/" + hist_name;
60 if (m_histos.contains(name)) {
61 ATH_MSG_WARNING("You are duplicating histogram: "
62 << name << ", this is not a good idea");
63 return;
64 }
65 auto * ptrT = new T(hist_name.c_str(), title.c_str(), args...);
66 m_histos.emplace(name, ptrT);
67 ptrT->Sumw2();
68 if (not m_hist_svc->regHist(m_directory_name + name, ptrT).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 53 of file HGTD_TrkTimePerformanceStudies.cxx.

53 {
54
55 SG::ReadHandle<xAOD::TrackParticleContainer> track_particles_hdl(
57 const xAOD::TrackParticleContainer* track_particles =
58 track_particles_hdl.cptr();
59
60 for (const auto* track : *track_particles) {
61 for (const auto& track_tool : m_track_sel_tools) {
62 for (const auto& time_tool : m_track_time_tools) {
63
64 const float trk_eta = track->eta();
65
66 if (!track_tool->trackPassesSelection(track)) {
67 continue;
68 }
69
70 const xAOD::TruthParticle* truth_particle =
72
73 auto purity = time_tool->fracPrimaryHits(*track);
74 int n_potential_primes = time_tool->numberPotentialPrimaryHits(*track);
75 bool has_time = time_tool->expertHasTime(*track);
76
78 if (purity < 0.01) {
79 switch (n_potential_primes) {
80 case 0:
82 break;
83 case 1:
85 break;
86 case 2:
88 break;
89 case 3:
91 break;
92 case 4:
94 break;
95 }
96 } else if (purity > 0.01 and purity < 0.48) {
98 } else if (purity > 0.48 and purity < 0.52) {
100 } else if (purity > 0.52 and purity < 0.98) {
101 primes_fraction = PrimesFractions::MoreThanHalfPrimes;
102 } else if (purity > 0.98) {
103 primes_fraction = PrimesFractions::AllPrimes;
104 }
105
106 bool morethanhalfprimes =
107 primes_fraction == PrimesFractions::AllPrimes or
108 primes_fraction == PrimesFractions::MoreThanHalfPrimes;
109 fillEffSubDir(track_tool->name(), time_tool->name(), "m_eff_vs_eta",
110 has_time, std::abs(trk_eta));
111
112 bool count_primesfrac_category_as_good = false;
113 for (size_t i = 0; i < m_primes_fractions.size(); i++) {
114 if (i == static_cast<size_t>(primes_fraction)) {
115 count_primesfrac_category_as_good = has_time;
116 } else {
117 count_primesfrac_category_as_good = false;
118 }
119 fillEffSubDir(track_tool->name(), time_tool->name(),
120 "m_eff_vs_eta_primesfrac" + m_primes_fractions.at(i),
121 count_primesfrac_category_as_good, std::abs(trk_eta));
122 }
123
124 if (has_time) {
125 auto truth_vertex = getTruthVertex(truth_particle);
126 if (truth_particle and truth_vertex) {
127 float track_time = time_tool->expertTime(*track);
128 float truth_time = time_tool->getTruthTime(*truth_vertex);
129 float time_res = track_time - truth_time;
130 fillSubdir<TH1F>(track_tool->name(), time_tool->name(),
131 "m_hist_timeres_outlier_cases" +
132 m_primes_fractions.at(primes_fraction),
133 time_res);
134 }
135 fillEffSubDir(track_tool->name(), time_tool->name(),
136 "m_eff_gt50pcprimes_vs_eta", morethanhalfprimes,
137 std::abs(trk_eta));
138 fillEffSubDir(track_tool->name(), time_tool->name(),
139 "m_eff_gt50pcprimes_vs_eta_mistag",
140 not morethanhalfprimes, std::abs(trk_eta));
141 } else {
142 fillEffSubDir(track_tool->name(), time_tool->name(),
143 "m_eff_gt50pcprimes_vs_eta", false, std::abs(trk_eta));
144 fillEffSubDir(track_tool->name(), time_tool->name(),
145 "m_eff_gt50pcprimes_vs_eta_mistag", false,
146 std::abs(trk_eta));
147 }
148 } // loop over track-time tools
149 } // loop over track selection tools
150 } // loop over tracks
151
152 return StatusCode::SUCCESS;
153}
void fillEffSubDir(std::string_view trk_sel_name, std::string_view wp_name, std::string_view hist_name, Ts... args)
void fillSubdir(std::string_view trk_sel_name, std::string_view time_wp, std::string_view 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 ( std::string_view 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 130 of file HGTD_AnalysisAlgBase.h.

130 {
131 auto it = m_histos.find(name);
132 if (it == m_histos.end() or it->second == nullptr) {
134 "[HistogramHandler::fill] ERROR: you are attempting to fill "
135 "a histogram with name "
136 << name << " which doesn't exist!");
137 return;
138 }
139 auto * ptrT = dynamic_cast<T*>(it->second);
140 if (!ptrT)[[unlikely]]{
141 ATH_MSG_WARNING("Cast failed for "<< name);
142 return;
143 }
144 ptrT->Fill(args...);
145 }
#define unlikely(x)

◆ fillEff()

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

Definition at line 168 of file HGTD_AnalysisAlgBase.h.

168 {
169 const auto it = m_histos.find(name);
170 if (it == m_histos.end() or it->second == nullptr)[[unlikely]] {
172 "[HistogramHandler::fillEff] ERROR: you are attempting to fill "
173 "a histogram with name "
174 << name << " which doesn't exist!");
175 return;
176 }
177 auto * ptrT = dynamic_cast<TEfficiency*>(it->second);
178 if (!ptrT)[[unlikely]]{
179 ATH_MSG_WARNING("Cast failed for "<< name);
180 return;
181 }
182 ptrT->Fill(args...);
183 }

◆ fillEffSubDir()

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

Definition at line 186 of file HGTD_AnalysisAlgBase.h.

188 {
189 const std::string name = std::format("{}/{}/{}", trk_sel_name, wp_name, hist_name);
190 auto it = m_histos.find(name) ;
191 if (it == m_histos.end() or it->second == nullptr) {
193 "[HistogramHandler::fill] ERROR: you are attempting to fill "
194 "a histogram with name "
195 << name << " which doesn't exist!");
196 return;
197 }
198 auto * ptrT = dynamic_cast<TEfficiency*>(it->second);
199 if (!ptrT)[[unlikely]]{
200 ATH_MSG_WARNING("Cast failed for "<< name);
201 return;
202 }
203 ptrT->Fill(args...);
204 }

◆ fillSubdir()

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

Definition at line 148 of file HGTD_AnalysisAlgBase.h.

149 {
150 const std::string name = std::format("{}/{}/{}", trk_sel_name, time_wp, hist_name);
151 auto it = m_histos.find(name);
152 if (it == m_histos.end() or it->second == nullptr) {
154 "[HistogramHandler::fill] ERROR: you are attempting to fill "
155 "a histogram with name "
156 << name << " which doesn't exist!");
157 return;
158 }
159 auto * ptrT = dynamic_cast<T*>(it->second);
160 if (!ptrT)[[unlikely]]{
161 ATH_MSG_WARNING("Cast failed for "<< name);
162 return;
163 }
164 ptrT->Fill(args...);
165 }

◆ 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 155 of file HGTD_TrkTimePerformanceStudies.cxx.

156 {
157 if (not truth_particle) {
158 return nullptr;
159 }
160
161 SG::ReadHandle<xAOD::TruthEventContainer> truth_event_container_hdl(
163 const xAOD::TruthEventContainer* truth_event_container =
164 truth_event_container_hdl.cptr();
165
166 if (not truth_event_container or truth_event_container->empty()) {
167 ATH_MSG_DEBUG("getTruthVertex: no " << m_truth_event_container_key.key()
168 << " container in this event");
169 return nullptr;
170 }
171
172 // check if truth particle is from HS event
173 auto truth_hs_event = truth_event_container->at(0);
174 if (not truth_hs_event) {
175 return nullptr;
176 }
177 int n_hs_truthparticles = truth_hs_event->nTruthParticles();
178 auto truth_hs_vtx = truth_event_container->at(0)->signalProcessVertex();
179
180 for (int i = 0; i < n_hs_truthparticles; i++) {
181 if (not truth_hs_event->truthParticle(i)) {
182 continue;
183 }
184 if (not truth_hs_event->truthParticle(i)->isSimulationParticle() and
185 truth_hs_event->truthParticle(i)->isStable() and
186 truth_hs_event->truthParticle(i)->isCharged() and
187 truth_hs_event->truthParticle(i)->index() == truth_particle->index()) {
188 return truth_hs_vtx;
189 }
190 }
191
192 SG::ReadHandle<xAOD::TruthPileupEventContainer> pileup_truth_container_hdl(
194 const xAOD::TruthPileupEventContainer* pileup_truth_container =
195 pileup_truth_container_hdl.cptr();
196
197 ATH_MSG_DEBUG("getTruthVertex: no HS vertex found");
198
199 // TruthPileupEvents is only written to the AOD for samples digitised with
200 // pile-up, so on a no-pile-up sample there is simply no pile-up vertex to
201 // associate the track to.
202 if (not pileup_truth_container) {
203 ATH_MSG_DEBUG("getTruthVertex: no " << m_pileup_truth_container_key.key()
204 << " container in this event");
205 return nullptr;
206 }
207
208 // if not, then check if from PU event
209 for (size_t pu_event = 0; pu_event < pileup_truth_container->size();
210 pu_event++) {
211 auto truth_pu_event = pileup_truth_container->at(pu_event);
212 auto truth_pu_vertex = truth_pu_event->truthVertex(1);
213 int n_pu_truthparticles = truth_pu_event->nTruthParticles();
214
215 for (int i = 0; i < n_pu_truthparticles; i++) {
216 if (not truth_pu_event->truthParticle(i)) {
217 continue;
218 }
219 if (not truth_pu_event->truthParticle(i)->isSimulationParticle() and
220 truth_pu_event->truthParticle(i)->isStable() and
221 truth_pu_event->truthParticle(i)->isCharged() and
222 truth_particle->index() ==
223 truth_pu_event->truthParticle(i)->index()) {
224 return truth_pu_vertex;
225 }
226 }
227 } // LOOP PU events
228 // can't be associated to any vertex
229 return nullptr;
230}
#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 const std::string titleStr{";|#eta| ;frequency"};
26 for (const auto& track_tool : m_track_sel_tools) {
27 const auto & tname = track_tool->name();
28 for (const auto& time_tool : m_track_time_tools) {
29 const auto & timetoolName = time_tool->name();
30 static const std::string effVsEta{"m_eff_vs_eta"};
31 bookEffSubdir(tname, timetoolName, effVsEta, titleStr, 32, 2.4, 4.0);
32 static const std::string primesVsEta{"m_eff_gt50pcprimes_vs_eta"};
33 bookEffSubdir(tname, timetoolName, primesVsEta, titleStr, 32, 2.4, 4.0);
34 static const std::string primesVsEtaMistag{"m_eff_gt50pcprimes_vs_eta_mistag"};
35 bookEffSubdir(tname, timetoolName, primesVsEtaMistag, titleStr, 32, 2.4, 4.0);
36 for (const auto& primes_fraction_i : m_primes_fractions) {
37 std::string name = "m_eff_vs_eta_primesfrac" + primes_fraction_i;
38 bookEffSubdir(tname, timetoolName, name, titleStr, 32, 2.4, 4.0);
39 std::string name_res = "m_hist_timeres_outlier_cases" + primes_fraction_i;
40 static const std::string thisTitle{";t_{reco} - t_{truth} [ns]; number of tracks"};
41 bookSubdir<TH1F>(tname, timetoolName, name_res, thisTitle, 200, -.4, 0.4);
42 }
43 }
44 }
45
46 ATH_CHECK(m_track_particles_key.initialize());
49
50 return StatusCode::SUCCESS;
51}
#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 368 of file AthCommonDataStore.h.

369 {
370 h.renounce();
372 }
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 352 of file AthCommonDataStore.h.

352 {
354 }

◆ setFilterPassed()

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

Set filter decision:

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, 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 298 of file AthCommonDataStore.h.

298 {
299 for (auto &a : m_vhka) {
301 for (auto k : keys) {
302 k->setOwner(this);
303 }
304 }
305 }

Member Data Documentation

◆ m_detStore

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

Pointer to StoreGate (detector store by default).

Definition at line 381 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 42 of file HGTD_AnalysisAlgBase.h.

42 {
43 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 378 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 207 of file HGTD_AnalysisAlgBase.h.

207{this, "THistSvc", "THistSvc"};

◆ m_histos

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

Definition at line 210 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 387 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 386 of file AthCommonDataStore.h.


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