ATLAS Offline Software
Public Member Functions | Public Attributes | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
CP::EfficiencyScaleFactor Class Reference

#include <EfficiencyScaleFactor.h>

Inheritance diagram for CP::EfficiencyScaleFactor:
Collaboration diagram for CP::EfficiencyScaleFactor:

Public Member Functions

 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 map & the time unit to consider. More...
 
 EfficiencyScaleFactor (std::shared_ptr< EfficiencyScaleFactor > nominal, const MuonEfficiencyScaleFactors &ref_tool, const std::string &file, const std::string &time_unit, const std::string &syst_name, int syst_type_bitmap)
 Constructor to use for systematic evaluations the nominal scale-factor is given as a fallback map in case the user want to activate uncorrelated systematic – a shared ptr is used to ensure that the map is always defined allthough the nominal container has been deleted somehow – the name of the systematic encodes the systematic to retrieve from the file. More...
 
 EfficiencyScaleFactor (const EfficiencyScaleFactor &)=delete
 Do not allow for copy constructors and other assignments of the class. More...
 
EfficiencyScaleFactoroperator= (const EfficiencyScaleFactor &)=delete
 
bool CheckConsistency ()
 check the consistency of the scale-factor map. More...
 
int nBins () const
 How many bins does the scale-factor map have. More...
 
std::string GetBinName (int bin) const
 Returns the name of the bin using the axis title from the scale-factor map. More...
 
int nOverFlowBins () const
 Number of overflow bins in the map. More...
 
bool isOverFlowBin (int b) const
 Check whether the bin is overflow or not. More...
 
int FindBinSF (const xAOD::Muon &mu) const
 Finds the bin to which the muon corresponds to. More...
 
bool SetSystematicBin (int bin)
 This function will let the world implode since it allows to decorrelate the sysstematics bin by bin. More...
 
bool separateBinSyst () const
 
bool IsUpVariation () const
 
CorrectionCode ScaleFactor (const xAOD::Muon &mu, float &SF) const
 the important bits - extract SF info More...
 
CorrectionCode ScaleFactor (columnar::MuonId mu, float &SF) const
 
CorrectionCode ScaleFactorReplicas (const xAOD::Muon &mu, std::vector< float > &SF)
 
CorrectionCode ApplyScaleFactor (const xAOD::Muon &mu) const
 or you can just decorate the scale-factor to the muon More...
 
CorrectionCode ApplyScaleFactorReplicas (const xAOD::Muon &mu, int n_replicas)
 
CorrectionCode DataEfficiency (const xAOD::Muon &mu, float &Eff) const
 ... and absolute efficiencies More...
 
CorrectionCode DataEfficiencyReplicas (const xAOD::Muon &mu, std::vector< float > &eff)
 
CorrectionCode ApplyDataEfficiency (const xAOD::Muon &mu) const
 You can decorate the data efficiecny as well. More...
 
CorrectionCode ApplyDataEfficiencyReplicas (const xAOD::Muon &mu, int n_replicas)
 
CorrectionCode MCEfficiency (const xAOD::Muon &mu, float &Eff) const
 ... mc efficiency More...
 
CorrectionCode MCEfficiencyReplicas (const xAOD::Muon &mu, std::vector< float > &eff)
 
CorrectionCode ApplyMCEfficiency (const xAOD::Muon &mu) const
 ... or decorate them directly More...
 
CorrectionCode ApplyMCEfficiencyReplicas (const xAOD::Muon &mu, int n_replicas)
 
void DebugPrint () const
 debug method More...
 
std::string sysname (bool with_direction=true) const
 A string having the full name of the systematic including the measurement. More...
 
unsigned int firstRun () const
 First run to which the map belongs to. More...
 
unsigned int lastRun () const
 Last run to which the map belongs to. The last run number is given exclusvely... More...
 
bool coversRunNumber (unsigned int run) const
 Check if a run of data-taking is covered by this map. More...
 
void setFirstLastRun (unsigned int first, unsigned int last)
 Set the run-number coverage. More...
 

Public Attributes

columnar::MuonAccessor< columnar::ObjectColumnm_muons {*this, "Muons"}
 
columnar::MuonAccessor< columnar::RetypeColumn< double, float > > ptAcc {*this, "pt"}
 
columnar::MuonAccessor< columnar::RetypeColumn< double, float > > etaAcc {*this, "eta"}
 
columnar::MuonAccessor< columnar::RetypeColumn< double, float > > phiAcc {*this, "phi"}
 
columnar::MuonAccessor< columnar::RetypeColumn< xAOD::Muon::MuonType, std::uint16_t > > muonTypeAcc {*this, "muonType"}
 

Private Types

typedef std::vector< std::unique_ptr< HistHandler > > SFReplicaVec
 
typedef SG::AuxElement::Decorator< float > FloatDecorator
 Typedef to make the definition of the follow decorators a bit shorted. More...
 
typedef SG::AuxElement::Decorator< std::vector< float > > FloatVectorDecorator
 

Private Member Functions

bool ReadFromFile (const std::string &file, const std::string &time_unit)
 Read SF histrograms from a given input file. More...
 
std::unique_ptr< HistHandlerReadHistFromFile (columnar::ColumnarTool<> *parent, const std::string &name, TFile *f, const std::string &time_unit)
 
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-dependet systematic More...
 
CorrectionCode GetContentFromHist (const HistHandler *Hist, columnar::MuonId mu, float &SF, bool add_kine_syst) const
 
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 More...
 
std::unique_ptr< HistHandlerpackage_histo (columnar::ColumnarTool<> *parent, TH1 *h)
 
void GenerateReplicas (int nrep, int seed)
 
void GenerateReplicasFromHist (HistHandler *h, int nrep, int seed, EfficiencyScaleFactor::SFReplicaVec &repVector)
 

Private Attributes

CP::MuonEfficiencyType m_measurement
 Section of variables of the tool. More...
 
std::string m_syst_name
 
bool m_is_up
 Boolean whether the scale-factor is varying upwards or downwards Only relevant if the systname is not empty. More...
 
bool m_is_lowpt
 states that this SF should respond to low pt systematics rather than high pt ones More...
 
bool m_respond_to_kineDepSyst
 steers the pt dependent systematics More...
 
bool m_separateBinSyst
 Can the systematic be decorrelated. More...
 
std::unique_ptr< HistHandlerm_sf
 the histograms needed to run More...
 
std::unique_ptr< HistHandlerm_eff
 
std::unique_ptr< HistHandlerm_mc_eff
 
