ATLAS Offline Software
Loading...
Searching...
No Matches
MuonCalibTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef MCAST_MUONCALIBTOOL_H
6#define MCAST_MUONCALIBTOOL_H
7
8// Framework include(s):
11#include "AsgTools/AsgTool.h"
17
29
32
33
34namespace CP {
35
37 public asg::AsgTool, public columnar::ColumnarTool<> {
38 // Create a proper constructor for Athena
41
42 public:
43 enum CalibMode {
44 //this should be sync with PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/python/MuonAnalysisConfig.py
45 noOption = -1, // <--- default
46 correctData_CB = 0,
47 correctData_IDMS = 1,
48 notCorrectData_IDMS = 2,
49 notCorrectData_CB = 3,
50 userDefined = 99,
51 };
52
53 // Interface methods that must be defined
54 // Interface - Apply the correction on a modifyable object
55 virtual CorrectionCode applyCorrection(xAOD::Muon& mu) const override;
57 // Interface - Create a corrected copy from a constant muon
58 virtual CorrectionCode correctedCopy(const xAOD::Muon& input, xAOD::Muon*& output) const override;
59 // Interface - Is the tool affected by a specific systematic?
60 virtual bool isAffectedBySystematic(const SystematicVariation& systematic) const override;
61 // Interface - Which systematics have an effect on the tool's behaviour?
62 virtual SystematicSet affectingSystematics() const override;
63 // Interface - Systematics to be used for physics analysis
64 virtual SystematicSet recommendedSystematics() const override;
65 // Interface - Use specific systematic
66 virtual StatusCode applySystematicVariation(const SystematicSet& systConfig) override;
67 // Interface - get the expected resolution of the muon
68 virtual double expectedResolution(const std::string& DetType, const xAOD::Muon& mu, const bool addMCCorrectionSmearing) const override;
69 // Interface - get the expected resolution of the muon
70 virtual double expectedResolution(const int& DetType, const xAOD::Muon& mu, const bool addMCCorrectionSmearing) const override;
71 double expectedResolution(const int& DetType, columnar::MuonId mu, columnar::EventInfoId evtInfo, const bool addMCCorrectionSmearing) const;
72 // Interface - Expert method to apply the MC correction on a modifyable trackParticle for ID- or MS-only corrections
73 virtual CorrectionCode applyCorrectionTrkOnly(xAOD::TrackParticle& inTrk, const int DetType) const override;
74
75 public:
76 // Constructor
77 MuonCalibTool(const std::string& name);
78
79 // Destructor
80 virtual ~MuonCalibTool() = default;
81
82 virtual StatusCode initialize() override;
83
84
85 protected:
86 // Event info
87 SG::ReadHandleKey<xAOD::EventInfo> m_eventInfo{this, "EventInfoContName", "EventInfo", "event info key"};
88
89 Gaudi::Property<bool> m_isRun3{this, "IsRun3Geo", false, "Needed for MuonSelectionTool"};
90
91 // Properties of the tool
92 Gaudi::Property<std::string> m_release{this, "release", "Recs2025_03_26_Run2Run3", "Release"};
93 // Systematics scheme
94 Gaudi::Property<std::string> m_sysScheme{this, "systematicScheme", "Corr_Scale", "Systematic scheme to be configured"};
95
96 Gaudi::Property<bool> m_validationMode{this, "expert_validationMode", false, "Expert only option. Puts the tool in the validation mode setup"};
97 Gaudi::Property<bool> m_expertMode_isData{this, "expertMode_isData", false, "Expert only option. Overwrites the isData Flag"};
98 Gaudi::Property<int> m_expertMode_RunNumber{this, "expertMode_RunNumber", 0, "Expert only option. Overwrites RunNumber"};
99 Gaudi::Property<unsigned long long> m_expertMode_EvtNumber{this, "expertMode_EvtNumber", 0, "Expert only option. Overwrites EventNumber"};
100 Gaudi::Property<bool> m_useRndRun{this, "useRandomRunNumber", false, "To use the random run number for deciding which calibration to apply"};
101
102 Gaudi::Property<int> m_calibMode{this, "calibMode", -1, "Calib mode"};
103
104 //it should be used ONLY by releases>=24.2.24 and p-tag < p5834
105 //more infos here https://atlas-mcp.docs.cern.ch/guidelines/muonselectiontool/index.html
106 Gaudi::Property<bool> m_excludeNSWFromPrecisionLayers{this, "ExcludeNSWFromPrecisionLayers", false, "Cut on the number of precision layers ignores the NSW"};
107
108 // Scale and Smear options
109 // Do direct CB calibration
110 Gaudi::Property<bool> m_doDirectCBCalib{this, "doDirectCBCalib", true, "Do direct calibration of CB tracks, otherwise, do ID+MS"};
111
112
113 // SagittaBias properties
114 Gaudi::Property<bool> m_doEtaSagittaSys{this, "doEtaSagittaSys", false, "Do Eta dependant systematic system"};
115 Gaudi::Property<bool> m_applyCorrectionOnData{this, "applyCorrectionOnData", true, "If to apply sagitta corrections on data, or take the full effect as systematic"};
116
117
118 // High pT correction options
119 // For more info: https://twiki.cern.ch/twiki/bin/view/Atlas/MuonSelectionToolR21#Usage_of_the_HighPt_selection
120 Gaudi::Property<bool> m_2stations_highpt_smearing{this, "do2StationsHighPt", false, "Extra smearing to be applied if high pT WP is used"};
121 // For more info: https://twiki.cern.ch/twiki/bin/view/Atlas/MuonSelectionToolR21#Usage_of_the_HighPt_selection
122 Gaudi::Property<bool> 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"};
123 Gaudi::Property<float> m_HighPtSystThreshold{this, "HighPtSystThr", 300.0, "Thershold for high pT smearing in GeV"};
124
126
129
131
132
133 // internal tool function
134 // Converts xAOD object to an internal MuonObj for easier transfer of information
136 MCP::MuonObj convertToMuonObj(const xAOD::TrackParticle& inTrk, const int DetType) const;
139
140
141 MCP::DataYear getPeriod(bool isData, columnar::EventInfoId evtInfo) const;
142
143 private:
144
146
147 public:
148
149 Gaudi::Property<bool> m_skipResolutionCategory{this, "skipResolutionCategory", false, "whether to skip the resolution category variable"};
150
151 std::unique_ptr<MCP::MuonCalibToolAccessors> m_acc {std::make_unique<MCP::MuonCalibToolAccessors>(*this)};
152
154 void callEvents (columnar::EventContextRange events) const override;
155
156 }; // class MuonCalibTool
157
158} // namespace CP
159
160#endif
#define ASG_TOOL_CLASS3(CLASSNAME, INT1, INT2, INT3)
Property holding a SG store/key/clid from which a ReadHandle is made.
Return value from object correction CP tools.
interface for all CP tools supporting systematic variations within a reentrant algorithm
Interface for all CP tools supporting systematic variations.
Gaudi::Property< std::string > m_sysScheme
asg::AnaToolHandle< CP::IMuonCalibIntScaleSmearTool > m_MuonIntScaleSmearTool
Gaudi::Property< unsigned long long > m_expertMode_EvtNumber
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Gaudi::Property< std::string > m_release
Gaudi::Property< bool > m_validationMode
Gaudi::Property< bool > m_excludeNSWFromPrecisionLayers
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.
MuonCalibTool(const std::string &name)
Gaudi::Property< bool > m_useRndRun
void initializeRandNumbers(MCP::MuonObj &obj, columnar::EventInfoId evtInfo) const
Decorate all information that's needed to ensure reproducibility of the smearing.
Gaudi::Property< bool > m_extra_highpt_smearing
virtual CorrectionCode applyCorrectionTrkOnly(xAOD::TrackParticle &inTrk, const int DetType) const override
Gaudi::Property< bool > m_skipResolutionCategory
MCP::DataYear getPeriod(bool isData, columnar::EventInfoId evtInfo) const
virtual CorrectionCode correctedCopy(const xAOD::Muon &input, xAOD::Muon *&output) const override
Create a corrected copy from a constant muon.
bool m_MuonIntHighTSmearToolInitialized
asg::AnaToolHandle< CP::IMuonCalibIntTool > m_MuonIntHighTSmearTool
Gaudi::Property< bool > m_doEtaSagittaSys
void callEvents(columnar::EventContextRange events) const override
Gaudi::Property< bool > m_applyCorrectionOnData
Gaudi::Property< float > m_HighPtSystThreshold
void callSingleEvent(columnar::MuonRange muons, columnar::EventInfoId event) const
asg::AnaToolHandle< CP::IMuonSelectionTool > m_MuonSelectionTool
MCP::MuonObj convertToMuonObj(columnar::MuonId mu, columnar::EventInfoId evtInfo) const
Gaudi::Property< bool > m_isRun3
virtual double expectedResolution(const std::string &DetType, const xAOD::Muon &mu, const bool addMCCorrectionSmearing) const override
Get the expected pT resolution.
asg::AnaToolHandle< CP::IMuonCalibIntTool > m_MuonIntSagittaTool
virtual ~MuonCalibTool()=default
Gaudi::Property< bool > m_2stations_highpt_smearing
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfo
virtual StatusCode applySystematicVariation(const SystematicSet &systConfig) override
effects: configure this tool for the given list of systematic variations.
Gaudi::Property< int > m_expertMode_RunNumber
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
Gaudi::Property< int > m_calibMode
std::unique_ptr< MCP::MuonCalibToolAccessors > m_acc
Gaudi::Property< bool > m_doDirectCBCalib
virtual SystematicSet recommendedSystematics() const override
the list of all systematics this tool recommends to use
Gaudi::Property< bool > m_expertMode_isData
Class to wrap a set of SystematicVariations.
Property holding a SG store/key/clid from which a ReadHandle is made.
a modified tool handle that allows its owner to configure new tools from the C++ side
Base class for the dual-use tool implementation classes.
Definition AsgTool.h:47
the base class for all columnar components
Select isolated Photons, Electrons and Muons.
DataYear
Definition EnumDef.h:28
ObjectId< ContainerId::muon > MuonId
Definition MuonDef.h:25
ObjectRange< ContainerId::eventContext > EventContextRange
ObjectRange< ContainerId::muon > MuonRange
Definition MuonDef.h:24
ObjectId< ContainerId::eventInfo > EventInfoId
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Muon_v1 Muon
Reference the current persistent version: