ATLAS Offline Software
Loading...
Searching...
No Matches
InDet::InDetTrackBiasingTool Class Referenceabstract

This class biases tracks to emulate systematic distortions of the tracking geometry. More...

#include <InDetTrackBiasingTool.h>

Inheritance diagram for InDet::InDetTrackBiasingTool:
Collaboration diagram for InDet::InDetTrackBiasingTool:

Public Types

typedef xAOD::TrackParticleContainer xAODContainerType
 description: the type of xAOD container used
typedef xAODContainerType::base_value_type xAODObjectType
 description: the type of xAOD object used

Public Member Functions

virtual void print () const
 Print the state of the tool.
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 sysInitialize () override
 Perform system initialization for an algorithm.
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
virtual CorrectionCode applyCorrection (xAODObjectType &inputObject)=0
 effects: apply the correction and store the output in the object returns: success
CorrectionCode correctedCopy (const xAODObjectType &inputObject, xAODObjectType *&outputObject)
 effects: make a clone of the input object, apply the correction to it and store the output in the object returns: success rationale: the interface class provides a default implementation in terms of applyCorrection, that the derived classes can override for efficiency
CorrectionCode applyContainerCorrection (xAODContainerType &inputContainer)
 effects: apply the correction to all the members of the container returns: overall success rationale: this will apply the correction to every single member (even if some members fail) rationale: the interface class provides a default implementation in terms of applyCorrection, that the derived classes can override for efficiency
Additional helper functions, not directly mimicking Athena
template<class T>
const T * getProperty (const std::string &name) const
 Get one of the tool's properties.
const std::string & msg_level_name () const __attribute__((deprecated))
 A deprecated function for getting the message level's name.
const std::string & getName (const void *ptr) const
 Get the name of an object that is / should be in the event store.
SG::sgkey_t getKey (const void *ptr) const
 Get the (hashed) key of an object that is in the event store.

Protected Member Functions

StatusCode initHistograms ()
CP::CorrectionCode applyBiasWithSyst (xAOD::TrackParticle &track, const CP::SystematicSet &filtered) const
 Core biasing logic; delegates from both applyCorrection overloads.
float readHistogram (float fDefault, TH2 *histogram, float phi, float eta) const
std::unique_ptr< TFile > getFile (const std::string &) const
 open and return a file with the given name.
template<class T>
StatusCode initObject (std::unique_ptr< T > &obj, const std::string &rootFileName, const std::string &objName) const
 a function to initialize an object from a root file
bool isActive (TrackSystematic) const
bool isActive (TrackSystematic syst, const CP::SystematicSet &filtered) const
 Reentrant variant of isActive(): checks syst against a caller-provided filtered set rather than the shared m_activeSysts.
const CP::SystematicSetgetFilteredSysts (const CP::SystematicSet &syst) const
 Look up the pre-filtered systematic set for syst.
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

std::vector< std::unique_ptr< TH2 > > m_biasD0Histograms
std::vector< std::unique_ptr< TH2 > > m_biasZ0Histograms
std::vector< std::unique_ptr< TH2 > > m_biasQoverPsagittaHistograms
std::string m_d0_nominal_histName = "d0/d0_theNominal"
std::string m_z0_nominal_histName = "z0/z0_theNominal"
std::string m_sagitta_nominal_histName = "sagitta/sagitta_theNominal"
Gaudi::Property< float > m_biasD0 {this, "biasD0", 0.f, "Overall d0 bias (mm)."}
Gaudi::Property< float > m_biasZ0 {this, "biasZ0", 0.f, "Overall z0 bias (mm)."}
Gaudi::Property< float > m_biasQoverPsagitta {this, "biasQoverPsagitta", 0.f, "Overall QoverP sagitta bias (TeV^-1)."}
Gaudi::Property< bool > m_applyD0Bias {this, "applyD0Bias", true, "Whether to apply the d0 bias from the calibration map."}
Gaudi::Property< bool > m_applyZ0Bias {this, "applyZ0Bias", true, "Whether to apply the z0 bias from the calibration map."}
Gaudi::Property< bool > m_applyQoverPBias {this, "applyQoverPBias", true, "Whether to apply the q/p sagitta bias from the calibration map."}
Gaudi::Property< bool > m_isMC {this, "isMC", true}
Gaudi::Property< uint32_t > m_runNumber {this, "runNumber", 0, "Manually override the run number used to select the calibration period."}
Gaudi::Property< std::vector< std::string > > m_calibFiles {this, "calibFiles", {}, "Calibration files, one per run period."}
Gaudi::Property< std::vector< unsigned int > > m_runNumberBounds {this, "runNumberBounds", {}, "Run number boundaries: {lower0, upper0, upper1, ...}. May be omitted when only one calibration file is configured."}
SG::ReadHandleKey< xAOD::EventInfom_evtInfoKey {this, "EvtInfo", "EventInfo", "EventInfo name"}
std::unordered_map< CP::SystematicSet, CP::SystematicSetm_sysFilterMap
const CP::SystematicSetm_activeSysts = nullptr

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

