ATLAS Offline Software
Loading...
Searching...
No Matches
MuonEfficiencyScaleFactors.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 )

initialize the tool once all settings are in place!

Retrieve the Scale factor and decorate the muon

replica generation

returns: whether this tool is affected by the given systematis

returns: the list of all systematics this tool can be affected by

returns: the list of all systematics this tool recommends to use

Obtain the muon efficiency measured using the data

Obtain the muon efficiency measured using the MC

load the SF histos

Scale-factor files since Moriond2019 contain the breakdown of systematics into their individual components. This method loads all systematics and looks their systematics up and returns them in a map together with a bitmask which files are affected by the systematic

The following methods are meant to propagate information from the central tool to the subtool managing the individual scale-factor maps to keep their constructors small in number of arguments. The users do not have to call them.

Construct the name of the input files from the configuration Make these methods public such that they can be used by the scale-factor managing EffiCollection class without piping All arguments to the constructor again

Reconstruction scale-factors have a dedicated map for calo-tag muons around |\eta|<0.1. If the scale-factor is isolation/TTVA then the central file name is returned

High-eta reconstruction scale-factors are not obtained by the means of are not obtained by the means of tag & probe, but rather by building the double ratio. The map is delivered in a dedicated file whose path is returned here

Returns the scale-factor maps from a complementary scale-factor measurement using the J/Psi or Upsilon resonance

LRT muons have their own efficiency maps

If the pt of the muon is below that threshold the J/Psi or Upsilon map is used given that it's available.

Returns the type of the measurement to be carried out... E.g. Reco/TTVA/Iso

The apply<Blah> methods decorate their result directly to the muon. The name of the decorators can be set by the users themselves using several properties. To avoid that systmatics overwrite each other and the nominal the final maps are decorating the muon following the logic <decoration>__<syst_name>

The following methods propagate the basic decoration names to the maps

Returns the position of the collection in the syst set vector. If the collection is not part of this class -1 is returned

Returns the number of EffiCollections stored in this class

Returns a boolean whether the uncorrelation of systematics has been switched on

Returns the string telling the tool in which float AuxElement the information of the separation to the closest jet is stored

option to set if we want to use 1D or 2D isolation SFs

option to set if we want to use LRT muons

utility method to 'dress' a filename using the path resolver

the working point to operate on

This vector stores all scale-factor maps

Pointer to the current active map in terms of systematics

subfolder to load from the calibration db

threshold below which low-pt SF (i.e. from JPsi) should be used

Name of the decoration to catch up the close by jets

It turned out that the code spends a large time in the look up of the systematics. This map tries to mitigate this issue.

Turn on if using LRT objects

Definition at line 1 of file MuonEfficiencyScaleFactors.h.