std::unique_ptr< FloatDecoratorm_sf_decor
 
std::unique_ptr< FloatDecoratorm_eff_decor
 
std::unique_ptr< FloatDecoratorm_mc_eff_decor
 
std::unique_ptr< FloatVectorDecoratorm_sf_rep_decor
 
std::unique_ptr< FloatVectorDecoratorm_eff_rep_decor
 
std::unique_ptr< FloatVectorDecoratorm_mc_eff_rep_decor
 
std::unique_ptr< IKinematicSystHandlerm_sf_KineDepsys
 
SFReplicaVec m_sf_replicas
 replicas, in case we use them More...
 
SFReplicaVec m_eff_replicas
 
SFReplicaVec m_mc_eff_replicas
 
std::shared_ptr< EfficiencyScaleFactorm_NominalFallBack
 Nominal fall-back scale-factor. More...
 
int m_SystematicBin
 
float m_default_eff
 default efficiency value (in case of OutOfValidityRange) More...
 
float m_default_eff_ttva
 default TTVA efficiency value (in case of MuonStandAlone for |eta|>2.5) More...
 
std::atomic< unsigned int > m_warnsPrinted
 
unsigned int m_firstRun
 
unsigned int m_lastRun
 

Static Private Attributes

static const unsigned int m_warningLimit = 10
 

Detailed Description

Definition at line 40 of file EfficiencyScaleFactor.h.

Member Typedef Documentation

◆ FloatDecorator

Typedef to make the definition of the follow decorators a bit shorted.

Definition at line 191 of file EfficiencyScaleFactor.h.

◆ FloatVectorDecorator

Definition at line 192 of file EfficiencyScaleFactor.h.

◆ SFReplicaVec

typedef std::vector<std::unique_ptr<HistHandler> > CP::EfficiencyScaleFactor::SFReplicaVec
private

Definition at line 147 of file EfficiencyScaleFactor.h.

Constructor & Destructor Documentation

◆ EfficiencyScaleFactor() [1/3]

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 map & the time unit to consider.

Definition at line 178 of file EfficiencyScaleFactor.cxx.

180  :
181  EfficiencyScaleFactor(std::shared_ptr<EfficiencyScaleFactor>(),
182  ref_tool,file, time_unit, "",0){}

◆ EfficiencyScaleFactor() [2/3]

EfficiencyScaleFactor::EfficiencyScaleFactor ( std::shared_ptr< EfficiencyScaleFactor nominal,
const MuonEfficiencyScaleFactors ref_tool,
const std::string &  file,
const std::string &  time_unit,
const std::string &  syst_name,
int  syst_type_bitmap 
)

Constructor to use for systematic evaluations the nominal scale-factor is given as a fallback map in case the user want to activate uncorrelated systematic – a shared ptr is used to ensure that the map is always defined allthough the nominal container has been deleted somehow – the name of the systematic encodes the systematic to retrieve from the file.

To ensure backwards compability with older files the names "STAT" and "SYS" refer to the total systematic

Nominal set loaded nothing needs to be done further

Asking for the total systematic... May be the current file does not support the asymmetric break-down yet. Let's try the good old approach and load the total sys histogram

Not even the old approach lead to something fruitful... Lets forget it and reset everything

Stat error can be retrieved from the nominal histogram itself

This systematic name is reserved for the kinematic histhandler

Some other systematic is asked for... Failure

Apply the systematic variations

Thus far there're no kinematic dependent systematics for low-pt

As well as for the high-eta range.

Load the pt_dependent systematics if needed

Old format of the pt-dependent systematic loaded

Now it comes to the new format

That one needs to be named properly in the future

Use the approach from the old sacle-factor file

Definition at line 12 of file EfficiencyScaleFactor.cxx.

