ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
CP::BaseLinearFakeBkgTool Class Referenceabstract

#include <BaseLinearFakeBkgTool.h>

Inheritance diagram for CP::BaseLinearFakeBkgTool:
Collaboration diagram for CP::BaseLinearFakeBkgTool:

Public Member Functions

 BaseLinearFakeBkgTool (const std::string &toolname)
 
virtual ~BaseLinearFakeBkgTool ()
 
virtual StatusCode initialize () override
 Dummy implementation of the initialisation function. More...
 
virtual StatusCode getEventWeight (float &weight, const std::string &selection, const std::string &process) override final
 returns an event weight addEvent() must have been called before hand. More...
 
virtual StatusCode getTotalYield (float &yield, float &statErrorUp, float &statErrorDown) override final
 returns the accumulated fake lepton background yield (or compute it, in the case of the likelihood matrix method), and fills the registered histograms (if any) The 'selection' and 'process' settings used for these operations can be chosen with the 'Selection' and 'Process' properties. More...
 
virtual StatusCode register1DHistogram (TH1 *h1, const float *val) override
 associates a 1D histogram to the tool, to obtain a binned estimate of the fake lepton background the 'val' argument points to a variable corresponding to the X axis of the histogram and that needs to be updated before each call to addEvent() undefined behaviour if the pointers are invalidated during the tool's lifetime More...
 
virtual StatusCode register2DHistogram (TH2 *h2, const float *xval, const float *yval) override
 associates a 2D histogram to the tool, to obtain a binned estimate of the fake lepton background the 'xval' / 'yval' arguments point to variables corresponding to the X/Y axis of the histogram and that need to be updated before each call to addEvent() undefined behaviour if the pointers are invalidated during the tool's lifetime More...
 
virtual StatusCode register3DHistogram (TH3 *h3, const float *xval, const float *yval, const float *zval) override
 associates a 3D histogram to the tool, to obtain a binned estimate of the fake lepton background More...
 
StatusCode assignYieldRange (TH1 *h)
 
virtual StatusCode saveProgress (TDirectory *dir) override
 
virtual StatusCode addEvent (const xAOD::IParticleContainer &particles, float extraWeight=1.f) override final
 supply list of leptons / global variables, internal counters incremented Does not return anything; event weight(s) must be retrieved by subsequent call(s) to getEventWeight() (for tools inheriting from ILinearFakeBkgTool) More...
 
virtual bool isAffectedBySystematic (const CP::SystematicVariation &systematic) const override
 Declare the interface that this class provides. More...
 
virtual CP::SystematicSet affectingSystematics () const override
 the list of all systematics this tool can be affected by More...
 
virtual CP::SystematicSet recommendedSystematics () const override
 the list of all systematics this tool recommends to use More...
 
virtual StatusCode applySystematicVariation (const CP::SystematicSet &systConfig) override
 effects: configure this tool for the given list of systematic variations. More...
 
virtual CP::SystematicSet affectingSystematicsFor (const std::string &nuisanceParameter) const override
 These functions are slow, don't use them in the tools implementations. More...
 
virtual std::string getUncertaintyDescription (const CP::SystematicVariation &systematic) const override final
 returns a human-readable description of the source of systematic uncertainty specified as argument More...
 
virtual void printUncertaintyDescription (const CP::SystematicVariation &systematic) const override final
 prints a human-readable description of the source of systematic uncertainty specified as argument More...
 
virtual bool isSystematicUncertainty (const CP::SystematicVariation &systematic) const override final
 checks whether the specified source of uncertainty originates from a systematic uncertainty in the efficiencies (as opposed to statistical) More...
 
virtual bool isStatisticalUncertainty (const CP::SystematicVariation &systematic) const override final
 checks whether the specified source of uncertainty originates from a statistical uncertainty in the efficiencies (as opposed to systematic) More...
 
virtual bool affectsElectrons (const CP::SystematicVariation &systematic) const override final
 checks whether the specified source of uncertainty affects electrons More...
 
virtual bool affectsMuons (const CP::SystematicVariation &systematic) const override final
 checks whether the specified source of uncertainty affects muons More...
 
virtual bool affectsTaus (const CP::SystematicVariation &systematic) const override final
 checks whether the specified source of uncertainty affects taus More...
 
virtual bool affectsRealEfficiencies (const CP::SystematicVariation &systematic) const override final
 checks whether the specified source of uncertainty affects real efficiencies More...
 
virtual bool affectsFakeEfficiencies (const CP::SystematicVariation &systematic) const override final
 checks whether the specified source of uncertainty affects fake efficiencies More...
 
virtual bool affectsFakeFactors (const CP::SystematicVariation &systematic) const override final
 checks whether the specified source of uncertainty affects fake factors More...
 
virtual const IFakeBkgSystDescriptorgetSystDescriptor () const override
 retrieves an interface to various helper methods to identify what the different SystematicVariations correspond to More...
 
virtual void print () const =0
 Print the state of the tool. More...
 
virtual void print () const
 Print the state of the tool. More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Static Public Member Functions

static constexpr const char * defaultSelection ()
 default value taken by the 'selection' argument of several methods or properties It indicates how the analysis selects leptons in the signal region The syntax supported for this arguments is described in the package documentation. More...
 
static constexpr const char * defaultProcess ()
 default value taken by the 'process' argument of several methods or properties It indicates what should be treated as fake lepton background. More...
 

Protected Member Functions

StatusCode incrementTotalYield ()
 be sure to only call this once per event! (typically at the end of addEvent()) More...
 
virtual StatusCode getEventWeightCustom (FakeBkgTools::Weight &weight, const FakeBkgTools::FinalState &fs)=0
 
virtual FakeBkgTools::Client clientForDB ()=0
 This indicates which type of efficiencies/fake factor need to be filled. More...
 
virtual StatusCode addEventCustom ()=0
 
FakeBkgTools::FinalState getCachedFinalState (uint8_t nparticles, const std::string &strPID, const std::string &strProc, bool &success)
 
std::string getListOfEfficienciesAffectedBy (uint16_t uid) const
 
StatusCode CheckHistogramCompatibility (const TH1 *lhs, const TH1 *rhs)
 
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
 
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed. More...
 

Protected Attributes

std::vector< FakeBkgTools::Yieldm_yields
 accumulated yield for all events (and histogram bins with uncertainties) More...
 
std::map< FakeBkgTools::FinalState, FakeBkgTools::Weightm_cachedWeights
 cached weight+uncertainties for a single event Each tool derived from this base class MUST clear the map in addEventCustom()! More...
 
std::map< TH1 *, std::pair< uint32_t, uint32_t > > m_histogramYieldsRange
 
bool m_initialized = false
 
bool m_needEventInfo = true
 
bool m_convertWhenMissing = false
 
std::vector< FakeBkgTools::ParticleDatam_particles
 
std::unique_ptr< FakeBkgTools::Databasem_database
 
float m_externalWeight
 
std::hash< std::string > m_hasher
 comes from Event passed to addEvent() More...
 
std::set< FakeBkgTools::FinalStatem_cachedFinalStates
 
std::map< TH1 *, const float * > m_values_1dhisto_map
 
std::map< TH2 *, std::pair< const float *, const float * > > m_values_2dhisto_map
 
std::map< TH3 *, std::tuple< const float *, const float *, const float * > > m_values_3dhisto_map
 
std::string m_selection = defaultSelection()
 'selection' settings used to compute the total yield / fill histograms More...
 
std::string m_process = defaultProcess()
 'process' settings used to compute the total yield / fill histograms More...
 
std::string m_energyUnit
 property EnergyUnit user can choose between MeV or GeV to indicate the unit of the pT parametrization of efficiencies in the input files More...
 
bool m_useDB = true
 
std::vector< std::string > m_inputFiles
 property InputFiles More...
 
std::string m_tightDecoNameAndType
 property TightDecoration More...
 
CP::ISelectionReadAccessorm_tightAccessor = nullptr
 this can't be a unique_ptr as this can cause issues with the dictionary in some particular circumstances More...
 
std::string m_progressFileName
 property ProgressFileName More...
 
std::string m_progressFileDirectory
 property ProgressFileDirectory More...
 
UncertaintyListm_selectedUncertainties = nullptr
 Pointer to a value of the 'm_systSetDict' map it must be invalidated each time the map is updated in principle only applySystematicVariation() needs to do that. More...
 
std::unordered_map< CP::SystematicSet, UncertaintyListm_systSetDict
 List of uncertainties in internal format, associated with a particular SystematicSet the m_selectedUncertainties pointer must be invalidated each time this map is updated in principle only applySystematicVariation() needs to do that. More...
 
bool m_unlimitedSystematicVariations = true
 used to prevent multiple calls to applySystematicVariation() when unsupported set to true in a particular tool's constructor to disable the possibility of calling applySystematicVariation() more than once / after the first call to addEvent() More...
 
bool m_lockedSystematicVariations = false
 when m_unlimitedSystematicVariations=false, keeps track of prior calls to applySystematicVariation() / addEvent() More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

StatusCode getEventWeightCommon (FakeBkgTools::Weight &weight, const std::string &selection, const std::string &process)
 
StatusCode mergeSubjobs ()
 
bool importEfficiencies (bool resetDB=false)
 load the config file(s) storing efficiencies More...
 
std::pair< uint16_t, float > identifyCpSystematicVariation (const CP::SystematicVariation &systematic) const
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

Definition at line 40 of file BaseLinearFakeBkgTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ BaseLinearFakeBkgTool()