28 {
29 class MuonEfficiencyScaleFactors: virtual public CP::IMuonEfficiencyScaleFactors, public asg::AsgTool, public columnar::ColumnarTool<>{
30
31 public:
32 MuonEfficiencyScaleFactors(const std::string& name);
33
34 virtual ~MuonEfficiencyScaleFactors();
35 //Proper constructor for Athena
36 ASG_TOOL_CLASS3( MuonEfficiencyScaleFactors, CP::IMuonEfficiencyScaleFactors, CP::ISystematicsTool, CP::IReentrantSystematicsTool )
37
38
39 virtual StatusCode initialize() override;
40
42 virtual CP::CorrectionCode getEfficiencyScaleFactor(const xAOD::Muon& mu, float& sf, const xAOD::EventInfo* info = 0) const override;
43 CP::CorrectionCode getEfficiencyScaleFactor(columnar::MuonId mu, float& sf, columnar::EventInfoId info) const;
44 virtual CP::CorrectionCode applyEfficiencyScaleFactor(const xAOD::Muon& mu, const xAOD::EventInfo* info = 0) const override;
46 virtual CP::CorrectionCode getEfficiencyScaleFactorReplicas(const xAOD::Muon& mu, std::vector<float> & sf_err, const xAOD::EventInfo* info = 0) const override;
47 virtual CP::CorrectionCode applyEfficiencyScaleFactorReplicas(const xAOD::Muon& mu, int nreplicas = 50, const xAOD::EventInfo* info = 0) const override;
48
50 virtual bool isAffectedBySystematic(const CP::SystematicVariation& systematic) const override;
51
53 virtual CP::SystematicSet affectingSystematics() const override;
54
56 virtual CP::SystematicSet recommendedSystematics() const override;
57
58 virtual StatusCode applySystematicVariation(const CP::SystematicSet& systConfig) override;
59
61 virtual CP::CorrectionCode getDataEfficiency(const xAOD::Muon& mu, float& eff, const xAOD::EventInfo* info = 0) const override;
62 virtual CP::CorrectionCode applyDataEfficiency(const xAOD::Muon& mu, const xAOD::EventInfo* info = 0) const override;
63
64 virtual CP::CorrectionCode getDataEfficiencyReplicas(const xAOD::Muon& mu, std::vector<float> & sf_err, const xAOD::EventInfo* info = 0) const;
65 virtual CP::CorrectionCode applyDataEfficiencyReplicas(const xAOD::Muon& mu, int nreplicas = 50, const xAOD::EventInfo* info = 0) const;
66
68 virtual CP::CorrectionCode getMCEfficiency(const xAOD::Muon& mu, float& eff, const xAOD::EventInfo* info = 0) const override;
69 virtual CP::CorrectionCode applyMCEfficiency(const xAOD::Muon& mu, const xAOD::EventInfo* info = 0) const override;
70
71 virtual CP::CorrectionCode getMCEfficiencyReplicas(const xAOD::Muon& mu, std::vector<float> & sf_err, const xAOD::EventInfo* info = 0) const;
72 virtual CP::CorrectionCode applyMCEfficiencyReplicas(const xAOD::Muon& mu, int nreplicas = 50, const xAOD::EventInfo* info = 0) const;
73
74 virtual int getUnCorrelatedSystBin(const xAOD::Muon& mu) const override;
75 virtual std::string getUncorrelatedSysBinName(unsigned int Bin) const override;
76 virtual std::string getUncorrelatedSysBinName(const CP::SystematicSet& systConfig) const override;
77
78
79 private:
80 unsigned int getRandomRunNumber(const xAOD::EventInfo* info) const;
81 unsigned int getRandomRunNumber(columnar::EventInfoId info) const;
83 StatusCode LoadInputs();
84
85 SG::ReadHandleKey<xAOD::EventInfo> m_eventInfo{this, "EventInfoContName", "EventInfo", "event info key"};
86
91 std::map<std::string, unsigned int> lookUpSystematics();
92 public:
96
97
102 std::string filename_Central()const;
106 std::string filename_Calo()const;
111 std::string filename_HighEta()const;
112
115 std::string filename_LowPt()const;
116 std::string filename_LowPtCalo()const;
118 std::string filename_LRTCentral() const;
119 std::string filename_LRTLowPt() const;
120
123 float lowPtTransition() const;
124
126 MuonEfficiencyType measurement() const;
127
132
134 std::string sf_decoration() const;
135 std::string data_effi_decoration() const;
136 std::string mc_effi_decoration() const;
137
138 std::string sf_replica_decoration() const;
139 std::string data_effi_replica_decoration() const;
140 std::string mc_effi_replica_deocration() const;
141
145 size_t getPosition(const EffiCollection* coll) const;
146
148 size_t getNCollections() const;
150 bool uncorrelate_sys() const;
151
155 const std::string& close_by_jet_decoration() const;
157 bool use_2D_iso_corrections() const;
159 bool use_lrt() const;
160
161
162 private:
164 std::string resolve_file_location(const std::string &filename)const;
165
166
168 std::string m_wp;
169
171 std::vector<std::unique_ptr<EffiCollection>> m_sf_sets;
172
174 EffiCollection* m_current_sf;
175
176 std::string m_custom_dir;
177 std::string m_custom_file_Combined;
178 std::string m_custom_file_Calo;
179 std::string m_custom_file_HighEta;
180 std::string m_custom_file_LowPt;
181 std::string m_custom_file_LowPtCalo;
182 std::string m_custom_file_LRTCombined;
183 std::string m_custom_file_LRTLowPt;
184
185 // Decorate the data-monteCarlo & scale-factors
186 // to the muon. Decoration names can be set flexile
187 std::string m_efficiency_decoration_name_data;
188 std::string m_efficiency_decoration_name_mc;
189 std::string m_sf_decoration_name;
190
192 std::string m_calibration_version;
193
194
196 float m_lowpt_threshold;
198 std::string m_iso_jet_dR;
199 bool m_use2DIsoCorr;
200 CP::SystematicSet m_affectingSys;
203 std::unordered_map<CP::SystematicSet, EffiCollection*> m_filtered_sys_sets;
204
205 bool m_init;
206 bool m_seperateSystBins;
207 bool m_breakDownSyst;
208 bool m_applyKineDepSys;
210 bool m_useLRT;
211
212 MuonEfficiencyType m_Type;
213
214 // a struct holding all columnar accessors, as those interfere
215 // with the root dictionaries.
216 struct Accessors;
217 std::unique_ptr<Accessors> m_accessors;
218
219 public:
220
221 void callSingleEvent (columnar::MuonRange muons, columnar::EventInfoId event) const;
222 virtual void callEvents (columnar::EventContextRange events) const override;
223 };
224
225} /* namespace ADD_CMODE(CP) */
#define ASG_TOOL_CLASS3(CLASSNAME, INT1, INT2, INT3)
virtual int getUnCorrelatedSystBin(const xAOD::Muon &mu) const =0
virtual std::string getUncorrelatedSysBinName(unsigned int Bin) const =0
virtual CorrectionCode getEfficiencyScaleFactorReplicas(const xAOD::Muon &mu, std::vector< float > &sf_err, const xAOD::EventInfo *info=0) const =0
BONUS functionality.
virtual CorrectionCode getMCEfficiency(const xAOD::Muon &mu, float &eff, const xAOD::EventInfo *info=0) const =0
Obtain the muon efficiency measured using the MonteCarlo.
virtual CorrectionCode applyDataEfficiency(const xAOD::Muon &mu, const xAOD::EventInfo *info=0) const =0
decorate a muon with the efficiency information
virtual CorrectionCode applyMCEfficiency(const xAOD::Muon &mu, const xAOD::EventInfo *info=0) const =0
virtual CorrectionCode getEfficiencyScaleFactor(const xAOD::Muon &mu, float &sf, const xAOD::EventInfo *info=0) const =0
Retrieve the Scale factor.
virtual CorrectionCode applyEfficiencyScaleFactorReplicas(const xAOD::Muon &mu, int nreplicas=50, const xAOD::EventInfo *info=0) const =0
decorate the muon with a set of SF replica weights.
virtual CorrectionCode applyEfficiencyScaleFactor(const xAOD::Muon &mu, const xAOD::EventInfo *info=0) const =0
decorate the muon with scale factor information
virtual CorrectionCode getDataEfficiency(const xAOD::Muon &mu, float &eff, const xAOD::EventInfo *info=0) const =0
Obtain the muon efficiency measured using the data.
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.
Eigen::Vector3d getPosition(const xAOD::TrackParticle &trk)
ObjectId< MuonDef > MuonId
Definition MuonDef.h:22
ObjectRange< EventContextDef > EventContextRange
ObjectRange< MuonDef > MuonRange
Definition MuonDef.h:21
ObjectId< EventInfoDef > EventInfoId
EventInfo_v1 EventInfo
Definition of the latest event info version.
Muon_v1 Muon
Reference the current persistent version:
Definition Muon.h:13
void initialize()