17  :
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),
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 
36  m_sf_replicas(),
39  m_NominalFallBack(nominal),
40  m_SystematicBin(-1),
41  m_default_eff(1.),
43  m_warnsPrinted(0),
44  m_firstRun(1),
45  m_lastRun(999999){
46 
47  if (ref_tool.measurement() == CP::MuonEfficiencyType::Iso){
48  dRJetAxisHandler::set_close_jet_decorator(ref_tool.close_by_jet_decoration());
49  dRJetAxisHandler::set_use_2D_sf(ref_tool.use_2D_iso_corrections());
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(this, "Eff", f.get(), time_unit);
59  m_mc_eff = ReadHistFromFile(this, "MC_Eff", f.get(), time_unit);
60  m_sf = ReadHistFromFile(this, "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(this, 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(this, 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  if (m_sf_KineDepsys)
153  addSubtool (*m_sf_KineDepsys);
154  return;
156  m_sf_KineDepsys = std::make_unique<TTVAClosureSysHandler>(ReadHistFromFile(this,"SF_NonClosure_sys",f.get(),time_unit));
157  if (!m_sf_KineDepsys->initialize()){
158  Error("EfficiencyScaleFactor()", "TTVA non closure systematic could not be loaded.");
159  m_sf_KineDepsys.reset();
160  }
161  else
162  m_sf_KineDepsys->SetSystematicWeight( IsUpVariation() ? 1 : -1);
163  if (m_sf_KineDepsys)
164  addSubtool (*m_sf_KineDepsys);
165  return;
166 
167  }
169  m_sf_KineDepsys = std::make_unique<PtKinematicSystHandler>(ReadHistFromFile(this, Form("SF_PtFlatness_1%s", m_is_up?"UP" :"DN"), f.get(), time_unit), ReadHistFromFile(this, "SF_PtDep_sys", f.get(), time_unit));
170 
172  if(!m_sf_KineDepsys->initialize()){
173  m_sf_KineDepsys = std::make_unique<PrimodialPtSystematic>(ReadHistFromFile(this, "SF_PtDep_sys", f.get(), time_unit));
174  }
175  m_sf_KineDepsys->SetSystematicWeight( IsUpVariation() ? 1 : -1);
176  addSubtool (*m_sf_KineDepsys);
177  }

◆ EfficiencyScaleFactor() [3/3]

CP::EfficiencyScaleFactor::EfficiencyScaleFactor ( const EfficiencyScaleFactor )
delete

Do not allow for copy constructors and other assignments of the class.

Member Function Documentation

◆ ApplyDataEfficiency()

CorrectionCode EfficiencyScaleFactor::ApplyDataEfficiency ( const xAOD::Muon mu) const

You can decorate the data efficiecny as well.

Definition at line 390 of file EfficiencyScaleFactor.cxx.

390  {
391  float effi = 0;
392  CorrectionCode result = DataEfficiency(mu, effi);
393  (*m_eff_decor)(mu) = effi;
394  return result;
395  }

◆ ApplyDataEfficiencyReplicas()

CorrectionCode EfficiencyScaleFactor::ApplyDataEfficiencyReplicas ( const xAOD::Muon mu,
int  n_replicas 
)

Definition at line 396 of file EfficiencyScaleFactor.cxx.

396  {
397  std::vector<float> replicas(n_replicas);
398  CorrectionCode result = DataEfficiencyReplicas(mu, replicas);
399  (*m_eff_rep_decor)(mu) = replicas;
400  return result;
401  }

◆ ApplyMCEfficiency()

CorrectionCode EfficiencyScaleFactor::ApplyMCEfficiency ( const xAOD::Muon mu) const

... or decorate them directly

Definition at line 402 of file EfficiencyScaleFactor.cxx.

402  {
403  float effi = 0;
404  CorrectionCode result = MCEfficiency(mu, effi);
405  (*m_mc_eff_decor)(mu) = effi;
406  return result;
407  }

◆ ApplyMCEfficiencyReplicas()

CorrectionCode EfficiencyScaleFactor::ApplyMCEfficiencyReplicas ( const xAOD::Muon mu,
int  n_replicas 
)

Definition at line 408 of file EfficiencyScaleFactor.cxx.

408  {
409  std::vector<float> replicas(n_replicas);
410  CorrectionCode result = MCEfficiencyReplicas(mu, replicas);
411  (*m_mc_eff_rep_decor)(mu) = replicas;
412  return result;
413  }

◆ ApplyScaleFactor()

CorrectionCode EfficiencyScaleFactor::ApplyScaleFactor ( const xAOD::Muon mu) const

or you can just decorate the scale-factor to the muon

Definition at line 377 of file EfficiencyScaleFactor.cxx.

377  {
378  float sf = 0;
379  CorrectionCode result = ScaleFactor(mu, sf);
380  (*m_sf_decor)(mu) = sf;
381  return result;
382  }

◆ ApplyScaleFactorReplicas()

CorrectionCode EfficiencyScaleFactor::ApplyScaleFactorReplicas ( const xAOD::Muon mu,
int  n_replicas 
)

Definition at line 383 of file EfficiencyScaleFactor.cxx.

383  {
384  std::vector<float> replicas(n_replicas);
385  CorrectionCode result = ScaleFactorReplicas(mu, replicas);
386  (*m_sf_rep_decor)(mu)= replicas;
387  return result;
388  }

◆ CheckConsistency()

bool EfficiencyScaleFactor::CheckConsistency ( )

check the consistency of the scale-factor map.

Needed histograms should be defined and the nominal fall back map is assigned properly as well as the map has a valid run number range

The histogram is simply not loaded which is fine since only the scale-factor is required

Definition at line 206 of file EfficiencyScaleFactor.cxx.

206  {
207  //Check whether the SFs could be successfully loaded
208  if (!m_sf) {
209  Error("EfficiencyScaleFactor()", "Could not load the SF for measurement %s and systematic %s",EfficiencyTypeName(m_measurement).c_str(), sysname().c_str());
210  return false;
211  }
212  if (m_respond_to_kineDepSyst && !m_sf_KineDepsys->initialize()) {
213  Error("EfficiencyScaleFactor()", "Could not load the SF pt-dependent systematic for %s and systematic %s", EfficiencyTypeName(m_measurement).c_str(), sysname().c_str() );
214  return false;
215  }
216  if (m_NominalFallBack.get() == this) {
217  Error("EfficiencyScaleFactor()", "The EfficiencyScaleFactor %s has itself as Nominal Fall back.", EfficiencyTypeName(m_measurement).c_str());
218  m_NominalFallBack.reset();
219  return false;
220  }
221  if (m_NominalFallBack) {
222  if (!m_NominalFallBack->sysname().empty() || sysname().empty()){
223  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() );
224  return false;
225  }
226  }
227  if (firstRun() > lastRun()){
228  Error("EfficiencyScaleFactor()", "Invalid run number range. Since the map is ranging from %u to %u.", firstRun(), lastRun());
229  return false;
230  }
231  std::function<bool(const std::unique_ptr<HistHandler>&)> consistent_histo = [](const std::unique_ptr<HistHandler>& histo)->bool{
234  if (!histo) return true;
235  for ( int i = 1; i <= histo->nBins(); ++i){
236  if (std::isnan(histo->GetBinContent(i)) || std::isinf(histo->GetBinContent(i))){
237  Error("EfficiencyScaleFactor()", "The %d-th bin %s has not a number (%f)",i, histo->GetBinName(i).c_str(), histo->GetBinContent(i));
238  return false;
239  }
240  }
241  return true;
242  };
243  if (!consistent_histo(m_sf)){
244  Error("EfficiencyScaleFactor()", "Invalid scalefactor in %s", sysname().c_str());
245  return false;
246  }
247  if (!consistent_histo(m_eff)){
248  Error("EfficiencyScaleFactor()", "Invalid data-efficiency in %s", sysname().c_str());
249  return false;
250  }
251  if (!consistent_histo(m_mc_eff)){
252  Error("EfficiencyScaleFactor()", "Invalid MC-efficiency in %s", sysname().c_str());
253  return false;
254  }
255  return true;
256  }

◆ coversRunNumber()

bool EfficiencyScaleFactor::coversRunNumber ( unsigned int  run) const

Check if a run of data-taking is covered by this map.

Definition at line 199 of file EfficiencyScaleFactor.cxx.

199  {
200  return m_firstRun <= run && run <= m_lastRun;
201  }

◆ DataEfficiency()

CorrectionCode EfficiencyScaleFactor::DataEfficiency ( const xAOD::Muon mu,
float &  Eff 
) const

... and absolute efficiencies

Definition at line 316 of file EfficiencyScaleFactor.cxx.

316  {
318  int bin = -1;
319  CorrectionCode cc = m_eff->FindBin(mu, bin);
320  if (cc == CP::CorrectionCode::Error) {
321  return cc;
322  }
323  if (bin != m_SystematicBin) {
324  return m_NominalFallBack->DataEfficiency(mu, Eff);
325  }
326  }
327  CorrectionCode cc = GetContentFromHist(m_eff.get(), mu, Eff, true);
328  if (cc == CorrectionCode::Error) Error("EfficiencyScaleFactor", "Could not apply the data efficiency");
329  return cc;
330  }