BaseLinearFakeBkgTool::BaseLinearFakeBkgTool ( const std::string &  toolname)

Note: don't use the usual syntax declareProperty("", x = default, ""), it won't work for standalone compilation

Definition at line 30 of file BaseLinearFakeBkgTool.cxx.

31 {
33 
35 }

◆ ~BaseLinearFakeBkgTool()

BaseLinearFakeBkgTool::~BaseLinearFakeBkgTool ( )
virtual

Definition at line 37 of file BaseLinearFakeBkgTool.cxx.

38 {
39 }

Member Function Documentation

◆ addEvent()

StatusCode BaseFakeBkgTool::addEvent ( const xAOD::IParticleContainer particles,
float  extraWeight = 1.f 
)
finaloverridevirtualinherited

supply list of leptons / global variables, internal counters incremented Does not return anything; event weight(s) must be retrieved by subsequent call(s) to getEventWeight() (for tools inheriting from ILinearFakeBkgTool)

prevent further calls to applySystematicVariation() if not allowed

only retrieved if some of the efficiency parameters are event-level!

for standalone compilation, pp is already a reference and the * operator is redefined to a no-op so that this works

Implements CP::IFakeBkgTool.

Definition at line 155 of file BaseFakeBkgTool.cxx.

156 {
157  if(!m_initialized)
158  {
159  ATH_MSG_WARNING("the tool hasn't been initialized");
160  return StatusCode::FAILURE;
161  }
162  m_particles.clear();
164 
165  const xAOD::EventInfo* eventInfo = nullptr;
166  if(m_needEventInfo)
167  {
168  #ifdef FAKEBKGTOOLS_ATLAS_ENVIRONMENT
169  ATH_CHECK( evtStore()->retrieve(eventInfo, "EventInfo") );
170  #else
171  eventInfo = &iparticles.eventInfo;
172  #endif
173  }
174 
175  for(const auto& pp : iparticles)
176  {
177  const auto& p = *pp;
178  m_particles.emplace_back();
179  auto& d = m_particles.back();
180  d.tight = m_tightAccessor->getBool(p);
181  d.type = p.type();
182  switch(p.type())
183  {
184  case xAOD::Type::Electron: d.charge = static_cast<const xAOD::Electron&>(p).charge(); break;
185  case xAOD::Type::Muon: d.charge = static_cast<const xAOD::Muon&>(p).charge(); break;
186  case xAOD::Type::Tau: d.charge = static_cast<const xAOD::TauJet&>(p).charge(); break;
187  case xAOD::Type::Photon: d.charge = 0; break;
188  default:
189  ATH_MSG_WARNING("unknown particle type, setting charge to 0");
190  d.charge = 0;
191  }
192  if(m_useDB)
193  {
194  std::string error;
195  if(!m_database->fillEfficiencies(d, p, *eventInfo, error))
196  {
197  ATH_MSG_ERROR("unable to retrieve efficiencies: " << error);
198  return StatusCode::FAILURE;
199  }
200  ATH_MSG_DEBUG("particle has fake fact. = " << d.fake_factor.value(this) <<", fake eff. = " << d.fake_efficiency.value(this) <<", real eff. = " << d.real_efficiency.value(this));
201  }
202  else
203  {
204  d.real_efficiency.nominal = p.auxdataConst<float>("real_eff");
205  d.fake_efficiency.nominal = p.auxdataConst<float>("fake_eff");
206  }
207  }
208  if(m_particles.size() > maxParticles())
209  {
210  ATH_MSG_WARNING( "the input contains " << m_particles.size() << " particles but the maximum allowed is " << maxParticles()
211  << "; the last " << (m_particles.size()-maxParticles()) << " will be ignored");
212  m_particles.erase(m_particles.begin() + maxParticles(), m_particles.end());
213  }
214  m_externalWeight = mcWeight;
215  ATH_MSG_DEBUG("calling addEventCustom() with #particles = " << m_particles.size());
216  return addEventCustom();
217 }

◆ addEventCustom()

virtual StatusCode CP::BaseFakeBkgTool::addEventCustom ( )
protectedpure virtualinherited

◆ affectingSystematics()

CP::SystematicSet BaseFakeBkgTool::affectingSystematics ( ) const
overridevirtualinherited

the list of all systematics this tool can be affected by

Implements CP::IReentrantSystematicsTool.

Definition at line 409 of file BaseFakeBkgTool.cxx.

410 {
411  if(!m_initialized || !m_database)
412  {
413  ATH_MSG_ERROR("This function can be called only once the tool has been initialized, since the number of systematic variations depends on the configuration...");
414  throw std::logic_error("BaseFakeBkgTool::affectingSystematics() called before initialization");
415  }
416  CP::SystematicSet affecting;
417  for(int step=0;step<2;++step)
418  {
419  std::string type = step? "STAT" : "SYST";
420  const int imax = step? m_database->numberOfStats() : m_database->numberOfSysts();
421  for(int i=0;i<imax;++i)
422  {
423  std::string name = "FAKEBKG_" + type + "_VAR" + std::to_string(i);
424  affecting.insert(CP::SystematicVariation(name, 1.f));
425  affecting.insert(CP::SystematicVariation(name, -1.f));
426  }
427  }
428  return affecting;
429 }

◆ affectingSystematicsFor()

CP::SystematicSet BaseFakeBkgTool::affectingSystematicsFor ( const std::string &  nuisanceParameter) const
overridevirtualinherited

These functions are slow, don't use them in the tools implementations.

Implements CP::IFakeBkgSystDescriptor.

Definition at line 589 of file BaseFakeBkgTool.cxx.

590 {
591  CP::SystematicSet affecting;
592  if(!m_initialized || !m_database)
593  {
594  ATH_MSG_ERROR("This function can be called only once the tool has been initialized, since the number of systematic variations depends on the configuration...");
595  return {};
596  }
597  bool up=true, down=true;
598  auto pos1=nuisanceParameter.find("__up"), pos2=nuisanceParameter.find("__down");
599  if(pos1!=std::string::npos && pos1+4==nuisanceParameter.length()) down = false;
600  else if(pos2!=std::string::npos && pos2+6==nuisanceParameter.length()) up = false;
601  std::string np = nuisanceParameter.substr(0, std::min(pos1, pos2));
602  for(unsigned i=0;i<m_database->numberOfSysts();++i)
603  {
604  auto syst = m_database->findSyst(m_database->systIndexToUID(i));
605  if(syst && syst->name==np)
606  {
607  std::string name = "FAKEBKG_SYST_VAR" + std::to_string(i);
608  if(up) affecting.insert(CP::SystematicVariation(name, 1.f));
609  if(down) affecting.insert(CP::SystematicVariation(name, -1.f));
610  }
611  }
612  return affecting;
613 }

◆ affectsElectrons()

bool BaseFakeBkgTool::affectsElectrons ( const CP::SystematicVariation systematic) const
finaloverridevirtualinherited

checks whether the specified source of uncertainty affects electrons

Implements CP::IFakeBkgSystDescriptor.

Definition at line 547 of file BaseFakeBkgTool.cxx.

548 {
549  uint16_t UID = identifyCpSystematicVariation(systematic).first;
550  if(UID) return getListOfEfficienciesAffectedBy(UID).find("electron") != std::string::npos;
551  return false;
552 }

◆ affectsFakeEfficiencies()

bool BaseFakeBkgTool::affectsFakeEfficiencies ( const CP::SystematicVariation systematic) const
finaloverridevirtualinherited

checks whether the specified source of uncertainty affects fake efficiencies

Implements CP::IFakeBkgSystDescriptor.

Definition at line 575 of file BaseFakeBkgTool.cxx.

576 {
577  uint16_t UID = identifyCpSystematicVariation(systematic).first;
578  if(UID) return getListOfEfficienciesAffectedBy(UID).find("fake eff") != std::string::npos;
579  return false;
580 }

◆ affectsFakeFactors()

bool BaseFakeBkgTool::affectsFakeFactors ( const CP::SystematicVariation systematic) const
finaloverridevirtualinherited

checks whether the specified source of uncertainty affects fake factors

Implements CP::IFakeBkgSystDescriptor.

Definition at line 582 of file BaseFakeBkgTool.cxx.

583 {
584  uint16_t UID = identifyCpSystematicVariation(systematic).first;
585  if(UID) return getListOfEfficienciesAffectedBy(UID).find("fake factor") != std::string::npos;
586  return false;
587 }

◆ affectsMuons()

bool BaseFakeBkgTool::affectsMuons ( const CP::SystematicVariation systematic) const
finaloverridevirtualinherited

checks whether the specified source of uncertainty affects muons

Implements CP::IFakeBkgSystDescriptor.

Definition at line 554 of file BaseFakeBkgTool.cxx.

555 {
556  uint16_t UID = identifyCpSystematicVariation(systematic).first;
557  if(UID) return getListOfEfficienciesAffectedBy(UID).find("muon") != std::string::npos;
558  return false;
559 }

◆ affectsRealEfficiencies()

bool BaseFakeBkgTool::affectsRealEfficiencies ( const CP::SystematicVariation systematic) const
finaloverridevirtualinherited

checks whether the specified source of uncertainty affects real efficiencies

Implements CP::IFakeBkgSystDescriptor.

Definition at line 568 of file BaseFakeBkgTool.cxx.

569 {
570  uint16_t UID = identifyCpSystematicVariation(systematic).first;
571  if(UID) return getListOfEfficienciesAffectedBy(UID).find("real eff") != std::string::npos;
572  return false;
573 }

◆ affectsTaus()