virtual ASG_TOOL_CLASS(InDetTrackBiasingTool, InDet::IInDetTrackBiasingTool) public ~InDetTrackBiasingTool ()
virtual StatusCode initialize () override
virtual void prepare () override
virtual CP::CorrectionCode applyCorrection (xAOD::TrackParticle &track) override
 Computes the tracks origin.
virtual CP::CorrectionCode correctedCopy (const xAOD::TrackParticle &in, xAOD::TrackParticle *&out) override
virtual CP::CorrectionCode applyContainerCorrection (xAOD::TrackParticleContainer &cont) override
virtual CP::CorrectionCode applyCorrection (xAOD::TrackParticle &track, const CP::SystematicSet &syst) const override
 Reentrant biasing (see IInDetTrackBiasingTool).
virtual bool isAffectedBySystematic (const CP::SystematicVariation &) const override
 returns: whether the tool is affected by the systematic
virtual CP::SystematicSet affectingSystematics () const override
 returns: list of systematics this tool can be affected by
virtual CP::SystematicSet recommendedSystematics () const override
 returns: list of recommended systematics to use with this tool
virtual StatusCode applySystematicVariation (const CP::SystematicSet &) override
 configure the tool to apply a given list of systematic variations
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

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

This class biases tracks to emulate systematic distortions of the tracking geometry.

Author
Pawel Bruckman (pawel.nosp@m..bru.nosp@m.ckman.nosp@m..de..nosp@m.renst.nosp@m.rom@.nosp@m.cern..nosp@m.ch)
Felix Clark (micha.nosp@m.el.r.nosp@m.yan.c.nosp@m.lark.nosp@m.@cern.nosp@m..ch)

In data, it corrects the biases. In simulation, it applys the biases in the same direction they are observed in the data.

Author
Pawel Bruckman (pawel.nosp@m..bru.nosp@m.ckman.nosp@m..de..nosp@m.renst.nosp@m.rom@.nosp@m.cern..nosp@m.ch)
Felix Clark (micha.nosp@m.el.r.nosp@m.yan.c.nosp@m.lark.nosp@m.@cern.nosp@m..ch)

Definition at line 39 of file InDetTrackBiasingTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

◆ xAODContainerType

description: the type of xAOD container used

Definition at line 46 of file CorrectionTool.h.

◆ xAODObjectType

description: the type of xAOD object used

Definition at line 48 of file CorrectionTool.h.

Member Function Documentation

◆ affectingSystematics()

CP::SystematicSet InDet::InDetTrackBiasingTool::affectingSystematics ( ) const
overrideprivatevirtual

returns: list of systematics this tool can be affected by

Implements InDet::IInDetTrackBiasingTool.

Definition at line 236 of file InDetTrackBiasingTool.cxx.

237 {
238 CP::SystematicSet result;
239 if (m_applyD0Bias) result.insert(InDet::TrackSystematicMap.at(TRK_BIAS_D0_WM));
240 if (m_applyZ0Bias) result.insert(InDet::TrackSystematicMap.at(TRK_BIAS_Z0_WM));
241 if (m_applyQoverPBias) result.insert(InDet::TrackSystematicMap.at(TRK_BIAS_QOVERP_SAGITTA_WM));
242 return result;
243 }
Gaudi::Property< bool > m_applyQoverPBias
Gaudi::Property< bool > m_applyZ0Bias
Gaudi::Property< bool > m_applyD0Bias
mapped_type at(key_type key) const
Look up an element in the map.

◆ applyBiasWithSyst()

CP::CorrectionCode InDet::InDetTrackBiasingTool::applyBiasWithSyst ( xAOD::TrackParticle & track,
const CP::SystematicSet & filtered ) const
protected

Core biasing logic; delegates from both applyCorrection overloads.

Definition at line 77 of file InDetTrackBiasingTool.cxx.

