ATLAS Offline Software
MuonCalibIntSagittaTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef MCAST_MUONCALIBINTSAGITTATOOL_H
6 #define MCAST_MUONCALIBINTSAGITTATOOL_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  // Interface - Is the tool affected by a specific systematic?
39  virtual bool isAffectedBySystematic(const SystematicVariation& systematic) const override;
40  // Interface - Which systematics have an effect on the tool's behaviour?
41  virtual SystematicSet affectingSystematics() const override;
42  // Interface - Systematics to be used for physics analysis
43  virtual SystematicSet recommendedSystematics() const override;
44  // Interface - Use specific systematic
45  virtual StatusCode applySystematicVariation(const SystematicSet& systConfig) override;
46 
47  public:
48  // Constructor
49  MuonCalibIntSagittaTool(const std::string& name);
50 
51  // Destructor
52  virtual ~MuonCalibIntSagittaTool() = default;
53 
54  virtual StatusCode initialize() override;
55 
56 
57  protected:
58  // Event info
59  SG::ReadHandleKey<xAOD::EventInfo> m_eventInfo{this, "EventInfoContName", "EventInfo", "event info key"};
60 
61  // Release scheme
62  Gaudi::Property<std::string> m_release{this, "release", "Recs2024_05_06_Run2Run3", "Release"};
63 
64  // Sagitta corrections
65  Gaudi::Property<bool> m_doEtaSagittaSys{this, "doEtaSagittaSys", false, "Do Eta dependant systematic system"};
66  Gaudi::Property<bool> m_applyCorrectionOnData{this, "applyCorrectionOnData", true, "If to apply sagitta corrections on data, or take the full effect as systematic"};
67 
68  // Do direct CB calibration
69  Gaudi::Property<bool> m_doDirectCBCalib{this, "doDirectCBCalib", true, "Apply sagitta corrections on CB tracks, otherwise, on ID+MS"};
70 
71  // Rho value to be used
72  Gaudi::Property<bool> m_useFixedRho{this, "useFixedRho", true, "Force Fixed Rho"};
73  Gaudi::Property<float> m_fixedRhoValue{this, "fixedRhoValue", 1, "Value for rho, if it is forced"};
74 
75  // Systematics scheme
76  Gaudi::Property<std::string> m_sysScheme{this, "systematicScheme", "Corr_Scale", "Systematic scheme to be configured"};
77  Gaudi::Property<float> m_extraRebiasSys{this, "extraRebias", 0.00002, "Additional systematic applied for the residual bias observed"};
78 
79  // For systematics
81  double SagittaRho{0.};
82  double SagittaBias{0.};
83  double SagittaGlobal{0.};
84  double SagittaPtExtra{0.};
85  double SagittaDataStat{0.};
86  double SagittaEtaSlice{0.};
87  };
88 
89  // calculate the parameter set for the given systematic
90  StatusCode calcSystematicVariation(const SystematicSet& systConfig, ParameterSetSagitta& param) const;
91 
94 
95  typedef std::map<MCP::SagittaCorrection, std::shared_ptr<MCP::CalibContainer>> SagittaCorrConstMap;
96 
97  // Corrections from the data
98  std::map<MCP::DataYear, SagittaCorrConstMap> m_sagittaCorrConst_ID;
99  std::map<MCP::DataYear, SagittaCorrConstMap> m_sagittaCorrConst_ME;
100  std::map<MCP::DataYear, SagittaCorrConstMap> m_sagittaCorrConst_CB;
101 
102  // Corrections from the MC - what is typically referred to as the kinematic term
103  std::map<MCP::DataYear, SagittaCorrConstMap> m_sagittaCorrConst_mcID;
104  std::map<MCP::DataYear, SagittaCorrConstMap> m_sagittaCorrConst_mcME;
105  std::map<MCP::DataYear, SagittaCorrConstMap> m_sagittaCorrConst_mcCB;
106 
107 
108  void applySagittaCorrection(double& pt, const std::vector<double>& correction, const int& charge, const bool& isData) const;
109 
110 
111  // Get the set of correction, based on data + systematic setting
112  std::vector<double> getCorrections(const MCP::TrackCalibObj& mu) const;
113 
114  // Statistical combination
115  double statCombCorrection(const MCP::MuonObj& mu, double corrIDpT, double corrMEpT, double CBpT) const;
116  CorrectionCode applyStatCombination(AmgVector(5) parsID, const AmgSymMatrix(5)& covID, AmgVector(5) parsMS, const AmgSymMatrix(5)& covMS, int charge, AmgVector(5) & parsCB, AmgSymMatrix(5) & covCB, double& chi2) const;
117 
118 
119  }; // class MuonCalibIntSagittaTool
120 
121 } // namespace CP
122 
123 #endif
CP::MuonCalibIntSagittaTool::m_sagittaCorrConst_mcCB
std::map< MCP::DataYear, SagittaCorrConstMap > m_sagittaCorrConst_mcCB
Definition: MuonCalibIntSagittaTool.h:105
CP::IMuonCalibIntTool
Definition: IMuonCalibIntTool.h:26
CP::MuonCalibIntSagittaTool::statCombCorrection
double statCombCorrection(const MCP::MuonObj &mu, double corrIDpT, double corrMEpT, double CBpT) const
Definition: MuonCalibIntSagittaTool.cxx:318
CP::MuonCalibIntSagittaTool::ParameterSetSagitta::SagittaBias
double SagittaBias
Definition: MuonCalibIntSagittaTool.h:82
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
PropertyWrapper.h
MuonObj.h
CP::MuonCalibIntSagittaTool::applySagittaCorrection
void applySagittaCorrection(double &pt, const std::vector< double > &correction, const int &charge, const bool &isData) const
Definition: MuonCalibIntSagittaTool.cxx:134
CP::MuonCalibIntSagittaTool::m_useFixedRho
Gaudi::Property< bool > m_useFixedRho
Definition: MuonCalibIntSagittaTool.h:72
CP::MuonCalibIntSagittaTool::~MuonCalibIntSagittaTool
virtual ~MuonCalibIntSagittaTool()=default
CP::MuonCalibIntSagittaTool::MuonCalibIntSagittaTool
MuonCalibIntSagittaTool(const std::string &name)
Definition: MuonCalibIntSagittaTool.cxx:20
CP::MuonCalibIntSagittaTool::ParameterSetSagitta::SagittaDataStat
double SagittaDataStat
Definition: MuonCalibIntSagittaTool.h:85
CP::MuonCalibIntSagittaTool::calcSystematicVariation
StatusCode calcSystematicVariation(const SystematicSet &systConfig, ParameterSetSagitta &param) const
Definition: MuonCalibIntSagittaTool.cxx:483
CP::MuonCalibIntSagittaTool::m_sagittaCorrConst_CB
std::map< MCP::DataYear, SagittaCorrConstMap > m_sagittaCorrConst_CB
Definition: MuonCalibIntSagittaTool.h:100
CP::MuonCalibIntSagittaTool::m_sagittaCorrConst_ID
std::map< MCP::DataYear, SagittaCorrConstMap > m_sagittaCorrConst_ID
Definition: MuonCalibIntSagittaTool.h:98
CP::MuonCalibIntSagittaTool::ParameterSetSagitta::SagittaPtExtra
double SagittaPtExtra
Definition: MuonCalibIntSagittaTool.h:84
CP::MuonCalibIntSagittaTool::m_eventInfo
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfo
Definition: MuonCalibIntSagittaTool.h:59
CalibContainer.h
test_pyathena.pt
pt
Definition: test_pyathena.py:11
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
CP::MuonCalibIntSagittaTool::m_sysScheme
Gaudi::Property< std::string > m_sysScheme
Definition: MuonCalibIntSagittaTool.h:76
CP::MuonCalibIntSagittaTool::m_extraRebiasSys
Gaudi::Property< float > m_extraRebiasSys
Definition: MuonCalibIntSagittaTool.h:77
CP::IMuonCalibIntTool::applyCorrection
virtual CorrectionCode applyCorrection(MCP::MuonObj &mu) const =0
Declare the interface that the class provides.
CP::MuonCalibIntSagittaTool::m_doEtaSagittaSys
Gaudi::Property< bool > m_doEtaSagittaSys
Definition: MuonCalibIntSagittaTool.h:65
CP::SystematicVariation
Definition: SystematicVariation.h:47
SG::ReadHandleKey< xAOD::EventInfo >
CP::MuonCalibIntSagittaTool::affectingSystematics
virtual SystematicSet affectingSystematics() const override
the list of all systematics this tool can be affected by
Definition: MuonCalibIntSagittaTool.cxx:443
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
AmgSymMatrix
#define AmgSymMatrix(dim)
Definition: EventPrimitives.h:50
CP::MuonCalibIntSagittaTool::ParameterSetSagitta::SagittaRho
double SagittaRho
Definition: MuonCalibIntSagittaTool.h:81
CP::MuonCalibIntSagittaTool::m_release
Gaudi::Property< std::string > m_release
Definition: MuonCalibIntSagittaTool.h:62
CP::MuonCalibIntSagittaTool::applyStatCombination
CorrectionCode applyStatCombination(AmgVector(5) parsID, const AmgSymMatrix(5)&covID, AmgVector(5) parsMS, const AmgSymMatrix(5)&covMS, int charge, AmgVector(5) &parsCB, AmgSymMatrix(5) &covCB, double &chi2) const
Definition: MuonCalibIntSagittaTool.cxx:381
tools.zlumi_mc_cf.correction
def correction(mu, runmode, campaign, run=None)
Definition: zlumi_mc_cf.py:4
CP::MuonCalibIntSagittaTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: MuonCalibIntSagittaTool.cxx:23
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.
AmgVector
AmgVector(4) T2BSTrackFilterTool
Definition: T2BSTrackFilterTool.cxx:114
CP::MuonCalibIntSagittaTool::m_Parameters
SystematicsCache< ParameterSetSagitta > m_Parameters
Definition: MuonCalibIntSagittaTool.h:92
chi2
double chi2(TH1 *h0, TH1 *h1)
Definition: comparitor.cxx:522
CP::MuonCalibIntSagittaTool::m_sagittaCorrConst_mcME
std::map< MCP::DataYear, SagittaCorrConstMap > m_sagittaCorrConst_mcME
Definition: MuonCalibIntSagittaTool.h:104
CP::MuonCalibIntSagittaTool::ParameterSetSagitta::SagittaEtaSlice
double SagittaEtaSlice
Definition: MuonCalibIntSagittaTool.h:86
CP::MuonCalibIntSagittaTool::recommendedSystematics
virtual SystematicSet recommendedSystematics() const override
the list of all systematics this tool recommends to use
Definition: MuonCalibIntSagittaTool.cxx:481
CP::MuonCalibIntSagittaTool::applySystematicVariation
virtual StatusCode applySystematicVariation(const SystematicSet &systConfig) override
effects: configure this tool for the given list of systematic variations.
Definition: MuonCalibIntSagittaTool.cxx:568
AnaToolHandle.h
CP::MuonCalibIntSagittaTool::SagittaCorrConstMap
std::map< MCP::SagittaCorrection, std::shared_ptr< MCP::CalibContainer > > SagittaCorrConstMap
Definition: MuonCalibIntSagittaTool.h:95
CP::MuonCalibIntSagittaTool::m_sagittaCorrConst_mcID
std::map< MCP::DataYear, SagittaCorrConstMap > m_sagittaCorrConst_mcID
Definition: MuonCalibIntSagittaTool.h:103
CP::MuonCalibIntSagittaTool::ParameterSetSagitta::SagittaGlobal
double SagittaGlobal
Definition: MuonCalibIntSagittaTool.h:83
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
charge
double charge(const T &p)
Definition: AtlasPID.h:538
CP::MuonCalibIntSagittaTool::m_sagittaCorrConst_ME
std::map< MCP::DataYear, SagittaCorrConstMap > m_sagittaCorrConst_ME
Definition: MuonCalibIntSagittaTool.h:99
EventInfo.h
EnumDef.h
CP::ISystematicsTool
Interface for all CP tools supporting systematic variations.
Definition: ISystematicsTool.h:32
CP::MuonCalibIntSagittaTool::isAffectedBySystematic
virtual ASG_TOOL_CLASS3(MuonCalibIntSagittaTool, CP::IMuonCalibIntTool, CP::ISystematicsTool, CP::IReentrantSystematicsTool) public bool isAffectedBySystematic(const SystematicVariation &systematic) const override
Declare the interface that this class provides.
Definition: MuonCalibIntSagittaTool.cxx:437
CP::MuonCalibIntSagittaTool::m_applyCorrectionOnData
Gaudi::Property< bool > m_applyCorrectionOnData
Definition: MuonCalibIntSagittaTool.h:66
CP::MuonCalibIntSagittaTool
Definition: MuonCalibIntSagittaTool.h:28
CP::MuonCalibIntSagittaTool::ParameterSetSagitta
Definition: MuonCalibIntSagittaTool.h:80
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
IMuonCalibIntTool.h
MCP::MuonObj
Definition: MuonObj.h:126
CP::MuonCalibIntSagittaTool::m_doDirectCBCalib
Gaudi::Property< bool > m_doDirectCBCalib
Definition: MuonCalibIntSagittaTool.h:69
AsgTool.h
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
CP::MuonCalibIntSagittaTool::m_fixedRhoValue
Gaudi::Property< float > m_fixedRhoValue
Definition: MuonCalibIntSagittaTool.h:73
SystematicsCache.h
CP::MuonCalibIntSagittaTool::getCorrections
std::vector< double > getCorrections(const MCP::TrackCalibObj &mu) const
Definition: MuonCalibIntSagittaTool.cxx:148
CP::MuonCalibIntSagittaTool::m_currentParameters
const ParameterSetSagitta * m_currentParameters
Definition: MuonCalibIntSagittaTool.h:93