ATLAS Offline Software
MuonCalibIntScaleSmearTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef MCAST_MUONCALIBINTSCALESMEARTOOL_H
6 #define MCAST_MUONCALIBINTSCALESMEARTOOL_H
7 
8 // C++ includes
9 #include <map>
10 #include <vector>
11 
12 // Framework include(s):
14 #include "AsgTools/AnaToolHandle.h"
15 #include "AsgTools/AsgTool.h"
19 
24 
25 namespace CP {
26 
28  public asg::AsgTool {
29  // Create a proper constructor for Athena
32 
33  public:
34  // Interface methods that must be defined
35  // Interface - Apply the correction on a modifyable object
36  virtual CorrectionCode applyCorrection(MCP::MuonObj& mu) const override;
37 
38  virtual double getExpectedResolution(const int &DetType, double pT, double eta, double phi, MCP::DataYear year, bool isData) const override;
39 
40  // Interface - Is the tool affected by a specific systematic?
41  virtual bool isAffectedBySystematic(const SystematicVariation& systematic) const override;
42  // Interface - Which systematics have an effect on the tool's behaviour?
43  virtual SystematicSet affectingSystematics() const override;
44  // Interface - Systematics to be used for physics analysis
45  virtual SystematicSet recommendedSystematics() const override;
46  // Interface - Use specific systematic
47  virtual StatusCode applySystematicVariation(const SystematicSet& systConfig) override;
48 
49  public:
50  // Constructor
51  MuonCalibIntScaleSmearTool(const std::string& name);
52 
53  // Destructor
54  virtual ~MuonCalibIntScaleSmearTool() = default;
55 
56  virtual StatusCode initialize() override;
57 
58  protected:
59  // Event info
60  SG::ReadHandleKey<xAOD::EventInfo> m_eventInfo{this, "EventInfoContName", "EventInfo", "event info key"};
61 
62  // Release scheme
63  Gaudi::Property<std::string> m_release{this, "release", "Recs2024_05_06_Run2Run3", "Release"};
64 
65  // Systematics scheme
66  Gaudi::Property<std::string> m_sysScheme{this, "systematicScheme", "Corr_Scale", "Systematic scheme to be configured"};
67 
68  // Do direct CB calibration
69  Gaudi::Property<bool> m_doDirectCBCalib{this, "doDirectCBCalib", true, "Do direct calibration of CB tracks, otherwise, do ID+MS"};
70 
71  typedef std::map<MCP::ScaleResCorrection, std::shared_ptr<MCP::CalibContainer>> ScaleSmearCorrConstMap;
72 
73  // For systematics
75  {
76  std::map<MCP::ScaleSmearParam, double> m_IDparams;
77  std::map<MCP::ScaleSmearParam, double> m_MEparams;
78  std::map<MCP::ScaleSmearParam, double> m_CBparams;
79  };
80 
81  // calculate the parameter set for the given systematic
83 
86 
87  // Corrections from the data
88  std::map<MCP::DataYear, std::map<MCP::ScaleSmearParam, ScaleSmearCorrConstMap>> m_IDparams;
89  std::map<MCP::DataYear, std::map<MCP::ScaleSmearParam, ScaleSmearCorrConstMap>> m_MEparams;
90  std::map<MCP::DataYear, std::map<MCP::ScaleSmearParam, ScaleSmearCorrConstMap>> m_CBparams;
91 
92 
93  // For expected resu
94  std::map<MCP::DataYear, std::map<MCP::ExpectedResParam, std::shared_ptr<MCP::CalibContainer>>> m_IDExpectedResparams;
95  std::map<MCP::DataYear, std::map<MCP::ExpectedResParam, std::shared_ptr<MCP::CalibContainer>>> m_MEExpectedResparams;
96 
98 
99  std::map<MCP::ScaleSmearParam, double> getConstants(const MCP::TrackCalibObj& trk, const std::map<MCP::ScaleSmearParam, ScaleSmearCorrConstMap>& constants, const std::map<MCP::ScaleSmearParam, double>& direction) const;
100 
101  // Apply all the pT corrections
102  double getCorrectedPt(const MCP::MuonObj& mu, const MCP::TrackCalibObj& trk, const std::map<MCP::ScaleSmearParam, double>& calibConstant) const;
103 
104  // Get the smearing correction
105  double getSmearCorr(const MCP::MuonObj& mu, const MCP::TrackCalibObj& trk, double r0, double r1, double r2) const;
106 
107  // Apply the ID+MS correction on the CB track
108  double getCorrectedCBPtWithIDMSComb(const MCP::MuonObj& mu, const std::map<MCP::ScaleSmearParam, double>&calibIDConstant , const std::map<MCP::ScaleSmearParam, double>& calibMEConstant) const;
109 
110  }; // class MuonCalibIntScaleSmearTool
111 
112 } // namespace CP
113 
114 #endif
CalculateHighPtTerm.pT
pT
Definition: ICHEP2016/CalculateHighPtTerm.py:57
CP::MuonCalibIntScaleSmearTool::ParameterSetScaleSmear
Definition: MuonCalibIntScaleSmearTool.h:75
CP::MuonCalibIntScaleSmearTool::applySystematicVariation
virtual StatusCode applySystematicVariation(const SystematicSet &systConfig) override
effects: configure this tool for the given list of systematic variations.
Definition: MuonCalibIntScaleSmearTool.cxx:460
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
CP::MuonCalibIntScaleSmearTool::~MuonCalibIntScaleSmearTool
virtual ~MuonCalibIntScaleSmearTool()=default
PropertyWrapper.h
MuonObj.h
CP::MuonCalibIntScaleSmearTool::ParameterSetScaleSmear::m_IDparams
std::map< MCP::ScaleSmearParam, double > m_IDparams
Definition: MuonCalibIntScaleSmearTool.h:76
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
CP::MuonCalibIntScaleSmearTool::m_doDirectCBCalib
Gaudi::Property< bool > m_doDirectCBCalib
Definition: MuonCalibIntScaleSmearTool.h:69
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
CP::MuonCalibIntScaleSmearTool::affectingSystematics
virtual SystematicSet affectingSystematics() const override
the list of all systematics this tool can be affected by
Definition: MuonCalibIntScaleSmearTool.cxx:271
CalibContainer.h
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
MCP::ScaleSmearParam::s0
@ s0
CP::IMuonCalibIntTool::applyCorrection
virtual CorrectionCode applyCorrection(MCP::MuonObj &mu) const =0
Declare the interface that the class provides.
CP::SystematicVariation
Definition: SystematicVariation.h:47
SG::ReadHandleKey< xAOD::EventInfo >
MCP::ScaleSmearParam::r2
@ r2
python.AtlRunQueryAMI.year
year
Definition: AtlRunQueryAMI.py:226
CP::MuonCalibIntScaleSmearTool::getConstants
std::map< MCP::ScaleSmearParam, double > getConstants(const MCP::TrackCalibObj &trk, const std::map< MCP::ScaleSmearParam, ScaleSmearCorrConstMap > &constants, const std::map< MCP::ScaleSmearParam, double > &direction) const
Definition: MuonCalibIntScaleSmearTool.cxx:106
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
CP::MuonCalibIntScaleSmearTool::m_currentParameters
const ParameterSetScaleSmear * m_currentParameters
Definition: MuonCalibIntScaleSmearTool.h:85
CP::MuonCalibIntScaleSmearTool::ParameterSetScaleSmear::m_MEparams
std::map< MCP::ScaleSmearParam, double > m_MEparams
Definition: MuonCalibIntScaleSmearTool.h:77
CP::MuonCalibIntScaleSmearTool::m_MEparams
std::map< MCP::DataYear, std::map< MCP::ScaleSmearParam, ScaleSmearCorrConstMap > > m_MEparams
Definition: MuonCalibIntScaleSmearTool.h:89
MCP::ScaleSmearParam::s1
@ s1
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
CP::MuonCalibIntScaleSmearTool::recommendedSystematics
virtual SystematicSet recommendedSystematics() const override
the list of all systematics this tool recommends to use
Definition: MuonCalibIntScaleSmearTool.cxx:328
CP::MuonCalibIntScaleSmearTool::m_IDparams
std::map< MCP::DataYear, std::map< MCP::ScaleSmearParam, ScaleSmearCorrConstMap > > m_IDparams
Definition: MuonCalibIntScaleSmearTool.h:88
CP::MuonCalibIntScaleSmearTool::m_release
Gaudi::Property< std::string > m_release
Definition: MuonCalibIntScaleSmearTool.h:63
CP::MuonCalibIntScaleSmearTool::m_IDExpectedResparams
std::map< MCP::DataYear, std::map< MCP::ExpectedResParam, std::shared_ptr< MCP::CalibContainer > > > m_IDExpectedResparams
Definition: MuonCalibIntScaleSmearTool.h:94
CP::MuonCalibIntScaleSmearTool::getExpectedResolution
virtual ASG_TOOL_CLASS3(MuonCalibIntScaleSmearTool, CP::IMuonCalibIntScaleSmearTool, CP::ISystematicsTool, CP::IReentrantSystematicsTool) public double getExpectedResolution(const int &DetType, double pT, double eta, double phi, MCP::DataYear year, bool isData) const override
Declare the interface that the class provides.
Definition: MuonCalibIntScaleSmearTool.cxx:466
CP::MuonCalibIntScaleSmearTool::getCorrectedCBPtWithIDMSComb
double getCorrectedCBPtWithIDMSComb(const MCP::MuonObj &mu, const std::map< MCP::ScaleSmearParam, double > &calibIDConstant, const std::map< MCP::ScaleSmearParam, double > &calibMEConstant) const
Definition: MuonCalibIntScaleSmearTool.cxx:176
CP::MuonCalibIntScaleSmearTool::isAffectedBySystematic
virtual bool isAffectedBySystematic(const SystematicVariation &systematic) const override
Declare the interface that this class provides.
Definition: MuonCalibIntScaleSmearTool.cxx:265
AnaToolHandle.h
CP::MuonCalibIntScaleSmearTool::m_eventInfo
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfo
Definition: MuonCalibIntScaleSmearTool.h:60
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
CP::IMuonCalibIntScaleSmearTool
class IMuonCalibIntTool
Definition: IMuonCalibIntTool.h:38
CP::MuonCalibIntScaleSmearTool::getSmearCorr
double getSmearCorr(const MCP::MuonObj &mu, const MCP::TrackCalibObj &trk, double r0, double r1, double r2) const
Definition: MuonCalibIntScaleSmearTool.cxx:159
CP::MuonCalibIntScaleSmearTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: MuonCalibIntScaleSmearTool.cxx:23
EventInfo.h
EnumDef.h
CP::MuonCalibIntScaleSmearTool::m_sysScheme
Gaudi::Property< std::string > m_sysScheme
Definition: MuonCalibIntScaleSmearTool.h:66
CP::ISystematicsTool
Interface for all CP tools supporting systematic variations.
Definition: ISystematicsTool.h:32
CP::MuonCalibIntScaleSmearTool::m_CBparams
std::map< MCP::DataYear, std::map< MCP::ScaleSmearParam, ScaleSmearCorrConstMap > > m_CBparams
Definition: MuonCalibIntScaleSmearTool.h:90
CP::MuonCalibIntScaleSmearTool::m_paramList
static constexpr std::array< MCP::ScaleSmearParam, 5 > m_paramList
Definition: MuonCalibIntScaleSmearTool.h:97
MCP::ScaleSmearParam::r0
@ r0
CP::MuonCalibIntScaleSmearTool::m_Parameters
SystematicsCache< ParameterSetScaleSmear > m_Parameters
Definition: MuonCalibIntScaleSmearTool.h:84
CP::MuonCalibIntScaleSmearTool
Definition: MuonCalibIntScaleSmearTool.h:28
constants
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:1
CP::MuonCalibIntScaleSmearTool::m_MEExpectedResparams
std::map< MCP::DataYear, std::map< MCP::ExpectedResParam, std::shared_ptr< MCP::CalibContainer > > > m_MEExpectedResparams
Definition: MuonCalibIntScaleSmearTool.h:95
ASG_TOOL_CLASS3
#define ASG_TOOL_CLASS3(CLASSNAME, INT1, INT2, INT3)
Definition: AsgToolMacros.h:85
CP::CorrectionCode
Return value from object correction CP tools.
Definition: CorrectionCode.h:31
CP::SystematicsCache
helper class to cache systematics varied calibration constants inside a ISystematicsTool or IRentrant...
Definition: SystematicsCache.h:85
CP::IReentrantSystematicsTool
interface for all CP tools supporting systematic variations within a reentrant algorithm
Definition: IReentrantSystematicsTool.h:58
CP::MuonCalibIntScaleSmearTool::calcSystematicVariation
StatusCode calcSystematicVariation(const SystematicSet &systConfig, ParameterSetScaleSmear &param) const
Definition: MuonCalibIntScaleSmearTool.cxx:330
IMuonCalibIntTool.h
python.grid.isData
def isData(dataset)
Definition: grid.py:491
MCP::DataYear
DataYear
Definition: EnumDef.h:28
CP::MuonCalibIntScaleSmearTool::ScaleSmearCorrConstMap
std::map< MCP::ScaleResCorrection, std::shared_ptr< MCP::CalibContainer > > ScaleSmearCorrConstMap
Definition: MuonCalibIntScaleSmearTool.h:71
MCP::MuonObj
Definition: MuonObj.h:126
CP::MuonCalibIntScaleSmearTool::MuonCalibIntScaleSmearTool
MuonCalibIntScaleSmearTool(const std::string &name)
Definition: MuonCalibIntScaleSmearTool.cxx:20
DetType
Definition: DetType.h:10
MCP::ScaleSmearParam::r1
@ r1
AsgTool.h
CP::MuonCalibIntScaleSmearTool::ParameterSetScaleSmear::m_CBparams
std::map< MCP::ScaleSmearParam, double > m_CBparams
Definition: MuonCalibIntScaleSmearTool.h:78
CaloNoise_fillDB.mu
mu
Definition: CaloNoise_fillDB.py:53
MCP::TrackCalibObj
Basic object to cache all relevant information from the track.
Definition: MuonObj.h:21
SystematicsCache.h
CP::MuonCalibIntScaleSmearTool::getCorrectedPt
double getCorrectedPt(const MCP::MuonObj &mu, const MCP::TrackCalibObj &trk, const std::map< MCP::ScaleSmearParam, double > &calibConstant) const
Definition: MuonCalibIntScaleSmearTool.cxx:139