79 {
80 if ( !m_isMC ) {
81 ATH_MSG_ERROR( "InDetTrackBiasingTool should only be run on MC." );
83 }
84
85 // determine which run number to use
86 SG::ReadHandle<xAOD::EventInfo> eventInfo(m_evtInfoKey);
87 static const SG::AuxElement::Accessor<unsigned int> randomRunNumber("RandomRunNumber");
88 auto runNumber = randomRunNumber(*eventInfo);
89
90 if (runNumber <= 0) {
91 ATH_MSG_WARNING( "Run number not set." );
92 }
93 // 5 TeV and heavy-ion runs have no biasing maps
94 if (runNumber >= 286282 && runNumber <= 287931) {
95 ATH_MSG_ERROR( "The 5 TeV and heavy ion runs do not have biasing maps for release 22. "
96 "Contact the tracking CP group to discuss the derivation of these maps." );
98 }
99
100 // find which configured period this run belongs to
101 size_t periodIdx = m_calibFiles.size(); // sentinel: no match
102 if (m_runNumberBounds.empty()) {
103 periodIdx = 0; // single period, accept all run numbers
104 } else {
105 for (size_t i = 0; i + 1 < m_runNumberBounds.size(); ++i) {
106 if (runNumber > m_runNumberBounds[i] && runNumber <= m_runNumberBounds[i+1]) {
107 periodIdx = i;
108 break;
109 }
110 }
111 }
112 if (periodIdx >= m_calibFiles.size()) {
113 ATH_MSG_ERROR( "Run number = " << runNumber << " does not fall within any configured calibration period." );
115 }
116
117 // select histograms for the matched period
118 TH2* biasD0Histogram = m_biasD0Histograms[periodIdx].get();
119 TH2* biasZ0Histogram = m_biasZ0Histograms[periodIdx].get();
120 TH2* biasQoverPsagittaHistogram = m_biasQoverPsagittaHistograms[periodIdx].get();
121
122 bool doD0Bias = m_applyD0Bias && biasD0Histogram != nullptr;
123 bool doZ0Bias = m_applyZ0Bias && biasZ0Histogram != nullptr;
124 bool doQoverPBias = m_applyQoverPBias && biasQoverPsagittaHistogram != nullptr;
125
126 if (m_applyD0Bias && !biasD0Histogram) ATH_MSG_WARNING( "d0 bias histogram is nullptr. Will not perform d0 bias." );
127 if (m_applyZ0Bias && !biasZ0Histogram) ATH_MSG_WARNING( "z0 bias histogram is nullptr. Will not perform z0 bias." );
128 if (m_applyQoverPBias && !biasQoverPsagittaHistogram) ATH_MSG_WARNING( "q/p bias histogram is nullptr. Will not perform q/p sagitta bias." );
129
130 // declare static accessors to avoid repeating string lookups
131 static const SG::AuxElement::Accessor< float > accD0( "d0" );
132 static const SG::AuxElement::Accessor< float > accZ0( "z0" );
133 static const SG::AuxElement::Accessor< float > accQOverP( "qOverP" );
134
135 const float phi = track.phi0();
136 const float eta = track.eta();
137
138 // do the biasing
139 // Always apply the correction to the nominal; undo it for systematic variations
140 if ( doD0Bias ) {
141 const float d0Corr = readHistogram(m_biasD0, biasD0Histogram, phi, eta);
142 accD0( track ) += d0Corr;
143 if ( isActive( TRK_BIAS_D0_WM, filtered ) ) {
144 accD0( track ) -= d0Corr;
145 }
146 }
147 if ( doZ0Bias ) {
148 const float z0Corr = readHistogram(m_biasZ0, biasZ0Histogram, phi, eta);
149 accZ0( track ) += z0Corr;
150 if ( isActive( TRK_BIAS_Z0_WM, filtered ) ) {
151 accZ0( track ) -= z0Corr;
152 }
153 }
154 if ( doQoverPBias ) {
155 auto sinTheta = 1.0 / std::cosh(eta);
156 const float qOverPCorr = 1.e-6*sinTheta*readHistogram(m_biasQoverPsagitta, biasQoverPsagittaHistogram, phi, eta);
157 accQOverP( track ) += qOverPCorr;
158 if ( isActive( TRK_BIAS_QOVERP_SAGITTA_WM, filtered ) ) {
159 accQOverP( track ) -= qOverPCorr;
160 }
161 }
162
164 }
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
@ Error
Some error happened during the object correction.
@ Ok
The correction was done successfully.
float readHistogram(float fDefault, TH2 *histogram, float phi, float eta) const
Gaudi::Property< float > m_biasQoverPsagitta
SG::ReadHandleKey< xAOD::EventInfo > m_evtInfoKey
std::vector< std::unique_ptr< TH2 > > m_biasD0Histograms
Gaudi::Property< std::vector< std::string > > m_calibFiles
Gaudi::Property< float > m_biasZ0
Gaudi::Property< float > m_biasD0
Gaudi::Property< std::vector< unsigned int > > m_runNumberBounds
std::vector< std::unique_ptr< TH2 > > m_biasQoverPsagittaHistograms
std::vector< std::unique_ptr< TH2 > > m_biasZ0Histograms