◆ DataEfficiencyReplicas()

CorrectionCode EfficiencyScaleFactor::DataEfficiencyReplicas ( const xAOD::Muon mu,
std::vector< float > &  eff 
)

Definition at line 417 of file EfficiencyScaleFactor.cxx.

417  {
419  }

◆ DebugPrint()

void CP::EfficiencyScaleFactor::DebugPrint ( ) const

debug method

◆ FindBinSF()

int EfficiencyScaleFactor::FindBinSF ( const xAOD::Muon mu) const

Finds the bin to which the muon corresponds to.

Definition at line 492 of file EfficiencyScaleFactor.cxx.

492  {
493  int bin = -1;
494  CorrectionCode cc = m_sf->FindBin(mu, bin);
495  if (cc == CP::CorrectionCode::Error) {
496  return -1;
497  }
498  return bin;
499  }

◆ firstRun()

unsigned int EfficiencyScaleFactor::firstRun ( ) const

First run to which the map belongs to.

If the measurement is not carried out in time then it's usally 1

Definition at line 193 of file EfficiencyScaleFactor.cxx.

193  {
194  return m_firstRun;
195  }

◆ GenerateReplicas()

void EfficiencyScaleFactor::GenerateReplicas ( int  nrep,
int  seed 
)
private

Definition at line 451 of file EfficiencyScaleFactor.cxx.

451  {
452  GenerateReplicasFromHist(m_eff.get(), nrep, seed, m_eff_replicas);
453  GenerateReplicasFromHist(m_sf.get(), nrep, seed, m_sf_replicas);
455  }

◆ GenerateReplicasFromHist()

void EfficiencyScaleFactor::GenerateReplicasFromHist ( HistHandler h,
int  nrep,
int  seed,
EfficiencyScaleFactor::SFReplicaVec repVector 
)
private

Definition at line 456 of file EfficiencyScaleFactor.cxx.

456  {
457  if (!h) return;
458  TRandom3 Rndm(seed);
459  replicas.clear();
460  replicas.reserve(nrep);
461  int nBins = h->nBins();
462  for (int t = 0; t < nrep; t++) {
463  replicas.push_back(package_histo(this, h->GetHist()));
464  HistHandler* replica = replicas.back().get();
465  for (int bin = 0; bin < nBins; bin++) {
466  replica->SetBinContent(bin, Rndm.Gaus(h->GetBinContent(bin), h->GetBinError(bin)));
467  }
468  }
469  }

◆ GetBinName()

std::string EfficiencyScaleFactor::GetBinName ( int  bin) const

Returns the name of the bin using the axis title from the scale-factor map.

Definition at line 484 of file EfficiencyScaleFactor.cxx.

484  {
485  if (bin < 1 || bin > nBins()) {
486  Error("EfficiencyScaleFactor::GetBinName()", "The current bin %i is out of the maximum range %u ", bin, nBins());
487  return "Out of range";
488  }
489  return m_sf->GetBinName(bin);
490  }

◆ GetContentFromHist() [1/2]

CorrectionCode EfficiencyScaleFactor::GetContentFromHist ( const HistHandler Hist,
columnar::MuonId  mu,
float &  SF,
bool  add_kine_syst 
) const
private

Definition at line 350 of file EfficiencyScaleFactor.cxx.

350  {
351  Eff = m_default_eff;
352  if (!Hist) {
354  Warning("EfficiencyScaleFactor", "Could not find histogram for variation %s and muon with pt=%.4f, eta=%.2f and phi=%.2f, returning %.1f", sysname().c_str(), ptAcc(mu), etaAcc(mu), phiAcc(mu), m_default_eff);
355  ++m_warnsPrinted;
356  }
358  }
359  if (m_measurement == CP::MuonEfficiencyType::TTVA && std::abs(etaAcc(mu)) > 2.5 && std::abs(etaAcc(mu)) <= 2.7 && muonTypeAcc(mu) == xAOD::Muon::MuonType::MuonStandAlone) {
361  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(), ptAcc(mu), etaAcc(mu), phiAcc(mu), m_default_eff_ttva);
362  ++m_warnsPrinted;
363  }
364  Eff = m_default_eff_ttva;
365  return CorrectionCode::Ok;
366  }
367  int bin = -1;
368  CorrectionCode cc = Hist->FindBin(mu, bin);
369  if (cc != CorrectionCode::Ok) return cc;
370  else Eff = Hist->GetBinContent(bin);
371 
372  if (add_kine_syst && m_respond_to_kineDepSyst) {
373  return m_sf_KineDepsys->GetKineDependent(mu, Eff);
374  }
375  return CorrectionCode::Ok;
376  }

◆ GetContentFromHist() [2/2]

CorrectionCode EfficiencyScaleFactor::GetContentFromHist ( const HistHandler Hist,
const xAOD::Muon mu,
float &  SF,
bool  add_kine_syst 
) const
private

read the content of the correct bin in one of my histos. MCefficiencies actually do not need a pt-dependet systematic

Definition at line 347 of file EfficiencyScaleFactor.cxx.

347  {
348  return GetContentFromHist (Hist, columnar::MuonId (mu), Eff, add_kine_syst);
349  }

◆ GetContentReplicasFromHist()

CorrectionCode EfficiencyScaleFactor::GetContentReplicasFromHist ( EfficiencyScaleFactor::SFReplicaVec replicas,
const xAOD::Muon mu,
std::vector< float > &  SF,
bool  add_kine_syst 
)
private

read a vector of replica contents in the correct bin in one of my histos

Definition at line 423 of file EfficiencyScaleFactor.cxx.

423  {
424  if (replicas.size() != SF.size()) GenerateReplicas(SF.size(), 1000. * mu.phi() + mu.eta());
425  if (replicas.empty()) return CorrectionCode::OutOfValidityRange;
426  if (m_measurement == CP::MuonEfficiencyType::TTVA && std::abs(mu.eta()) > 2.5 && std::abs(mu.eta()) <= 2.7 && mu.muonType() == xAOD::Muon::MuonType::MuonStandAlone) {
428  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);
429  ++m_warnsPrinted;
430  }
431  for (auto& r : SF)
433  return CorrectionCode::Ok;
434  }
435  int bin = -1;
436  float extra_sys = 1;
437  if (add_kine_syst && m_respond_to_kineDepSyst) {
438  CorrectionCode cc = m_sf_KineDepsys->GetKineDependent(mu, extra_sys);
439  if (cc != CorrectionCode::Ok) {}
440  }
441 
442  CorrectionCode res = (*replicas.begin())->FindBin(mu, bin);
443  if (res != CorrectionCode::Ok) return res;
444  else {
445  for (size_t k = 0; k < SF.size(); k++) {
446  SF[k] = replicas.at(k)->GetBinContent(bin) * extra_sys;
447  }
448  }
449  return res;
450  }

