ATLAS Offline Software
Loading...
Searching...
No Matches
CP::MuonCalibTool Class Reference

#include <MuonCalibTool.h>

Inheritance diagram for CP::MuonCalibTool:
Collaboration diagram for CP::MuonCalibTool:

Public Member Functions

 MuonCalibTool (const std::string &name)
virtual ~MuonCalibTool ()=default
virtual StatusCode initialize () override
 Dummy implementation of the initialisation function.
void callSingleEvent (columnar::MuonRange muons, columnar::EventInfoId event) const
void callEvents (columnar::EventContextRange events) const override
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
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.

Public Attributes

Gaudi::Property< boolm_skipResolutionCategory {this, "skipResolutionCategory", false, "whether to skip the resolution category variable"}
std::unique_ptr< MCP::MuonCalibToolAccessorsm_acc {std::make_unique<MCP::MuonCalibToolAccessors>(*this)}

Protected Member Functions

MCP::MuonObj convertToMuonObj (columnar::MuonId mu, columnar::EventInfoId evtInfo) const
MCP::MuonObj convertToMuonObj (const xAOD::TrackParticle &inTrk, const int DetType) const
void initializeRandNumbers (MCP::MuonObj &obj, columnar::EventInfoId evtInfo) const
 Decorate all information that's needed to ensure reproducibility of the smearing.
MCP::DataYear getPeriod (bool isData, columnar::EventInfoId evtInfo) 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

SG::ReadHandleKey< xAOD::EventInfom_eventInfo {this, "EventInfoContName", "EventInfo", "event info key"}
Gaudi::Property< boolm_isRun3 {this, "IsRun3Geo", false, "Needed for MuonSelectionTool"}
Gaudi::Property< std::string > m_release {this, "release", "Recs2025_12_11_Run2Run3", "Release"}
Gaudi::Property< std::string > m_sysScheme {this, "systematicScheme", "Corr_Scale", "Systematic scheme to be configured"}
Gaudi::Property< boolm_validationMode {this, "expert_validationMode", false, "Expert only option. Puts the tool in the validation mode setup"}
Gaudi::Property< boolm_expertMode_isData {this, "expertMode_isData", false, "Expert only option. Overwrites the isData Flag"}
Gaudi::Property< intm_expertMode_RunNumber {this, "expertMode_RunNumber", 0, "Expert only option. Overwrites RunNumber"}
Gaudi::Property< unsigned long long > m_expertMode_EvtNumber {this, "expertMode_EvtNumber", 0, "Expert only option. Overwrites EventNumber"}
Gaudi::Property< boolm_useRndRun {this, "useRandomRunNumber", false, "To use the random run number for deciding which calibration to apply"}
Gaudi::Property< intm_calibMode {this, "calibMode", -1, "Calib mode"}
Gaudi::Property< boolm_excludeNSWFromPrecisionLayers {this, "ExcludeNSWFromPrecisionLayers", false, "Cut on the number of precision layers ignores the NSW"}
Gaudi::Property< boolm_doEtaSagittaSys {this, "doEtaSagittaSys", false, "Do Eta dependant systematic system"}
Gaudi::Property< boolm_applyCorrectionOnData {this, "applyCorrectionOnData", true, "If to apply sagitta corrections on data, or take the full effect as systematic"}
Gaudi::Property< boolm_2stations_highpt_smearing {this, "do2StationsHighPt", false, "Extra smearing to be applied if high pT WP is used"}
Gaudi::Property< boolm_extra_highpt_smearing {this, "doExtraSmearing", false, "Flag provided to test if analysis are sensitive to high pT calibration. NOT TO BE USED FOR RESULTS. Please see twiki"}
Gaudi::Property< floatm_HighPtSystThreshold {this, "HighPtSystThr", 300.0, "Thershold for high pT smearing in GeV"}
asg::AnaToolHandle< CP::IMuonSelectionToolm_MuonSelectionTool {""}
asg::AnaToolHandle< CP::IMuonCalibIntToolm_MuonIntSagittaTool {""}
asg::AnaToolHandle< CP::IMuonCalibIntScaleSmearToolm_MuonIntScaleSmearTool {""}
asg::AnaToolHandle< CP::IMuonCalibIntToolm_MuonIntHighTSmearTool {""}

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

virtual ASG_TOOL_CLASS3(MuonCalibTool, CP::IMuonCalibrationAndSmearingTool, CP::ISystematicsTool, CP::IReentrantSystematicsTool) public CorrectionCode applyCorrection (xAOD::Muon &mu) const override
 Declare the interface that the class provides.
CorrectionCode applyCorrection (columnar::MuonId mu, columnar::EventInfoId evtInfo) const
virtual CorrectionCode correctedCopy (const xAOD::Muon &input, xAOD::Muon *&output) const override
 Create a corrected copy from a constant muon.
virtual bool isAffectedBySystematic (const SystematicVariation &systematic) const override
 Declare the interface that this class provides.
virtual SystematicSet affectingSystematics () const override
 the list of all systematics this tool can be affected by
virtual SystematicSet recommendedSystematics () const override
 the list of all systematics this tool recommends to use
virtual StatusCode applySystematicVariation (const SystematicSet &systConfig) override
 effects: configure this tool for the given list of systematic variations.
virtual double expectedResolution (const std::string &DetType, const xAOD::Muon &mu, const bool addMCCorrectionSmearing) const override
 Get the expected pT resolution.
virtual double expectedResolution (const int &DetType, const xAOD::Muon &mu, const bool addMCCorrectionSmearing) const override
 Get the expected pT resolution - int argument is more efficient.
double expectedResolution (const int &DetType, columnar::MuonId mu, columnar::EventInfoId evtInfo, const bool addMCCorrectionSmearing) const
virtual CorrectionCode applyCorrectionTrkOnly (xAOD::TrackParticle &inTrk, const int DetType) const override
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

bool m_MuonIntHighTSmearToolInitialized {false}
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 36 of file MuonCalibTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ MuonCalibTool()

CP::MuonCalibTool::MuonCalibTool ( const std::string & name)

These properties are meant to be expert properties for debugging of the code and shall not touched by the common

Definition at line 21 of file MuonCalibTool.cxx.

21 : asg::AsgTool(name){
22
24 m_MuonSelectionTool.declarePropertyFor(this,"MuonSelectionTool", "Instance of the MuonSelectionTool needed for the HighPt categorization");
25 m_MuonIntSagittaTool.declarePropertyFor(this, "SagittaTool", "Instance of the Sagitta bias corrections sub tool");
26 m_MuonIntScaleSmearTool.declarePropertyFor(this, "ScaleAndSmearTool", "Instance of the tool that applies the smearing & scale corrections");
27 m_MuonIntHighTSmearTool.declarePropertyFor(this, "HighPtSmearingTool", "Extra smearing of the high pt working point");
28 }
asg::AnaToolHandle< CP::IMuonCalibIntScaleSmearTool > m_MuonIntScaleSmearTool
asg::AnaToolHandle< CP::IMuonCalibIntTool > m_MuonIntHighTSmearTool
asg::AnaToolHandle< CP::IMuonSelectionTool > m_MuonSelectionTool
asg::AnaToolHandle< CP::IMuonCalibIntTool > m_MuonIntSagittaTool

◆ ~MuonCalibTool()