◆ applyContainerCorrection() [1/2]

effects: apply the correction to all the members of the container returns: overall success rationale: this will apply the correction to every single member (even if some members fail) rationale: the interface class provides a default implementation in terms of applyCorrection, that the derived classes can override for efficiency

◆ applyContainerCorrection() [2/2]

CP::CorrectionCode InDet::InDetTrackBiasingTool::applyContainerCorrection ( xAOD::TrackParticleContainer & cont)
overrideprivatevirtual

Implements InDet::IInDetTrackBiasingTool.

Definition at line 226 of file InDetTrackBiasingTool.cxx.

227 {
228 return TrackCorrTool_t::applyContainerCorrection(cont);
229 }

◆ applyCorrection() [1/3]

effects: apply the correction and store the output in the object returns: success

◆ applyCorrection() [2/3]

CP::CorrectionCode InDet::InDetTrackBiasingTool::applyCorrection ( xAOD::TrackParticle & track)
overrideprivatevirtual

Computes the tracks origin.

Implements InDet::IInDetTrackBiasingTool.

Definition at line 61 of file InDetTrackBiasingTool.cxx.

61 {
62 if (m_activeSysts == nullptr) {
63 ATH_MSG_ERROR( "applySystematicVariation() was not called before applyCorrection()." );
65 }
66 return applyBiasWithSyst(track, *m_activeSysts);
67 }
CP::CorrectionCode applyBiasWithSyst(xAOD::TrackParticle &track, const CP::SystematicSet &filtered) const
Core biasing logic; delegates from both applyCorrection overloads.

◆ applyCorrection() [3/3]

CP::CorrectionCode InDet::InDetTrackBiasingTool::applyCorrection ( xAOD::TrackParticle & track,
const CP::SystematicSet & syst ) const
overrideprivatevirtual

Reentrant biasing (see IInDetTrackBiasingTool).

Implements InDet::IInDetTrackBiasingTool.

Definition at line 69 of file InDetTrackBiasingTool.cxx.

71 {
72 const CP::SystematicSet* filtered = getFilteredSysts(syst);
73 if (filtered == nullptr) return CP::CorrectionCode::Error;
74 return applyBiasWithSyst(track, *filtered);
75 }
const CP::SystematicSet * getFilteredSysts(const CP::SystematicSet &syst) const
Look up the pre-filtered systematic set for syst.

◆ applySystematicVariation()

StatusCode InDet::InDetTrackBiasingTool::applySystematicVariation ( const CP::SystematicSet & systs)
overrideprivatevirtual

configure the tool to apply a given list of systematic variations

Implements InDet::IInDetTrackBiasingTool.

Definition at line 250 of file InDetTrackBiasingTool.cxx.

251 {
253 }
virtual StatusCode applySystematicVariation(const CP::SystematicSet &) override
configure the tool to apply a given list of systematic variations

◆ correctedCopy() [1/2]

effects: make a clone of the input object, apply the correction to it and store the output in the object returns: success rationale: the interface class provides a default implementation in terms of applyCorrection, that the derived classes can override for efficiency

◆ correctedCopy() [2/2]

CP::CorrectionCode InDet::InDetTrackBiasingTool::correctedCopy ( const xAOD::TrackParticle & in,
xAOD::TrackParticle *& out )
overrideprivatevirtual

Implements InDet::IInDetTrackBiasingTool.

Definition at line 220 of file InDetTrackBiasingTool.cxx.

222 {
223 return TrackCorrTool_t::correctedCopy(in, out);
224 }

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::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< AlgTool > >::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< AlgTool > >::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< AlgTool > >::evtStore ( )
inlineinherited

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

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::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

◆ getFile()

std::unique_ptr< TFile > InDet::InDetTrackSystematicsTool::getFile ( const std::string & filename) const
protectedinherited

open and return a file with the given name.

Definition at line 122 of file InDetTrackSystematicsTool.cxx.