◆ isOverFlowBin()

bool EfficiencyScaleFactor::isOverFlowBin ( int  b) const

Check whether the bin is overflow or not.

Definition at line 294 of file EfficiencyScaleFactor.cxx.

294  {
295  return m_sf ? m_sf->isOverFlowBin(b) : true;
296  }

◆ IsUpVariation()

bool EfficiencyScaleFactor::IsUpVariation ( ) const

Definition at line 190 of file EfficiencyScaleFactor.cxx.

190  {
191  return m_is_up;
192  }

◆ lastRun()

unsigned int EfficiencyScaleFactor::lastRun ( ) const

Last run to which the map belongs to. The last run number is given exclusvely...

Definition at line 196 of file EfficiencyScaleFactor.cxx.

196  {
197  return m_lastRun;
198  }

◆ MCEfficiency()

CorrectionCode EfficiencyScaleFactor::MCEfficiency ( const xAOD::Muon mu,
float &  Eff 
) const

... mc efficiency

Definition at line 331 of file EfficiencyScaleFactor.cxx.

331  {
333  int bin = -1;
334  CorrectionCode cc = m_mc_eff->FindBin(mu, bin);
335  if (cc == CP::CorrectionCode::Error) {
336  return cc;
337  }
338  if (bin != m_SystematicBin) {
339  return m_NominalFallBack->MCEfficiency(mu, Eff);
340  }
341  }
342  CorrectionCode cc = GetContentFromHist(m_mc_eff.get(), mu, Eff, false);
343  if (cc == CorrectionCode::Error) Error("EfficiencyScaleFactor", "Could not apply the Monte Carlo efficiency");
344  return cc;
345  }

◆ MCEfficiencyReplicas()

CorrectionCode EfficiencyScaleFactor::MCEfficiencyReplicas ( const xAOD::Muon mu,
std::vector< float > &  eff 
)

Definition at line 420 of file EfficiencyScaleFactor.cxx.

420  {
422  }

◆ nBins()

int EfficiencyScaleFactor::nBins ( ) const

How many bins does the scale-factor map have.

Only the bins of the primary map are counted. If the map has an extra kinematic systematic on top, these bins cannot be resolved at the moment

Definition at line 288 of file EfficiencyScaleFactor.cxx.

288  {
289  return m_sf ? m_sf->nBins() : -1;
290  }

◆ nOverFlowBins()

int EfficiencyScaleFactor::nOverFlowBins ( ) const

Number of overflow bins in the map.

Definition at line 291 of file EfficiencyScaleFactor.cxx.

291  {
292  return m_sf ? m_sf->nOverFlowBins() : -1;
293  }

◆ operator=()

EfficiencyScaleFactor& CP::EfficiencyScaleFactor::operator= ( const EfficiencyScaleFactor )
delete

◆ package_histo()

std::unique_ptr< HistHandler > EfficiencyScaleFactor::package_histo ( columnar::ColumnarTool<> *  parent,
TH1 *  h 
)
private

Definition at line 272 of file EfficiencyScaleFactor.cxx.

272  {
273  // make sure that the correct type of histo is used
274  // Dynamic cast for TH2 Poly otherwise we can rely on the GetDimension() ,ethod
275  if (!h) return std::unique_ptr<HistHandler>();
276  if (dynamic_cast<TH2Poly*>(h)) {
277  return std::make_unique<HistHandler_TH2Poly>(parent, dynamic_cast<TH2Poly*>(h));
278  }else if (h->GetDimension() == 3) {
279  return std::make_unique<HistHandler_TH3>(parent, h);
280  }else if (h->GetDimension() == 2) {
281  return std::make_unique<HistHandler_TH2>(parent, h);
282  } else if (h->GetDimension() == 1) {
283  return std::make_unique<HistHandler_TH1>(parent, h);
284  }
285  Error("EfficiencyScaleFactor", "Unable to package histo %s (%s) in a known HistHandler", h->GetName(), h->IsA()->GetName());
286  return std::unique_ptr<HistHandler>();
287  }

◆ ReadFromFile()

bool CP::EfficiencyScaleFactor::ReadFromFile ( const std::string &  file,
const std::string &  time_unit 
)
private

Read SF histrograms from a given input file.

◆ ReadHistFromFile()

std::unique_ptr< HistHandler > EfficiencyScaleFactor::ReadHistFromFile ( columnar::ColumnarTool<> *  parent,
const std::string &  name,
TFile *  f,
const std::string &  time_unit 
)
private

Definition at line 257 of file EfficiencyScaleFactor.cxx.

257  {
258 
259  TH1* hist_from_file = nullptr;
260 
261  f->GetObject((name + std::string("_") + time_unit).c_str(), hist_from_file);
262  // if no period weighting, the histo may also not have a time period in the name at all
263 
264  if (!hist_from_file && time_unit == "All") {
265  f->GetObject(name.c_str(), hist_from_file);
266  }
267  if (!hist_from_file) {
268  return std::unique_ptr<HistHandler>();
269  }
270  return package_histo(parent, hist_from_file);
271  }

◆ ScaleFactor() [1/2]

CorrectionCode EfficiencyScaleFactor::ScaleFactor ( columnar::MuonId  mu,
float &  SF 
) const

Definition at line 300 of file EfficiencyScaleFactor.cxx.

300  {
302  int bin = -1;
303  CorrectionCode cc = m_sf->FindBin(mu, bin);
304  if (cc == CP::CorrectionCode::Error) {
305  return cc;
306  }
307  if (bin != m_SystematicBin) {
308  return m_NominalFallBack->ScaleFactor(mu, SF);
309  }
310  }
311  CorrectionCode cc = GetContentFromHist(m_sf.get(), mu, SF, true);
312  if (cc == CorrectionCode::Error) Error("EfficiencyScaleFactor", "Could not apply the scale factor");
313  return cc;
314  }

◆ ScaleFactor() [2/2]

CorrectionCode EfficiencyScaleFactor::ScaleFactor ( const xAOD::Muon mu,
float &  SF 
) const

the important bits - extract SF info