virtual CP::MuonCalibTool::~MuonCalibTool ( )
virtualdefault

Member Function Documentation

◆ affectingSystematics()

SystematicSet CP::MuonCalibTool::affectingSystematics ( ) const
overrideprivatevirtual

the list of all systematics this tool can be affected by

Implements CP::IReentrantSystematicsTool.

Definition at line 294 of file MuonCalibTool.cxx.

295 {
296 SystematicSet result = m_MuonIntSagittaTool->affectingSystematics();
297 result.insert(m_MuonIntScaleSmearTool->affectingSystematics());
298 if (m_MuonIntHighTSmearToolInitialized) result.insert(m_MuonIntHighTSmearTool->affectingSystematics());
299 return result;
300 }
bool m_MuonIntHighTSmearToolInitialized

◆ applyCorrection() [1/2]

CorrectionCode CP::MuonCalibTool::applyCorrection ( columnar::MuonId mu,
columnar::EventInfoId evtInfo ) const
private

Definition at line 141 of file MuonCalibTool.cxx.

142 {
143 auto& acc = *m_acc;
144 ATH_MSG_VERBOSE("Muon Type = " << mu(acc.muonTypeAcc) << " ( 0: Combined, 1: StandAlone, 2: SegmentTagged, 3: CaloTagged, 4: SiliconAssociatedForwardMuon)");
145 ATH_MSG_VERBOSE("Muon Author = " << mu(acc.authorAcc));
146
147 // Convert to the internal object
148 MCP::MuonObj muonObj = convertToMuonObj(mu, evtInfo);
149
150 ATH_MSG_VERBOSE("input ID pT "<<muonObj.ID.calib_pt);
151 ATH_MSG_VERBOSE("input ME pT "<<muonObj.ME.calib_pt);
152 ATH_MSG_VERBOSE("input CB pT "<<muonObj.CB.calib_pt);
153 ATH_MSG_VERBOSE("input eta "<<muonObj.CB.eta);
154 ATH_MSG_VERBOSE("input phi "<<muonObj.CB.phi);
155
156 if (muonObj.CB.isData)
157 {
158 ATH_MSG_VERBOSE("Doing data corrections");
159
160 // Sagitta Correction specifics
162 {
163 CorrectionCode sgCode = m_MuonIntSagittaTool->applyCorrection(muonObj);
164 if (sgCode != CorrectionCode::Ok) return sgCode;
165 }
166
167 // Override combined momentum for special cases
168 if (std::abs(muonObj.ME.calib_pt) == 0) muonObj.CB.calib_pt = muonObj.ID.calib_pt;
169 if (std::abs(muonObj.ID.calib_pt) == 0) muonObj.CB.calib_pt = muonObj.ME.calib_pt;
170
171 // Only for combined set it
172 if (mu(acc.muonTypeAcc) == xAOD::Muon::MuonType::Combined)
173 {
174 acc.ptOutDec (mu) = muonObj.CB.calib_pt * GeVtoMeV;
175 }
176
177
178 acc.dec_idPt(mu) = muonObj.ID.calib_pt * GeVtoMeV;
179 acc.dec_mePt(mu) = muonObj.ME.calib_pt * GeVtoMeV;
180 acc.dec_idCharge(mu) = muonObj.ID.calib_charge;
181 acc.dec_meCharge(mu) = muonObj.ME.calib_charge;
182
183 ATH_MSG_DEBUG("Checking Output Muon Info for data - Pt_ID: " << acc.dec_idPt(mu));
184 ATH_MSG_DEBUG("Checking Output Muon Info for data - Pt_MS: " << acc.dec_mePt(mu));
185 ATH_MSG_DEBUG("Checking Output Muon Info for data - Pt_CB: " << mu(acc.ptAcc));
186
187 return CorrectionCode::Ok;
188 }
189
190 // Do Scale and Smearing corrections
191 CorrectionCode sgCode = m_MuonIntScaleSmearTool->applyCorrection(muonObj);
192 if (sgCode != CorrectionCode::Ok) return sgCode;
193
194 // Systematics for sagitta correction
195 if ((mu(acc.muonTypeAcc) != xAOD::Muon::MuonType::SiliconAssociatedForwardMuon))
196 {
197 ATH_MSG_VERBOSE("Systematic uncertainties for sagitta bias ");
198 // TODO:: something specific for calo tags
199 CorrectionCode sgCode = m_MuonIntSagittaTool->applyCorrection(muonObj);
200 if (sgCode != CorrectionCode::Ok) return sgCode;
201 }
202
203 // Override combined momentum for special cases
204 if (std::abs(muonObj.ME.calib_pt) == 0) muonObj.CB.calib_pt = muonObj.ID.calib_pt;
205 if (std::abs(muonObj.ID.calib_pt) == 0) muonObj.CB.calib_pt = muonObj.ME.calib_pt;
206
207 // Setting the output object properties right now, so the resolution category get the corrected info
208 acc.ptOutDec(mu) = muonObj.CB.calib_pt * GeVtoMeV;
209 acc.chargeOutDec(mu) = muonObj.CB.calib_charge;
210 acc.dec_idPt(mu) = muonObj.ID.calib_pt * GeVtoMeV;
211 acc.dec_mePt(mu) = muonObj.ME.calib_pt * GeVtoMeV;
212 acc.dec_idCharge(mu) = muonObj.ID.calib_charge;
213 acc.dec_meCharge(mu) = muonObj.ME.calib_charge;
214
216 {
217 muonObj.raw_mst_category = (CP::IMuonSelectionTool::ResolutionCategory) m_MuonSelectionTool->getResolutionCategory(mu.getXAODObject());
218 }
219
220 // Special case: if the proper flags are selected (m_extra_highpt_smearing or m_2stations_highpt_smearing)
221 // an ad-hoc smearing of the combined momentum has to be applied
222 bool extra_smearing = (m_extra_highpt_smearing && (muonObj.raw_mst_category.value() >= 0) && !( muonObj.raw_mst_category.value() & IMuonSelectionTool::CategoryFour)); // Extra smearing, if selected, gets anyway only applied to non-3-station muons!
223 bool highpt_smearing = (m_2stations_highpt_smearing && (muonObj.raw_mst_category.value() >= 0) && ( muonObj.raw_mst_category.value() & IMuonSelectionTool::CategoryThree)); // Special highpt smearing, if selected, gets anyway only applied to missing-inner, 2-station muons only!
224
225 if (((extra_smearing || highpt_smearing)) && (mu(acc.ptAcc) > m_HighPtSystThreshold * GeVtoMeV))
226 {
227 sgCode = m_MuonIntHighTSmearTool->applyCorrection(muonObj);
228 if (sgCode != CorrectionCode::Ok) return sgCode;
229 }
230
231 // Final info to be written to the muon object
232 acc.ptOutDec(mu) = muonObj.CB.calib_pt * GeVtoMeV;
233 acc.dec_idPt(mu) = muonObj.ID.calib_pt * GeVtoMeV;
234 acc.dec_mePt(mu) = muonObj.ME.calib_pt * GeVtoMeV;
235
236
237 ATH_MSG_DEBUG("Checking Output Muon Info - Pt_ID: " << acc.dec_idPt(mu));
238 ATH_MSG_DEBUG("Checking Output Muon Info - Pt_MS: " << acc.dec_mePt(mu));
239 ATH_MSG_DEBUG("Checking Output Muon Info - Pt_CB: " << acc.ptOutDec(mu));
240
241 // If saggita was out of validity, return it here
242 if (sgCode == CorrectionCode::OutOfValidityRange) return sgCode;
243
244 // Return gracefully:
245 return CorrectionCode::Ok;
246 }
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
@ OutOfValidityRange
Input object is out of validity range.
@ Ok
The correction was done successfully.
ResolutionCategory
Declare the interface that the class provides.
Gaudi::Property< bool > m_validationMode
Gaudi::Property< bool > m_extra_highpt_smearing
Gaudi::Property< bool > m_skipResolutionCategory
Gaudi::Property< bool > m_applyCorrectionOnData
Gaudi::Property< float > m_HighPtSystThreshold
MCP::MuonObj convertToMuonObj(columnar::MuonId mu, columnar::EventInfoId evtInfo) const
Gaudi::Property< bool > m_2stations_highpt_smearing
std::unique_ptr< MCP::MuonCalibToolAccessors > m_acc
static const SG::AuxElement::Accessor< ElementLink< IParticleContainer > > acc("originalObjectLink")
Object used for setting/getting the dynamic decoration in question.
TrackCalibObj ID
Definition MuonObj.h:182
std::optional< ResolutionCategory > raw_mst_category
Definition MuonObj.h:198
TrackCalibObj CB
Definition MuonObj.h:184
TrackCalibObj ME
Definition MuonObj.h:183
int calib_charge
Value of the track-charge (after calibration).
Definition MuonObj.h:165
const double eta
Value of the track-eta.
Definition MuonObj.h:157
const double phi
Value of the track-phi.
Definition MuonObj.h:159
const bool isData
Definition MuonObj.h:169
double calib_pt
Smeared track pt.
Definition MuonObj.h:155

