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 ()
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
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::vector< std::unique_ptr< TH2 > > m_biasD0HistErrors
std::vector< std::unique_ptr< TH2 > > m_biasZ0HistErrors
std::vector< std::unique_ptr< TH2 > > m_biasQoverPsagittaHistErrors
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"
std::string m_d0_uncertainty_histName = "d0/d0_theUncertainty"
std::string m_z0_uncertainty_histName = "z0/z0_theUncertainty"
std::string m_sagitta_uncertainty_histName = "sagitta/sagitta_theUncertainty"
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 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 232 of file InDetTrackBiasingTool.cxx.

233 {
234 CP::SystematicSet result;
235 if (m_applyD0Bias) result.insert(InDet::TrackSystematicMap.at(TRK_BIAS_D0_WM));
236 if (m_applyZ0Bias) result.insert(InDet::TrackSystematicMap.at(TRK_BIAS_Z0_WM));
237 if (m_applyQoverPBias) result.insert(InDet::TrackSystematicMap.at(TRK_BIAS_QOVERP_SAGITTA_WM));
238 return result;
239 }
Gaudi::Property< bool > m_applyQoverPBias
Gaudi::Property< bool > m_applyZ0Bias
Gaudi::Property< bool > m_applyD0Bias

◆ applyContainerCorrection() [1/2]

CorrectionCode CP::CorrectionTool< xAOD::TrackParticleContainer >::applyContainerCorrection ( xAODContainerType & inputContainer)
inherited

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 222 of file InDetTrackBiasingTool.cxx.

223 {
224 return TrackCorrTool_t::applyContainerCorrection(cont);
225 }

◆ applyCorrection() [1/2]

virtual CorrectionCode CP::CorrectionTool< xAOD::TrackParticleContainer >::applyCorrection ( xAODObjectType & inputObject)
pure virtualinherited

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