123 {
124 // now the files are stored in the calibration area
125 // filename is configurable in each tool and should include the path starting from the package name
126 // but defaults to recommendation for current release
127 std::string filenameWithFullPath = PathResolverFindCalibFile(filename);
128
129 return std::unique_ptr<TFile>(TFile::Open(filenameWithFullPath.data(), "READ"));;
130 }
std::string PathResolverFindCalibFile(const std::string &logical_file_name)

◆ getFilteredSysts()

const CP::SystematicSet * InDet::InDetTrackSystematicsTool::getFilteredSysts ( const CP::SystematicSet & syst) const
protectedinherited

Look up the pre-filtered systematic set for syst.

Returns nullptr if syst was never passed to applySystematicVariation() (e.g. not called during initialize()). Safe to call concurrently from execute() since m_sysFilterMap is read-only after initialize().

Definition at line 100 of file InDetTrackSystematicsTool.cxx.

102 {
103 // m_sysFilterMap is populated during initialize() (single-threaded)
104 // and is read-only during execute(), so no lock is required.
105 auto it = m_sysFilterMap.find(syst);
106 if (it == m_sysFilterMap.end()) {
107 ATH_MSG_ERROR( "Systematic set '" << syst.name()
108 << "' was not pre-registered. "
109 "Call applySystematicVariation() during initialize()." );
110 return nullptr;
111 }
112 return &it->second;
113 }
std::string name() const
returns: the systematics joined into a single string.
std::unordered_map< CP::SystematicSet, CP::SystematicSet > m_sysFilterMap

◆ getKey()

SG::sgkey_t asg::AsgTool::getKey ( const void * ptr) const
inherited

Get the (hashed) key of an object that is in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the SG::sgkey_t key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getName
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The hashed key of the object in the store. If not found, an invalid (zero) key.

Definition at line 119 of file AsgTool.cxx.

119 {
120
121#ifdef XAOD_STANDALONE
122 // In case we use @c xAOD::TEvent, we have a direct function call
123 // for this.
124 return evtStore()->event()->getKey( ptr );
125#else
126 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
127 return ( proxy == nullptr ? 0 : proxy->sgkey() );
128#endif // XAOD_STANDALONE
129 }
ServiceHandle< StoreGateSvc > & evtStore()

◆ getName()

const std::string & asg::AsgTool::getName ( const void * ptr) const
inherited

Get the name of an object that is / should be in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the std::string name for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getKey
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The string name of the object in the store. If not found, an empty string.

Definition at line 106 of file AsgTool.cxx.

106 {
107
108#ifdef XAOD_STANDALONE
109 // In case we use @c xAOD::TEvent, we have a direct function call
110 // for this.
111 return evtStore()->event()->getName( ptr );
112#else
113 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
114 static const std::string dummy = "";
115 return ( proxy == nullptr ? dummy : proxy->name() );
116#endif // XAOD_STANDALONE
117 }

◆ getProperty()

template<class T>
const T * asg::AsgTool::getProperty ( const std::string & name) const
inherited

Get one of the tool's properties.

◆ initHistograms()

StatusCode InDet::InDetTrackBiasingTool::initHistograms ( )
protected

Definition at line 166 of file InDetTrackBiasingTool.cxx.