◆ applyCorrection() [2/2]

CorrectionCode CP::MuonCalibTool::applyCorrection ( xAOD::Muon & mu) const
overrideprivatevirtual

Declare the interface that the class provides.

Apply the correction on a modifyable object

Implements CP::IMuonCalibrationAndSmearingTool.

Definition at line 134 of file MuonCalibTool.cxx.

135 {
136 // Retrieve the event information:
137 SG::ReadHandle<xAOD::EventInfo> evtInfo(m_eventInfo);
139 }
virtual ASG_TOOL_CLASS3(MuonCalibTool, CP::IMuonCalibrationAndSmearingTool, CP::ISystematicsTool, CP::IReentrantSystematicsTool) public CorrectionCode applyCorrection(xAOD::Muon &mu) const override
Declare the interface that the class provides.
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfo
ObjectId< MuonDef > MuonId
Definition MuonDef.h:22
ObjectId< EventInfoDef > EventInfoId

◆ applyCorrectionTrkOnly()

CorrectionCode CP::MuonCalibTool::applyCorrectionTrkOnly ( xAOD::TrackParticle & inTrk,
const int DetType ) const
overrideprivatevirtual

Implements CP::IMuonCalibrationAndSmearingTool.

Definition at line 248 of file MuonCalibTool.cxx.

249 {
250 // Convert to the internal object
251 MCP::MuonObj muonObj = convertToMuonObj(inTrk, DetType);
252
253 // Do Scale and Smearing corrections
254 CorrectionCode sgCode = m_MuonIntScaleSmearTool->applyCorrection(muonObj);
255 if (sgCode != CorrectionCode::Ok) return sgCode;
256
257 double res_pt = (DetType == MCP::DetectorType::MS) ? muonObj.ME.calib_pt*GeVtoMeV : muonObj.ID.calib_pt*GeVtoMeV;
258
259 inTrk.setDefiningParameters(inTrk.d0(), inTrk.z0(), inTrk.phi0(), inTrk.theta(),
260 inTrk.charge() / (res_pt * std::cosh(inTrk.eta())));
261
262 // Return gracefully:
263 return CorrectionCode::Ok;
264 }
float z0() const
Returns the parameter.
float theta() const
Returns the parameter, which has range 0 to .
float d0() const
Returns the parameter.
void setDefiningParameters(float d0, float z0, float phi0, float theta, float qOverP)
Set the defining parameters.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
float charge() const
Returns the charge.
float phi0() const
Returns the parameter, which has range to .
ID
//////////////////////////////////////// JetAlgorithmType::ID defines most common physics jet finding...

◆ applySystematicVariation()

StatusCode CP::MuonCalibTool::applySystematicVariation ( const SystematicSet & systConfig)
overrideprivatevirtual

effects: configure this tool for the given list of systematic variations.

any requested systematics that are not affecting this tool will be silently ignored (unless they cause other errors). failures: systematic unknown failures: requesting multiple variations on the same systematic (e.g. up & down) failures: requesting an unsupported variation on an otherwise supported systematic (e.g. a 2 sigma variation and the tool only supports 1 sigma variations) failures: unsupported combination of supported systematic failures: other tool specific errors

Implements CP::ISystematicsTool.

Definition at line 304 of file MuonCalibTool.cxx.

305 {
306 // Apply to the underlying tool
307 StatusCode code = m_MuonIntSagittaTool->applySystematicVariation(systConfig);
308 if(code != StatusCode::SUCCESS) return code;
309
310 code = m_MuonIntScaleSmearTool->applySystematicVariation(systConfig);
311 if(code != StatusCode::SUCCESS) return code;
312
314 code = m_MuonIntHighTSmearTool->applySystematicVariation(systConfig);
315 if(code != StatusCode::SUCCESS) return code;
316 }
317 return code;
318 }
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ callEvents()

void CP::MuonCalibTool::callEvents ( columnar::EventContextRange events) const
override

Definition at line 661 of file MuonCalibTool.cxx.

661 {
662 auto& acc = *m_acc;
663 for (columnar::EventContextId event : events)
664 {
665 auto eventInfo = acc.m_eventInfoCol(event);
666 callSingleEvent (acc.m_muons(event), eventInfo);
667 }
668 }
void callSingleEvent(columnar::MuonRange muons, columnar::EventInfoId event) const
ObjectId< EventContextDef > EventContextId

◆ callSingleEvent()

void CP::MuonCalibTool::callSingleEvent ( columnar::MuonRange muons,
columnar::EventInfoId event ) const

Definition at line 644 of file MuonCalibTool.cxx.

645 {
646 for (columnar::MuonId muon : muons)
647 {
648 switch (applyCorrection(muon, event).code())
649 {
651 break;
653 throw std::runtime_error("OutOfValidityRange in applyCorrection");
654 break;
656 throw std::runtime_error("Error in applyCorrection");
657 }
658 }
659 }
@ Error
Some error happened during the object correction.

◆ convertToMuonObj() [1/2]

MCP::MuonObj CP::MuonCalibTool::convertToMuonObj ( columnar::MuonId mu,
columnar::EventInfoId evtInfo ) const
protected

Definition at line 415 of file MuonCalibTool.cxx.