bool BaseFakeBkgTool::affectsTaus ( const CP::SystematicVariation systematic) const
finaloverridevirtualinherited

checks whether the specified source of uncertainty affects taus

Implements CP::IFakeBkgSystDescriptor.

Definition at line 561 of file BaseFakeBkgTool.cxx.

562 {
563  uint16_t UID = identifyCpSystematicVariation(systematic).first;
564  if(UID) return getListOfEfficienciesAffectedBy(UID).find("tau") != std::string::npos;
565  return false;
566 }

◆ applySystematicVariation()

StatusCode BaseFakeBkgTool::applySystematicVariation ( const CP::SystematicSet systConfig)
overridevirtualinherited

effects: configure this tool for the given list of systematic variations.

any requested systematics that are not affecting this tool will be silently ignored (unless they cause other errors). failures: systematic unknown failures: requesting multiple variations on the same systematic (e.g. up & down) failures: requesting an unsupported variation on an otherwise supported systematic (e.g. a 2 sigma variation and the tool only supports 1 sigma variations) failures: unsupported combination of supported systematic failures: other tool specific errors

prevent further calls to applySystematicVariation() if not allowed

Implements CP::ISystematicsTool.

Definition at line 436 of file BaseFakeBkgTool.cxx.

437 {
438  if(!m_initialized || !m_database)
439  {
440  ATH_MSG_ERROR("This function can be called only once the tool has been initialized");
441  throw std::logic_error("BaseFakeBkgTool::applySystematicVariation() called before initialization");
442  }
444  {
445  ATH_MSG_ERROR("this particular method doesn't support multiple calls to applySystematicVariation(), or after the first call to addEvent(). Please use a separate instance of the tool for each variation.");
446  throw std::logic_error("BaseFakeBkgTool::applySystematicVariation() called at a wrong time");
447  }
449  if(!systConfig.size())
450  {
451  m_selectedUncertainties = nullptr;
452  return StatusCode::SUCCESS;
453  }
454  auto itr = m_systSetDict.find(systConfig);
455  if(itr != m_systSetDict.end())
456  {
457  m_selectedUncertainties = &itr->second;
458  return StatusCode::SUCCESS;
459  }
460  CP::SystematicSet mysys;
462  if(sc != StatusCode::SUCCESS) return sc;
463  std::unique_ptr<UncertaintyList> uncertainties;
464  for(auto& sysvar : mysys)
465  {
466  auto var = identifyCpSystematicVariation(sysvar);
467  if(!var.first)
468  {
469  ATH_MSG_ERROR("The systematic variation " << sysvar.name() << " is not recognized, despite being present in affectingSystematics()...");
470  return StatusCode::FAILURE;
471  }
472  if(!uncertainties) uncertainties.reset(new UncertaintyList(var.first, var.second));
473  else uncertainties->extraVariation(var.first, var.second);
474  }
475  if(uncertainties)
476  {
477  auto emplaced = m_systSetDict.emplace(systConfig, std::move(*uncertainties));
478  m_selectedUncertainties = &emplaced.first->second;
479  }
480  else m_selectedUncertainties = nullptr;
481  return StatusCode::SUCCESS;
482 }

◆ assignYieldRange()

StatusCode BaseLinearFakeBkgTool::assignYieldRange ( TH1 h)

Definition at line 149 of file BaseLinearFakeBkgTool.cxx.

150 {
151  const std::string histname = h->GetName();
152  std::pair<uint32_t, uint32_t> range;
153  for(auto itr=m_histogramYieldsRange.begin();itr!=m_histogramYieldsRange.end();++itr)
154  {
155  if(histname != itr->first->GetName()) continue;
156  range = itr->second;
157  m_histogramYieldsRange.erase(itr);
158  m_histogramYieldsRange.emplace(h, range);
159  return StatusCode::SUCCESS;
160  }
161  range.first = m_yields.size();
162  m_yields.insert(m_yields.end(), std::max(1, h->GetNcells()), FakeBkgTools::Yield{});
163  range.second = m_yields.size() - 1;
164  m_histogramYieldsRange.emplace(h, range);
165  return StatusCode::SUCCESS;
166 }

◆ CheckHistogramCompatibility()

StatusCode BaseFakeBkgTool::CheckHistogramCompatibility ( const TH1 lhs,
const TH1 rhs 
)
protectedinherited

Definition at line 330 of file BaseFakeBkgTool.cxx.

331 {
332  std::string error;
333  if(std::string(lhs->GetName()) != rhs->GetName()) error = "names";
334  else if(lhs->GetDimension() != rhs->GetDimension()) error = "dimensions";
335  else if(lhs->GetNbinsX()!=rhs->GetNbinsX() || lhs->GetNbinsY()!=rhs->GetNbinsY() || lhs->GetNbinsZ()!=rhs->GetNbinsZ()) error = "number of bins";
336  else
337  {
338  for(auto getAxis : std::initializer_list<const TAxis*(TH1::*)()const>{&TH1::GetXaxis, &TH1::GetYaxis, &TH1::GetZaxis})
339  {
340  auto lhsAxis=(lhs->*getAxis)(), rhsAxis=(rhs->*getAxis)();
341  for(int i=0;i<=lhsAxis->GetNbins();++i)
342  {
343  auto x=lhsAxis->GetBinUpEdge(i), y=rhsAxis->GetBinUpEdge(i), width=lhsAxis->GetBinWidth(i?i:1);
344  if(std::fabs(x-y) > 0.01*width) error = "bin edges";
345  }
346  }
347  }
348  if(error.length())
349  {
350  ATH_MSG_ERROR("the registered histogram \"" << lhs->GetName() << "\" is not compatible with the one saved in the in-progress ROOT file (mismatching " << error << "). Or, you tried registering two different histograms with the same name.");
351  return StatusCode::FAILURE;
352  }
353  return StatusCode::SUCCESS;
354 }

◆ clientForDB()

Client BaseFakeBkgTool::clientForDB ( )
protectedpure virtualinherited

This indicates which type of efficiencies/fake factor need to be filled.

Implemented in CP::LhoodMM_tools, CP::ApplyFakeFactor, CP::ApplyE2YFakeRate, and CP::AsymptMatrixTool.

Definition at line 58 of file BaseFakeBkgTool.cxx.

59 {
60  return Client::NONE;
61 }

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKeyArray>

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleBase>

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ defaultProcess()

static constexpr const char* CP::IFakeBkgTool::defaultProcess ( )
inlinestaticconstexprinherited

default value taken by the 'process' argument of several methods or properties It indicates what should be treated as fake lepton background.

The syntax supported for this arguments is described in the package documentation.

Definition at line 37 of file IFakeBkgTool.h.

37 { return ">=1F[T]"; }

◆ defaultSelection()

static constexpr const char* CP::IFakeBkgTool::defaultSelection ( )
inlinestaticconstexprinherited

default value taken by the 'selection' argument of several methods or properties It indicates how the analysis selects leptons in the signal region The syntax supported for this arguments is described in the package documentation.

Definition at line 32 of file IFakeBkgTool.h.

32 { return "0!T"; }

◆ detStore()

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ evtStore() [1/2]

ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( ) const
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase &  ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ getCachedFinalState()

FinalState BaseFakeBkgTool::getCachedFinalState ( uint8_t  nparticles,
const std::string &  strPID,
const std::string &  strProc,
bool &  success 
)
protectedinherited

no longer fill cache if it becomes too large

Definition at line 219 of file BaseFakeBkgTool.cxx.

220 {
221  success = true;
222  size_t hFS = m_hasher(strProc) ^ m_hasher(strPID) ^ nparticles;
223  auto itrFS = m_cachedFinalStates.find(FinalState(hFS));
224  if(itrFS != m_cachedFinalStates.end()) return *itrFS;
225  std::string error;
226  FinalState fs(hFS, nparticles, strPID, strProc, error);
227  if(error.length())
228  {
230  success = false;
231  return FinalState(0);
232  }
233  if(m_cachedFinalStates.size() < 1024)
234  {
235  m_cachedFinalStates.emplace(fs);
236  }
237  return fs;
238 }

◆ getEventWeight()

StatusCode BaseLinearFakeBkgTool::getEventWeight ( float &  weight,
const std::string &  selection,
const std::string &  process 
)
finaloverridevirtual

returns an event weight addEvent() must have been called before hand.

Can be called several times for the same event, possibly with different arguments. The 'selection' argument indicates how the analysis selects leptons in the signal region The 'process' argument indicates what should be treated as fake lepton background. The syntax supported for these two arguments is described in the package documentation. The extraWeight argument specified to addEvent() is NOT included in the returned weight.

Implements CP::ILinearFakeBkgTool.

Definition at line 46 of file BaseLinearFakeBkgTool.cxx.

47 {
50  weight = w.value(this);
51  return sc;
52 }

◆ getEventWeightCommon()

StatusCode BaseLinearFakeBkgTool::getEventWeightCommon ( FakeBkgTools::Weight weight,
const std::string &  selection,
const std::string &  process 
)
private

Definition at line 54 of file BaseLinearFakeBkgTool.cxx.

55 {
56  if(!m_initialized)
57  {
58  ATH_MSG_WARNING("the tool hasn't been initialized");
59  return StatusCode::FAILURE;
60  }
61  weight.uncertainties.clear();
62  bool success = true;
63  auto fs = getCachedFinalState(m_particles.size(), selection, process, success);
64  if(!success) return StatusCode::FAILURE;
65  auto itr = m_cachedWeights.find(fs);
66  if(itr != m_cachedWeights.end())
67  {
68  weight = itr->second;
69  return StatusCode::SUCCESS;
70  }
72  if(sc != StatusCode::SUCCESS) return sc;
73  m_cachedWeights.emplace(fs, weight);
74  return StatusCode::SUCCESS;
75 }