◆ applyCorrection() [2/2]

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
63 // determine which run number to use
64 SG::ReadHandle<xAOD::EventInfo> eventInfo(m_evtInfoKey);
65 static const SG::AuxElement::Accessor<unsigned int> randomRunNumber("RandomRunNumber");
66 auto runNumber = m_isMC ? randomRunNumber(*eventInfo) : eventInfo->runNumber();
67
68 if (runNumber <= 0) {
69 ATH_MSG_WARNING( "Run number not set." );
70 }
71 // 5 TeV and heavy-ion runs have no biasing maps
72 if (runNumber >= 286282 && runNumber <= 287931) {
73 ATH_MSG_ERROR( "The 5 TeV and heavy ion runs do not have biasing maps for release 22. "
74 "Contact the tracking CP group to discuss the derivation of these maps." );
76 }
77
78 // find which configured period this run belongs to
79 size_t periodIdx = m_calibFiles.size(); // sentinel: no match
80 if (m_runNumberBounds.empty()) {
81 periodIdx = 0; // single period, accept all run numbers
82 } else {
83 for (size_t i = 0; i + 1 < m_runNumberBounds.size(); ++i) {
84 if (runNumber > m_runNumberBounds[i] && runNumber <= m_runNumberBounds[i+1]) {
85 periodIdx = i;
86 break;
87 }
88 }
89 }
90 if (periodIdx >= m_calibFiles.size()) {
91 ATH_MSG_ERROR( "Run number = " << runNumber << " does not fall within any configured calibration period." );
93 }
94
95 // select histograms for the matched period
96 TH2* biasD0Histogram = m_biasD0Histograms[periodIdx].get();
97 TH2* biasZ0Histogram = m_biasZ0Histograms[periodIdx].get();
98 TH2* biasQoverPsagittaHistogram = m_biasQoverPsagittaHistograms[periodIdx].get();
99 TH2* biasD0HistError = m_biasD0HistErrors[periodIdx].get();
100 TH2* biasZ0HistError = m_biasZ0HistErrors[periodIdx].get();
101 TH2* biasQoverPsagittaHistError = m_biasQoverPsagittaHistErrors[periodIdx].get();
102
103 bool doD0Bias = m_applyD0Bias && biasD0Histogram != nullptr;
104 bool doZ0Bias = m_applyZ0Bias && biasZ0Histogram != nullptr;
105 bool doQoverPBias = m_applyQoverPBias && biasQoverPsagittaHistogram != nullptr;
106
107 if (m_applyD0Bias && !biasD0Histogram) ATH_MSG_WARNING( "d0 bias histogram is nullptr. Will not perform d0 bias." );
108 if (m_applyZ0Bias && !biasZ0Histogram) ATH_MSG_WARNING( "z0 bias histogram is nullptr. Will not perform z0 bias." );
109 if (m_applyQoverPBias && !biasQoverPsagittaHistogram) ATH_MSG_WARNING( "q/p bias histogram is nullptr. Will not perform q/p sagitta bias." );
110
111 // declare static accessors to avoid repeating string lookups
112 static const SG::AuxElement::Accessor< float > accD0( "d0" );
113 static const SG::AuxElement::Accessor< float > accZ0( "z0" );
114 static const SG::AuxElement::Accessor< float > accQOverP( "qOverP" );
115
116 const float phi = track.phi0();
117 const float eta = track.eta();
118
119 // do the biasing
120 if ( doD0Bias ) {
121 bool d0WmActive = isActive( TRK_BIAS_D0_WM );
122 if ( !m_isMC || d0WmActive ) {
123 accD0( track ) += readHistogram(m_biasD0, biasD0Histogram, phi, eta);
124 if ( !m_isMC && d0WmActive ) {
125 accD0( track ) += readHistogram(0., biasD0HistError, phi, eta);
126 }
127 }
128 }
129 if ( doZ0Bias ) {
130 bool z0WmActive = isActive( TRK_BIAS_Z0_WM );
131 if ( !m_isMC || z0WmActive ) {
132 accZ0( track ) += readHistogram(m_biasZ0, biasZ0Histogram, phi, eta);
133 if ( !m_isMC && z0WmActive ) {
134 accZ0( track ) += readHistogram(0., biasZ0HistError, phi, eta);
135 }
136 }
137 }
138 if ( doQoverPBias ) {
139 bool qOverPWmActive = isActive( TRK_BIAS_QOVERP_SAGITTA_WM );
140 if ( !m_isMC || qOverPWmActive ) {
141 auto sinTheta = 1.0 / std::cosh(eta);
142 // readHistogram flips the sign of the correction if m_isMC is true
143 accQOverP( track ) += 1.e-6*sinTheta*readHistogram(m_biasQoverPsagitta, biasQoverPsagittaHistogram, phi, eta);
144 if ( !m_isMC && qOverPWmActive ) {
145 accQOverP( track ) += 1.e-6*sinTheta*readHistogram(0., biasQoverPsagittaHistError, phi, eta);
146 }
147 }
148 }
149
151 }
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_biasZ0HistErrors
std::vector< std::unique_ptr< TH2 > > m_biasD0Histograms
std::vector< std::unique_ptr< TH2 > > m_biasD0HistErrors
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
std::vector< std::unique_ptr< TH2 > > m_biasQoverPsagittaHistErrors
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:573

◆ 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 246 of file InDetTrackBiasingTool.cxx.

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

◆ correctedCopy() [1/2]

CorrectionCode CP::CorrectionTool< xAOD::TrackParticleContainer >::correctedCopy ( const xAODObjectType & inputObject,
xAODObjectType *& outputObject )
inherited

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 216 of file InDetTrackBiasingTool.cxx.

218 {
219 return TrackCorrTool_t::correctedCopy(in, out);
220 }

◆ 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 99 of file InDetTrackSystematicsTool.cxx.

100 {
101 // now the files are stored in the calibration area
102 // filename is configurable in each tool and should include the path starting from the package name
103 // but defaults to recommendation for current release
104 std::string filenameWithFullPath = PathResolverFindCalibFile(filename);
105
106 return std::unique_ptr<TFile>(TFile::Open(filenameWithFullPath.data(), "READ"));;
107 }
std::string PathResolverFindCalibFile(const std::string &logical_file_name)

◆ 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 153 of file InDetTrackBiasingTool.cxx.