416 {
417 auto& acc = *m_acc;
418 // Get information about data
419 bool isData = false;
421 else
422 {
423 // Retrieve the event information:
424 isData = !evtInfo(acc.eventTypeAcc, xAOD::EventInfo::IS_SIMULATION);
425 }
426 ATH_MSG_VERBOSE("Checking Simulation flag: " << !isData);
427
428 // Get information about which year it is here
429 auto year = MuonCalibTool::getPeriod(isData, evtInfo);
430
431
432 double Primary_eta = mu(acc.etaAcc);
433 double Primary_phi = mu(acc.phiAcc);
434 int charge = mu(acc.chargeAcc);
436
438 {
439 static const SG::AuxElement::Accessor<float> cb_pt("expert_ptcb");
440 static const SG::AuxElement::Accessor<float> id_pt("expert_ptid");
441 static const SG::AuxElement::Accessor<float> ms_pt("expert_ptms");
442 static const SG::AuxElement::Accessor<AmgVector(5)> CBParam("CBParam");
443 static const SG::AuxElement::Accessor<AmgSymMatrix(5)> CBCov("CBCov");
444 static const SG::AuxElement::Accessor<AmgVector(5)> IDParam("IDParam");
445 static const SG::AuxElement::Accessor<AmgSymMatrix(5)> IDCov("IDCov");
446 static const SG::AuxElement::Accessor<AmgVector(5)> MEParam("MEParam");
447 static const SG::AuxElement::Accessor<AmgSymMatrix(5)> MECov("MECov");
448
449 // Use the constructor where the eta/phi are overwritten to keep it inma line with current recommendations. To be changed in the future
450 auto CB = MCP::TrackCalibObj(MCP::TrackType::CB, charge, cb_pt(mu.getXAODObject()), Primary_eta, Primary_phi, mass, CBParam(mu.getXAODObject()), CBCov(mu.getXAODObject()), year, isData);
451 auto ID = MCP::TrackCalibObj(MCP::TrackType::ID, charge, id_pt(mu.getXAODObject()), Primary_eta, Primary_phi, mass, IDParam(mu.getXAODObject()), IDCov(mu.getXAODObject()), year, isData);
452 auto ME = MCP::TrackCalibObj(MCP::TrackType::ME, charge, ms_pt(mu.getXAODObject()), Primary_eta, Primary_phi, mass, MEParam(mu.getXAODObject()), MECov(mu.getXAODObject()), year, isData);
453
454 MCP::MuonObj muonObj{CB,ID,ME};
455 initializeRandNumbers(muonObj, evtInfo);
456
459 muonObj.expectedResID = expectedResolution(MCP::DetectorType::ID, mu, evtInfo, true) * muonObj.CB.calib_pt;
460 muonObj.expectedResME = expectedResolution(MCP::DetectorType::MS, mu, evtInfo, true) * muonObj.CB.calib_pt;
461
462 return muonObj;
463 }
464
465
466 // Retrieve all the trans
467 auto CB_track = mu(acc.combinedTrackParticleLinkAcc);
468 auto ID_track = mu(acc.inDetTrackParticleLinkAcc).opt_value();
469 auto ME_track = mu(acc.extrapolatedMuonSpectrometerTrackParticleLinkAcc);
470
471 // For SI muons, overwrite the charge from the CB track
472 if (mu(acc.muonTypeAcc) == xAOD::Muon::MuonType::SiliconAssociatedForwardMuon)
473 {
474 if (CB_track) charge = CB_track.value()(acc.trkChargeAcc);
475 }
476
477 // Use the constructor where the eta/phi are overwritten to keep it inma line with current recommendations. To be changed in the future
478 auto CB = MCP::TrackCalibObj(acc, columnar::OptObjectId<columnar::MuonTrackDef>(CB_track), MCP::TrackType::CB, charge, Primary_eta, Primary_phi, year, isData);
479 auto ID = MCP::TrackCalibObj(acc, columnar::OptObjectId<columnar::MuonTrackDef>(ID_track), MCP::TrackType::ID, charge, Primary_eta, Primary_phi, year, isData);
480 auto ME = MCP::TrackCalibObj(acc, columnar::OptObjectId<columnar::MuonTrackDef>(ME_track), MCP::TrackType::ME, charge, Primary_eta, Primary_phi, year, isData);
481
482 MCP::MuonObj muonObj{CB,ID,ME};
483 initializeRandNumbers(muonObj, evtInfo);
486
487 muonObj.expectedResID = expectedResolution(MCP::DetectorType::ID, mu, evtInfo, true) * muonObj.CB.calib_pt;
488 muonObj.expectedResME = expectedResolution(MCP::DetectorType::MS, mu, evtInfo, true) * muonObj.CB.calib_pt;
489 return muonObj;
490 }
#define AmgSymMatrix(dim)
#define AmgVector(rows)
void initializeRandNumbers(MCP::MuonObj &obj, columnar::EventInfoId evtInfo) const
Decorate all information that's needed to ensure reproducibility of the smearing.
MCP::DataYear getPeriod(bool isData, columnar::EventInfoId evtInfo) const
virtual double expectedResolution(const std::string &DetType, const xAOD::Muon &mu, const bool addMCCorrectionSmearing) const override
Get the expected pT resolution.
Gaudi::Property< bool > m_expertMode_isData
@ IS_SIMULATION
true: simulation, false: data
constexpr float MeVtoGeV
constexpr double muonMassInMeV
the mass of the muon (in MeV)
double expectedResID
Definition MuonObj.h:201
double expectedPercentResME
Definition MuonObj.h:205
double expectedResME
Definition MuonObj.h:202
double expectedPercentResID
Definition MuonObj.h:204

◆ convertToMuonObj() [2/2]

MCP::MuonObj CP::MuonCalibTool::convertToMuonObj ( const xAOD::TrackParticle & inTrk,
const int DetType ) const
protected

Definition at line 491 of file MuonCalibTool.cxx.

492 {
493 auto& acc = *m_acc;
494 // Get information about data
495 bool isData = false;
496
497 // Retrieve the event information:
498 SG::ReadHandle<xAOD::EventInfo> evtInfo(m_eventInfo);
499 isData = !evtInfo->eventType(xAOD::EventInfo::IS_SIMULATION);
500
501 ATH_MSG_VERBOSE("Checking Simulation flag: " << !isData);
502
503 // Get information about which year it is here
504 auto year = MuonCalibTool::getPeriod(isData, *evtInfo);
505 int charge = inTrk.charge();
506 if (DetType == MCP::DetectorType::ID)
507 {
508 auto CB = MCP::TrackCalibObj(acc, &inTrk, MCP::TrackType::CB, charge, year, isData);
509 auto ID = MCP::TrackCalibObj(acc, &inTrk, MCP::TrackType::ID, charge, year, isData);
510 auto ME = MCP::TrackCalibObj(acc, &inTrk, MCP::TrackType::ME, charge, year, isData);
511
512 MCP::MuonObj muonObj{CB,ID,ME};
513 return muonObj;
514 }
515
516 auto CB = MCP::TrackCalibObj(acc, &inTrk, MCP::TrackType::CB, charge, year, isData);
517 auto ID = MCP::TrackCalibObj(acc, nullptr, MCP::TrackType::ID, charge, year, isData);
518 auto ME = MCP::TrackCalibObj(acc, &inTrk, MCP::TrackType::ME, charge, year, isData);
519
520 MCP::MuonObj muonObj{CB,ID,ME};
521 return muonObj;
522 }

◆ correctedCopy()

CorrectionCode CP::MuonCalibTool::correctedCopy ( const xAOD::Muon & input,
xAOD::Muon *& output ) const
overrideprivatevirtual