◆ getEventWeightCustom()

virtual StatusCode CP::BaseLinearFakeBkgTool::getEventWeightCustom ( FakeBkgTools::Weight weight,
const FakeBkgTools::FinalState fs 
)
protectedpure virtual

◆ getKey()

SG::sgkey_t asg::AsgTool::getKey ( const void *  ptr) const
inherited

Get the (hashed) key of an object that is in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the SG::sgkey_t key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getName
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The hashed key of the object in the store. If not found, an invalid (zero) key.

Definition at line 119 of file AsgTool.cxx.

119  {
120 
121 #ifdef XAOD_STANDALONE
122  // In case we use @c xAOD::TEvent, we have a direct function call
123  // for this.
124  return evtStore()->event()->getKey( ptr );
125 #else
126  const SG::DataProxy* proxy = evtStore()->proxy( ptr );
127  return ( proxy == nullptr ? 0 : proxy->sgkey() );
128 #endif // XAOD_STANDALONE
129  }

◆ getListOfEfficienciesAffectedBy()

std::string BaseFakeBkgTool::getListOfEfficienciesAffectedBy ( uint16_t  uid) const
protectedinherited

Definition at line 356 of file BaseFakeBkgTool.cxx.

357 {
358  if(!m_initialized || !m_database)
359  {
360  ATH_MSG_ERROR("This function can be called only once the tool has been initialized");
361  return "";
362  }
363  std::bitset<Database::N_EFFICIENCY_TYPES> affects;
364  auto stat = m_database->findStat(uid);
365  if(stat) affects = stat->affects;
366  else
367  {
368  auto syst = m_database->findSyst(uid);
369  if(syst) affects = syst->affects;
370  else
371  {
372  ATH_MSG_ERROR("uncertainty with UID " << std::hex << uid << std::dec << " not found in database");
373  return "";
374  }
375  }
376  std::string info;
377  if(affects[Database::ELECTRON_REAL_EFFICIENCY]) info += "electron real efficiencies, ";
378  if(affects[Database::ELECTRON_FAKE_EFFICIENCY]) info += "electron fake efficiencies, ";
379  if(affects[Database::ELECTRON_FAKE_FACTOR]) info += "electron fake factors, ";
380  if(affects[Database::MUON_REAL_EFFICIENCY]) info += "muon real efficiencies, ";
381  if(affects[Database::MUON_FAKE_EFFICIENCY]) info += "muon fake efficiencies, ";
382  if(affects[Database::MUON_FAKE_FACTOR]) info += "muon fake factors, ";
383  if(affects[Database::PHOTON_ELE_FAKE_FACTOR]) info += "electron->photon fake rate, ";
384  if(affects[Database::PHOTON_ELE_FAKE_FACTOR_SF]) info += "electron->photon fake rate scale factor, ";
385  return info.substr(0, info.size()-2);
386 }

◆ getName()

const std::string & asg::AsgTool::getName ( const void *  ptr) const
inherited

Get the name of an object that is / should be in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the std::string name for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getKey
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The string name of the object in the store. If not found, an empty string.

Definition at line 106 of file AsgTool.cxx.

106  {
107 
108 #ifdef XAOD_STANDALONE
109  // In case we use @c xAOD::TEvent, we have a direct function call
110  // for this.
111  return evtStore()->event()->getName( ptr );
112 #else
113  const SG::DataProxy* proxy = evtStore()->proxy( ptr );
114  static const std::string dummy = "";
115  return ( proxy == nullptr ? dummy : proxy->name() );
116 #endif // XAOD_STANDALONE
117  }

◆ getProperty()

template<class T >
const T* asg::AsgTool::getProperty ( const std::string &  name) const
inherited

Get one of the tool's properties.

◆ getSystDescriptor()

virtual const IFakeBkgSystDescriptor& CP::BaseFakeBkgTool::getSystDescriptor ( ) const
inlineoverridevirtualinherited

retrieves an interface to various helper methods to identify what the different SystematicVariations correspond to

Implements CP::IFakeBkgTool.

Definition at line 74 of file BaseFakeBkgTool.h.

74 {return *this; }

◆ getTotalYield()

StatusCode BaseLinearFakeBkgTool::getTotalYield ( float &  yield,
float &  statErrorUp,
float &  statErrorDown 
)
finaloverridevirtual

returns the accumulated fake lepton background yield (or compute it, in the case of the likelihood matrix method), and fills the registered histograms (if any) The 'selection' and 'process' settings used for these operations can be chosen with the 'Selection' and 'Process' properties.

Only statistical uncertainties can be retrieved; use applySystematicVariation() to obtain uncertainties

Implements CP::IFakeBkgTool.

Definition at line 77 of file BaseLinearFakeBkgTool.cxx.

78 {
79  if(!m_initialized)
80  {
81  ATH_MSG_WARNING("the tool hasn't been initialized");
82  return StatusCode::FAILURE;
83  }
84  if(m_progressFileName.length() && m_progressFileName != "none")
85  {
87  }
88  auto& total = m_yields.at(0);
89  yield = total.value(this);
90  yieldStatErrorUp = sqrt(total.stat2.up);
91  yieldStatErrorDown = sqrt(total.stat2.down);
92  for(auto& kv : m_histogramYieldsRange)
93  {
94  for(int i=0;i<kv.first->GetNcells();++i)
95  {
96  auto& yield = m_yields.at(kv.second.first + i);
97  kv.first->SetBinContent(i, yield.value(this));
98  kv.first->SetBinError(i, yield.stat());
99  }
100  }
101  return StatusCode::SUCCESS;
102 }

◆ getUncertaintyDescription()

std::string BaseFakeBkgTool::getUncertaintyDescription ( const CP::SystematicVariation systematic) const
finaloverridevirtualinherited

returns a human-readable description of the source of systematic uncertainty specified as argument

need to add more info (bin index, etc)

Implements CP::IFakeBkgSystDescriptor.

Definition at line 490 of file BaseFakeBkgTool.cxx.

491 {
492  if(!m_initialized || !m_database)
493  {
494  ATH_MSG_ERROR("This function can be called only once the tool has been initialized");
495  return "";
496  }
497 
498  auto UID = identifyCpSystematicVariation(systematic).first;
499  if(!UID)
500  {
501  ATH_MSG_WARNING("Systematic variation " + systematic.name() + " is not recognized by BaseFakeBkgTool");
502  return "";
503  }
504 
505  if(UID == 0)
506  {
507  return "Total statistical uncertainty in the event yield";
508  }
509  std::string info;
510  auto stat = m_database->findStat(UID);
511  if(stat)
512  {
513  info = "Statistical uncertainty affecting ";
515  }
516  else
517  {
518  auto syst = m_database->findSyst(UID);
519  if(syst)
520  {
521  info = "Systematic uncertainty \"" + syst->name + "\" affecting ";
522  }
523  else
524  {
525  ATH_MSG_ERROR("uncertainty with UID " << std::hex << UID << std::dec << " not found in database");
526  return "";
527  }
528  }
530  return info;
531 }

◆ identifyCpSystematicVariation()

std::pair< uint16_t, float > BaseFakeBkgTool::identifyCpSystematicVariation ( const CP::SystematicVariation systematic) const
privateinherited

Definition at line 388 of file BaseFakeBkgTool.cxx.

389 {
390  if(!m_initialized || !m_database)
391  {
392  ATH_MSG_ERROR("This function can be called only once the tool has been initialized, since the number of systematic variations depends on the configuration...");
393  throw std::logic_error("BaseFakeBkgTool::identifyCpSystematicVariation() called before initialization");
394  }
395  std::smatch smr;
396  auto bn = systematic.basename();
397  if(!std::regex_match(bn, smr, std::regex("FAKEBKG_(STAT|SYST)_VAR(\\d+)"))) return {{0}, 0.f};
398  unsigned index = std::stol(smr[2].str());
399  float sigma = systematic.parameter();
400  if(smr[1].str() == "SYST") return {m_database->systIndexToUID(index), sigma};
401  else return {m_database->statIndexToUID(index), sigma};
402 }

◆ importEfficiencies()

bool BaseFakeBkgTool::importEfficiencies ( bool  resetDB = false)
privateinherited

load the config file(s) storing efficiencies

XML parsing error

ROOT histograms importing error, or unknown error

Definition at line 109 of file BaseFakeBkgTool.cxx.

110 {
111  if(resetDB) m_database->reset();
112  std::string filename;
113  try
114  {
115  for(const auto& fn : m_inputFiles)
116  {
117  filename = fn;
118  auto pos = filename.rfind(".xml");
119  if(pos == filename.length()-4)
120  {
121  m_database->importXML(filename);
122  continue;
123  }
124  pos = filename.rfind(".root");
125  if(pos == filename.length()-5)
126  {
127  m_database->importDefaultROOT(fn);
128  continue;
129  }
130  ATH_MSG_ERROR("File extension not supported for " << filename);
131  return false;
132  }
133  }
134  catch(const Database::XmlError& err)
135  {
136  unsigned line1 = m_database->getXmlLineNumber(err.location.ptr);
137  unsigned line2 = m_database->getXmlLineNumber(err.location.endptr);
138  ATH_MSG_INFO("Exception caught while reading file " << filename << ", details follow");
139  std::string fullmsg = "(while parsing XML, line";
140  if(line2 != line1) fullmsg += "s " + std::to_string(line1) + " - " + std::to_string(line2);
141  else fullmsg += " " + std::to_string(line1);
142  fullmsg += "): " + err.reason;
143  ATH_MSG_ERROR(fullmsg);
144  return false;
145  }
146  catch(const Database::GenericError& err)
147  {
148  ATH_MSG_INFO("Exception caught while reading file " << filename << ", details follow");
149  ATH_MSG_ERROR(err.reason);
150  return false;
151  }
152  return m_database->ready();
153 }