154 {
155
156 if (m_calibFiles.empty()) {
157 ATH_MSG_ERROR( "No calibration files configured. Set 'calibFiles' and (for multiple periods) "
158 "'runNumberBounds' for the relevant MC campaign via the python configuration." );
159 return StatusCode::FAILURE;
160 }
161 if (!m_runNumberBounds.empty() && m_runNumberBounds.size() != m_calibFiles.size() + 1) {
162 ATH_MSG_ERROR( "'runNumberBounds' (size " << m_runNumberBounds.size() << ") must have "
163 "calibFiles.size() + 1 = " << (m_calibFiles.size() + 1) << " entries." );
164 return StatusCode::FAILURE;
165 }
166 if (m_runNumberBounds.empty() && m_calibFiles.size() > 1) {
167 ATH_MSG_ERROR( "'runNumberBounds' must be set when multiple calibration files are configured." );
168 return StatusCode::FAILURE;
169 }
170
171 for (size_t i = 0; i < m_calibFiles.size(); ++i) {
172 if (m_runNumberBounds.empty()) {
173 ATH_MSG_INFO( "Calibration period 0 (all run numbers): file: "
175 } else {
176 ATH_MSG_INFO( "Calibration period " << i << ": run range ["
177 << m_runNumberBounds[i] << ", " << m_runNumberBounds[i+1]
178 << "], file: " << PathResolverFindCalibFile(m_calibFiles[i]) );
179 }
180 m_biasD0Histograms.emplace_back(nullptr);
182 m_biasZ0Histograms.emplace_back(nullptr);
184 m_biasQoverPsagittaHistograms.emplace_back(nullptr);
186 m_biasD0HistErrors.emplace_back(nullptr);
188 m_biasZ0HistErrors.emplace_back(nullptr);
190 m_biasQoverPsagittaHistErrors.emplace_back(nullptr);
192 }
193
194 return StatusCode::SUCCESS;
195 }
#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 64 of file InDetTrackSystematicsTool.h.

65{
66 if (obj != nullptr) ATH_MSG_WARNING( obj->GetName() << " is not null, yet we are now attempting to initialize from " << rootFileName );
67 std::unique_ptr<TFile> F = getFile(rootFileName);
68 if(!F || F->IsZombie()) {
69 ATH_MSG_ERROR( "Could not open file " << rootFileName );
70 return StatusCode::FAILURE;
71 }
72 T* tempObj = nullptr;
73 F->GetObject(objName.data(), tempObj);
74 if(tempObj==nullptr) {
75 ATH_MSG_ERROR( "Could not retrieve " << objName << " from file " << rootFileName );
76 return StatusCode::FAILURE;
77 }
78 obj = std::unique_ptr<T>(static_cast<T*>(tempObj->Clone()));
79 obj->SetDirectory(0);
80 F->Clear();
81 F->Close();
82 return StatusCode::SUCCESS;
83}
#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()

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 227 of file InDetTrackBiasingTool.cxx.

228 {
230 }
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 197 of file InDetTrackBiasingTool.cxx.

197 {
198 if (histogram == nullptr) {
199 ATH_MSG_ERROR( "Configuration histogram is invalid. Check the run number and systematic configuration combination.");
200 throw std::runtime_error( "invalid configuration" );
201 }
202
203 // safety measure:
204 if( eta>2.499 ) eta= 2.499;
205 if( eta<-2.499 ) eta=-2.499;
206
207 // the sign assumes that we apply a correction opposite to what the maps give
208 float f = -1. * histogram->GetBinContent(histogram->FindBin(eta, phi));
209 // apply different correction sign if applying correction to MC
210 if (m_isMC) f = -f;
211 f += fDefault; // should be zero unless a manual override is provided
212
213 return f;
214 }
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 241 of file InDetTrackBiasingTool.cxx.

242 {
244 }
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_biasD0HistErrors

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

Definition at line 82 of file InDetTrackBiasingTool.h.

◆ m_biasD0Histograms

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

Definition at line 79 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_biasQoverPsagittaHistErrors

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

Definition at line 84 of file InDetTrackBiasingTool.h.

◆ m_biasQoverPsagittaHistograms

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

Definition at line 81 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_biasZ0HistErrors

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

Definition at line 83 of file InDetTrackBiasingTool.h.

◆ m_biasZ0Histograms

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

Definition at line 80 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 87 of file InDetTrackBiasingTool.h.

◆ m_d0_uncertainty_histName

std::string InDet::InDetTrackBiasingTool::m_d0_uncertainty_histName = "d0/d0_theUncertainty"
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 89 of file InDetTrackBiasingTool.h.

◆ m_sagitta_uncertainty_histName

std::string InDet::InDetTrackBiasingTool::m_sagitta_uncertainty_histName = "sagitta/sagitta_theUncertainty"
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 88 of file InDetTrackBiasingTool.h.

◆ m_z0_uncertainty_histName

std::string InDet::InDetTrackBiasingTool::m_z0_uncertainty_histName = "z0/z0_theUncertainty"
protected

Definition at line 91 of file InDetTrackBiasingTool.h.


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