Create a corrected copy from a constant muon.

Implements CP::IMuonCalibrationAndSmearingTool.

Definition at line 266 of file MuonCalibTool.cxx.

267 {
268 // A sanity check:
269 if (output)
271 "Non-null pointer received. "
272 "There's a possible memory leak!");
273
274 // Create a new object:
275 ATH_MSG_VERBOSE("Going to create new xAOD::Muon...");
276 output = new xAOD::Muon();
277 ATH_MSG_VERBOSE("Calling makePrivateStore...");
278 output->makePrivateStore(input);
279
280 // Use the other function to modify this object:
281 ATH_MSG_VERBOSE("Calling applyCorrection...");
282
283 CP::CorrectionCode retCode = applyCorrection(*output);
284
285 return retCode;
286 }
#define ATH_MSG_WARNING(x)
output
Definition merge.py:16
Muon_v1 Muon
Reference the current persistent version:

◆ 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.

◆ expectedResolution() [1/3]

double CP::MuonCalibTool::expectedResolution ( const int & DetType,
columnar::MuonId mu,
columnar::EventInfoId evtInfo,
const bool addMCCorrectionSmearing ) const
private

Definition at line 341 of file MuonCalibTool.cxx.

342 {
343 auto& acc = *m_acc;
344 // Get information about data
345 bool isData = false;
347 else
348 {
349 // Retrieve the event information:
350 isData = !evtInfo(acc.eventTypeAcc, xAOD::EventInfo::IS_SIMULATION);
351 }
352
353 // Get information about which year it is here
354 MCP::DataYear dataYear = MuonCalibTool::getPeriod(isData, evtInfo);
355
356 // get the pt measurements from the xAOD::Muon object
357 double loc_ptid = 0;
358 double loc_ptms = 0;
359 double loc_ptcb = 0;
360
361 double Primary_eta = mu(acc.etaAcc);
362 double Primary_phi = mu(acc.phiAcc);
363
364 if (m_validationMode)
365 {
366 static const SG::AuxElement::Accessor<float> id_pt("expert_ptid");
367 static const SG::AuxElement::Accessor<float> ms_pt("expert_ptms");
368 static const SG::AuxElement::Accessor<float> cb_pt("expert_ptcb");
369
370 loc_ptid = id_pt(mu.getXAODObject()) * MeVtoGeV;
371 loc_ptms = ms_pt(mu.getXAODObject()) * MeVtoGeV;
372 loc_ptcb = cb_pt(mu.getXAODObject()) * MeVtoGeV;
373
374 } else {
375
376 // Retrieve all the trans
377 auto CB_track = mu(acc.combinedTrackParticleLinkAcc);
378 auto ID_track = mu(acc.inDetTrackParticleLinkAcc).opt_value();
379 auto ME_track = mu(acc.extrapolatedMuonSpectrometerTrackParticleLinkAcc);
380
381 if(CB_track) loc_ptcb = acc.trkMomentumAcc.pt(CB_track.value(), ParticleConstants::muonMassInMeV) * MeVtoGeV;
382 if(ID_track) loc_ptid = acc.trkMomentumAcc.pt(ID_track.value(), ParticleConstants::muonMassInMeV) * MeVtoGeV;
383 if(ME_track) loc_ptms = acc.trkMomentumAcc.pt(ME_track.value(), ParticleConstants::muonMassInMeV) * MeVtoGeV;
384 }
385
386 if (DetType == MCP::DetectorType::MS)
387 {
388 return m_MuonIntScaleSmearTool->getExpectedResolution(DetType, loc_ptms, Primary_eta, Primary_phi, dataYear, addMCCorrectionSmearing);
389 }
390 else if (DetType == MCP::DetectorType::ID)
391 {
392 return m_MuonIntScaleSmearTool->getExpectedResolution(DetType, loc_ptid, Primary_eta, Primary_phi, dataYear, addMCCorrectionSmearing);
393 }
394 else if (DetType == MCP::DetectorType::CB)
395 {
396 // Due to complicated maths, the expected combined resolution
397 // is given by this equation (note: all sigmas are fractional uncertainties):
398 // sigma_CB = std::sqrt(2) * sigma_ID * sigma_MS * pTMS * pTID / {pTCB * std::sqrt({sigma_ID*pTID}^2 + {sigma_MS*pTMS}^2)}
399 // Do a little recursive calling to make things easier to read
400 // Turn these into *absolute* uncertainties to make life easier
401 double sigmaID = expectedResolution(MCP::DetectorType::ID, mu, evtInfo, addMCCorrectionSmearing) * loc_ptid;
402 double sigmaMS = expectedResolution(MCP::DetectorType::MS, mu, evtInfo, addMCCorrectionSmearing) * loc_ptms;
403 double denominator = (loc_ptcb)*std::sqrt(sigmaID * sigmaID + sigmaMS * sigmaMS);
404 return denominator ? sigmaID * sigmaMS / denominator : 0.;
405 }
406 else
407 {
408 ATH_MSG_ERROR("wrong DetType in input " << DetType);
409 }
410 return 0.;
411
412 }
#define ATH_MSG_ERROR(x)
DataYear
Definition EnumDef.h:28

◆ expectedResolution() [2/3]

double CP::MuonCalibTool::expectedResolution ( const int & DetType,
const xAOD::Muon & mu,
const bool mc ) const
overrideprivatevirtual

Get the expected pT resolution - int argument is more efficient.

Implements CP::IMuonCalibrationAndSmearingTool.

Definition at line 335 of file MuonCalibTool.cxx.

336 {
337 SG::ReadHandle<xAOD::EventInfo> evtInfo(m_eventInfo);
338 return expectedResolution(DetType, columnar::MuonId(mu), columnar::EventInfoId(*evtInfo), addMCCorrectionSmearing);
339 }

◆ expectedResolution() [3/3]

double CP::MuonCalibTool::expectedResolution ( const std::string & DetType,
const xAOD::Muon & mu,
const bool mc ) const
overrideprivatevirtual

Get the expected pT resolution.

Implements CP::IMuonCalibrationAndSmearingTool.

Definition at line 320 of file MuonCalibTool.cxx.

321 {
322 // Expected resolution in data (or unsmeared MC if second argument is true)
323 if (DetType == "MS") {
324 return expectedResolution(MCP::DetectorType::MS, mu, addMCCorrectionSmearing);
325 } else if (DetType == "ID") {
326 return expectedResolution(MCP::DetectorType::ID, mu, addMCCorrectionSmearing);
327 } else if (DetType == "CB") {
328 return expectedResolution(MCP::DetectorType::CB, mu, addMCCorrectionSmearing);
329 } else {
330 ATH_MSG_ERROR("The DetType that you entered is not allows - DetType = " << DetType);
331 return 0.;
332 }
333 }

◆ 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

◆ 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::Event 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::Event, 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::Event 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::Event, 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 }

◆ getPeriod()

MCP::DataYear CP::MuonCalibTool::getPeriod ( bool isData,
columnar::EventInfoId evtInfo ) const
protected

Definition at line 548 of file MuonCalibTool.cxx.