◆ incrementTotalYield()

StatusCode BaseLinearFakeBkgTool::incrementTotalYield ( )
protected

be sure to only call this once per event! (typically at the end of addEvent())

note: we multiply by m_externalWeight which means that it is NOT included in m_eventWeight

Definition at line 104 of file BaseLinearFakeBkgTool.cxx.

105 {
106  FakeBkgTools::Weight eventWeight;
109  m_yields.at(0).add(eventWeight, m_externalWeight);
110  for(auto& kv : m_values_1dhisto_map)
111  {
112  unsigned index = m_histogramYieldsRange.at(kv.first).first + kv.first->FindBin(*kv.second);
113  m_yields.at(index).add(eventWeight, m_externalWeight);
114  }
115  for(auto& kv : m_values_2dhisto_map)
116  {
117  unsigned index = m_histogramYieldsRange.at(kv.first).first + kv.first->FindBin(*kv.second.first, *kv.second.second);
118  m_yields.at(index).add(eventWeight, m_externalWeight);
119  }
120  for(auto& kv : m_values_3dhisto_map)
121  {
122  unsigned index = m_histogramYieldsRange.at(kv.first).first + kv.first->FindBin(*std::get<0>(kv.second), *std::get<1>(kv.second), *std::get<2>(kv.second));
123  m_yields.at(index).add(eventWeight, m_externalWeight);
124  }
125  return StatusCode::SUCCESS;
126 }

◆ initialize()

StatusCode BaseLinearFakeBkgTool::initialize ( )
overridevirtual

Dummy implementation of the initialisation function.

It's here to allow the dual-use tools to skip defining an initialisation function. Since many are doing so...

Reimplemented from CP::BaseFakeBkgTool.

Reimplemented in CP::ApplyFakeFactor, CP::ApplyE2YFakeRate, and CP::AsymptMatrixTool.

Definition at line 41 of file BaseLinearFakeBkgTool.cxx.

42 {
44 }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isAffectedBySystematic()

bool BaseFakeBkgTool::isAffectedBySystematic ( const CP::SystematicVariation systematic) const
overridevirtualinherited

Declare the interface that this class provides.

returns: whether this tool is affected by the given systematics

Implements CP::ISystematicsTool.

Definition at line 404 of file BaseFakeBkgTool.cxx.

405 {
406  return identifyCpSystematicVariation(systematic).first;
407 }

◆ isStatisticalUncertainty()

bool BaseFakeBkgTool::isStatisticalUncertainty ( const CP::SystematicVariation systematic) const
finaloverridevirtualinherited

checks whether the specified source of uncertainty originates from a statistical uncertainty in the efficiencies (as opposed to systematic)

Implements CP::IFakeBkgSystDescriptor.

Definition at line 540 of file BaseFakeBkgTool.cxx.

541 {
542  uint16_t UID = identifyCpSystematicVariation(systematic).first;
543  if(UID) return Database::isStatUID(UID);
544  return false;
545 }

◆ isSystematicUncertainty()

bool BaseFakeBkgTool::isSystematicUncertainty ( const CP::SystematicVariation systematic) const
finaloverridevirtualinherited

checks whether the specified source of uncertainty originates from a systematic uncertainty in the efficiencies (as opposed to statistical)

Implements CP::IFakeBkgSystDescriptor.

Definition at line 533 of file BaseFakeBkgTool.cxx.

534 {
535  uint16_t UID = identifyCpSystematicVariation(systematic).first;
536  if(UID) return Database::isSystUID(UID);
537  return false;
538 }

◆ mergeSubjobs()

StatusCode BaseLinearFakeBkgTool::mergeSubjobs ( )
private

To do: check that the registered histograms are compatible with the saved ones for that, will just need to list the histograms in the directory and call register1/2DHistogram(), where the checks are made.

histogram not registered? don't load the data

Definition at line 229 of file BaseLinearFakeBkgTool.cxx.

230 {
232 
233  auto file = std::unique_ptr<TFile>(TFile::Open(filename.c_str(), "READ"));
234  if(!file)
235  {
236  ATH_MSG_ERROR("Unable to open the file specified for the \"ProgressFileName\" property: " << m_progressFileName);
237  return StatusCode::FAILURE;
238  }
239  std::string path = ::savedYieldsKey;
240  if(m_progressFileDirectory.length())
241  {
243  }
244  auto tree = static_cast<TTree*>(file->Get(path.c_str()));
245  if(!tree)
246  {
247  ATH_MSG_ERROR("Unable to find the tree \"" << path << "\" in the input file " << m_progressFileName);
248  return StatusCode::FAILURE;
249  }
250 
253 
254  std::hash<std::string> hasher;
255  std::map<std::size_t, decltype(m_histogramYieldsRange.cbegin())> dictionary;
256  for(auto itr=m_histogramYieldsRange.cbegin();itr!=m_histogramYieldsRange.cend();++itr)
257  {
258  dictionary[hasher(itr->first->GetName())] = itr;
259  }
260 
261  ULong64_t histname = 0;
262  UInt_t bin=0, n=0;
263  float nominal, stat2Up, stat2Down;
264  const std::size_t maxSize = m_database->numberOfStats() + m_database->numberOfSysts();
265  std::unique_ptr<UShort_t[]> systUID(new UShort_t[maxSize]);
266  std::unique_ptr<float[]> systUp(new float[maxSize]), systDown(new float[maxSize]);
267  tree->SetBranchStatus("*", kTRUE);
268  tree->SetBranchAddress("Name", &histname);
269  tree->SetBranchAddress("Bin", &bin);
270  tree->SetBranchAddress("nominal", &nominal);
271  tree->SetBranchAddress("stat2Up", &stat2Up);
272  tree->SetBranchAddress("stat2Down", &stat2Down);
273  tree->SetBranchAddress("N", &n);
274  TBranch* branch = tree->FindBranch("N");
275  tree->SetBranchAddress("systUID", systUID.get());
276  tree->SetBranchAddress("systUp", systUp.get());
277  tree->SetBranchAddress("systDown", systDown.get());
278 
279  std::set<std::size_t> filledHistograms;
280  const long entries = tree->GetEntries();
281  for(long entry=0;entry<entries;++entry)
282  {
283  branch->GetEntry(entry);
284  if(n > maxSize)
285  {
286  ATH_MSG_ERROR("the tool configuration seems to have changed (number of systematics)!");
287  return StatusCode::FAILURE;
288  }
289  tree->GetEntry(entry);
290 
291  long index;
292  if(histname != 0)
293  {
294  auto itr = dictionary.find(histname);
295  if(itr == dictionary.end()) continue;
296  filledHistograms.emplace(histname);
297  const TH1* h = itr->second->first;
298  const auto& range = itr->second->second;
299  if(bin > (range.second - range.first))
300  {
301  ATH_MSG_ERROR("inconsistent binnings found for histogram " << h->GetName());
302  return StatusCode::FAILURE;
303  }
304  index = range.first + bin;
305  }
306  else
307  {
308  index = 0;
309  }
310 
311  FakeBkgTools::Yield yield;
312  yield.nominal = nominal;
313  yield.stat2.up = stat2Up;
314  yield.stat2.down = stat2Down;
315  for(unsigned j=0;j<n;++j)
316  {
318  u.up = systUp[j];
319  u.down= systDown[j];
320  auto emplaced = yield.uncertainties.emplace(systUID[j], u);
321  if(!emplaced.second) emplaced.first->second += u;
322  }
323  m_yields.at(index).add(yield);
324  }
325 
326  if(filledHistograms.size() != m_histogramYieldsRange.size())
327  {
328  ATH_MSG_ERROR("some of the registered histogram were not found in the input file " << m_progressFileName);
329  return StatusCode::FAILURE;
330  }
331 
332  m_progressFileName.clear();
333  return StatusCode::SUCCESS;
334 }