167 {
168
169 if (m_calibFiles.empty()) {
170 ATH_MSG_ERROR( "No calibration files configured. Set 'calibFiles' and (for multiple periods) "
171 "'runNumberBounds' for the relevant MC campaign via the python configuration." );
172 return StatusCode::FAILURE;
173 }
174 if (!m_runNumberBounds.empty() && m_runNumberBounds.size() != m_calibFiles.size() + 1) {
175 ATH_MSG_ERROR( "'runNumberBounds' (size " << m_runNumberBounds.size() << ") must have "
176 "calibFiles.size() + 1 = " << (m_calibFiles.size() + 1) << " entries." );
177 return StatusCode::FAILURE;
178 }
179 if (m_runNumberBounds.empty() && m_calibFiles.size() > 1) {
180 ATH_MSG_ERROR( "'runNumberBounds' must be set when multiple calibration files are configured." );
181 return StatusCode::FAILURE;
182 }
183
184 for (size_t i = 0; i < m_calibFiles.size(); ++i) {
185 if (m_runNumberBounds.empty()) {
186 ATH_MSG_INFO( "Calibration period 0 (all run numbers): file: "
188 } else {
189 ATH_MSG_INFO( "Calibration period " << i << ": run range ["
190 << m_runNumberBounds[i] << ", " << m_runNumberBounds[i+1]
191 << "], file: " << PathResolverFindCalibFile(m_calibFiles[i]) );
192 }
193 m_biasD0Histograms.emplace_back(nullptr);
195 m_biasZ0Histograms.emplace_back(nullptr);
197 m_biasQoverPsagittaHistograms.emplace_back(nullptr);
199 }
200
201 return StatusCode::SUCCESS;
202 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
StatusCode initObject(std::unique_ptr< T > &obj, const std::string &rootFileName, const std::string &objName) const
a function to initialize an object from a root file

◆ initialize()

StatusCode InDet::InDetTrackBiasingTool::initialize ( void )
overrideprivatevirtual

Implements InDet::IInDetTrackBiasingTool.

Definition at line 29 of file InDetTrackBiasingTool.cxx.

30 {
31 if (m_biasD0 != 0.) {
32 ATH_MSG_INFO( "overall d0 bias added = " << m_biasD0
33 << " mm (not part of an official recommendation)" );
34 }
35 if (m_biasZ0 != 0.) {
36 ATH_MSG_INFO( "overall z0 bias added = " << m_biasZ0
37 << " mm (not part of an official recommendation)" );
38 }
39 if (m_biasQoverPsagitta != 0.) {
40 ATH_MSG_INFO( "overall QoverP sagitta bias added = " << m_biasQoverPsagitta
41 << " TeV^-1 (not part of an official recommendation)" );
42 }
43
44 if (m_runNumber > 0) {
45 ATH_MSG_WARNING( "Using manually-set run number (" << m_runNumber << ") to determine which calibration file to use." );
46 }
47
49
50 ATH_CHECK(m_evtInfoKey.initialize());
51
53
54 return StatusCode::SUCCESS;
55 }
Gaudi::Property< uint32_t > m_runNumber
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.

◆ initObject()

template<class T>
StatusCode InDet::InDetTrackSystematicsTool::initObject ( std::unique_ptr< T > & obj,
const std::string & rootFileName,
const std::string & objName ) const
protectedinherited

a function to initialize an object from a root file

Definition at line 77 of file InDetTrackSystematicsTool.h.

78{
79 if (obj != nullptr) ATH_MSG_WARNING( obj->GetName() << " is not null, yet we are now attempting to initialize from " << rootFileName );
80 std::unique_ptr<TFile> F = getFile(rootFileName);
81 if(!F || F->IsZombie()) {
82 ATH_MSG_ERROR( "Could not open file " << rootFileName );
83 return StatusCode::FAILURE;
84 }
85 T* tempObj = nullptr;
86 F->GetObject(objName.data(), tempObj);
87 if(tempObj==nullptr) {
88 ATH_MSG_ERROR( "Could not retrieve " << objName << " from file " << rootFileName );
89 return StatusCode::FAILURE;
90 }
91 obj = std::unique_ptr<T>(static_cast<T*>(tempObj->Clone()));
92 obj->SetDirectory(0);
93 F->Clear();
94 F->Close();
95 return StatusCode::SUCCESS;
96}
#define F(x, y, z)
Definition MD5.cxx:112
std::unique_ptr< TFile > getFile(const std::string &) const
open and return a file with the given name.
unsigned long long T

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::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.

◆ isActive() [1/2]

bool InDet::InDetTrackSystematicsTool::isActive ( TrackSystematic syst,
const CP::SystematicSet & filtered ) const
protectedinherited

Reentrant variant of isActive(): checks syst against a caller-provided filtered set rather than the shared m_activeSysts.

Definition at line 115 of file InDetTrackSystematicsTool.cxx.

117 {
118 return filtered.find(InDet::TrackSystematicMap.at(syst))
119 != filtered.end();
120 }
const_iterator end() const
description: const iterator to the end of the set
iterator find(const SystematicVariation &sys) const
description: find an element in the set

◆ isActive() [2/2]

bool InDet::InDetTrackSystematicsTool::isActive ( TrackSystematic syst) const
protectedinherited

Definition at line 89 of file InDetTrackSystematicsTool.cxx.

90 {
91 if (m_activeSysts == nullptr) {
92 ATH_MSG_DEBUG( "applySystematicsVariation() has not been successfully called." );
93 return false;
94 }
95 const auto it_syst = m_activeSysts->find(InDet::TrackSystematicMap.at(syst));
96 return it_syst != m_activeSysts->end();
97 }
#define ATH_MSG_DEBUG(x)

◆ isAffectedBySystematic()

bool InDet::InDetTrackBiasingTool::isAffectedBySystematic ( const CP::SystematicVariation & syst) const
overrideprivatevirtual

returns: whether the tool is affected by the systematic

Implements InDet::IInDetTrackBiasingTool.

Definition at line 231 of file InDetTrackBiasingTool.cxx.

232 {
234 }
virtual bool isAffectedBySystematic(const CP::SystematicVariation &) const override
returns: whether the tool is affected by the systematic

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg_level_name()

const std::string & asg::AsgTool::msg_level_name ( ) const
inherited

A deprecated function for getting the message level's name.

Instead of using this, weirdly named function, user code should get the string name of the current minimum message level (in case they really need it...), with:

MSG::name( msg().level() )

This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.

Returns
The string name of the current minimum message level that's printed

Definition at line 101 of file AsgTool.cxx.

101 {
102
103 return MSG::name( msg().level() );
104 }
MsgStream & msg() const
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition MsgLevel.cxx:19

◆ msgLvl()

bool AthCommonMsg< AlgTool >::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< AlgTool > >::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.

◆ prepare()

virtual void InDet::InDetTrackBiasingTool::prepare ( )
inlineoverrideprivatevirtual

Implements InDet::IInDetTrackBiasingTool.

Definition at line 54 of file InDetTrackBiasingTool.h.

54{};

◆ print()

◆ readHistogram()

float InDet::InDetTrackBiasingTool::readHistogram ( float fDefault,
TH2 * histogram,
float phi,
float eta ) const
protected

Definition at line 204 of file InDetTrackBiasingTool.cxx.

204 {
205 if (histogram == nullptr) {
206 ATH_MSG_ERROR( "Configuration histogram is invalid. Check the run number and systematic configuration combination.");
207 throw std::runtime_error( "invalid configuration" );
208 }
209
210 // safety measure:
211 if( eta>2.499 ) eta= 2.499;
212 if( eta<-2.499 ) eta=-2.499;
213
214 float f = histogram->GetBinContent(histogram->FindBin(eta, phi));
215 f += fDefault; // should be zero unless a manual override is provided
216
217 return f;
218 }
std::string histogram
Definition chains.cxx:52

◆ recommendedSystematics()

CP::SystematicSet InDet::InDetTrackBiasingTool::recommendedSystematics ( ) const
overrideprivatevirtual

returns: list of recommended systematics to use with this tool

Implements InDet::IInDetTrackBiasingTool.

Definition at line 245 of file InDetTrackBiasingTool.cxx.

246 {
248 }
virtual CP::SystematicSet recommendedSystematics() const override
returns: list of recommended systematics to use with this tool

◆ 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< AlgTool > >::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< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::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< AlgTool > >::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 }
std::vector< SG::VarHandleKeyArray * > m_vhka

◆ ~InDetTrackBiasingTool()

InDet::InDetTrackBiasingTool::~InDetTrackBiasingTool ( )
privatevirtual

Definition at line 57 of file InDetTrackBiasingTool.cxx.

57 {
58 m_runNumber = -1;
59 }

Member Data Documentation

◆ m_activeSysts

const CP::SystematicSet* InDet::InDetTrackSystematicsTool::m_activeSysts = nullptr
protectedinherited

Definition at line 54 of file InDetTrackSystematicsTool.h.

◆ m_applyD0Bias

Gaudi::Property<bool> InDet::InDetTrackBiasingTool::m_applyD0Bias {this, "applyD0Bias", true, "Whether to apply the d0 bias from the calibration map."}
protected

Definition at line 98 of file InDetTrackBiasingTool.h.

98{this, "applyD0Bias", true, "Whether to apply the d0 bias from the calibration map."};

◆ m_applyQoverPBias

Gaudi::Property<bool> InDet::InDetTrackBiasingTool::m_applyQoverPBias {this, "applyQoverPBias", true, "Whether to apply the q/p sagitta bias from the calibration map."}
protected

Definition at line 100 of file InDetTrackBiasingTool.h.

100{this, "applyQoverPBias", true, "Whether to apply the q/p sagitta bias from the calibration map."};

◆ m_applyZ0Bias

Gaudi::Property<bool> InDet::InDetTrackBiasingTool::m_applyZ0Bias {this, "applyZ0Bias", true, "Whether to apply the z0 bias from the calibration map."}
protected

Definition at line 99 of file InDetTrackBiasingTool.h.

99{this, "applyZ0Bias", true, "Whether to apply the z0 bias from the calibration map."};

◆ m_biasD0

Gaudi::Property<float> InDet::InDetTrackBiasingTool::m_biasD0 {this, "biasD0", 0.f, "Overall d0 bias (mm)."}
protected

Definition at line 94 of file InDetTrackBiasingTool.h.

94{this, "biasD0", 0.f, "Overall d0 bias (mm)."};

◆ m_biasD0Histograms

std::vector<std::unique_ptr<TH2> > InDet::InDetTrackBiasingTool::m_biasD0Histograms
protected

Definition at line 85 of file InDetTrackBiasingTool.h.

◆ m_biasQoverPsagitta

Gaudi::Property<float> InDet::InDetTrackBiasingTool::m_biasQoverPsagitta {this, "biasQoverPsagitta", 0.f, "Overall QoverP sagitta bias (TeV^-1)."}
protected

Definition at line 96 of file InDetTrackBiasingTool.h.

96{this, "biasQoverPsagitta", 0.f, "Overall QoverP sagitta bias (TeV^-1)."};

◆ m_biasQoverPsagittaHistograms

std::vector<std::unique_ptr<TH2> > InDet::InDetTrackBiasingTool::m_biasQoverPsagittaHistograms
protected

Definition at line 87 of file InDetTrackBiasingTool.h.

◆ m_biasZ0

Gaudi::Property<float> InDet::InDetTrackBiasingTool::m_biasZ0 {this, "biasZ0", 0.f, "Overall z0 bias (mm)."}
protected

Definition at line 95 of file InDetTrackBiasingTool.h.

95{this, "biasZ0", 0.f, "Overall z0 bias (mm)."};

◆ m_biasZ0Histograms

std::vector<std::unique_ptr<TH2> > InDet::InDetTrackBiasingTool::m_biasZ0Histograms
protected

Definition at line 86 of file InDetTrackBiasingTool.h.

◆ m_calibFiles

Gaudi::Property<std::vector<std::string> > InDet::InDetTrackBiasingTool::m_calibFiles {this, "calibFiles", {}, "Calibration files, one per run period."}
protected

Definition at line 109 of file InDetTrackBiasingTool.h.

109{this, "calibFiles", {}, "Calibration files, one per run period."};

◆ m_d0_nominal_histName

std::string InDet::InDetTrackBiasingTool::m_d0_nominal_histName = "d0/d0_theNominal"
protected

Definition at line 90 of file InDetTrackBiasingTool.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtInfoKey

SG::ReadHandleKey<xAOD::EventInfo> InDet::InDetTrackBiasingTool::m_evtInfoKey {this, "EvtInfo", "EventInfo", "EventInfo name"}
protected

Definition at line 112 of file InDetTrackBiasingTool.h.

112{this, "EvtInfo", "EventInfo", "EventInfo name"};

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 390 of file AthCommonDataStore.h.

◆ m_isMC

Gaudi::Property<bool> InDet::InDetTrackBiasingTool::m_isMC {this, "isMC", true}
protected

Definition at line 102 of file InDetTrackBiasingTool.h.

102{this, "isMC", true};

◆ m_runNumber

Gaudi::Property<uint32_t> InDet::InDetTrackBiasingTool::m_runNumber {this, "runNumber", 0, "Manually override the run number used to select the calibration period."}
protected

Definition at line 103 of file InDetTrackBiasingTool.h.

103{this, "runNumber", 0, "Manually override the run number used to select the calibration period."};

◆ m_runNumberBounds

Gaudi::Property<std::vector<unsigned int> > InDet::InDetTrackBiasingTool::m_runNumberBounds {this, "runNumberBounds", {}, "Run number boundaries: {lower0, upper0, upper1, ...}. May be omitted when only one calibration file is configured."}
protected

Definition at line 110 of file InDetTrackBiasingTool.h.

110{this, "runNumberBounds", {}, "Run number boundaries: {lower0, upper0, upper1, ...}. May be omitted when only one calibration file is configured."};

◆ m_sagitta_nominal_histName

std::string InDet::InDetTrackBiasingTool::m_sagitta_nominal_histName = "sagitta/sagitta_theNominal"
protected

Definition at line 92 of file InDetTrackBiasingTool.h.

◆ m_sysFilterMap

std::unordered_map< CP::SystematicSet, CP::SystematicSet > InDet::InDetTrackSystematicsTool::m_sysFilterMap
protectedinherited

Definition at line 52 of file InDetTrackSystematicsTool.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.

◆ m_z0_nominal_histName

std::string InDet::InDetTrackBiasingTool::m_z0_nominal_histName = "z0/z0_theNominal"
protected

Definition at line 91 of file InDetTrackBiasingTool.h.


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