549 {
550 // I've copied the run number ranges from SUSYTools (Run2) - Haider
551 // https://gitlab.cern.ch/atlas/athena/blob/21.2/PhysicsAnalysis/SUSYPhys/SUSYTools/Root/SUSYObjDef_xAOD.cxx#L2438
552 // Range for Run3 taken from COMA - Luca
553 // https://atlas-tagservices.cern.ch/tagservices/RunBrowser/runBrowserReport/rBR_Period_Report.php?fnt=data22_13p6TeV
554 // https://atlas-tagservices.cern.ch/tagservices/RunBrowser/runBrowserReport/rBR_Period_Report.php?fnt=data23_13p6TeV
555 // https://atlas-tagservices.cern.ch/tagservices/RunBrowser/runBrowserReport/rBR_Period_Report.php?fnt=data24_13p6TeV
556 constexpr unsigned int last_run_16 = 320000;
557 constexpr unsigned int last_run_17 = 342000;
558 constexpr unsigned int last_run_18 = 370000;
559 constexpr unsigned int last_run_22 = 440614;
560 constexpr unsigned int last_run_23 = 456750;
561 constexpr unsigned int last_run_24 = 999999;
562
563 static const std::set<int> MCperiods1516{284500};
564 static const std::set<int> MCperiods17{300000, 304000, 305000};
565 static const std::set<int> MCperiods18{310000};
566 static const std::set<int> MCperiods22{330000, 410000};
567 static const std::set<int> MCperiods23{450000};
568 static const std::set<int> MCperiods24{470000};
569
570 static const std::set<int> MCperiodsRun4{350000, 350060, 350140, 350200};
571
572 auto& acc = *m_acc;
573 unsigned int run = 0;
575 else run = evtInfo(acc.runNumberAcc);
576 // retrieve the random run number
577 if (!isData && m_useRndRun) {
578 if (acc.acc_rnd.isAvailable(evtInfo))
579 run = acc.acc_rnd(evtInfo);
580 else {
582 "No random runnumber could be found although the tool is configured to assign the years based on it. Please make sure "
583 "to apply the prwTool before-hand or consider to set the property 'useRandomRunNumber' to false.");
585 }
586 }
587 // Check the Monte carlo
588 if (!isData && (!m_useRndRun || !acc.acc_rnd.isAvailable(evtInfo))) {
589 if (MCperiods1516.count(run)) {
590 ATH_MSG_DEBUG("The current run " << run << " corresponds to data mc20a / data15-16");
592 } else if (MCperiods17.count(run)) {
593 ATH_MSG_DEBUG("The current run " << run << " corresponds to data mc20d / data17");
595 } else if (MCperiods18.count(run)) {
596 ATH_MSG_DEBUG("The current run " << run << " corresponds to data mc20e / data18");
598 } else if (MCperiods22.count(run)) {
599 ATH_MSG_DEBUG("The current run " << run << " corresponds to data mc21 / mc23a / data22");
601 } else if (MCperiods23.count(run)) {
602 ATH_MSG_DEBUG("The current run " << run << " corresponds to data mc23c / mc23d / data23");
604 } else if (MCperiods24.count(run)) {
605 ATH_MSG_DEBUG("The current run " << run << " corresponds to data mc23e / data24");
607 } else if (MCperiodsRun4.count(run)) {
608 ATH_MSG_DEBUG("The current run " << run << " corresponds to data Run4");
609 return MCP::DataYear::Run4;
610 }
611
612 }
613 // Check data itself or the random run number is used
614 else if (isData || m_useRndRun) {
615 if (run < last_run_16) {
616 ATH_MSG_DEBUG("The current run " << run << " is taken in data 15-16");
618 } else if (run <= last_run_17) {
619 ATH_MSG_DEBUG("The current run " << run << " is taken in data 17");
621 } else if (run <= last_run_18) {
622 ATH_MSG_DEBUG("The current run " << run << " is taken in data 18");
624 } else if (run <= last_run_22) {
625 ATH_MSG_DEBUG("The current run " << run << " is taken in data 22");
627 } else if (run < last_run_23) {
628 ATH_MSG_DEBUG("The current run " << run << " is taken in data 23");
630 } else if (run < last_run_24) {
631 ATH_MSG_DEBUG("The current run " << run << " is taken in data 24");
633 }
634 }
635 static std::atomic<bool> warningPrinted {false};
636 if (!warningPrinted) {
637 ATH_MSG_WARNING("Could not assign run-number " << run << " to a specific year of data-taking, using default year 24");
638 warningPrinted = true;
639 }
641 }
Gaudi::Property< bool > m_useRndRun
Gaudi::Property< int > m_expertMode_RunNumber
int run(int argc, char *argv[])

◆ getProperty()

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

Get one of the tool's properties.

◆ initialize()

StatusCode CP::MuonCalibTool::initialize ( void )
overridevirtual

Dummy implementation of the initialisation function.

It's here to allow the dual-use tools to skip defining an initialisation function. Since many are doing so...

Create the high pT tool

Reimplemented from asg::AsgTool.

Definition at line 30 of file MuonCalibTool.cxx.