scale factors...

Definition at line 297 of file EfficiencyScaleFactor.cxx.

297  {
298  return ScaleFactor (columnar::MuonId (mu), SF);
299  }

◆ ScaleFactorReplicas()

CorrectionCode EfficiencyScaleFactor::ScaleFactorReplicas ( const xAOD::Muon mu,
std::vector< float > &  SF 
)

Definition at line 414 of file EfficiencyScaleFactor.cxx.

414  {
416  }

◆ separateBinSyst()

bool EfficiencyScaleFactor::separateBinSyst ( ) const

Definition at line 187 of file EfficiencyScaleFactor.cxx.

187  {
188  return m_separateBinSyst;
189  }

◆ setFirstLastRun()

void EfficiencyScaleFactor::setFirstLastRun ( unsigned int  first,
unsigned int  last 
)

Set the run-number coverage.

Definition at line 202 of file EfficiencyScaleFactor.cxx.

202  {
203  m_firstRun = first;
204  m_lastRun = last;
205  }

◆ SetSystematicBin()

bool EfficiencyScaleFactor::SetSystematicBin ( int  bin)

This function will let the world implode since it allows to decorrelate the sysstematics bin by bin.

Definition at line 471 of file EfficiencyScaleFactor.cxx.

471  {
472  if (m_syst_name.empty()) return true;
473  if (!m_NominalFallBack) {
474  Error("EfficiencyScaleFactor::SetSystematicBin()", "No fallback has been given for %s", sysname().c_str());
475  return false;
476  }
478  Error("EfficiencyScaleFactor::SetSystematicBin()", "The current bin %i is out of the maximum range %u ", bin, nBins());
479  return false;
480  }
482  return true;
483  }

◆ sysname()

std::string EfficiencyScaleFactor::sysname ( bool  with_direction = true) const

A string having the full name of the systematic including the measurement.

If the systematic string is empty then an empty string is returned. The flag controls whether the suffix __1UP or __1DN is appended after the string.

Definition at line 184 of file EfficiencyScaleFactor.cxx.

184  {
185  return m_syst_name.empty() ? "" : EfficiencyTypeName(m_measurement) + "_" + m_syst_name +(m_is_lowpt ? "_LOWPT" : "") + (with_direction ? (m_is_up ?"__1UP" : "__1DN") :"");
186  }

Member Data Documentation

◆ etaAcc

columnar::MuonAccessor<columnar::RetypeColumn<double,float> > CP::EfficiencyScaleFactor::etaAcc {*this, "eta"}

Definition at line 232 of file EfficiencyScaleFactor.h.

◆ m_default_eff

float CP::EfficiencyScaleFactor::m_default_eff
private

default efficiency value (in case of OutOfValidityRange)

Definition at line 218 of file EfficiencyScaleFactor.h.

◆ m_default_eff_ttva

float CP::EfficiencyScaleFactor::m_default_eff_ttva
private

default TTVA efficiency value (in case of MuonStandAlone for |eta|>2.5)

Definition at line 220 of file EfficiencyScaleFactor.h.

◆ m_eff

std::unique_ptr<HistHandler> CP::EfficiencyScaleFactor::m_eff
private

Definition at line 187 of file EfficiencyScaleFactor.h.

◆ m_eff_decor

std::unique_ptr<FloatDecorator> CP::EfficiencyScaleFactor::m_eff_decor
private

Definition at line 195 of file EfficiencyScaleFactor.h.

◆ m_eff_rep_decor

std::unique_ptr<FloatVectorDecorator> CP::EfficiencyScaleFactor::m_eff_rep_decor
private

Definition at line 199 of file EfficiencyScaleFactor.h.

◆ m_eff_replicas

SFReplicaVec CP::EfficiencyScaleFactor::m_eff_replicas
private

Definition at line 209 of file EfficiencyScaleFactor.h.

◆ m_firstRun

unsigned int CP::EfficiencyScaleFactor::m_firstRun
private

Definition at line 225 of file EfficiencyScaleFactor.h.

◆ m_is_lowpt

bool CP::EfficiencyScaleFactor::m_is_lowpt
private

states that this SF should respond to low pt systematics rather than high pt ones

Definition at line 180 of file EfficiencyScaleFactor.h.

◆ m_is_up

bool CP::EfficiencyScaleFactor::m_is_up
private

Boolean whether the scale-factor is varying upwards or downwards Only relevant if the systname is not empty.

Definition at line 178 of file EfficiencyScaleFactor.h.

◆ m_lastRun

unsigned int CP::EfficiencyScaleFactor::m_lastRun
private

Definition at line 226 of file EfficiencyScaleFactor.h.

◆ m_mc_eff

std::unique_ptr<HistHandler> CP::EfficiencyScaleFactor::m_mc_eff
private

Definition at line 188 of file EfficiencyScaleFactor.h.

◆ m_mc_eff_decor

std::unique_ptr<FloatDecorator> CP::EfficiencyScaleFactor::m_mc_eff_decor
private

Definition at line 196 of file EfficiencyScaleFactor.h.

◆ m_mc_eff_rep_decor

std::unique_ptr<FloatVectorDecorator> CP::EfficiencyScaleFactor::m_mc_eff_rep_decor
private

Definition at line 200 of file EfficiencyScaleFactor.h.

◆ m_mc_eff_replicas

SFReplicaVec CP::EfficiencyScaleFactor::m_mc_eff_replicas
private

Definition at line 210 of file EfficiencyScaleFactor.h.

◆ m_measurement

CP::MuonEfficiencyType CP::EfficiencyScaleFactor::m_measurement
private

Section of variables of the tool.

Definition at line 173 of file EfficiencyScaleFactor.h.

◆ m_muons

columnar::MuonAccessor<columnar::ObjectColumn> CP::EfficiencyScaleFactor::m_muons {*this, "Muons"}

Definition at line 230 of file EfficiencyScaleFactor.h.

◆ m_NominalFallBack

std::shared_ptr<EfficiencyScaleFactor> CP::EfficiencyScaleFactor::m_NominalFallBack
private

Nominal fall-back scale-factor.

Definition at line 213 of file EfficiencyScaleFactor.h.

◆ m_respond_to_kineDepSyst

bool CP::EfficiencyScaleFactor::m_respond_to_kineDepSyst
private

steers the pt dependent systematics

Definition at line 182 of file EfficiencyScaleFactor.h.

◆ m_separateBinSyst

bool CP::EfficiencyScaleFactor::m_separateBinSyst
private

