ATLAS Offline Software
Loading...
Searching...
No Matches
MuonCalibTool.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

namespace ADD_CMODE (CP)

Function Documentation

◆ ADD_CMODE()

namespace ADD_CMODE ( CP )

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

Definition at line 1 of file MuonCalibTool.h.

34 {
35
36 class MuonCalibTool : public virtual CP::IMuonCalibrationAndSmearingTool,
37 public asg::AsgTool, public columnar::ColumnarTool<> {
38 // Create a proper constructor for Athena
39 ASG_TOOL_CLASS3(MuonCalibTool, CP::IMuonCalibrationAndSmearingTool, CP::ISystematicsTool,
40 CP::IReentrantSystematicsTool)
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 correctData_IDonly = 4,
51 correctData_MSonly = 5,
52 userDefined = 99,
53 };
54
55 // Interface methods that must be defined
56 // Interface - Apply the correction on a modifyable object
57 virtual CP::CorrectionCode applyCorrection(xAOD::Muon& mu) const override;
58 CP::CorrectionCode applyCorrection(columnar::MuonId mu, columnar::EventInfoId evtInfo) const;
59 // Interface - Create a corrected copy from a constant muon
60 virtual CP::CorrectionCode correctedCopy(const xAOD::Muon& input, xAOD::Muon*& output) const override;
61 // Interface - Is the tool affected by a specific systematic?
62 virtual bool isAffectedBySystematic(const CP::SystematicVariation& systematic) const override;
63 // Interface - Which systematics have an effect on the tool's behaviour?
64 virtual CP::SystematicSet affectingSystematics() const override;
65 // Interface - Systematics to be used for physics analysis
66 virtual CP::SystematicSet recommendedSystematics() const override;
67 // Interface - Use specific systematic
68 virtual StatusCode applySystematicVariation(const CP::SystematicSet& systConfig) override;
69 // Interface - get the expected resolution of the muon
70 virtual double expectedResolution(const std::string& DetType, const xAOD::Muon& mu, const bool addMCCorrectionSmearing) const override;
71 // Interface - get the expected resolution of the muon
72 virtual double expectedResolution(const int& DetType, const xAOD::Muon& mu, const bool addMCCorrectionSmearing) const override;
73 double expectedResolution(const int& DetType, columnar::MuonId mu, columnar::EventInfoId evtInfo, const bool addMCCorrectionSmearing) const;
74 // Interface - Expert method to apply the MC correction on a modifyable trackParticle for ID- or MS-only corrections
75 virtual CP::CorrectionCode applyCorrectionTrkOnly(xAOD::TrackParticle& inTrk, const int DetType) const override;
76
77 public:
78 // Constructor
79 MuonCalibTool(const std::string& name);
80
81 // Destructor
82 virtual ~MuonCalibTool() = default;
83
84 virtual StatusCode initialize() override;
85
86
87 protected:
88 // Event info
89 SG::ReadHandleKey<xAOD::EventInfo> m_eventInfo{this, "EventInfoContName", "EventInfo", "event info key"};
90
91 Gaudi::Property<bool> m_isRun3{this, "IsRun3Geo", false, "Needed for MuonSelectionTool"};
92
93 // Properties of the tool
94 Gaudi::Property<std::string> m_release{this, "release", "Recs2025_12_11_Run2Run3", "Release"};
95 // Systematics scheme
96 Gaudi::Property<std::string> m_sysScheme{this, "systematicScheme", "Corr_Scale", "Systematic scheme to be configured"};
97
98 Gaudi::Property<bool> m_validationMode{this, "expert_validationMode", false, "Expert only option. Puts the tool in the validation mode setup"};
99 Gaudi::Property<bool> m_expertMode_isData{this, "expertMode_isData", false, "Expert only option. Overwrites the isData Flag"};
100 Gaudi::Property<int> m_expertMode_RunNumber{this, "expertMode_RunNumber", 0, "Expert only option. Overwrites RunNumber"};
101 Gaudi::Property<unsigned long long> m_expertMode_EvtNumber{this, "expertMode_EvtNumber", 0, "Expert only option. Overwrites EventNumber"};
102 Gaudi::Property<bool> m_useRndRun{this, "useRandomRunNumber", false, "To use the random run number for deciding which calibration to apply"};
103
104 Gaudi::Property<int> m_calibMode{this, "calibMode", -1, "Calib mode"};
105
106 //it should be used ONLY by releases>=24.2.24 and p-tag < p5834
107 //more infos here https://atlas-mcp.docs.cern.ch/guidelines/muonselectiontool/index.html
108 Gaudi::Property<bool> m_excludeNSWFromPrecisionLayers{this, "ExcludeNSWFromPrecisionLayers", false, "Cut on the number of precision layers ignores the NSW"};
109
110 // SagittaBias properties
111 Gaudi::Property<bool> m_doEtaSagittaSys{this, "doEtaSagittaSys", false, "Do Eta dependant systematic system"};
112 Gaudi::Property<bool> m_applyCorrectionOnData{this, "applyCorrectionOnData", true, "If to apply sagitta corrections on data, or take the full effect as systematic"};
113
114 // High pT correction options
115 // For more info: https://twiki.cern.ch/twiki/bin/view/Atlas/MuonSelectionToolR21#Usage_of_the_HighPt_selection
116 Gaudi::Property<bool> m_2stations_highpt_smearing{this, "do2StationsHighPt", false, "Extra smearing to be applied if high pT WP is used"};
117 // For more info: https://twiki.cern.ch/twiki/bin/view/Atlas/MuonSelectionToolR21#Usage_of_the_HighPt_selection
118 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"};
119 Gaudi::Property<float> m_HighPtSystThreshold{this, "HighPtSystThr", 300.0, "Thershold for high pT smearing in GeV"};
120
121 asg::AnaToolHandle<CP::IMuonSelectionTool> m_MuonSelectionTool{""};
122
123 asg::AnaToolHandle<IMuonCalibIntTool> m_MuonIntSagittaTool{""};
124 asg::AnaToolHandle<IMuonCalibIntScaleSmearTool> m_MuonIntScaleSmearTool{""};
125
126 asg::AnaToolHandle<IMuonCalibIntTool> m_MuonIntHighTSmearTool{""};
127
128
129 // internal tool function
130 // Converts xAOD object to an internal MuonObj for easier transfer of information
131 MCP::MuonObj convertToMuonObj(columnar::MuonId mu, columnar::EventInfoId evtInfo) const;
132 MCP::MuonObj convertToMuonObj(const xAOD::TrackParticle& inTrk, const int DetType) const;
134 void initializeRandNumbers(MCP::MuonObj& obj, columnar::EventInfoId evtInfo) const;
135
136
137 MCP::DataYear getPeriod(bool isData, columnar::EventInfoId evtInfo) const;
138
139 private:
140
141 bool m_MuonIntHighTSmearToolInitialized{false};
142
143 public:
144
145 Gaudi::Property<bool> m_skipResolutionCategory{this, "skipResolutionCategory", false, "whether to skip the resolution category variable"};
146
147 std::unique_ptr<MCP::MuonCalibToolAccessors> m_acc {std::make_unique<MCP::MuonCalibToolAccessors>(*this)};
148
149 void callSingleEvent (columnar::MuonRange muons, columnar::EventInfoId event) const;
150 void callEvents (columnar::EventContextRange events) const override;
151
152 }; // class MuonCalibTool
153
154} // namespace ADD_CMODE(CP)
#define ASG_TOOL_CLASS3(CLASSNAME, INT1, INT2, INT3)
virtual CorrectionCode applyCorrection(xAOD::Muon &mu) const =0
Declare the interface that the class provides.
virtual CorrectionCode applyCorrectionTrkOnly(xAOD::TrackParticle &inTrk, const int DetType) const =0
virtual double expectedResolution(const std::string &DetType, const xAOD::Muon &mu, const bool mc) const =0
Get the expected pT resolution.
virtual CorrectionCode correctedCopy(const xAOD::Muon &input, xAOD::Muon *&output) const =0
Create a corrected copy from a constant muon.
virtual SystematicSet affectingSystematics() const =0
the list of all systematics this tool can be affected by
virtual SystematicSet recommendedSystematics() const =0
the list of all systematics this tool recommends to use
virtual StatusCode applySystematicVariation(const SystematicSet &systConfig)=0
effects: configure this tool for the given list of systematic variations.
virtual bool isAffectedBySystematic(const SystematicVariation &systematic) const =0
Declare the interface that this class provides.
Base class for the dual-use tool implementation classes.
Definition AsgTool.h:47
the base class for all columnar components
::StatusCode StatusCode
StatusCode definition for legacy code.
DataYear
Definition EnumDef.h:28
ObjectId< MuonDef > MuonId
Definition MuonDef.h:22
ObjectRange< EventContextDef > EventContextRange
ObjectRange< MuonDef > MuonRange
Definition MuonDef.h:21
ObjectId< EventInfoDef > EventInfoId
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Muon_v1 Muon
Reference the current persistent version:
Definition Muon.h:13
void initialize()