31 {
32 // Greet the user:
33 ATH_MSG_INFO("Initialising...");
34
35 // Get the m_eventinfo container
36 ATH_CHECK(m_eventInfo.initialize());
37
38 // Set the options
39 if (m_calibMode == MuonCalibTool::correctData_CB) {
40 ATH_MSG_INFO("Data will be corrected for sagitta bias and Montecarlo will be corrected using CB calibration");
42 } else if (m_calibMode == MuonCalibTool::correctData_IDMS) {
43 ATH_MSG_INFO("Data will be corrected for sagitta bias and Montecarlo will be corrected using ID+MS calibration");
45 } else if (m_calibMode == MuonCalibTool::notCorrectData_IDMS) {
46 ATH_MSG_INFO("Data will be untouched (no sagitta bias corrections) and Montecarlo will be corrected using ID+MS calibration");
48 } else if (m_calibMode == MuonCalibTool::notCorrectData_CB) {
49 ATH_MSG_INFO("Data will be untouched (no sagitta bias corrections) and Montecarlo will be corrected using CB calibration");
51 } else if (m_calibMode == MuonCalibTool::correctData_IDonly) {
52 ATH_MSG_INFO("Data will be corrected for sagitta bias and Montecarlo will be corrected using ID calibration only");
54 } else if (m_calibMode == MuonCalibTool::correctData_MSonly) {
55 ATH_MSG_INFO("Data will be corrected for sagitta bias and Montecarlo will be corrected using MS calibration only");
57 } else if (m_calibMode == MuonCalibTool::userDefined) {
58 ATH_MSG_INFO("Using options as provided by the user");
59 }
60 else {
61 ATH_MSG_FATAL("Invalid calibration mode: " << m_calibMode << " Allowed modes are correctData_CB("
62 << MuonCalibTool::correctData_CB << ") correctData_IDMS ("
63 << MuonCalibTool::correctData_IDMS << ") or notCorrectData_IDMS ("
64 << MuonCalibTool::notCorrectData_IDMS << ") or notCorrectData_CB ("
65 << MuonCalibTool::notCorrectData_CB << ") or correctData_IDonly ("
66 << MuonCalibTool::correctData_IDonly << ") or correctData_MSonly ("
67 << MuonCalibTool::correctData_MSonly << ")");
68 return StatusCode::FAILURE;
69 }
70
71 if (!m_skipResolutionCategory.value())
72 {
73 // Get the muon selection tool
74 if (m_MuonSelectionTool.empty()) {
75 m_MuonSelectionTool.setTypeAndName("CP::MuonSelectionTool/MCaST_Own_MST");
76 ATH_CHECK(m_MuonSelectionTool.setProperty("MaxEta", 2.7));
77 ATH_CHECK(m_MuonSelectionTool.setProperty("MuQuality", 1));
78 ATH_CHECK(m_MuonSelectionTool.setProperty("TurnOffMomCorr", true));
79 ATH_CHECK(m_MuonSelectionTool.setProperty("IsRun3Geo", m_isRun3.value()));
80 ATH_CHECK(m_MuonSelectionTool.setProperty("OutputLevel", msg().level()));
81 ATH_CHECK(m_MuonSelectionTool.setProperty("ExcludeNSWFromPrecisionLayers", m_excludeNSWFromPrecisionLayers.value()));
82 }
84 if (auto *selectionTool = dynamic_cast<columnar::ColumnarTool<>*>(m_MuonSelectionTool.get()))
85 addSubtool (*selectionTool);
86 }
87
88 // Create the Sagitta tool
89 if (m_MuonIntSagittaTool.empty()) {
90 m_MuonIntSagittaTool.setTypeAndName("CP::MuonCalibIntSagittaTool/MCaST_Sagitta");
91 ATH_CHECK(m_MuonIntSagittaTool.setProperty("release", m_release.value()));
92 ATH_CHECK(m_MuonIntSagittaTool.setProperty("systematicScheme", m_sysScheme.value()));
93 ATH_CHECK(m_MuonIntSagittaTool.setProperty("calibMode", m_calibMode));
94 ATH_CHECK(m_MuonIntSagittaTool.setProperty("doEtaSagittaSys", m_doEtaSagittaSys.value()));
95 ATH_CHECK(m_MuonIntSagittaTool.setProperty("OutputLevel", msg().level()));
96 }
98
99 // Create the scale smear tool
100 if (m_MuonIntScaleSmearTool.empty()) {
101 m_MuonIntScaleSmearTool.setTypeAndName("CP::MuonCalibIntScaleSmearTool/MCaST_ScaleSmear");
102 ATH_CHECK(m_MuonIntScaleSmearTool.setProperty("release", m_release.value()));
103 ATH_CHECK(m_MuonIntScaleSmearTool.setProperty("systematicScheme", m_sysScheme.value()));
104 ATH_CHECK(m_MuonIntScaleSmearTool.setProperty("calibMode", m_calibMode));
105 ATH_CHECK(m_MuonIntScaleSmearTool.setProperty("OutputLevel", msg().level()));
107 }
110 if (m_MuonIntHighTSmearTool.empty()) {
111 m_MuonIntHighTSmearTool.setTypeAndName("CP::MuonCalibIntHighpTSmearTool/MCaST_highPtScaleSmear");
112 ATH_CHECK(m_MuonIntHighTSmearTool.setProperty("release", m_release.value()));
113 ATH_CHECK(m_MuonIntHighTSmearTool.setProperty("OutputLevel", msg().level()));
114 }
117 }
118 if (!applySystematicVariation(SystematicSet()))
119 {
120 ATH_MSG_ERROR("Unable to run with no systematic");
121 return StatusCode::FAILURE;
122 }
123 SystematicRegistry &registry = SystematicRegistry::getInstance();
124 if (registry.registerSystematics(*this) != StatusCode::SUCCESS)
125 {
126 ATH_MSG_ERROR("Unkown systematic list");
127 return StatusCode::FAILURE;
128 }
129 ATH_CHECK (initializeColumns());
130 // Return gracefully:
131 return StatusCode::SUCCESS;
132 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
MsgStream & msg() const
Gaudi::Property< std::string > m_sysScheme
Gaudi::Property< std::string > m_release
Gaudi::Property< bool > m_excludeNSWFromPrecisionLayers
Gaudi::Property< bool > m_doEtaSagittaSys
Gaudi::Property< bool > m_isRun3
virtual StatusCode applySystematicVariation(const SystematicSet &systConfig) override
effects: configure this tool for the given list of systematic variations.
Gaudi::Property< int > m_calibMode
static SystematicRegistry & getInstance()
Get the singleton instance of the registry for the curren thread.
StatusCode registerSystematics(const IReentrantSystematicsTool &tool)
effects: register all the systematics from the tool

◆ initializeRandNumbers()

void CP::MuonCalibTool::initializeRandNumbers ( MCP::MuonObj & obj,
columnar::EventInfoId evtInfo ) const
protected

Decorate all information that's needed to ensure reproducibility of the smearing.

Definition at line 525 of file MuonCalibTool.cxx.

526 {
527 auto& acc = *m_acc;
528 // Random number generation for smearing
529 TRandom3 loc_random3;
530 // Get Event Number, Retrieve the event information:
531 unsigned long long eventNumber = 0;
533 else eventNumber = evtInfo(acc.eventNumberAcc);
534 // Construct a seed for the random number generator:
535 const UInt_t seed = 1 + std::abs(muonObj.CB.phi) * 1E6 + std::abs(muonObj.CB.eta) * 1E3 + eventNumber;
536 loc_random3.SetSeed(seed);
537
538 muonObj.rnd_g0 = loc_random3.Gaus(0, 1);
539 muonObj.rnd_g1 = loc_random3.Gaus(0, 1);
540 muonObj.rnd_g2 = loc_random3.Gaus(0, 1);
541 muonObj.rnd_g3 = loc_random3.Gaus(0, 1);
542 muonObj.rnd_g4 = loc_random3.Gaus(0, 1);
543 muonObj.rnd_g_highPt = loc_random3.Gaus(0, 1);
544
545
546 }
Gaudi::Property< unsigned long long > m_expertMode_EvtNumber

◆ 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.

◆ isAffectedBySystematic()

bool CP::MuonCalibTool::isAffectedBySystematic ( const SystematicVariation & systematic) const
overrideprivatevirtual

Declare the interface that this class provides.

returns: whether this tool is affected by the given systematics

Implements CP::ISystematicsTool.

Definition at line 288 of file MuonCalibTool.cxx.

289 {
290 SystematicSet sys = affectingSystematics();
291 return sys.find(systematic) != sys.end();
292 }
virtual SystematicSet affectingSystematics() const override
the list of all systematics this tool can be affected by

◆ 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 }
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.

◆ print()

◆ recommendedSystematics()

SystematicSet CP::MuonCalibTool::recommendedSystematics ( ) const
overrideprivatevirtual

the list of all systematics this tool recommends to use

Implements CP::IReentrantSystematicsTool.

Definition at line 302 of file MuonCalibTool.cxx.

302{ return affectingSystematics(); }

◆ 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

Member Data Documentation

◆ m_2stations_highpt_smearing

Gaudi::Property<bool> CP::MuonCalibTool::m_2stations_highpt_smearing {this, "do2StationsHighPt", false, "Extra smearing to be applied if high pT WP is used"}
protected

Definition at line 116 of file MuonCalibTool.h.

116{this, "do2StationsHighPt", false, "Extra smearing to be applied if high pT WP is used"};

◆ m_acc

std::unique_ptr<MCP::MuonCalibToolAccessors> CP::MuonCalibTool::m_acc {std::make_unique<MCP::MuonCalibToolAccessors>(*this)}