Can the systematic be decorrelated.

Definition at line 184 of file EfficiencyScaleFactor.h.

◆ m_sf

std::unique_ptr<HistHandler> CP::EfficiencyScaleFactor::m_sf
private

the histograms needed to run

Definition at line 186 of file EfficiencyScaleFactor.h.

◆ m_sf_decor

std::unique_ptr<FloatDecorator> CP::EfficiencyScaleFactor::m_sf_decor
private

Definition at line 194 of file EfficiencyScaleFactor.h.

◆ m_sf_KineDepsys

std::unique_ptr<IKinematicSystHandler> CP::EfficiencyScaleFactor::m_sf_KineDepsys
private

Definition at line 204 of file EfficiencyScaleFactor.h.

◆ m_sf_rep_decor

std::unique_ptr<FloatVectorDecorator> CP::EfficiencyScaleFactor::m_sf_rep_decor
private

Definition at line 198 of file EfficiencyScaleFactor.h.

◆ m_sf_replicas

SFReplicaVec CP::EfficiencyScaleFactor::m_sf_replicas
private

replicas, in case we use them

Definition at line 208 of file EfficiencyScaleFactor.h.

◆ m_syst_name

std::string CP::EfficiencyScaleFactor::m_syst_name
private

Definition at line 174 of file EfficiencyScaleFactor.h.

◆ m_SystematicBin

int CP::EfficiencyScaleFactor::m_SystematicBin
private

Definition at line 214 of file EfficiencyScaleFactor.h.

◆ m_warningLimit

const unsigned int EfficiencyScaleFactor::m_warningLimit = 10
staticprivate

Definition at line 223 of file EfficiencyScaleFactor.h.

◆ m_warnsPrinted

std::atomic<unsigned int> CP::EfficiencyScaleFactor::m_warnsPrinted
mutableprivate

Definition at line 222 of file EfficiencyScaleFactor.h.

◆ muonTypeAcc

columnar::MuonAccessor<columnar::RetypeColumn<xAOD::Muon::MuonType,std::uint16_t> > CP::EfficiencyScaleFactor::muonTypeAcc {*this, "muonType"}

Definition at line 234 of file EfficiencyScaleFactor.h.

◆ phiAcc

columnar::MuonAccessor<columnar::RetypeColumn<double,float> > CP::EfficiencyScaleFactor::phiAcc {*this, "phi"}

Definition at line 233 of file EfficiencyScaleFactor.h.

◆ ptAcc

columnar::MuonAccessor<columnar::RetypeColumn<double,float> > CP::EfficiencyScaleFactor::ptAcc {*this, "pt"}

Definition at line 231 of file EfficiencyScaleFactor.h.