◆ msg() [1/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msg_level_name()

const std::string & asg::AsgTool::msg_level_name ( ) const
inherited

A deprecated function for getting the message level's name.

Instead of using this, weirdly named function, user code should get the string name of the current minimum message level (in case they really need it...), with:

MSG::name( msg().level() )

This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.

Returns
The string name of the current minimum message level that's printed

Definition at line 101 of file AsgTool.cxx.

101  {
102 
103  return MSG::name( msg().level() );
104  }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ outputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ print() [1/2]

void asg::AsgTool::print ( ) const
virtualinherited

◆ print() [2/2]

virtual void asg::IAsgTool::print ( ) const
pure virtualinherited

◆ printUncertaintyDescription()

void BaseFakeBkgTool::printUncertaintyDescription ( const CP::SystematicVariation systematic) const
finaloverridevirtualinherited

prints a human-readable description of the source of systematic uncertainty specified as argument

Implements CP::IFakeBkgSystDescriptor.

Definition at line 484 of file BaseFakeBkgTool.cxx.

485 {
486  auto info = getUncertaintyDescription(systematic);
487  if(info.length()) ATH_MSG_INFO(info);
488 }

◆ recommendedSystematics()

CP::SystematicSet BaseFakeBkgTool::recommendedSystematics ( ) const
overridevirtualinherited

the list of all systematics this tool recommends to use

Implements CP::IReentrantSystematicsTool.

Definition at line 431 of file BaseFakeBkgTool.cxx.

432 {
433  return affectingSystematics();
434 }

◆ register1DHistogram()

StatusCode BaseLinearFakeBkgTool::register1DHistogram ( TH1 h1,
const float *  val 
)
overridevirtual

associates a 1D histogram to the tool, to obtain a binned estimate of the fake lepton background the 'val' argument points to a variable corresponding to the X axis of the histogram and that needs to be updated before each call to addEvent() undefined behaviour if the pointers are invalidated during the tool's lifetime

Reimplemented from CP::BaseFakeBkgTool.

Definition at line 128 of file BaseLinearFakeBkgTool.cxx.

129 {
131  if(sc != StatusCode::SUCCESS) return sc;
132  return assignYieldRange(h1);
133 }

◆ register2DHistogram()

StatusCode BaseLinearFakeBkgTool::register2DHistogram ( TH2 h2,
const float *  xval,
const float *  yval 
)
overridevirtual

associates a 2D histogram to the tool, to obtain a binned estimate of the fake lepton background the 'xval' / 'yval' arguments point to variables corresponding to the X/Y axis of the histogram and that need to be updated before each call to addEvent() undefined behaviour if the pointers are invalidated during the tool's lifetime

Reimplemented from CP::BaseFakeBkgTool.

Definition at line 135 of file BaseLinearFakeBkgTool.cxx.

136 {
138  if(sc != StatusCode::SUCCESS) return sc;
139  return assignYieldRange(h2);
140 }

◆ register3DHistogram()

StatusCode BaseLinearFakeBkgTool::register3DHistogram ( TH3 h3,
const float *  xval,
const float *  yval,
const float *  zval 
)
overridevirtual

associates a 3D histogram to the tool, to obtain a binned estimate of the fake lepton background

the 'xval' / 'yval' / 'zval' arguments point to variables corresponding to the X/Y/Z axis of the histogram and that need to be updated before each call to addEvent() undefined behaviour if the pointers are invalidated during the tool's lifetime

Reimplemented from CP::BaseFakeBkgTool.

Definition at line 142 of file BaseLinearFakeBkgTool.cxx.

143 {
145  if(sc != StatusCode::SUCCESS) return sc;
146  return assignYieldRange(h3);
147 }

◆ renounce()

std::enable_if_t<std::is_void_v<std::result_of_t<decltype(&T::renounce)(T)> > && !std::is_base_of_v<SG::VarHandleKeyArray, T> && std::is_base_of_v<Gaudi::DataHandle, T>, void> AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T &  h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381  {
382  h.renounce();
383  PBASE::renounce (h);
384  }

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ saveProgress()

StatusCode BaseLinearFakeBkgTool::saveProgress ( TDirectory *  dir)
overridevirtual

Implements CP::IFakeBkgTool.

Definition at line 168 of file BaseLinearFakeBkgTool.cxx.

169 {
170  TTree tree(::savedYieldsKey, "binned yields saved by BaseLinearFakeBkgTool");
171  TObjArray histograms;
172 
173  ULong64_t histname = 0;
174  UInt_t bin=0, n=0;
175  float nominal, stat2Up, stat2Down;
176  const std::size_t maxSize = m_database->numberOfStats() + m_database->numberOfSysts();
177  std::unique_ptr<UShort_t[]> systUID(new UShort_t[maxSize]);
178  std::unique_ptr<float[]> systUp(new float[maxSize]), systDown(new float[maxSize]);
179  tree.Branch("Name", &histname, "Name/l");
180  tree.Branch("Bin", &bin, "Bin/i");
181  tree.Branch("nominal", &nominal, "nominal/F");
182  tree.Branch("stat2Up", &stat2Up, "stat2Up/F");
183  tree.Branch("stat2Down", &stat2Down, "stat2Down/F");
184  tree.Branch("N", &n, "N/i");
185  tree.Branch("systUID", systUID.get(), "systUID[N]/s");
186  tree.Branch("systUp", systUp.get(), "systUp[N]/F");
187  tree.Branch("systDown", systDown.get(), "systDown[N]/F");
188 
189  auto fillTree = [&](const auto& yield)
190  {
191  nominal = yield.nominal;
192  stat2Up = yield.stat2.up;
193  stat2Down = yield.stat2.down;
194  n = yield.uncertainties.size();
195  auto itr = yield.uncertainties.begin();
196  for(uint32_t j=0;j<n;++j)
197  {
198  systUID[j] = itr->first;
199  systUp[j] = itr->second.up;
200  systDown[j] = itr->second.down;
201  ++itr;
202  }
203  tree.Fill();
204  };
205 
206  fillTree(m_yields.at(0));
207 
208  std::hash<std::string> hasher;
209  for(auto& kv : m_histogramYieldsRange)
210  {
211  histograms.AddLast(kv.first);
212  histname = hasher(kv.first->GetName());
213  for(uint32_t i=kv.second.first;i<=kv.second.second;++i)
214  {
215  bin = i - kv.second.first;
216  fillTree(m_yields.at(i));
217  }
218  }
219 
220  dir->cd();
221  tree.Write();
222  dir->mkdir(::savedHistogramsKey);
223  dir->cd(::savedHistogramsKey);
224  histograms.Write();
225  dir->cd("..");
226  return StatusCode::SUCCESS;
227 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase &  )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308  {
309  // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310  // << " size: " << m_vhka.size() << endmsg;
311  for (auto &a : m_vhka) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_cachedFinalStates

std::set<FakeBkgTools::FinalState> CP::BaseFakeBkgTool::m_cachedFinalStates
protectedinherited

Definition at line 99 of file BaseFakeBkgTool.h.

◆ m_cachedWeights

std::map<FakeBkgTools::FinalState, FakeBkgTools::Weight> CP::BaseLinearFakeBkgTool::m_cachedWeights
protected

cached weight+uncertainties for a single event Each tool derived from this base class MUST clear the map in addEventCustom()!

Definition at line 72 of file BaseLinearFakeBkgTool.h.

◆ m_convertWhenMissing

bool CP::BaseFakeBkgTool::m_convertWhenMissing = false
protectedinherited

Definition at line 80 of file BaseFakeBkgTool.h.

◆ m_database

std::unique_ptr<FakeBkgTools::Database> CP::BaseFakeBkgTool::m_database
protectedinherited

Definition at line 91 of file BaseFakeBkgTool.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_energyUnit

std::string CP::BaseFakeBkgTool::m_energyUnit
protectedinherited

property EnergyUnit user can choose between MeV or GeV to indicate the unit of the pT parametrization of efficiencies in the input files

Definition at line 122 of file BaseFakeBkgTool.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_externalWeight

float CP::BaseFakeBkgTool::m_externalWeight
protectedinherited

Definition at line 95 of file BaseFakeBkgTool.h.

◆ m_hasher

std::hash<std::string> CP::BaseFakeBkgTool::m_hasher
protectedinherited

comes from Event passed to addEvent()

Definition at line 97 of file BaseFakeBkgTool.h.

◆ m_histogramYieldsRange

std::map<TH1*, std::pair<uint32_t, uint32_t> > CP::BaseLinearFakeBkgTool::m_histogramYieldsRange
protected

Definition at line 78 of file BaseLinearFakeBkgTool.h.

◆ m_initialized

bool CP::BaseFakeBkgTool::m_initialized = false
protectedinherited

Definition at line 78 of file BaseFakeBkgTool.h.

◆ m_inputFiles

std::vector<std::string> CP::BaseFakeBkgTool::m_inputFiles
protectedinherited

property InputFiles

Definition at line 127 of file BaseFakeBkgTool.h.

◆ m_lockedSystematicVariations

bool CP::BaseFakeBkgTool::m_lockedSystematicVariations = false
protectedinherited

when m_unlimitedSystematicVariations=false, keeps track of prior calls to applySystematicVariation() / addEvent()

Definition at line 173 of file BaseFakeBkgTool.h.

◆ m_needEventInfo

bool CP::BaseFakeBkgTool::m_needEventInfo = true
protectedinherited

Definition at line 79 of file BaseFakeBkgTool.h.

◆ m_particles

std::vector<FakeBkgTools::ParticleData> CP::BaseFakeBkgTool::m_particles
protectedinherited

Definition at line 85 of file BaseFakeBkgTool.h.

◆ m_process

std::string CP::BaseFakeBkgTool::m_process = defaultProcess()
protectedinherited

'process' settings used to compute the total yield / fill histograms

Definition at line 118 of file BaseFakeBkgTool.h.

◆ m_progressFileDirectory

std::string CP::BaseFakeBkgTool::m_progressFileDirectory
protectedinherited

property ProgressFileDirectory

Definition at line 139 of file BaseFakeBkgTool.h.

◆ m_progressFileName

std::string CP::BaseFakeBkgTool::m_progressFileName
protectedinherited

property ProgressFileName

Definition at line 136 of file BaseFakeBkgTool.h.

◆ m_selectedUncertainties

UncertaintyList* CP::BaseFakeBkgTool::m_selectedUncertainties = nullptr
protectedinherited

Pointer to a value of the 'm_systSetDict' map it must be invalidated each time the map is updated in principle only applySystematicVariation() needs to do that.


Definition at line 161 of file BaseFakeBkgTool.h.

◆ m_selection

std::string CP::BaseFakeBkgTool::m_selection = defaultSelection()
protectedinherited

'selection' settings used to compute the total yield / fill histograms

Definition at line 115 of file BaseFakeBkgTool.h.

◆ m_systSetDict

std::unordered_map<CP::SystematicSet, UncertaintyList> CP::BaseFakeBkgTool::m_systSetDict
protectedinherited

List of uncertainties in internal format, associated with a particular SystematicSet the m_selectedUncertainties pointer must be invalidated each time this map is updated in principle only applySystematicVariation() needs to do that.


Definition at line 166 of file BaseFakeBkgTool.h.

◆ m_tightAccessor

CP::ISelectionReadAccessor* CP::BaseFakeBkgTool::m_tightAccessor = nullptr
protectedinherited

this can't be a unique_ptr as this can cause issues with the dictionary in some particular circumstances

Definition at line 133 of file BaseFakeBkgTool.h.

◆ m_tightDecoNameAndType

std::string CP::BaseFakeBkgTool::m_tightDecoNameAndType
protectedinherited

property TightDecoration

Definition at line 130 of file BaseFakeBkgTool.h.

◆ m_unlimitedSystematicVariations

bool CP::BaseFakeBkgTool::m_unlimitedSystematicVariations = true
protectedinherited

used to prevent multiple calls to applySystematicVariation() when unsupported set to true in a particular tool's constructor to disable the possibility of calling applySystematicVariation() more than once / after the first call to addEvent()

Definition at line 170 of file BaseFakeBkgTool.h.

◆ m_useDB

bool CP::BaseFakeBkgTool::m_useDB = true
protectedinherited

Definition at line 124 of file BaseFakeBkgTool.h.

◆ m_values_1dhisto_map

std::map<TH1*, const float*> CP::BaseFakeBkgTool::m_values_1dhisto_map
protectedinherited

Definition at line 108 of file BaseFakeBkgTool.h.

◆ m_values_2dhisto_map

std::map<TH2*, std::pair<const float*, const float*> > CP::BaseFakeBkgTool::m_values_2dhisto_map
protectedinherited

Definition at line 109 of file BaseFakeBkgTool.h.

◆ m_values_3dhisto_map

std::map<TH3*, std::tuple<const float*, const float*, const float*> > CP::BaseFakeBkgTool::m_values_3dhisto_map
protectedinherited

Definition at line 110 of file BaseFakeBkgTool.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.

◆ m_yields

std::vector<FakeBkgTools::Yield> CP::BaseLinearFakeBkgTool::m_yields
protected

accumulated yield for all events (and histogram bins with uncertainties)

Definition at line 68 of file BaseLinearFakeBkgTool.h.


The documentation for this class was generated from the following files:
grepfile.info
info
Definition: grepfile.py:38
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
CP::BaseFakeBkgTool::register1DHistogram
virtual StatusCode register1DHistogram(TH1 *h1, const float *val) override
associates a 1D histogram to the tool, to obtain a binned estimate of the fake lepton background the ...
Definition: BaseFakeBkgTool.cxx:240
NONE
@ NONE
Definition: sTGCenumeration.h:13
python.changerun.bn
bn
Definition: changerun.py:79
CP::BaseFakeBkgTool::getUncertaintyDescription
virtual std::string getUncertaintyDescription(const CP::SystematicVariation &systematic) const override final
returns a human-readable description of the source of systematic uncertainty specified as argument
Definition: BaseFakeBkgTool.cxx:490
beamspotnt.var
var
Definition: bin/beamspotnt.py:1394
CP::BaseFakeBkgTool::getCachedFinalState
FakeBkgTools::FinalState getCachedFinalState(uint8_t nparticles, const std::string &strPID, const std::string &strProc, bool &success)
Definition: BaseFakeBkgTool.cxx:219
FakeBkgTools::Uncertainty
Definition: FakeBkgInternals.h:27
FakeBkgTools::Uncertainty::down
float down
Definition: FakeBkgInternals.h:28
python.CaloRecoConfig.f
f
Definition: CaloRecoConfig.py:127
pdg_comparison.sigma
sigma
Definition: pdg_comparison.py:324
xAOD::Electron
Electron_v1 Electron
Definition of the current "egamma version".
Definition: Event/xAOD/xAODEgamma/xAODEgamma/Electron.h:17
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
athena.path
path
python interpreter configuration --------------------------------------—
Definition: athena.py:126
max
#define max(a, b)
Definition: cfImp.cxx:41
covarianceTool.histograms
dictionary histograms
Definition: covarianceTool.py:53
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
CP::BaseFakeBkgTool::m_inputFiles
std::vector< std::string > m_inputFiles
property InputFiles
Definition: BaseFakeBkgTool.h:127
CP::SystematicVariation::basename
std::string basename() const
description: the base name, i.e.
Definition: SystematicVariation.cxx:312
CP::BaseFakeBkgTool::m_useDB
bool m_useDB
Definition: BaseFakeBkgTool.h:124
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
CP::BaseFakeBkgTool::identifyCpSystematicVariation
std::pair< uint16_t, float > identifyCpSystematicVariation(const CP::SystematicVariation &systematic) const
Definition: BaseFakeBkgTool.cxx:388
CP::SystematicSet::size
size_t size() const
returns: size of the set
Definition: SystematicSet.h:71
LArG4FSStartPointFilterLegacy.line1
line1
Definition: LArG4FSStartPointFilterLegacy.py:58
index
Definition: index.py:1
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
hist_file_dump.d
d
Definition: hist_file_dump.py:137
FakeBkgTools::Database::GenericError
This propagates an error message.
Definition: Database.h:136
tree
TChain * tree
Definition: tile_monitor.h:30
CP::SystematicVariation::name
const std::string & name() const
description: the full systematics name, for use in strings, etc.
Definition: SystematicVariation.cxx:303
CP::BaseFakeBkgTool::m_lockedSystematicVariations
bool m_lockedSystematicVariations
when m_unlimitedSystematicVariations=false, keeps track of prior calls to applySystematicVariation() ...
Definition: BaseFakeBkgTool.h:173
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
bin
Definition: BinsDiffFromStripMedian.h:43
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
CP::BaseFakeBkgTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: BaseFakeBkgTool.cxx:63
CP::BaseFakeBkgTool::m_database
std::unique_ptr< FakeBkgTools::Database > m_database
Definition: BaseFakeBkgTool.h:91
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
CP::SystematicVariation
Definition: SystematicVariation.h:47
PlotPulseshapeFromCool.np
np
Definition: PlotPulseshapeFromCool.py:64
read_hist_ntuple.h1
h1
Definition: read_hist_ntuple.py:21
x
#define x
CP::BaseLinearFakeBkgTool::m_histogramYieldsRange
std::map< TH1 *, std::pair< uint32_t, uint32_t > > m_histogramYieldsRange
Definition: BaseLinearFakeBkgTool.h:78
SUSY_SimplifiedModel_PostInclude.process
string process
Definition: SUSY_SimplifiedModel_PostInclude.py:42
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:83
xAOD::Muon_v1
Class describing a Muon.
Definition: Muon_v1.h:38
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
CP::BaseFakeBkgTool::BaseFakeBkgTool
BaseFakeBkgTool(const std::string &toolname)
Definition: BaseFakeBkgTool.cxx:29
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:200
PrepareReferenceFile.regex
regex
Definition: PrepareReferenceFile.py:43
fillTree
void fillTree(AccumulateMap &map, TTree *tree, int nLayers, int nCoords)
Writes the contents of an AccumulateMap into the supplied tree (one entry per sector).
Definition: FPGATrackSimMatrixIO.cxx:225
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
CP::BaseFakeBkgTool::register3DHistogram
virtual StatusCode register3DHistogram(TH3 *h3, const float *xval, const float *yval, const float *zval) override
associates a 3D histogram to the tool, to obtain a binned estimate of the fake lepton background
Definition: BaseFakeBkgTool.cxx:300
CP::BaseLinearFakeBkgTool::mergeSubjobs
StatusCode mergeSubjobs()
Definition: BaseLinearFakeBkgTool.cxx:229
CP::BaseFakeBkgTool::m_cachedFinalStates
std::set< FakeBkgTools::FinalState > m_cachedFinalStates
Definition: BaseFakeBkgTool.h:99
python.getCurrentFolderTag.fn
fn
Definition: getCurrentFolderTag.py:65
AthCommonDataStore
Definition: AthCommonDataStore.h:52
CP::BaseFakeBkgTool::UncertaintyList::extraVariation
void extraVariation(uint16_t extra_UID, float extra_sigma)
Definition: BaseFakeBkgTool.h:148
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
PixelAthClusterMonAlgCfg.histname
histname
Definition: PixelAthClusterMonAlgCfg.py:106
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
dqt_zlumi_pandas.err
err
Definition: dqt_zlumi_pandas.py:193
Monitored::detail::getAxis
constexpr auto getAxis(H *hist)
Helper to get corresponding TAxis selected by Monitored::Axis.
Definition: HistogramFillerUtils.h:40
lumiFormat.i
int i
Definition: lumiFormat.py:92
CP::BaseFakeBkgTool::m_initialized
bool m_initialized
Definition: BaseFakeBkgTool.h:78
h
beamspotman.n
n
Definition: beamspotman.py:731
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
xAOD::TauJet_v3
Class describing a tau jet.
Definition: TauJet_v3.h:41
CP::BaseFakeBkgTool::m_progressFileDirectory
std::string m_progressFileDirectory
property ProgressFileDirectory
Definition: BaseFakeBkgTool.h:139
top::nominal
@ nominal
Definition: ScaleFactorRetriever.h:29
FakeBkgTools::Database::XmlError
This propagates an error message + the reference to the faulty piece of XML when an exception is rais...
Definition: Database.h:124
CalibCoolCompareRT.up
up
Definition: CalibCoolCompareRT.py:109
CP::BaseFakeBkgTool::m_systSetDict
std::unordered_map< CP::SystematicSet, UncertaintyList > m_systSetDict
List of uncertainties in internal format, associated with a particular SystematicSet the m_selectedUn...
Definition: BaseFakeBkgTool.h:166
CP::BaseLinearFakeBkgTool::assignYieldRange
StatusCode assignYieldRange(TH1 *h)
Definition: BaseLinearFakeBkgTool.cxx:149
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
file
TFile * file
Definition: tile_monitor.h:29
plotting.yearwise_efficiency.yval
float yval
Definition: yearwise_efficiency.py:43
CP::BaseFakeBkgTool::m_hasher
std::hash< std::string > m_hasher
comes from Event passed to addEvent()
Definition: BaseFakeBkgTool.h:97
python.xAODType.dummy
dummy
Definition: xAODType.py:4
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
MSG::name
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition: MsgLevel.cxx:19
CP::BaseFakeBkgTool::m_process
std::string m_process
'process' settings used to compute the total yield / fill histograms
Definition: BaseFakeBkgTool.h:118
CP::BaseFakeBkgTool::register2DHistogram
virtual StatusCode register2DHistogram(TH2 *h2, const float *xval, const float *yval) override
associates a 2D histogram to the tool, to obtain a binned estimate of the fake lepton background the ...
Definition: BaseFakeBkgTool.cxx:270
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
CP::BaseFakeBkgTool::m_unlimitedSystematicVariations
bool m_unlimitedSystematicVariations
used to prevent multiple calls to applySystematicVariation() when unsupported set to true in a partic...
Definition: BaseFakeBkgTool.h:170
plotting.yearwise_efficiency.xval
float xval
Definition: yearwise_efficiency.py:42
selection
std::string selection
Definition: fbtTestBasics.cxx:73
imax
int imax(int i, int j)
Definition: TileLaserTimingTool.cxx:33
beamspotman.stat
stat
Definition: beamspotman.py:266
CP::BaseFakeBkgTool::m_values_1dhisto_map
std::map< TH1 *, const float * > m_values_1dhisto_map
Definition: BaseFakeBkgTool.h:108
CP::BaseFakeBkgTool::getListOfEfficienciesAffectedBy
std::string getListOfEfficienciesAffectedBy(uint16_t uid) const
Definition: BaseFakeBkgTool.cxx:356
beamspotman.dir
string dir
Definition: beamspotman.py:623
min
#define min(a, b)
Definition: cfImp.cxx:40
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
master.dictionary
dictionary
Definition: master.py:47
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
CP::BaseFakeBkgTool::m_needEventInfo
bool m_needEventInfo
Definition: BaseFakeBkgTool.h:79
CP::SystematicSet::insert
void insert(const SystematicVariation &systematic)
description: insert a systematic into the set
Definition: SystematicSet.cxx:88
python.hypoToolDisplay.toolname
def toolname(tool)
Definition: hypoToolDisplay.py:13
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
CP::BaseFakeBkgTool::m_tightAccessor
CP::ISelectionReadAccessor * m_tightAccessor
this can't be a unique_ptr as this can cause issues with the dictionary in some particular circumstan...
Definition: BaseFakeBkgTool.h:133
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
plotBeamSpotVxVal.bin
int bin
Definition: plotBeamSpotVxVal.py:83
charge
double charge(const T &p)
Definition: AtlasPID.h:494
FakeBkgTools::maxParticles
constexpr uint8_t maxParticles()
Definition: FakeBkgInternals.h:93
CP::ISelectionReadAccessor::getBool
virtual bool getBool(const SG::AuxElement &element, const CP::SystematicSet *sys=nullptr) const =0
get the selection decoration
CP::BaseFakeBkgTool::m_externalWeight
float m_externalWeight
Definition: BaseFakeBkgTool.h:95
FakeBkgTools::Weight
a structure to hold a weight together with a variable number of systematic uncertainties
Definition: FakeBkgInternals.h:62
CP::BaseFakeBkgTool::m_particles
std::vector< FakeBkgTools::ParticleData > m_particles
Definition: BaseFakeBkgTool.h:85
xAOD::Electron_v1
Definition: Electron_v1.h:34
CP::BaseFakeBkgTool::m_selectedUncertainties
UncertaintyList * m_selectedUncertainties
Pointer to a value of the 'm_systSetDict' map it must be invalidated each time the map is updated in ...
Definition: BaseFakeBkgTool.h:161
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
xAOD::Photon
Photon_v1 Photon
Definition of the current "egamma version".
Definition: Event/xAOD/xAODEgamma/xAODEgamma/Photon.h:17
Muon
struct TBPatternUnitContext Muon
CP::BaseFakeBkgTool::addEventCustom
virtual StatusCode addEventCustom()=0
FakeBkgTools::Efficiency::nominal
float nominal
Definition: FakeBkgInternals.h:42
FakeBkgTools::FinalState
Definition: FakeBkgInternals.h:98
FakeBkgTools::Uncertainty::up
float up
Definition: FakeBkgInternals.h:28
FakeBkgTools::Yield
a structure to hold an event yield together with a statistical uncertainty and a variable number of s...
Definition: FakeBkgInternals.h:70
PathResolverFindDataFile
std::string PathResolverFindDataFile(const std::string &logical_file_name)
Definition: PathResolver.cxx:379
RTTAlgmain.branch
branch
Definition: RTTAlgmain.py:61
DeMoScan.index
string index
Definition: DeMoScan.py:362
a
TList * a
Definition: liststreamerinfos.cxx:10
y
#define y
h
Base_Fragment.width
width
Definition: Sherpa_i/share/common/Base_Fragment.py:59
python.CaloScaleNoiseConfig.str
str
Definition: CaloScaleNoiseConfig.py:78
CP::BaseLinearFakeBkgTool::getEventWeightCommon
StatusCode getEventWeightCommon(FakeBkgTools::Weight &weight, const std::string &selection, const std::string &process)
Definition: BaseLinearFakeBkgTool.cxx:54
CP::BaseLinearFakeBkgTool::getEventWeightCustom
virtual StatusCode getEventWeightCustom(FakeBkgTools::Weight &weight, const FakeBkgTools::FinalState &fs)=0
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
FakeBkgTools::Yield::stat2
Uncertainty stat2
Definition: FakeBkgInternals.h:71
CP::BaseFakeBkgTool::affectingSystematics
virtual CP::SystematicSet affectingSystematics() const override
the list of all systematics this tool can be affected by
Definition: BaseFakeBkgTool.cxx:409
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
Herwig7_QED_EvtGen_ll.fs
dictionary fs
Definition: Herwig7_QED_EvtGen_ll.py:17
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:616
entries
double entries
Definition: listroot.cxx:49
CP::BaseFakeBkgTool::m_selection
std::string m_selection
'selection' settings used to compute the total yield / fill histograms
Definition: BaseFakeBkgTool.h:115
LArCellBinning.step
step
Definition: LArCellBinning.py:158
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
xAODType::Tau
@ Tau
The object is a tau (jet)
Definition: ObjectType.h:49
LArG4FSStartPointFilterLegacy.line2
line2
Definition: LArG4FSStartPointFilterLegacy.py:59
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
CP::BaseFakeBkgTool::m_values_2dhisto_map
std::map< TH2 *, std::pair< const float *, const float * > > m_values_2dhisto_map
Definition: BaseFakeBkgTool.h:109
CP::BaseLinearFakeBkgTool::m_yields
std::vector< FakeBkgTools::Yield > m_yields
accumulated yield for all events (and histogram bins with uncertainties)
Definition: BaseLinearFakeBkgTool.h:68
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
get_generator_info.error
error
Definition: get_generator_info.py:40
SG::DataProxy
Definition: DataProxy.h:44
error
Definition: IImpactPoint3dEstimator.h:70
CP::BaseFakeBkgTool::m_values_3dhisto_map
std::map< TH3 *, std::tuple< const float *, const float *, const float * > > m_values_3dhisto_map
Definition: BaseFakeBkgTool.h:110
CP::BaseFakeBkgTool::m_progressFileName
std::string m_progressFileName
property ProgressFileName
Definition: BaseFakeBkgTool.h:136
CP::BaseLinearFakeBkgTool::m_cachedWeights
std::map< FakeBkgTools::FinalState, FakeBkgTools::Weight > m_cachedWeights
cached weight+uncertainties for a single event Each tool derived from this base class MUST clear the ...
Definition: BaseLinearFakeBkgTool.h:72
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
CP::SystematicSet::filterForAffectingSystematics
static StatusCode filterForAffectingSystematics(const SystematicSet &systConfig, const SystematicSet &affectingSystematics, SystematicSet &filteredSystematics)
description: filter the systematics for the affected systematics returns: success guarantee: strong f...
Definition: SystematicSet.cxx:213
FakeBkgTools::Efficiency::uncertainties
std::map< uint16_t, FakeBkgTools::Uncertainty > uncertainties
Definition: FakeBkgInternals.h:43
fitman.k
k
Definition: fitman.py:528
CP::SystematicVariation::parameter
float parameter() const
description: the numeric parameter contained in the subvariation(), or 0 if the subvariation can't be...
Definition: SystematicVariation.cxx:340