Definition at line 147 of file MuonCalibTool.h.

147{std::make_unique<MCP::MuonCalibToolAccessors>(*this)};

◆ m_applyCorrectionOnData

Gaudi::Property<bool> CP::MuonCalibTool::m_applyCorrectionOnData {this, "applyCorrectionOnData", true, "If to apply sagitta corrections on data, or take the full effect as systematic"}
protected

Definition at line 112 of file MuonCalibTool.h.

112{this, "applyCorrectionOnData", true, "If to apply sagitta corrections on data, or take the full effect as systematic"};

◆ m_calibMode

Gaudi::Property<int> CP::MuonCalibTool::m_calibMode {this, "calibMode", -1, "Calib mode"}
protected

Definition at line 104 of file MuonCalibTool.h.

104{this, "calibMode", -1, "Calib mode"};

◆ 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_doEtaSagittaSys

Gaudi::Property<bool> CP::MuonCalibTool::m_doEtaSagittaSys {this, "doEtaSagittaSys", false, "Do Eta dependant systematic system"}
protected

Definition at line 111 of file MuonCalibTool.h.

111{this, "doEtaSagittaSys", false, "Do Eta dependant systematic system"};

◆ m_eventInfo

SG::ReadHandleKey<xAOD::EventInfo> CP::MuonCalibTool::m_eventInfo {this, "EventInfoContName", "EventInfo", "event info key"}
protected

Definition at line 89 of file MuonCalibTool.h.

89{this, "EventInfoContName", "EventInfo", "event info key"};

◆ 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_excludeNSWFromPrecisionLayers

Gaudi::Property<bool> CP::MuonCalibTool::m_excludeNSWFromPrecisionLayers {this, "ExcludeNSWFromPrecisionLayers", false, "Cut on the number of precision layers ignores the NSW"}
protected

Definition at line 108 of file MuonCalibTool.h.

108{this, "ExcludeNSWFromPrecisionLayers", false, "Cut on the number of precision layers ignores the NSW"};

◆ m_expertMode_EvtNumber

Gaudi::Property<unsigned long long> CP::MuonCalibTool::m_expertMode_EvtNumber {this, "expertMode_EvtNumber", 0, "Expert only option. Overwrites EventNumber"}
protected

Definition at line 101 of file MuonCalibTool.h.

101{this, "expertMode_EvtNumber", 0, "Expert only option. Overwrites EventNumber"};

◆ m_expertMode_isData

Gaudi::Property<bool> CP::MuonCalibTool::m_expertMode_isData {this, "expertMode_isData", false, "Expert only option. Overwrites the isData Flag"}
protected

Definition at line 99 of file MuonCalibTool.h.

99{this, "expertMode_isData", false, "Expert only option. Overwrites the isData Flag"};

◆ m_expertMode_RunNumber

Gaudi::Property<int> CP::MuonCalibTool::m_expertMode_RunNumber {this, "expertMode_RunNumber", 0, "Expert only option. Overwrites RunNumber"}
protected

Definition at line 100 of file MuonCalibTool.h.

100{this, "expertMode_RunNumber", 0, "Expert only option. Overwrites RunNumber"};

◆ m_extra_highpt_smearing

Gaudi::Property<bool> CP::MuonCalibTool::m_extra_highpt_smearing {this, "doExtraSmearing", false, "Flag provided to test if analysis are sensitive to high pT calibration. NOT TO BE USED FOR RESULTS. Please see twiki"}
protected

Definition at line 118 of file MuonCalibTool.h.

118{this, "doExtraSmearing", false, "Flag provided to test if analysis are sensitive to high pT calibration. NOT TO BE USED FOR RESULTS. Please see twiki"};

◆ m_HighPtSystThreshold

Gaudi::Property<float> CP::MuonCalibTool::m_HighPtSystThreshold {this, "HighPtSystThr", 300.0, "Thershold for high pT smearing in GeV"}
protected

Definition at line 119 of file MuonCalibTool.h.

119{this, "HighPtSystThr", 300.0, "Thershold for high pT smearing in GeV"};

◆ m_isRun3

Gaudi::Property<bool> CP::MuonCalibTool::m_isRun3 {this, "IsRun3Geo", false, "Needed for MuonSelectionTool"}
protected

Definition at line 91 of file MuonCalibTool.h.

91{this, "IsRun3Geo", false, "Needed for MuonSelectionTool"};

◆ m_MuonIntHighTSmearTool

asg::AnaToolHandle<CP::IMuonCalibIntTool> CP::MuonCalibTool::m_MuonIntHighTSmearTool {""}
protected

Definition at line 126 of file MuonCalibTool.h.

126{""};

◆ m_MuonIntHighTSmearToolInitialized

bool CP::MuonCalibTool::m_MuonIntHighTSmearToolInitialized {false}
private

Definition at line 141 of file MuonCalibTool.h.

141{false};

◆ m_MuonIntSagittaTool

asg::AnaToolHandle<CP::IMuonCalibIntTool> CP::MuonCalibTool::m_MuonIntSagittaTool {""}
protected

Definition at line 123 of file MuonCalibTool.h.

123{""};

◆ m_MuonIntScaleSmearTool

asg::AnaToolHandle<CP::IMuonCalibIntScaleSmearTool> CP::MuonCalibTool::m_MuonIntScaleSmearTool {""}
protected

Definition at line 124 of file MuonCalibTool.h.

124{""};

◆ m_MuonSelectionTool

asg::AnaToolHandle<CP::IMuonSelectionTool> CP::MuonCalibTool::m_MuonSelectionTool {""}
protected

Definition at line 121 of file MuonCalibTool.h.

121{""};

◆ m_release

Gaudi::Property<std::string> CP::MuonCalibTool::m_release {this, "release", "Recs2025_12_11_Run2Run3", "Release"}
protected

Definition at line 94 of file MuonCalibTool.h.

94{this, "release", "Recs2025_12_11_Run2Run3", "Release"};

◆ m_skipResolutionCategory

Gaudi::Property<bool> CP::MuonCalibTool::m_skipResolutionCategory {this, "skipResolutionCategory", false, "whether to skip the resolution category variable"}

Definition at line 145 of file MuonCalibTool.h.

145{this, "skipResolutionCategory", false, "whether to skip the resolution category variable"};

◆ m_sysScheme

Gaudi::Property<std::string> CP::MuonCalibTool::m_sysScheme {this, "systematicScheme", "Corr_Scale", "Systematic scheme to be configured"}
protected

Definition at line 96 of file MuonCalibTool.h.

96{this, "systematicScheme", "Corr_Scale", "Systematic scheme to be configured"};

◆ m_useRndRun

Gaudi::Property<bool> CP::MuonCalibTool::m_useRndRun {this, "useRandomRunNumber", false, "To use the random run number for deciding which calibration to apply"}
protected

Definition at line 102 of file MuonCalibTool.h.

102{this, "useRandomRunNumber", false, "To use the random run number for deciding which calibration to apply"};

◆ m_validationMode

Gaudi::Property<bool> CP::MuonCalibTool::m_validationMode {this, "expert_validationMode", false, "Expert only option. Puts the tool in the validation mode setup"}
protected

Definition at line 98 of file MuonCalibTool.h.

98{this, "expert_validationMode", false, "Expert only option. Puts the tool in the validation mode setup"};

◆ 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.


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