The documentation for this class was generated from the following files:
CP::EfficiencyScaleFactor::m_syst_name
std::string m_syst_name
Definition: EfficiencyScaleFactor.h:174
CP::EfficiencyScaleFactor::m_eff_decor
std::unique_ptr< FloatDecorator > m_eff_decor
Definition: EfficiencyScaleFactor.h:195
beamspotman.r
def r
Definition: beamspotman.py:674
CP::EfficiencyScaleFactor::DataEfficiency
CorrectionCode DataEfficiency(const xAOD::Muon &mu, float &Eff) const
... and absolute efficiencies
Definition: EfficiencyScaleFactor.cxx:316
CP::EfficiencyScaleFactor::m_warnsPrinted
std::atomic< unsigned int > m_warnsPrinted
Definition: EfficiencyScaleFactor.h:222
CP::EfficiencyScaleFactor::ScaleFactorReplicas
CorrectionCode ScaleFactorReplicas(const xAOD::Muon &mu, std::vector< float > &SF)
Definition: EfficiencyScaleFactor.cxx:414
CP::EfficiencyScaleFactor::etaAcc
columnar::MuonAccessor< columnar::RetypeColumn< double, float > > etaAcc
Definition: EfficiencyScaleFactor.h:232
CP::EfficiencyScaleFactor::MCEfficiencyReplicas
CorrectionCode MCEfficiencyReplicas(const xAOD::Muon &mu, std::vector< float > &eff)
Definition: EfficiencyScaleFactor.cxx:420
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:423
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:188
CP::EfficiencyScaleFactor::m_firstRun
unsigned int m_firstRun
Definition: EfficiencyScaleFactor.h:225
CP::BadMuonVeto
@ BadMuonVeto
Definition: MuonEfficiencyType.h:17
RootHelpers::FindBin
Int_t FindBin(const TAxis *axis, const double x)
Definition: RootHelpers.cxx:14
CP::EffiCollection::UnCorrelated
@ UnCorrelated
Definition: EffiCollection.h:61
CP::EfficiencyScaleFactor::m_sf_KineDepsys
std::unique_ptr< IKinematicSystHandler > m_sf_KineDepsys
Definition: EfficiencyScaleFactor.h:204
CP::EfficiencyScaleFactor::IsUpVariation
bool IsUpVariation() const
Definition: EfficiencyScaleFactor.cxx:190
CP::EfficiencyScaleFactor::m_eff
std::unique_ptr< HistHandler > m_eff
Definition: EfficiencyScaleFactor.h:187
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:180
CP::EfficiencyScaleFactor::m_NominalFallBack
std::shared_ptr< EfficiencyScaleFactor > m_NominalFallBack
Nominal fall-back scale-factor.
Definition: EfficiencyScaleFactor.h:213
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::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:347
CP::EfficiencyScaleFactor::m_sf_rep_decor
std::unique_ptr< FloatVectorDecorator > m_sf_rep_decor
Definition: EfficiencyScaleFactor.h:198
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ZDCMsg::Info
@ Info
Definition: ZDCMsg.h:20
CP::EfficiencyScaleFactor::muonTypeAcc
columnar::MuonAccessor< columnar::RetypeColumn< xAOD::Muon::MuonType, std::uint16_t > > muonTypeAcc
Definition: EfficiencyScaleFactor.h:234
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
CP::EfficiencyScaleFactor::m_warningLimit
static const unsigned int m_warningLimit
Definition: EfficiencyScaleFactor.h:223
CP::EfficiencyScaleFactor::ReadHistFromFile
std::unique_ptr< HistHandler > ReadHistFromFile(columnar::ColumnarTool<> *parent, const std::string &name, TFile *f, const std::string &time_unit)
Definition: EfficiencyScaleFactor.cxx:257
CP::EfficiencyScaleFactor::DataEfficiencyReplicas
CorrectionCode DataEfficiencyReplicas(const xAOD::Muon &mu, std::vector< float > &eff)
Definition: EfficiencyScaleFactor.cxx:417
CP::EfficiencyScaleFactor::m_measurement
CP::MuonEfficiencyType m_measurement
Section of variables of the tool.
Definition: EfficiencyScaleFactor.h:173
CP::EfficiencyScaleFactor::ptAcc
columnar::MuonAccessor< columnar::RetypeColumn< double, float > > ptAcc
Definition: EfficiencyScaleFactor.h:231
CP::EfficiencyScaleFactor::m_default_eff
float m_default_eff
default efficiency value (in case of OutOfValidityRange)
Definition: EfficiencyScaleFactor.h:218
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:226
CP::Iso
@ Iso
Definition: MuonEfficiencyType.h:16
CP::EfficiencyScaleFactor::m_separateBinSyst
bool m_separateBinSyst
Can the systematic be decorrelated.
Definition: EfficiencyScaleFactor.h:184
lumiFormat.i
int i
Definition: lumiFormat.py:85
CP::EffiCollection::UpVariation
@ UpVariation
Definition: EffiCollection.h:62
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:11
CP::EffiCollection::PtDependent
@ PtDependent
Definition: EffiCollection.h:60
CP::EfficiencyScaleFactor::m_sf_decor
std::unique_ptr< FloatDecorator > m_sf_decor
Definition: EfficiencyScaleFactor.h:194
CP::EfficiencyScaleFactor::m_sf_replicas
SFReplicaVec m_sf_replicas
replicas, in case we use them
Definition: EfficiencyScaleFactor.h:208
file
TFile * file
Definition: tile_monitor.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
CP::EfficiencyScaleFactor::MCEfficiency
CorrectionCode MCEfficiency(const xAOD::Muon &mu, float &Eff) const
... mc efficiency
Definition: EfficiencyScaleFactor.cxx:331
HistHandler
utility class to avoid having to determine the input histo at every single call to the tool Remembers...
hist_file_dump.f
f
Definition: hist_file_dump.py:140
run
Definition: run.py:1
CP::dRJetAxisHandler::set_use_2D_sf
static void set_use_2D_sf(const bool)
Definition: HistHandler.cxx:73
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:220
CP::EfficiencyScaleFactor::phiAcc
columnar::MuonAccessor< columnar::RetypeColumn< double, float > > phiAcc
Definition: EfficiencyScaleFactor.h:233
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:196
columnar::ObjectId
a class representing a single object (electron, muons, etc.)
Definition: ContainerId.h:176
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:76
plotBeamSpotVxVal.bin
int bin
Definition: plotBeamSpotVxVal.py:82
CP::TTVA
@ TTVA
Definition: MuonEfficiencyType.h:15
CP::EfficiencyScaleFactor::m_mc_eff_replicas
SFReplicaVec m_mc_eff_replicas
Definition: EfficiencyScaleFactor.h:210
CP::EffiCollection::Symmetric
@ Symmetric
Definition: EffiCollection.h:59
CP::EfficiencyScaleFactor::GenerateReplicas
void GenerateReplicas(int nrep, int seed)
Definition: EfficiencyScaleFactor.cxx:451
CP::EfficiencyScaleFactor::GenerateReplicasFromHist
void GenerateReplicasFromHist(HistHandler *h, int nrep, int seed, EfficiencyScaleFactor::SFReplicaVec &repVector)
Definition: EfficiencyScaleFactor.cxx:456
CP::CorrectionCode::Ok
@ Ok
The correction was done successfully.
Definition: CorrectionCode.h:38
columnar::empty
bool empty() const noexcept
Definition: ObjectRange.h:163
h
CP::EffiCollection::JPsiAnalysis
@ JPsiAnalysis
Distinguish these two because the systematics are named with an extra LOWPT.
Definition: EffiCollection.h:54
mapkey::sf
@ sf
Definition: TElectronEfficiencyCorrectionTool.cxx:38
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:184
DeMoScan.first
bool first
Definition: DeMoScan.py:534
CP::EfficiencyScaleFactor::ScaleFactor
CorrectionCode ScaleFactor(const xAOD::Muon &mu, float &SF) const
the important bits - extract SF info
Definition: EfficiencyScaleFactor.cxx:297
CP::EfficiencyScaleFactor::m_mc_eff_decor
std::unique_ptr< FloatDecorator > m_mc_eff_decor
Definition: EfficiencyScaleFactor.h:196
CP::EfficiencyScaleFactor::m_SystematicBin
int m_SystematicBin
Definition: EfficiencyScaleFactor.h:214
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:178
dqt_zlumi_alleff_HIST.eff
int eff
Definition: dqt_zlumi_alleff_HIST.py:113
L1Topo::Error
Error
The different types of error that can be flagged in the L1TopoRDO.
Definition: Error.h:16
CP::EfficiencyScaleFactor::nBins
int nBins() const
How many bins does the scale-factor map have.
Definition: EfficiencyScaleFactor.cxx:288
CP::EfficiencyScaleFactor::package_histo
std::unique_ptr< HistHandler > package_histo(columnar::ColumnarTool<> *parent, TH1 *h)
Definition: EfficiencyScaleFactor.cxx:272
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:178
CP::EfficiencyScaleFactor::firstRun
unsigned int firstRun() const
First run to which the map belongs to.
Definition: EfficiencyScaleFactor.cxx:193
CP::EfficiencyScaleFactor::m_respond_to_kineDepSyst
bool m_respond_to_kineDepSyst
steers the pt dependent systematics
Definition: EfficiencyScaleFactor.h:182
plotBeamSpotCompare.histo
histo
Definition: plotBeamSpotCompare.py:414
CaloNoise_fillDB.mu
mu
Definition: CaloNoise_fillDB.py:51
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:186
CP::EfficiencyScaleFactor::m_mc_eff_rep_decor
std::unique_ptr< FloatVectorDecorator > m_mc_eff_rep_decor
Definition: EfficiencyScaleFactor.h:200
CP::EfficiencyScaleFactor::m_eff_rep_decor
std::unique_ptr< FloatVectorDecorator > m_eff_rep_decor
Definition: EfficiencyScaleFactor.h:199
fitman.k
k
Definition: fitman.py:528
python.handimod.cc
int cc
Definition: handimod.py:522
CP::EfficiencyScaleFactor::m_eff_replicas
SFReplicaVec m_eff_replicas
Definition: EfficiencyScaleFactor.h:209