ATLAS Offline Software
EfficiencyScaleFactor.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3  */
4 
8 #include <TRandom3.h>
9 #include <TClass.h>
10 namespace CP {
11  const unsigned int EfficiencyScaleFactor::m_warningLimit = 10;
12  EfficiencyScaleFactor::EfficiencyScaleFactor(std::shared_ptr<EfficiencyScaleFactor> nominal,
13  const MuonEfficiencyScaleFactors& ref_tool,
14  const std::string& file,
15  const std::string& time_unit,
16  const std::string& syst_name,
17  int syst_type_bitmap):
18  m_measurement(ref_tool.measurement()),
19  m_syst_name(syst_name),
20  m_is_up(syst_type_bitmap & EffiCollection::UpVariation),
21  m_is_lowpt(syst_type_bitmap & EffiCollection::JPsiAnalysis),
22  m_respond_to_kineDepSyst(syst_type_bitmap & EffiCollection::PtDependent),
23  m_separateBinSyst(syst_type_bitmap & EffiCollection::UnCorrelated),
24  m_sf(),
25  m_eff(),
26  m_mc_eff(),
27 
28  m_sf_decor(std::make_unique<FloatDecorator>(ref_tool.sf_decoration()+ (m_syst_name.empty()? "" :"_"+ m_syst_name + (m_is_up? "_1UP": "_1DN")))),
29  m_eff_decor(std::make_unique<FloatDecorator>(ref_tool.data_effi_decoration()+ (m_syst_name.empty()? "" :"_"+ m_syst_name + (m_is_up? "_1UP": "_1DN")))),
30  m_mc_eff_decor(std::make_unique<FloatDecorator>(ref_tool.mc_effi_decoration()+ (m_syst_name.empty()? "" :"_"+ m_syst_name + (m_is_up? "_1UP": "_1DN")))),
31  m_sf_rep_decor(std::make_unique<FloatVectorDecorator>(ref_tool.sf_replica_decoration()+ (m_syst_name.empty()? "" :"_"+ m_syst_name + (m_is_up? "_1UP": "_1DN")))),
32  m_eff_rep_decor(std::make_unique<FloatVectorDecorator>(ref_tool.data_effi_replica_decoration()+ (m_syst_name.empty()? "" :"_"+ m_syst_name + (m_is_up? "_1UP": "_1DN")))),
33  m_mc_eff_rep_decor(std::make_unique<FloatVectorDecorator>(ref_tool.mc_effi_replica_deocration()+ (m_syst_name.empty()? "" :"_"+ m_syst_name + (m_is_up? "_1UP": "_1DN")))),
34 
35  m_sf_KineDepsys(),
36  m_sf_replicas(),
37  m_eff_replicas(),
38  m_mc_eff_replicas(),
39  m_NominalFallBack(nominal),
40  m_SystematicBin(-1),
41  m_default_eff(1.),
42  m_default_eff_ttva(1.),
43  m_warnsPrinted(0),
44  m_firstRun(1),
45  m_lastRun(999999){
46 
47  if (ref_tool.measurement() == CP::MuonEfficiencyType::Iso){
50  }
51  // open the file
52  std::unique_ptr<TFile> f (TFile::Open(file.c_str(), "READ"));
53  if (!f || !f->IsOpen()) {
54  Error("EfficiencyScaleFactor", "Unable to open file %s", file.c_str());
55  return;
56  }
57  // now we can read our three mean histograms Histos
58  m_eff = ReadHistFromFile("Eff", f.get(), time_unit);
59  m_mc_eff = ReadHistFromFile("MC_Eff", f.get(), time_unit);
60  m_sf = ReadHistFromFile("SF", f.get(), time_unit);
62  if (syst_name.empty()) return;
63 
64 
65  if (IsUpVariation()){
66  m_default_eff = 2.;
67  m_default_eff_ttva = 1. + 1.e-9;
68  } else {
69  m_default_eff = 0.;
70  m_default_eff_ttva = 1. - 1.e-9;
71  }
72  std::function<void(std::unique_ptr<HistHandler>&, const std::string& )> syst_loader = [this, &f, &time_unit, &syst_type_bitmap] (std::unique_ptr<HistHandler>& nominal, const std::string& hist_type) {
73  if(!nominal) return;
74  std::unique_ptr<HistHandler> sys = ReadHistFromFile(Form("%s_%s_%s", hist_type.c_str() ,
75  m_syst_name.c_str(),
76  (syst_type_bitmap & EffiCollection::Symmetric ? "SYM" : (m_is_up ? "1UP" : "1DN")) ),
77  f.get(), time_unit);
78  if (sys) {
79  for (int i = 1; i <= nominal->nBins(); ++i) {
80  double content = nominal->GetBinContent(i);
81  double variation = (IsUpVariation() ? 1. : -1.)*sys->GetBinContent(i);
82  nominal->SetBinContent(i,content + variation);
83  }
84  return;
85  }
89  if (m_syst_name == "SYS"){
90  std::unique_ptr<HistHandler> old_sys = ReadHistFromFile(hist_type +"_sys", f.get(), time_unit);
92  if (!old_sys){
93  nominal.reset();
94  return;
95  }
96 
97  for (int i = 1; i<= nominal->nBins(); ++i) {
98  nominal->SetBinContent(i, nominal->GetBinContent(i) + (IsUpVariation() ? 1. : -1.)*old_sys->GetBinContent(i));
99  }
100  }
102  else if (m_syst_name == "STAT") {
103  for (int i = 1; i<= nominal->nBins(); ++i) {
104  nominal->SetBinContent(i, nominal->GetBinContent(i) + (IsUpVariation() ? 1. : -1.)*nominal->GetBinError(i));
105  }
106  }
108  else if (m_syst_name == "PTDEPENDENCY"){
109  return;
110  }
112  else{
113  Error("EfficiencyScaleFactor()", "Failed to load sytstematic variation %s for measurement %s and histo-type %s", sysname(true).c_str(),
114  EfficiencyTypeName(m_measurement).c_str(),
115  hist_type.c_str());
116  nominal.reset();
117  }
118  };
120  syst_loader(m_sf,"SF");
121  syst_loader(m_eff,"Eff");
122  syst_loader(m_mc_eff,"MC_Eff");
123 
125  if (m_is_lowpt || (file == ref_tool.filename_HighEta() && ref_tool.filename_HighEta() != ref_tool.filename_Central()) ||
126  (file == ref_tool.filename_Calo() && ref_tool.filename_Calo() != ref_tool.filename_Central())) m_respond_to_kineDepSyst =false;
128 
131  return;
132  }
133  // Load the systematic of the bad veto
135  TDirectory* SystDir = nullptr;
136  f->GetObject(("KinematicSystHandler_" + time_unit).c_str(), SystDir);
138  if (SystDir) {
139  m_sf_KineDepsys = std::make_unique<BadMuonVetoSystHandler>(SystDir);
140  } else {
142  f->GetObject("BadMuonVetoSyst_3Stations", SystDir);
143  TDirectory* SystDir_2Stat = nullptr;
144  f->GetObject("BadMuonVetoSyst_2Stations", SystDir_2Stat);
145  m_sf_KineDepsys = std::make_unique<BadMuonVetoSystHandler>(SystDir, SystDir_2Stat);
146  }
147  m_sf_KineDepsys->SetSystematicWeight( IsUpVariation() ? 1 : -1);
148  if (!m_sf_KineDepsys->initialize()){
149  Error("EfficiencyScaleFactor()", "Pt dependent systematic could not be loaded");
150  m_sf_KineDepsys.reset();
151  }
152  return;
154  m_sf_KineDepsys = std::make_unique<TTVAClosureSysHandler>(ReadHistFromFile("SF_NonClosure_sys",f.get(),time_unit));
155  if (!m_sf_KineDepsys->initialize()){
156  Error("EfficiencyScaleFactor()", "TTVA non closure systematic could not be loaded.");
157  m_sf_KineDepsys.reset();
158  }
159  else
160  m_sf_KineDepsys->SetSystematicWeight( IsUpVariation() ? 1 : -1);
161  return;
162 
163  }
165  m_sf_KineDepsys = std::make_unique<PtKinematicSystHandler>(ReadHistFromFile(Form("SF_PtFlatness_1%s", m_is_up?"UP" :"DN"), f.get(), time_unit), ReadHistFromFile("SF_PtDep_sys", f.get(), time_unit));
166 
168  if(!m_sf_KineDepsys->initialize()){
169  m_sf_KineDepsys = std::make_unique<PrimodialPtSystematic>(ReadHistFromFile("SF_PtDep_sys", f.get(), time_unit));
170  }
171  m_sf_KineDepsys->SetSystematicWeight( IsUpVariation() ? 1 : -1);
172  }
174  const std::string &file,
175  const std::string &time_unit):
176  EfficiencyScaleFactor(std::shared_ptr<EfficiencyScaleFactor>(),
177  ref_tool,file, time_unit, "",0){}
178 
179  std::string EfficiencyScaleFactor::sysname(bool with_direction) const {
180  return m_syst_name.empty() ? "" : EfficiencyTypeName(m_measurement) + "_" + m_syst_name +(m_is_lowpt ? "_LOWPT" : "") + (with_direction ? (m_is_up ?"__1UP" : "__1DN") :"");
181  }
183  return m_separateBinSyst;
184  }
186  return m_is_up;
187  }
188  unsigned int EfficiencyScaleFactor::firstRun() const{
189  return m_firstRun;
190  }
191  unsigned int EfficiencyScaleFactor::lastRun() const{
192  return m_lastRun;
193  }
194  bool EfficiencyScaleFactor::coversRunNumber(unsigned int run) const{
195  return m_firstRun <= run && run <= m_lastRun;
196  }
197  void EfficiencyScaleFactor::setFirstLastRun(unsigned int first, unsigned int last){
198  m_firstRun = first;
199  m_lastRun = last;
200  }
202  //Check whether the SFs could be successfully loaded
203  if (!m_sf) {
204  Error("EfficiencyScaleFactor()", "Could not load the SF for measurement %s and systematic %s",EfficiencyTypeName(m_measurement).c_str(), sysname().c_str());
205  return false;
206  }
207  if (m_respond_to_kineDepSyst && !m_sf_KineDepsys->initialize()) {
208  Error("EfficiencyScaleFactor()", "Could not load the SF pt-dependent systematic for %s and systematic %s", EfficiencyTypeName(m_measurement).c_str(), sysname().c_str() );
209  return false;
210  }
211  if (m_NominalFallBack.get() == this) {
212  Error("EfficiencyScaleFactor()", "The EfficiencyScaleFactor %s has itself as Nominal Fall back.", EfficiencyTypeName(m_measurement).c_str());
213  m_NominalFallBack.reset();
214  return false;
215  }
216  if (m_NominalFallBack) {
217  if (!m_NominalFallBack->sysname().empty() || sysname().empty()){
218  Error("EfficiencyScaleFactor()", "Either nominal is assigned with a fall back (%s) or the nominal fall back is invald(%s).", sysname().c_str(), m_NominalFallBack->sysname().c_str() );
219  return false;
220  }
221  }
222  if (firstRun() > lastRun()){
223  Error("EfficiencyScaleFactor()", "Invalid run number range. Since the map is ranging from %u to %u.", firstRun(), lastRun());
224  return false;
225  }
226  std::function<bool(const std::unique_ptr<HistHandler>&)> consistent_histo = [](const std::unique_ptr<HistHandler>& histo)->bool{
229  if (!histo) return true;
230  for ( int i = 1; i <= histo->nBins(); ++i){
231  if (std::isnan(histo->GetBinContent(i)) || std::isinf(histo->GetBinContent(i))){
232  Error("EfficiencyScaleFactor()", "The %d-th bin %s has not a number (%f)",i, histo->GetBinName(i).c_str(), histo->GetBinContent(i));
233  return false;
234  }
235  }
236  return true;
237  };
238  if (!consistent_histo(m_sf)){
239  Error("EfficiencyScaleFactor()", "Invalid scalefactor in %s", sysname().c_str());
240  return false;
241  }
242  if (!consistent_histo(m_eff)){
243  Error("EfficiencyScaleFactor()", "Invalid data-efficiency in %s", sysname().c_str());
244  return false;
245  }
246  if (!consistent_histo(m_mc_eff)){
247  Error("EfficiencyScaleFactor()", "Invalid MC-efficiency in %s", sysname().c_str());
248  return false;
249  }
250  return true;
251  }
252  std::unique_ptr<HistHandler> EfficiencyScaleFactor::ReadHistFromFile(const std::string& name, TFile* f, const std::string& time_unit) {
253 
254  TH1* hist_from_file = nullptr;
255 
256  f->GetObject((name + std::string("_") + time_unit).c_str(), hist_from_file);
257  // if no period weighting, the histo may also not have a time period in the name at all
258 
259  if (!hist_from_file && time_unit == "All") {
260  f->GetObject(name.c_str(), hist_from_file);
261  }
262  if (!hist_from_file) {
263  return std::unique_ptr<HistHandler>();
264  }
265  return package_histo(hist_from_file);
266  }
267  std::unique_ptr<HistHandler> EfficiencyScaleFactor::package_histo(TH1* h) {
268  // make sure that the correct type of histo is used
269  // Dynamic cast for TH2 Poly otherwise we can rely on the GetDimension() ,ethod
270  if (!h) return std::unique_ptr<HistHandler>();
271  if (dynamic_cast<TH2Poly*>(h)) {
272  return std::make_unique<HistHandler_TH2Poly>(dynamic_cast<TH2Poly*>(h));
273  }else if (h->GetDimension() == 3) {
274  return std::make_unique<HistHandler_TH3>(h);
275  }else if (h->GetDimension() == 2) {
276  return std::make_unique<HistHandler_TH2>(h);
277  } else if (h->GetDimension() == 1) {
278  return std::make_unique<HistHandler_TH1>(h);
279  }
280  Error("EfficiencyScaleFactor", "Unable to package histo %s (%s) in a known HistHandler", h->GetName(), h->IsA()->GetName());
281  return std::unique_ptr<HistHandler>();
282  }
284  return m_sf ? m_sf->nBins() : -1;
285  }
287  return m_sf ? m_sf->nOverFlowBins() : -1;
288  }
290  return m_sf ? m_sf->isOverFlowBin(b) : true;
291  }
294  int bin = -1;
295  CorrectionCode cc = m_sf->FindBin(mu, bin);
296  if (cc == CP::CorrectionCode::Error) {
297  return cc;
298  }
299  if (bin != m_SystematicBin) {
300  return m_NominalFallBack->ScaleFactor(mu, SF);
301  }
302  }
303  CorrectionCode cc = GetContentFromHist(m_sf.get(), mu, SF, true);
304  if (cc == CorrectionCode::Error) Error("EfficiencyScaleFactor", "Could not apply the scale factor");
305  return cc;
306  }
307 
310  int bin = -1;
311  CorrectionCode cc = m_eff->FindBin(mu, bin);
312  if (cc == CP::CorrectionCode::Error) {
313  return cc;
314  }
315  if (bin != m_SystematicBin) {
316  return m_NominalFallBack->DataEfficiency(mu, Eff);
317  }
318  }
319  CorrectionCode cc = GetContentFromHist(m_eff.get(), mu, Eff, true);
320  if (cc == CorrectionCode::Error) Error("EfficiencyScaleFactor", "Could not apply the data efficiency");
321  return cc;
322  }
325  int bin = -1;
326  CorrectionCode cc = m_mc_eff->FindBin(mu, bin);
327  if (cc == CP::CorrectionCode::Error) {
328  return cc;
329  }
330  if (bin != m_SystematicBin) {
331  return m_NominalFallBack->MCEfficiency(mu, Eff);
332  }
333  }
334  CorrectionCode cc = GetContentFromHist(m_mc_eff.get(), mu, Eff, false);
335  if (cc == CorrectionCode::Error) Error("EfficiencyScaleFactor", "Could not apply the Monte Carlo efficiency");
336  return cc;
337  }
338 
339  CorrectionCode EfficiencyScaleFactor::GetContentFromHist(const HistHandler* Hist, const xAOD::Muon& mu, float & Eff, bool add_kine_syst) const {
340  Eff = m_default_eff;
341  if (!Hist) {
343  Warning("EfficiencyScaleFactor", "Could not find histogram for variation %s and muon with pt=%.4f, eta=%.2f and phi=%.2f, returning %.1f", sysname().c_str(), mu.pt(), mu.eta(), mu.phi(), m_default_eff);
344  ++m_warnsPrinted;
345  }
347  }
348  if (m_measurement == CP::MuonEfficiencyType::TTVA && std::abs(mu.eta()) > 2.5 && std::abs(mu.eta()) <= 2.7 && mu.muonType() == xAOD::Muon::MuonType::MuonStandAlone) {
350  Info("EfficiencyScaleFactor", "No TTVA sf/efficiency provided for standalone muons with 2.5<|eta|<2.7 for variation %s and muon with pt=%.4f, eta=%.2f and phi=%.2f, returning %.1f", sysname().c_str(), mu.pt(), mu.eta(), mu.phi(), m_default_eff_ttva);
351  ++m_warnsPrinted;
352  }
353  Eff = m_default_eff_ttva;
354  return CorrectionCode::Ok;
355  }
356  int bin = -1;
357  CorrectionCode cc = Hist->FindBin(mu, bin);
358  if (cc != CorrectionCode::Ok) return cc;
359  else Eff = Hist->GetBinContent(bin);
360 
361  if (add_kine_syst && m_respond_to_kineDepSyst) {
362  return m_sf_KineDepsys->GetKineDependent(mu, Eff);
363  }
364  return CorrectionCode::Ok;
365  }
367  float sf = 0;
369  (*m_sf_decor)(mu) = sf;
370  return result;
371  }
373  std::vector<float> replicas(n_replicas);
375  (*m_sf_rep_decor)(mu)= replicas;
376  return result;
377  }
378 
380  float effi = 0;
382  (*m_eff_decor)(mu) = effi;
383  return result;
384  }
386  std::vector<float> replicas(n_replicas);
388  (*m_eff_rep_decor)(mu) = replicas;
389  return result;
390  }
392  float effi = 0;
394  (*m_mc_eff_decor)(mu) = effi;
395  return result;
396  }
398  std::vector<float> replicas(n_replicas);
400  (*m_mc_eff_rep_decor)(mu) = replicas;
401  return result;
402  }
405  }
408  }
411  }
413  if (replicas.size() != SF.size()) GenerateReplicas(SF.size(), 1000. * mu.phi() + mu.eta());
414  if (replicas.empty()) return CorrectionCode::OutOfValidityRange;
415  if (m_measurement == CP::MuonEfficiencyType::TTVA && std::abs(mu.eta()) > 2.5 && std::abs(mu.eta()) <= 2.7 && mu.muonType() == xAOD::Muon::MuonType::MuonStandAlone) {
417  Info("EfficiencyScaleFactor", "No TTVA sf/efficiency provided for standalone muons with 2.5<|eta|<2.7 for variation %s and muon with pt=%.4f, eta=%.2f and phi=%.2f, returning %.1f", sysname().c_str(), mu.pt(), mu.eta(), mu.phi(), m_default_eff_ttva);
418  ++m_warnsPrinted;
419  }
420  for (auto& r : SF)
422  return CorrectionCode::Ok;
423  }
424  int bin = -1;
425  float extra_sys = 1;
426  if (add_kine_syst && m_respond_to_kineDepSyst) {
427  CorrectionCode cc = m_sf_KineDepsys->GetKineDependent(mu, extra_sys);
428  if (cc != CorrectionCode::Ok) {}
429  }
430 
431  CorrectionCode res = (*replicas.begin())->FindBin(mu, bin);
432  if (res != CorrectionCode::Ok) return res;
433  else {
434  for (size_t k = 0; k < SF.size(); k++) {
435  SF[k] = replicas.at(k)->GetBinContent(bin) * extra_sys;
436  }
437  }
438  return res;
439  }
440  void EfficiencyScaleFactor::GenerateReplicas(int nrep, int seed) {
441  GenerateReplicasFromHist(m_eff.get(), nrep, seed, m_eff_replicas);
442  GenerateReplicasFromHist(m_sf.get(), nrep, seed, m_sf_replicas);
444  }
446  if (!h) return;
447  TRandom3 Rndm(seed);
448  replicas.clear();
449  replicas.reserve(nrep);
450  int nBins = h->nBins();
451  for (int t = 0; t < nrep; t++) {
452  replicas.push_back(package_histo(h->GetHist()));
453  HistHandler* replica = replicas.back().get();
454  for (int bin = 0; bin < nBins; bin++) {
455  replica->SetBinContent(bin, Rndm.Gaus(h->GetBinContent(bin), h->GetBinError(bin)));
456  }
457  }
458  }
459 
461  if (m_syst_name.empty()) return true;
462  if (!m_NominalFallBack) {
463  Error("EfficiencyScaleFactor::SetSystematicBin()", "No fallback has been given for %s", sysname().c_str());
464  return false;
465  }
467  Error("EfficiencyScaleFactor::SetSystematicBin()", "The current bin %i is out of the maximum range %u ", bin, nBins());
468  return false;
469  }
471  return true;
472  }
473  std::string EfficiencyScaleFactor::GetBinName(int bin) const {
474  if (bin < 1 || bin > nBins()) {
475  Error("EfficiencyScaleFactor::GetBinName()", "The current bin %i is out of the maximum range %u ", bin, nBins());
476  return "Out of range";
477  }
478  return m_sf->GetBinName(bin);
479  }
480 
482  int bin = -1;
483  CorrectionCode cc = m_sf->FindBin(mu, bin);
484  if (cc == CP::CorrectionCode::Error) {
485  return -1;
486  }
487  return bin;
488  }
489 
490 } /* namespace CP */
CP::MuonEfficiencyScaleFactors::filename_Calo
std::string filename_Calo() const
Reconstruction scale-factors have a dedicated map for calo-tag muons around |\eta|<0....
Definition: MuonEfficiencyScaleFactors.cxx:378
CP::EfficiencyScaleFactor::m_syst_name
std::string m_syst_name
Definition: EfficiencyScaleFactor.h:167
CP::MuonEfficiencyScaleFactors::filename_Central
std::string filename_Central() const
The following methods are meant to propagate information from the central tool to the subtool managin...
Definition: MuonEfficiencyScaleFactors.cxx:347
beamspotman.r
def r
Definition: beamspotman.py:676
CP::EfficiencyScaleFactor::DataEfficiency
CorrectionCode DataEfficiency(const xAOD::Muon &mu, float &Eff) const
... and absolute efficiencies
Definition: EfficiencyScaleFactor.cxx:308
CP::EfficiencyScaleFactor::m_warnsPrinted
std::atomic< unsigned int > m_warnsPrinted
Definition: EfficiencyScaleFactor.h:215
CP::EfficiencyScaleFactor::ScaleFactorReplicas
CorrectionCode ScaleFactorReplicas(const xAOD::Muon &mu, std::vector< float > &SF)
Definition: EfficiencyScaleFactor.cxx:403
CP::EfficiencyScaleFactor::package_histo
std::unique_ptr< HistHandler > package_histo(TH1 *h)
Definition: EfficiencyScaleFactor.cxx:267
CP::EfficiencyScaleFactor::isOverFlowBin
bool isOverFlowBin(int b) const
Check whether the bin is overflow or not.
Definition: EfficiencyScaleFactor.cxx:289
CP::EffiCollection
The EffiCollection class handles the 5 different scale-factor maps binned in time.
Definition: EffiCollection.h:29
CP::EfficiencyScaleFactor::MCEfficiencyReplicas
CorrectionCode MCEfficiencyReplicas(const xAOD::Muon &mu, std::vector< float > &eff)
Definition: EfficiencyScaleFactor.cxx:409
CP::EfficiencyScaleFactor::ReadHistFromFile
std::unique_ptr< HistHandler > ReadHistFromFile(const std::string &name, TFile *f, const std::string &time_unit)
Definition: EfficiencyScaleFactor.cxx:252
CP::EfficiencyScaleFactor::GetContentReplicasFromHist
CorrectionCode GetContentReplicasFromHist(EfficiencyScaleFactor::SFReplicaVec &replicas, const xAOD::Muon &mu, std::vector< float > &SF, bool add_kine_syst)
read a vector of replica contents in the correct bin in one of my histos
Definition: EfficiencyScaleFactor.cxx:412
get_generator_info.result
result
Definition: get_generator_info.py:21
CP::EfficiencyScaleFactor::m_mc_eff
std::unique_ptr< HistHandler > m_mc_eff
Definition: EfficiencyScaleFactor.h:181
CP::EfficiencyScaleFactor::m_firstRun
unsigned int m_firstRun
Definition: EfficiencyScaleFactor.h:218
make_unique
std::unique_ptr< T > make_unique(Args &&... args)
Definition: SkimmingToolEXOT5.cxx:23
CP::BadMuonVeto
@ BadMuonVeto
Definition: MuonEfficiencyType.h:17
MuonEfficiencyScaleFactors.h
RootHelpers::FindBin
Int_t FindBin(const TAxis *axis, const double x)
Definition: RootHelpers.cxx:14
CP::EfficiencyScaleFactor::m_sf_KineDepsys
std::unique_ptr< IKinematicSystHandler > m_sf_KineDepsys
Definition: EfficiencyScaleFactor.h:197
CP::EfficiencyScaleFactor::IsUpVariation
bool IsUpVariation() const
Definition: EfficiencyScaleFactor.cxx:185
CP::EfficiencyScaleFactor::m_eff
std::unique_ptr< HistHandler > m_eff
Definition: EfficiencyScaleFactor.h:180
CP::EfficiencyScaleFactor::m_is_lowpt
bool m_is_lowpt
states that this SF should respond to low pt systematics rather than high pt ones
Definition: EfficiencyScaleFactor.h:173
CP::EfficiencyScaleFactor::m_NominalFallBack
std::shared_ptr< EfficiencyScaleFactor > m_NominalFallBack
Nominal fall-back scale-factor.
Definition: EfficiencyScaleFactor.h:206
CP::MuonEfficiencyScaleFactors
Definition: MuonEfficiencyScaleFactors.h:23
TRT_PAI_gasdata::SF
const float SF[NF]
Cross sections for Fluor.
Definition: TRT_PAI_gasdata.h:285
bin
Definition: BinsDiffFromStripMedian.h:43
CP::EfficiencyScaleFactor::FindBinSF
int FindBinSF(const xAOD::Muon &mu) const
Finds the bin to which the muon corresponds to.
Definition: EfficiencyScaleFactor.cxx:481
CP::EfficiencyScaleFactor::GetContentFromHist
CorrectionCode GetContentFromHist(const HistHandler *Hist, const xAOD::Muon &mu, float &SF, bool add_kine_syst) const
read the content of the correct bin in one of my histos. MCefficiencies actually do not need a pt-dep...
Definition: EfficiencyScaleFactor.cxx:339
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
CP::HistHandler::GetBinContent
double GetBinContent(int bin) const
Definition: HistHandler.h:46
empty
bool empty(TH1 *h)
Definition: computils.cxx:295
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
xAOD::Muon_v1
Class describing a Muon.
Definition: Muon_v1.h:38
CP::EfficiencyScaleFactor::m_warningLimit
static const unsigned int m_warningLimit
Definition: EfficiencyScaleFactor.h:216
CP::EfficiencyScaleFactor::ApplyScaleFactor
CorrectionCode ApplyScaleFactor(const xAOD::Muon &mu) const
or you can just decorate the scale-factor to the muon
Definition: EfficiencyScaleFactor.cxx:366
CP::EfficiencyScaleFactor::DataEfficiencyReplicas
CorrectionCode DataEfficiencyReplicas(const xAOD::Muon &mu, std::vector< float > &eff)
Definition: EfficiencyScaleFactor.cxx:406
CP::EfficiencyScaleFactor::m_measurement
CP::MuonEfficiencyType m_measurement
Section of variables of the tool.
Definition: EfficiencyScaleFactor.h:166
CP::EfficiencyScaleFactor::coversRunNumber
bool coversRunNumber(unsigned int run) const
Check if a run of data-taking is covered by this map.
Definition: EfficiencyScaleFactor.cxx:194
CP::EfficiencyScaleFactor::m_default_eff
float m_default_eff
default efficiency value (in case of OutOfValidityRange)
Definition: EfficiencyScaleFactor.h:211
CP::EfficiencyScaleFactor::SetSystematicBin
bool SetSystematicBin(int bin)
This function will let the world implode since it allows to decorrelate the sysstematics bin by bin.
Definition: EfficiencyScaleFactor.cxx:460
sTgcDigitEffiDump.effi
list effi
Definition: sTgcDigitEffiDump.py:38
grepfile.content
string content
Definition: grepfile.py:56
CP::CorrectionCode::OutOfValidityRange
@ OutOfValidityRange
Input object is out of validity range.
Definition: CorrectionCode.h:37
CP::CorrectionCode::Error
@ Error
Some error happened during the object correction.
Definition: CorrectionCode.h:36
CP::EfficiencyScaleFactor::m_lastRun
unsigned int m_lastRun
Definition: EfficiencyScaleFactor.h:219
CP::Iso
@ Iso
Definition: MuonEfficiencyType.h:16
CP::EfficiencyScaleFactor::m_separateBinSyst
bool m_separateBinSyst
Can the systematic be decorrelated.
Definition: EfficiencyScaleFactor.h:177
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition: Decorator.h:59
lumiFormat.i
int i
Definition: lumiFormat.py:85
CP::EfficiencyScaleFactor::setFirstLastRun
void setFirstLastRun(unsigned int first, unsigned int last)
Set the run-number coverage.
Definition: EfficiencyScaleFactor.cxx:197
CP::HistHandler::SetBinContent
void SetBinContent(int bin, float val)
Definition: HistHandler.cxx:140
CP::HistHandler
Definition: HistHandler.h:37
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:14
CP::EfficiencyScaleFactor::m_sf_replicas
SFReplicaVec m_sf_replicas
replicas, in case we use them
Definition: EfficiencyScaleFactor.h:201
file
TFile * file
Definition: tile_monitor.h:29
CP::EfficiencyScaleFactor::MCEfficiency
CorrectionCode MCEfficiency(const xAOD::Muon &mu, float &Eff) const
... mc efficiency
Definition: EfficiencyScaleFactor.cxx:323
EfficiencyScaleFactor.h
hist_file_dump.f
f
Definition: hist_file_dump.py:135
CP::EfficiencyScaleFactor
Definition: EfficiencyScaleFactor.h:35
run
Definition: run.py:1
CP::EfficiencyScaleFactor::ApplyDataEfficiency
CorrectionCode ApplyDataEfficiency(const xAOD::Muon &mu) const
You can decorate the data efficiecny as well.
Definition: EfficiencyScaleFactor.cxx:379
CP::dRJetAxisHandler::set_use_2D_sf
static void set_use_2D_sf(const bool)
Definition: HistHandler.cxx:73
CP::EfficiencyScaleFactor::ApplyDataEfficiencyReplicas
CorrectionCode ApplyDataEfficiencyReplicas(const xAOD::Muon &mu, int n_replicas)
Definition: EfficiencyScaleFactor.cxx:385
CP::MuonEfficiencyScaleFactors::filename_HighEta
std::string filename_HighEta() const
High-eta reconstruction scale-factors are not obtained by the means of are not obtained by the means ...
Definition: MuonEfficiencyScaleFactors.cxx:385
CP::EfficiencyScaleFactor::m_default_eff_ttva
float m_default_eff_ttva
default TTVA efficiency value (in case of MuonStandAlone for |eta|>2.5)
Definition: EfficiencyScaleFactor.h:213
CP::EfficiencyScaleFactor::lastRun
unsigned int lastRun() const
Last run to which the map belongs to. The last run number is given exclusvely...
Definition: EfficiencyScaleFactor.cxx:191
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
plotBeamSpotVxVal.bin
int bin
Definition: plotBeamSpotVxVal.py:83
CP::TTVA
@ TTVA
Definition: MuonEfficiencyType.h:15
CP::EfficiencyScaleFactor::m_mc_eff_replicas
SFReplicaVec m_mc_eff_replicas
Definition: EfficiencyScaleFactor.h:203
CP::HistHandler::FindBin
virtual CorrectionCode FindBin(const xAOD::Muon &muon, int &bin) const =0
Function that changes from Implementation to implementation.
CP::EfficiencyScaleFactor::nOverFlowBins
int nOverFlowBins() const
Number of overflow bins in the map.
Definition: EfficiencyScaleFactor.cxx:286
CP::EffiCollection::Symmetric
@ Symmetric
Definition: EffiCollection.h:53
CP::EfficiencyScaleFactor::GenerateReplicas
void GenerateReplicas(int nrep, int seed)
Definition: EfficiencyScaleFactor.cxx:440
CP::EfficiencyScaleFactor::GenerateReplicasFromHist
void GenerateReplicasFromHist(HistHandler *h, int nrep, int seed, EfficiencyScaleFactor::SFReplicaVec &repVector)
Definition: EfficiencyScaleFactor.cxx:445
CP::CorrectionCode::Ok
@ Ok
The correction was done successfully.
Definition: CorrectionCode.h:38
h
CP::EfficiencyScaleFactor::ApplyMCEfficiency
CorrectionCode ApplyMCEfficiency(const xAOD::Muon &mu) const
... or decorate them directly
Definition: EfficiencyScaleFactor.cxx:391
mapkey::sf
@ sf
Definition: TElectronEfficiencyCorrectionTool.cxx:38
CP::EfficiencyScaleFactor::ApplyScaleFactorReplicas
CorrectionCode ApplyScaleFactorReplicas(const xAOD::Muon &mu, int n_replicas)
Definition: EfficiencyScaleFactor.cxx:372
CP::dRJetAxisHandler::set_close_jet_decorator
static void set_close_jet_decorator(const std::string &decor_name)
Definition: HistHandler.cxx:69
CP::EfficiencyScaleFactor::sysname
std::string sysname(bool with_direction=true) const
A string having the full name of the systematic including the measurement.
Definition: EfficiencyScaleFactor.cxx:179
DeMoScan.first
bool first
Definition: DeMoScan.py:536
CP::CorrectionCode
Return value from object correction CP tools.
Definition: CorrectionCode.h:31
CP::EfficiencyScaleFactor::ScaleFactor
CorrectionCode ScaleFactor(const xAOD::Muon &mu, float &SF) const
the important bits - extract SF info
Definition: EfficiencyScaleFactor.cxx:292
CP::EfficiencyScaleFactor::GetBinName
std::string GetBinName(int bin) const
Returns the name of the bin using the axis title from the scale-factor map.
Definition: EfficiencyScaleFactor.cxx:473
CP::EfficiencyScaleFactor::m_SystematicBin
int m_SystematicBin
Definition: EfficiencyScaleFactor.h:207
CP::MuonEfficiencyScaleFactors::close_by_jet_decoration
const std::string & close_by_jet_decoration() const
Returns the string telling the tool in which float AuxElement the information of the separation to th...
Definition: MuonEfficiencyScaleFactors.cxx:83
CP::EfficiencyScaleFactor::m_is_up
bool m_is_up
Boolean whether the scale-factor is varying upwards or downwards Only relevant if the systname is not...
Definition: EfficiencyScaleFactor.h:171
CP::EfficiencyScaleFactor::SFReplicaVec
std::vector< std::unique_ptr< HistHandler > > SFReplicaVec
Definition: EfficiencyScaleFactor.h:141
dqt_zlumi_alleff_HIST.eff
int eff
Definition: dqt_zlumi_alleff_HIST.py:113
CP::EfficiencyScaleFactor::nBins
int nBins() const
How many bins does the scale-factor map have.
Definition: EfficiencyScaleFactor.cxx:283
CP::EfficiencyScaleFactor::ApplyMCEfficiencyReplicas
CorrectionCode ApplyMCEfficiencyReplicas(const xAOD::Muon &mu, int n_replicas)
Definition: EfficiencyScaleFactor.cxx:397
CP::EfficiencyScaleFactor::CheckConsistency
bool CheckConsistency()
check the consistency of the scale-factor map.
Definition: EfficiencyScaleFactor.cxx:201
CP::EfficiencyScaleFactor::EfficiencyScaleFactor
EfficiencyScaleFactor(const MuonEfficiencyScaleFactors &ref_tool, const std::string &file, const std::string &time_unit)
Nominal constructor to use having the measurement (Reco/TTVA/Iso/BadMuon) path to the scale-factor ma...
Definition: EfficiencyScaleFactor.cxx:173
CP::MuonEfficiencyScaleFactors::use_2D_iso_corrections
bool use_2D_iso_corrections() const
option to set if we want to use 1D or 2D isolation SFs
Definition: MuonEfficiencyScaleFactors.cxx:86
CP::EfficiencyScaleFactor::firstRun
unsigned int firstRun() const
First run to which the map belongs to.
Definition: EfficiencyScaleFactor.cxx:188
CP::EfficiencyScaleFactor::m_respond_to_kineDepSyst
bool m_respond_to_kineDepSyst
steers the pt dependent systematics
Definition: EfficiencyScaleFactor.h:175
plotBeamSpotCompare.histo
histo
Definition: plotBeamSpotCompare.py:415
CaloNoise_fillDB.mu
mu
Definition: CaloNoise_fillDB.py:53
xAOD::bool
setBGCode setTAP setLVL2ErrorBits bool
Definition: TrigDecision_v1.cxx:60
CP::EfficiencyScaleFactor::m_sf
std::unique_ptr< HistHandler > m_sf
the histograms needed to run
Definition: EfficiencyScaleFactor.h:179
CP::MuonEfficiencyScaleFactors::measurement
CP::MuonEfficiencyType measurement() const
Returns the type of the measurement to be carried out... E.g. Reco/TTVA/Iso.
Definition: MuonEfficiencyScaleFactors.cxx:93
fitman.k
k
Definition: fitman.py:528
python.handimod.cc
int cc
Definition: handimod.py:523
EffiCollection.h
CP::EfficiencyScaleFactor::m_eff_replicas
SFReplicaVec m_eff_replicas
Definition: EfficiencyScaleFactor.h:202
CP::EfficiencyScaleFactor::separateBinSyst
bool separateBinSyst() const
Definition: EfficiencyScaleFactor.cxx:182