ATLAS Offline Software
Loading...
Searching...
No Matches
CP::BaseFakeBkgTool Class Referenceabstract

#include <BaseFakeBkgTool.h>

Inheritance diagram for CP::BaseFakeBkgTool:

Classes

struct  UncertaintyList
 List of systematic variations (UID + sigma) to be considered This is implemented as a basic linked list, since unless in very rare cases it should only contain a single entry. More...

Public Member Functions

 BaseFakeBkgTool (const std::string &toolname)
virtual ~BaseFakeBkgTool ()
virtual StatusCode initialize () override
 Dummy implementation of the initialisation function.
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)
virtual StatusCode addEvent (const ConstDataVector< 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)
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
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
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 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
virtual bool isAffectedBySystematic (const CP::SystematicVariation &systematic) const override
 Declare the interface that this class provides.
virtual CP::SystematicSet affectingSystematics () const override
 the list of all systematics this tool can be affected by
virtual CP::SystematicSet recommendedSystematics () const override
 the list of all systematics this tool recommends to use
virtual StatusCode applySystematicVariation (const CP::SystematicSet &systConfig) override
 effects: configure this tool for the given list of systematic variations.
virtual CP::SystematicSet affectingSystematicsFor (const std::string &nuisanceParameter) const override
 These functions are slow, don't use them in the tools implementations.
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
virtual void printUncertaintyDescription (const CP::SystematicVariation &systematic) const override final
 prints a human-readable description of the source of systematic uncertainty specified as argument
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)
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)
virtual bool affectsElectrons (const CP::SystematicVariation &systematic) const override final
 checks whether the specified source of uncertainty affects electrons
virtual bool affectsMuons (const CP::SystematicVariation &systematic) const override final
 checks whether the specified source of uncertainty affects muons
virtual bool affectsTaus (const CP::SystematicVariation &systematic) const override final
 checks whether the specified source of uncertainty affects taus
virtual bool affectsRealEfficiencies (const CP::SystematicVariation &systematic) const override final
 checks whether the specified source of uncertainty affects real efficiencies
virtual bool affectsFakeEfficiencies (const CP::SystematicVariation &systematic) const override final
 checks whether the specified source of uncertainty affects fake efficiencies
virtual bool affectsFakeFactors (const CP::SystematicVariation &systematic) const override final
 checks whether the specified source of uncertainty affects fake factors
virtual const IFakeBkgSystDescriptor & getSystDescriptor () const override
 retrieves an interface to various helper methods to identify what the different SystematicVariations correspond to
virtual StatusCode getTotalYield (float &yield, float &statErrorUp, float &statErrorDown)=0
 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.
virtual StatusCode saveProgress (TDirectory *dir)=0
virtual void print () const
 Print the state of the tool.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
Additional helper functions, not directly mimicking Athena
template<class T>
const T * getProperty (const std::string &name) const
 Get one of the tool's properties.
const std::string & msg_level_name () const __attribute__((deprecated))
 A deprecated function for getting the message level's name.
const std::string & getName (const void *ptr) const
 Get the name of an object that is / should be in the event store.
SG::sgkey_t getKey (const void *ptr) const
 Get the (hashed) key of an object that is in the event store.

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.
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.

Protected Member Functions

virtual FakeBkgTools::Client clientForDB ()=0
 This indicates which type of efficiencies/fake factor need to be filled.
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
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.

Protected Attributes

bool m_initialized = false
bool m_needEventInfo = true
bool m_convertWhenMissing = false
std::vector< FakeBkgTools::ParticleData > m_particles
std::unique_ptr< FakeBkgTools::Database > m_database
float m_externalWeight {}
std::hash< std::string > m_hasher
 comes from Event passed to addEvent()
std::set< FakeBkgTools::FinalState > m_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
std::string m_process = defaultProcess()
 'process' settings used to compute the total yield / fill histograms
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
bool m_useDB = true
std::vector< std::string > m_inputFiles
 property InputFiles
std::string m_tightDecoNameAndType
 property TightDecoration
CP::ISelectionReadAccessor * m_tightAccessor = nullptr
 this can't be a unique_ptr as this can cause issues with the dictionary in some particular circumstances
std::string m_progressFileName
 property ProgressFileName
std::string m_progressFileDirectory
 property ProgressFileDirectory
UncertaintyList * m_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.
std::unordered_map< CP::SystematicSet, UncertaintyList > m_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.
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()
bool m_lockedSystematicVariations = false
 when m_unlimitedSystematicVariations=false, keeps track of prior calls to applySystematicVariation() / addEvent()
SG::ConstAccessor< float > m_accRealEff
SG::ConstAccessor< float > m_accFakeEff
 only used when m_useDB is false

Private Types

typedef ServiceHandle< StoreGateSvc > StoreGateSvc_t

Private Member Functions

template<class C>
StatusCode addEventImpl (const C &iparticles, float mcWeight)
 only used when m_useDB is false
bool importEfficiencies (bool resetDB=false)
 load the config file(s) storing efficiencies
std::pair< uint16_t, float > identifyCpSystematicVariation (const CP::SystematicVariation &systematic) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

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

Friends

struct FakeBkgTools::Efficiency

Detailed Description

Definition at line 40 of file BaseFakeBkgTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 376 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ BaseFakeBkgTool()

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

Definition at line 23 of file BaseFakeBkgTool.cxx.

23 :
24 AsgTool(toolname),
25 m_initialized(false),
26 m_database(nullptr),
27 m_energyUnit("MeV"),
28 m_tightDecoNameAndType("Tight,as_char"),
29 m_progressFileName("none"),
31 m_accRealEff("real_eff"),
32 m_accFakeEff("fake_eff")
33{
34 declareProperty("InputFiles",
36 "list of XML/ROOT files storing the efficiencies [default = {}]. If left empty, the tool "
37 "assumes that efficiencies are provided by the user as decorations (xAOD) or class "
38 "members (standalone) of the lepton objects");
39 declareProperty("Selection",
41 "Selection used to increment total yield / fill histograms [default = \""
42 + m_selection +"\"]");
43 declareProperty("Process",
45 "Process used to increment total yield / fill histograms [default = \""
46 + m_process +"\"]");
47 declareProperty("EnergyUnit",
49 "MeV or GeV -- keep consistent between the input (IParticle decorations/members) "
50 "and the configuration files! [default = \"MeV\"]");
51 declareProperty("ConvertWhenMissing",
53 "set to 'true' to compute fake factors from fake efficiencies if only the latter "
54 "are provided in the config files (and vice-versa) [default = false]");
55 declareProperty("TightDecoration",
57 "Name (and type) of the decoration used to indicate whether leptons pass the 'tight' "
58 "requirements or not [default = \"Tight,as_char\"]");
59 declareProperty("ProgressFileName",
61 "Name of ntuple file with results from a subset of the data");
62 declareProperty("ProgressFileDirectory",
64 "complementary to ProgressFileName, specifies the directory inside the file where the "
65 "results are stored [default = \"\"]");
66}
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
std::string m_progressFileName
property ProgressFileName
std::string m_progressFileDirectory
property ProgressFileDirectory
SG::ConstAccessor< float > m_accRealEff
std::string m_selection
'selection' settings used to compute the total yield / fill histograms
std::unique_ptr< FakeBkgTools::Database > m_database
std::vector< std::string > m_inputFiles
property InputFiles
std::string m_tightDecoNameAndType
property TightDecoration
std::string m_process
'process' settings used to compute the total yield / fill histograms
std::string m_energyUnit
property EnergyUnit user can choose between MeV or GeV to indicate the unit of the pT parametrization...
SG::ConstAccessor< float > m_accFakeEff
only used when m_useDB is false
static constexpr const char * defaultSelection()
default value taken by the 'selection' argument of several methods or properties It indicates how the...
static constexpr const char * defaultProcess()
default value taken by the 'process' argument of several methods or properties It indicates what shou...
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition AsgTool.cxx:58

◆ ~BaseFakeBkgTool()

BaseFakeBkgTool::~BaseFakeBkgTool ( )
virtual

Definition at line 68 of file BaseFakeBkgTool.cxx.

69{
70 delete m_tightAccessor;
71}
CP::ISelectionReadAccessor * m_tightAccessor
this can't be a unique_ptr as this can cause issues with the dictionary in some particular circumstan...

Member Function Documentation

◆ addEvent() [1/2]

StatusCode BaseFakeBkgTool::addEvent ( const ConstDataVector< xAOD::IParticleContainer > & particles,
float extraWeight = 1.f )
finaloverridevirtual

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)

Implements CP::IFakeBkgTool.

Definition at line 241 of file BaseFakeBkgTool.cxx.

242{
243 return addEventImpl(iparticles, mcWeight);
244}
StatusCode addEventImpl(const C &iparticles, float mcWeight)
only used when m_useDB is false

◆ addEvent() [2/2]

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

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)

Implements CP::IFakeBkgTool.

Definition at line 236 of file BaseFakeBkgTool.cxx.

237{
238 return addEventImpl(iparticles, mcWeight);
239}

◆ addEventCustom()

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

◆ addEventImpl()

template<class C>
StatusCode BaseFakeBkgTool::addEventImpl ( const C & iparticles,
float mcWeight )
private

only used when m_useDB is false

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

Definition at line 172 of file BaseFakeBkgTool.cxx.

173{
174 if(!m_initialized)
175 {
176 ATH_MSG_WARNING("the tool hasn't been initialized");
177 return StatusCode::FAILURE;
178 }
179 m_particles.clear();
181
182 const xAOD::EventInfo* eventInfo = nullptr;
184 {
185 #ifdef FAKEBKGTOOLS_ATLAS_ENVIRONMENT
186 ATH_CHECK( evtStore()->retrieve(eventInfo, "EventInfo") );
187 #else
188 eventInfo = &iparticles.eventInfo;
189 #endif
190 }
191
192 for(const auto& pp : iparticles)
193 {
194 const auto& p = *pp;
195 m_particles.emplace_back();
196 auto& d = m_particles.back();
197 d.tight = m_tightAccessor->getBool(p);
198 d.type = p.type();
199 switch(p.type())
200 {
201 case xAOD::Type::Electron: d.charge = static_cast<const xAOD::Electron&>(p).charge(); break;
202 case xAOD::Type::Muon: d.charge = static_cast<const xAOD::Muon&>(p).charge(); break;
203 case xAOD::Type::Tau: d.charge = static_cast<const xAOD::TauJet&>(p).charge(); break;
204 case xAOD::Type::Photon: d.charge = 0; break;
205 default:
206 ATH_MSG_WARNING("unknown particle type, setting charge to 0");
207 d.charge = 0;
208 }
209 if(m_useDB)
210 {
211 std::string error;
212 if(!m_database->fillEfficiencies(d, p, eventInfo, error))
213 {
214 ATH_MSG_ERROR("unable to retrieve efficiencies: " << error);
215 return StatusCode::FAILURE;
216 }
217 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));
218 }
219 else
220 {
221 d.real_efficiency.nominal = m_accRealEff(p);
222 d.fake_efficiency.nominal = m_accFakeEff(p);
223 }
224 }
225 if(m_particles.size() > maxParticles())
226 {
227 ATH_MSG_WARNING( "the input contains " << m_particles.size() << " particles but the maximum allowed is " << maxParticles()
228 << "; the last " << (m_particles.size()-maxParticles()) << " will be ignored");
229 m_particles.erase(m_particles.begin() + maxParticles(), m_particles.end());
230 }
231 m_externalWeight = mcWeight;
232 ATH_MSG_DEBUG("calling addEventCustom() with #particles = " << m_particles.size());
233 return addEventCustom();
234}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
ServiceHandle< StoreGateSvc > & evtStore()
virtual StatusCode addEventCustom()=0
std::vector< FakeBkgTools::ParticleData > m_particles
bool m_unlimitedSystematicVariations
used to prevent multiple calls to applySystematicVariation() when unsupported set to true in a partic...
bool m_lockedSystematicVariations
when m_unlimitedSystematicVariations=false, keeps track of prior calls to applySystematicVariation() ...
constexpr uint8_t maxParticles()
@ Photon
The object is a photon.
Definition ObjectType.h:47
@ Muon
The object is a muon.
Definition ObjectType.h:48
@ Electron
The object is an electron.
Definition ObjectType.h:46
@ Tau
The object is a tau (jet).
Definition ObjectType.h:49
EventInfo_v1 EventInfo
Definition of the latest event info version.
TauJet_v3 TauJet
Definition of the current "tau version".
Definition TauJet.h:17
Muon_v1 Muon
Reference the current persistent version:
Electron_v1 Electron
Definition of the current "egamma version".

◆ affectingSystematics()

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

the list of all systematics this tool can be affected by

Implements CP::IReentrantSystematicsTool.

Definition at line 436 of file BaseFakeBkgTool.cxx.

437{
439 {
440 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...");
441 throw std::logic_error("BaseFakeBkgTool::affectingSystematics() called before initialization");
442 }
443 CP::SystematicSet affecting;
444 for(int step=0;step<2;++step)
445 {
446 std::string type = step? "STAT" : "SYST";
447 const int imax = step? m_database->numberOfStats() : m_database->numberOfSysts();
448 for(int i=0;i<imax;++i)
449 {
450 std::string name = "FAKEBKG_" + type + "_VAR" + std::to_string(i);
451 affecting.insert(CP::SystematicVariation(name, 1.f));
452 affecting.insert(CP::SystematicVariation(name, -1.f));
453 }
454 }
455 return affecting;
456}
int imax(int i, int j)
void insert(const SystematicVariation &systematic)
description: insert a systematic into the set

◆ affectingSystematicsFor()

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

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

Implements CP::IFakeBkgSystDescriptor.

Definition at line 613 of file BaseFakeBkgTool.cxx.

614{
615 CP::SystematicSet affecting;
617 {
618 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...");
619 return {};
620 }
621 bool up=true, down=true;
622 auto pos1=nuisanceParameter.find("__up"), pos2=nuisanceParameter.find("__down");
623 if(pos1!=std::string::npos && pos1+4==nuisanceParameter.length()) down = false;
624 else if(pos2!=std::string::npos && pos2+6==nuisanceParameter.length()) up = false;
625 std::string np = nuisanceParameter.substr(0, std::min(pos1, pos2));
626 for(unsigned i=0;i<m_database->numberOfSysts();++i)
627 {
628 auto syst = m_database->findSyst(m_database->systIndexToUID(i));
629 if(syst && syst->name==np)
630 {
631 std::string name = "FAKEBKG_SYST_VAR" + std::to_string(i);
632 if(up) affecting.insert(CP::SystematicVariation(name, 1.f));
633 if(down) affecting.insert(CP::SystematicVariation(name, -1.f));
634 }
635 }
636 return affecting;
637}

◆ affectsElectrons()

bool BaseFakeBkgTool::affectsElectrons ( const CP::SystematicVariation & systematic) const
finaloverridevirtual

checks whether the specified source of uncertainty affects electrons

Implements CP::IFakeBkgSystDescriptor.

Definition at line 571 of file BaseFakeBkgTool.cxx.

572{
573 uint16_t UID = identifyCpSystematicVariation(systematic).first;
574 if(UID) return getListOfEfficienciesAffectedBy(UID).find("electron") != std::string::npos;
575 return false;
576}
std::string getListOfEfficienciesAffectedBy(uint16_t uid) const
std::pair< uint16_t, float > identifyCpSystematicVariation(const CP::SystematicVariation &systematic) const
setWord1 uint16_t

◆ affectsFakeEfficiencies()

bool BaseFakeBkgTool::affectsFakeEfficiencies ( const CP::SystematicVariation & systematic) const
finaloverridevirtual

checks whether the specified source of uncertainty affects fake efficiencies

Implements CP::IFakeBkgSystDescriptor.

Definition at line 599 of file BaseFakeBkgTool.cxx.

600{
601 uint16_t UID = identifyCpSystematicVariation(systematic).first;
602 if(UID) return getListOfEfficienciesAffectedBy(UID).find("fake eff") != std::string::npos;
603 return false;
604}

◆ affectsFakeFactors()

bool BaseFakeBkgTool::affectsFakeFactors ( const CP::SystematicVariation & systematic) const
finaloverridevirtual

checks whether the specified source of uncertainty affects fake factors

Implements CP::IFakeBkgSystDescriptor.

Definition at line 606 of file BaseFakeBkgTool.cxx.

607{
608 uint16_t UID = identifyCpSystematicVariation(systematic).first;
609 if(UID) return getListOfEfficienciesAffectedBy(UID).find("fake factor") != std::string::npos;
610 return false;
611}

◆ affectsMuons()

bool BaseFakeBkgTool::affectsMuons ( const CP::SystematicVariation & systematic) const
finaloverridevirtual

checks whether the specified source of uncertainty affects muons

Implements CP::IFakeBkgSystDescriptor.

Definition at line 578 of file BaseFakeBkgTool.cxx.

579{
580 uint16_t UID = identifyCpSystematicVariation(systematic).first;
581 if(UID) return getListOfEfficienciesAffectedBy(UID).find("muon") != std::string::npos;
582 return false;
583}

◆ affectsRealEfficiencies()

bool BaseFakeBkgTool::affectsRealEfficiencies ( const CP::SystematicVariation & systematic) const
finaloverridevirtual

checks whether the specified source of uncertainty affects real efficiencies

Implements CP::IFakeBkgSystDescriptor.

Definition at line 592 of file BaseFakeBkgTool.cxx.

593{
594 uint16_t UID = identifyCpSystematicVariation(systematic).first;
595 if(UID) return getListOfEfficienciesAffectedBy(UID).find("real eff") != std::string::npos;
596 return false;
597}

◆ affectsTaus()

bool BaseFakeBkgTool::affectsTaus ( const CP::SystematicVariation & systematic) const
finaloverridevirtual

checks whether the specified source of uncertainty affects taus

Implements CP::IFakeBkgSystDescriptor.

Definition at line 585 of file BaseFakeBkgTool.cxx.

586{
587 uint16_t UID = identifyCpSystematicVariation(systematic).first;
588 if(UID) return getListOfEfficienciesAffectedBy(UID).find("tau") != std::string::npos;
589 return false;
590}

◆ applySystematicVariation()

StatusCode BaseFakeBkgTool::applySystematicVariation ( const CP::SystematicSet & systConfig)
overridevirtual

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 463 of file BaseFakeBkgTool.cxx.

464{
466 {
467 ATH_MSG_ERROR("This function can be called only once the tool has been initialized");
468 throw std::logic_error("BaseFakeBkgTool::applySystematicVariation() called before initialization");
469 }
471 {
472 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.");
473 throw std::logic_error("BaseFakeBkgTool::applySystematicVariation() called at a wrong time");
474 }
476 if(!systConfig.size())
477 {
478 m_selectedUncertainties = nullptr;
479 return StatusCode::SUCCESS;
480 }
481 auto itr = m_systSetDict.find(systConfig);
482 if(itr != m_systSetDict.end())
483 {
484 m_selectedUncertainties = &itr->second;
485 return StatusCode::SUCCESS;
486 }
487 CP::SystematicSet mysys;
489 if(sc != StatusCode::SUCCESS) return sc;
490 std::unique_ptr<UncertaintyList> uncertainties;
491 for(auto& sysvar : mysys)
492 {
493 auto var = identifyCpSystematicVariation(sysvar);
494 if(!var.first)
495 {
496 ATH_MSG_ERROR("The systematic variation " << sysvar.name() << " is not recognized, despite being present in affectingSystematics()...");
497 return StatusCode::FAILURE;
498 }
499 if(!uncertainties) uncertainties.reset(new UncertaintyList(var.first, var.second));
500 else uncertainties->extraVariation(var.first, var.second);
501 }
502 if(uncertainties)
503 {
504 auto emplaced = m_systSetDict.emplace(systConfig, std::move(*uncertainties));
505 m_selectedUncertainties = &emplaced.first->second;
506 }
507 else m_selectedUncertainties = nullptr;
508 return StatusCode::SUCCESS;
509}
static Double_t sc
UncertaintyList * m_selectedUncertainties
Pointer to a value of the 'm_systSetDict' map it must be invalidated each time the map is updated in ...
virtual CP::SystematicSet affectingSystematics() const override
the list of all systematics this tool can be affected by
std::unordered_map< CP::SystematicSet, UncertaintyList > m_systSetDict
List of uncertainties in internal format, associated with a particular SystematicSet the m_selectedUn...
size_t size() const
returns: size of the set
static StatusCode filterForAffectingSystematics(const SystematicSet &systConfig, const SystematicSet &affectingSystematics, SystematicSet &filteredSystematics)
description: filter the systematics for the affected systematics returns: success guarantee: strong f...
List of systematic variations (UID + sigma) to be considered This is implemented as a basic linked li...

◆ CheckHistogramCompatibility()

StatusCode BaseFakeBkgTool::CheckHistogramCompatibility ( const TH1 * lhs,
const TH1 * rhs )
protected

Definition at line 357 of file BaseFakeBkgTool.cxx.

358{
359 std::string error;
360 if(std::string(lhs->GetName()) != rhs->GetName()) error = "names";
361 else if(lhs->GetDimension() != rhs->GetDimension()) error = "dimensions";
362 else if(lhs->GetNbinsX()!=rhs->GetNbinsX() || lhs->GetNbinsY()!=rhs->GetNbinsY() || lhs->GetNbinsZ()!=rhs->GetNbinsZ()) error = "number of bins";
363 else
364 {
365 for(auto getAxis : std::initializer_list<const TAxis*(TH1::*)()const>{&TH1::GetXaxis, &TH1::GetYaxis, &TH1::GetZaxis})
366 {
367 auto lhsAxis=(lhs->*getAxis)(), rhsAxis=(rhs->*getAxis)();
368 for(int i=0;i<=lhsAxis->GetNbins();++i)
369 {
370 auto x=lhsAxis->GetBinUpEdge(i), y=rhsAxis->GetBinUpEdge(i), width=lhsAxis->GetBinWidth(i?i:1);
371 if(std::fabs(x-y) > 0.01*width) error = "bin edges";
372 }
373 }
374 }
375 if(error.length())
376 {
377 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.");
378 return StatusCode::FAILURE;
379 }
380 return StatusCode::SUCCESS;
381}
const double width
#define y
#define x
constexpr auto getAxis(H *hist)
Helper to get corresponding TAxis selected by Monitored::Axis.

◆ clientForDB()

Client BaseFakeBkgTool::clientForDB ( )
protectedpure virtual

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

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

Definition at line 73 of file BaseFakeBkgTool.cxx.

74{
75 return Client::NONE;
76}

◆ declareGaudiProperty()

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

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

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

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

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ defaultProcess()

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 38 of file IFakeBkgTool.h.

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

◆ defaultSelection()

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 33 of file IFakeBkgTool.h.

33{ 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.

◆ evtStore()

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.

◆ 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 )
protected

no longer fill cache if it becomes too large

Definition at line 246 of file BaseFakeBkgTool.cxx.

247{
248 success = true;
249 size_t hFS = m_hasher(strProc) ^ m_hasher(strPID) ^ nparticles;
250 auto itrFS = m_cachedFinalStates.find(FinalState(hFS));
251 if(itrFS != m_cachedFinalStates.end()) return *itrFS;
252 std::string error;
253 FinalState fs(hFS, nparticles, strPID, strProc, error);
254 if(error.length())
255 {
256 ATH_MSG_ERROR(error);
257 success = false;
258 return FinalState(0);
259 }
260 if(m_cachedFinalStates.size() < 1024)
261 {
262 m_cachedFinalStates.emplace(fs);
263 }
264 return fs;
265}
static Double_t fs
std::set< FakeBkgTools::FinalState > m_cachedFinalStates
std::hash< std::string > m_hasher
comes from Event passed to addEvent()

◆ 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::Event 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::Event, 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
protected

Definition at line 383 of file BaseFakeBkgTool.cxx.

384{
386 {
387 ATH_MSG_ERROR("This function can be called only once the tool has been initialized");
388 return "";
389 }
390 std::bitset<Database::N_EFFICIENCY_TYPES> affects;
391 auto stat = m_database->findStat(uid);
392 if(stat) affects = stat->affects;
393 else
394 {
395 auto syst = m_database->findSyst(uid);
396 if(syst) affects = syst->affects;
397 else
398 {
399 ATH_MSG_ERROR("uncertainty with UID " << std::hex << uid << std::dec << " not found in database");
400 return "";
401 }
402 }
403 std::string info;
404 if(affects[Database::ELECTRON_REAL_EFFICIENCY]) info += "electron real efficiencies, ";
405 if(affects[Database::ELECTRON_FAKE_EFFICIENCY]) info += "electron fake efficiencies, ";
406 if(affects[Database::ELECTRON_FAKE_FACTOR]) info += "electron fake factors, ";
407 if(affects[Database::MUON_REAL_EFFICIENCY]) info += "muon real efficiencies, ";
408 if(affects[Database::MUON_FAKE_EFFICIENCY]) info += "muon fake efficiencies, ";
409 if(affects[Database::MUON_FAKE_FACTOR]) info += "muon fake factors, ";
410 if(affects[Database::PHOTON_ELE_FAKE_FACTOR]) info += "electron->photon fake rate, ";
411 if(affects[Database::PHOTON_ELE_FAKE_FACTOR_SF]) info += "electron->photon fake rate scale factor, ";
412 return info.substr(0, info.size()-2);
413}

◆ 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::Event 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::Event, 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
inlineoverridevirtual

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()

virtual StatusCode CP::IFakeBkgTool::getTotalYield ( float & yield,
float & statErrorUp,
float & statErrorDown )
pure virtualinherited

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

Implemented in CP::BaseLinearFakeBkgTool, and CP::LhoodMM_tools.

◆ getUncertaintyDescription()

std::string BaseFakeBkgTool::getUncertaintyDescription ( const CP::SystematicVariation & systematic) const
finaloverridevirtual

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 517 of file BaseFakeBkgTool.cxx.

518{
520 {
521 ATH_MSG_ERROR("This function can be called only once the tool has been initialized");
522 return "";
523 }
524
525 auto UID = identifyCpSystematicVariation(systematic).first;
526 if(!UID)
527 {
528 ATH_MSG_WARNING("Systematic variation " + systematic.name() + " is not recognized by BaseFakeBkgTool");
529 return "";
530 }
531
532 //UID cannot be zero here
533 std::string info;
534 auto stat = m_database->findStat(UID);
535 if(stat)
536 {
537 info = "Statistical uncertainty affecting ";
539 }
540 else
541 {
542 auto syst = m_database->findSyst(UID);
543 if(syst)
544 {
545 info = "Systematic uncertainty \"" + syst->name + "\" affecting ";
546 }
547 else
548 {
549 ATH_MSG_ERROR("uncertainty with UID " << std::hex << UID << std::dec << " not found in database");
550 return "";
551 }
552 }
554 return info;
555}
const std::string & name() const
description: the full systematics name, for use in strings, etc.

◆ identifyCpSystematicVariation()

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

Definition at line 415 of file BaseFakeBkgTool.cxx.

416{
418 {
419 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...");
420 throw std::logic_error("BaseFakeBkgTool::identifyCpSystematicVariation() called before initialization");
421 }
422 std::smatch smr;
423 auto bn = systematic.basename();
424 if(!std::regex_match(bn, smr, std::regex("FAKEBKG_(STAT|SYST)_VAR(\\d+)"))) return {{0}, 0.f};
425 unsigned index = std::stol(smr[2].str());
426 float sigma = systematic.parameter();
427 if(smr[1].str() == "SYST") return {m_database->systIndexToUID(index), sigma};
428 else return {m_database->statIndexToUID(index), sigma};
429}
float parameter() const
description: the numeric parameter contained in the subvariation(), or 0 if the subvariation can't be...
std::string basename() const
description: the base name, i.e.
str index
Definition DeMoScan.py:362

◆ importEfficiencies()

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

load the config file(s) storing efficiencies

XML parsing error

ROOT histograms importing error, or unknown error

Definition at line 125 of file BaseFakeBkgTool.cxx.

126{
127 if(resetDB) m_database->reset();
128 std::string filename;
129 try
130 {
131 for(const auto& fn : m_inputFiles)
132 {
134 auto pos = filename.rfind(".xml");
135 if(pos == filename.length()-4)
136 {
137 m_database->importXML(filename);
138 continue;
139 }
140 pos = filename.rfind(".root");
141 if(pos == filename.length()-5)
142 {
143 m_database->importDefaultROOT(fn);
144 continue;
145 }
146 ATH_MSG_ERROR("File extension not supported for " << filename);
147 return false;
148 }
149 }
150 catch(const Database::XmlError& err)
151 {
152 unsigned line1 = m_database->getXmlLineNumber(err.location.ptr);
153 unsigned line2 = m_database->getXmlLineNumber(err.location.endptr);
154 ATH_MSG_INFO("Exception caught while reading file " << filename << ", details follow");
155 std::string fullmsg = "(while parsing XML, line";
156 if(line2 != line1) fullmsg += "s " + std::to_string(line1) + " - " + std::to_string(line2);
157 else fullmsg += " " + std::to_string(line1);
158 fullmsg += "): " + err.reason;
159 ATH_MSG_ERROR(fullmsg);
160 return false;
161 }
162 catch(const Database::GenericError& err)
163 {
164 ATH_MSG_INFO("Exception caught while reading file " << filename << ", details follow");
165 ATH_MSG_ERROR(err.reason);
166 return false;
167 }
168 return m_database->ready();
169}
#define ATH_MSG_INFO(x,...)
std::string PathResolverFindDataFile(const std::string &logical_file_name)

◆ initialize()

StatusCode BaseFakeBkgTool::initialize ( void )
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 asg::AsgTool.

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

Definition at line 78 of file BaseFakeBkgTool.cxx.

79{
81 {
82 ATH_MSG_WARNING("the tool has already been initialized successfully");
83 return StatusCode::FAILURE;
84 }
85
86 m_useDB = m_inputFiles.size();
87
88
89 bool useGeV;
90 if(m_energyUnit == "MeV" || m_energyUnit == "MEV") useGeV = false;
91 else if(m_energyUnit == "GeV" || m_energyUnit == "GEV" ) useGeV = true;
92 else
93 {
94 ATH_MSG_ERROR("unrecognized energy unit \"" << m_energyUnit << '"');
95 return StatusCode::FAILURE;
96 }
97
98 std::unique_ptr<CP::ISelectionReadAccessor> tightAccessor;
100 m_tightAccessor = tightAccessor.release();
101
102 if(!m_useDB)
103 {
104 ATH_MSG_WARNING("no input file(s) provided with the reference efficiencies, will try reading the efficiencies directly from the IParticle");
105 }
106
107 if(m_useDB && clientForDB()!=Client::NONE)
108 {
109 auto db = new Database(clientForDB(), useGeV, m_convertWhenMissing);
110 if(!db) return StatusCode::FAILURE;
111 m_database = std::unique_ptr<Database>(db);
112 if(!importEfficiencies(true)){
113 ATH_MSG_ERROR("importEfficiencies failed!");
114 return StatusCode::FAILURE;
115 }
116 m_needEventInfo = db->needEventInfo();
117 }
118 else m_needEventInfo = false;
119
120 m_initialized = true;
121
122 return StatusCode::SUCCESS;
123}
bool importEfficiencies(bool resetDB=false)
load the config file(s) storing efficiencies
virtual FakeBkgTools::Client clientForDB()=0
This indicates which type of efficiencies/fake factor need to be filled.
StatusCode makeSelectionReadAccessor(const std::string &expr, std::unique_ptr< ISelectionReadAccessor > &accessor, bool defaultToChar)
make the ISelectionReadAccessor for the given name

◆ 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
overridevirtual

Declare the interface that this class provides.

returns: whether this tool is affected by the given systematics

Implements CP::ISystematicsTool.

Definition at line 431 of file BaseFakeBkgTool.cxx.

432{
433 return identifyCpSystematicVariation(systematic).first;
434}

◆ isStatisticalUncertainty()

bool BaseFakeBkgTool::isStatisticalUncertainty ( const CP::SystematicVariation & systematic) const
finaloverridevirtual

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 564 of file BaseFakeBkgTool.cxx.

565{
566 uint16_t UID = identifyCpSystematicVariation(systematic).first;
567 if(UID) return Database::isStatUID(UID);
568 return false;
569}
static constexpr bool isStatUID(unsigned short uid)
Definition Database.h:223

◆ isSystematicUncertainty()

bool BaseFakeBkgTool::isSystematicUncertainty ( const CP::SystematicVariation & systematic) const
finaloverridevirtual

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 557 of file BaseFakeBkgTool.cxx.

558{
559 uint16_t UID = identifyCpSystematicVariation(systematic).first;
560 if(UID) return Database::isSystUID(UID);
561 return false;
562}
static constexpr bool isSystUID(unsigned short uid)
Definition Database.h:222

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ 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 }
MsgStream & msg() const
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition MsgLevel.cxx:19

◆ 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()

◆ printUncertaintyDescription()

void BaseFakeBkgTool::printUncertaintyDescription ( const CP::SystematicVariation & systematic) const
finaloverridevirtual

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

Implements CP::IFakeBkgSystDescriptor.

Definition at line 511 of file BaseFakeBkgTool.cxx.

512{
513 auto info = getUncertaintyDescription(systematic);
514 if(info.length()) ATH_MSG_INFO(info);
515}
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

◆ recommendedSystematics()

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

the list of all systematics this tool recommends to use

Implements CP::IReentrantSystematicsTool.

Definition at line 458 of file BaseFakeBkgTool.cxx.

459{
460 return affectingSystematics();
461}

◆ register1DHistogram()

StatusCode BaseFakeBkgTool::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

Implements CP::IFakeBkgTool.

Reimplemented in CP::BaseLinearFakeBkgTool, and CP::LhoodMM_tools.

Definition at line 267 of file BaseFakeBkgTool.cxx.

267 {
268
269 if(!h1)
270 {
271 ATH_MSG_ERROR("invalid histogram pointer");
272 return StatusCode::FAILURE;
273 }
274 const std::string name = h1->GetName();
275 auto itr = m_values_1dhisto_map.begin();
276 const auto enditr = m_values_1dhisto_map.end();
277 for(;itr!=enditr;++itr)
278 {
279 if(itr->first == h1)
280 {
281 ATH_MSG_ERROR("the histogram \"" << name << "\" has already been registered");
282 return StatusCode::FAILURE;
283 }
284 if(name == itr->first->GetName()) break;
285 }
286 if(itr == enditr)
287 {
288 m_values_1dhisto_map.emplace(h1, val);
289 }
290 else
291 {
292 ATH_CHECK( CheckHistogramCompatibility(h1, itr->first) );
293 }
294 return StatusCode::SUCCESS;
295}
StatusCode CheckHistogramCompatibility(const TH1 *lhs, const TH1 *rhs)
std::map< TH1 *, const float * > m_values_1dhisto_map

◆ register2DHistogram()

StatusCode BaseFakeBkgTool::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

Implements CP::IFakeBkgTool.

Reimplemented in CP::BaseLinearFakeBkgTool, and CP::LhoodMM_tools.

Definition at line 297 of file BaseFakeBkgTool.cxx.

297 {
298
299 if(!h2)
300 {
301 ATH_MSG_ERROR("invalid histogram pointer");
302 return StatusCode::FAILURE;
303 }
304 const std::string name = h2->GetName();
305 auto itr = m_values_2dhisto_map.begin();
306 const auto enditr = m_values_2dhisto_map.end();
307 for(;itr!=enditr;++itr)
308 {
309 if(itr->first == h2)
310 {
311 ATH_MSG_ERROR("the histogram \"" << name << "\" has already been registered");
312 return StatusCode::FAILURE;
313 }
314 if(name == itr->first->GetName()) break;
315 }
316 if(itr == enditr)
317 {
318 m_values_2dhisto_map.emplace(h2, std::make_pair(xval, yval));
319 }
320 else
321 {
322 ATH_CHECK( CheckHistogramCompatibility(h2, itr->first) );
323 }
324 return StatusCode::SUCCESS;
325}
std::map< TH2 *, std::pair< const float *, const float * > > m_values_2dhisto_map

◆ register3DHistogram()

StatusCode BaseFakeBkgTool::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

Implements CP::IFakeBkgTool.

Reimplemented in CP::BaseLinearFakeBkgTool, and CP::LhoodMM_tools.

Definition at line 327 of file BaseFakeBkgTool.cxx.

327 {
328
329 if(!h3)
330 {
331 ATH_MSG_ERROR("invalid histogram pointer");
332 return StatusCode::FAILURE;
333 }
334 const std::string name = h3->GetName();
335 auto itr = m_values_3dhisto_map.begin();
336 const auto enditr = m_values_3dhisto_map.end();
337 for(;itr!=enditr;++itr)
338 {
339 if(itr->first == h3)
340 {
341 ATH_MSG_ERROR("the histogram \"" << name << "\" has already been registered");
342 return StatusCode::FAILURE;
343 }
344 if(name == itr->first->GetName()) break;
345 }
346 if(itr == enditr)
347 {
348m_values_3dhisto_map.emplace(h3, std::make_tuple(xval, yval, zval));
349 }
350 else
351 {
352 ATH_CHECK( CheckHistogramCompatibility(h3, itr->first) );
353 }
354 return StatusCode::SUCCESS;
355}
std::map< TH3 *, std::tuple< const float *, const float *, const float * > > m_values_3dhisto_map

◆ 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 368 of file AthCommonDataStore.h.

369 {
370 h.renounce();
372 }
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)

◆ renounceArray()

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

remove all handles from I/O resolution

Definition at line 352 of file AthCommonDataStore.h.

352 {
354 }

◆ saveProgress()

virtual StatusCode CP::IFakeBkgTool::saveProgress ( TDirectory * dir)
pure virtualinherited

◆ 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 asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, and AthCheckedComponent<::AthAlgTool >.

◆ 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 298 of file AthCommonDataStore.h.

298 {
299 for (auto &a : m_vhka) {
301 for (auto k : keys) {
302 k->setOwner(this);
303 }
304 }
305 }
std::vector< SG::VarHandleKeyArray * > m_vhka

◆ FakeBkgTools::Efficiency

friend struct FakeBkgTools::Efficiency
friend

Definition at line 187 of file BaseFakeBkgTool.h.

Member Data Documentation

◆ m_accFakeEff

SG::ConstAccessor<float> CP::BaseFakeBkgTool::m_accFakeEff
protected

only used when m_useDB is false

Definition at line 177 of file BaseFakeBkgTool.h.

◆ m_accRealEff

SG::ConstAccessor<float> CP::BaseFakeBkgTool::m_accRealEff
protected

Definition at line 175 of file BaseFakeBkgTool.h.

◆ m_cachedFinalStates

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

Definition at line 99 of file BaseFakeBkgTool.h.

◆ m_convertWhenMissing

bool CP::BaseFakeBkgTool::m_convertWhenMissing = false
protected

Definition at line 80 of file BaseFakeBkgTool.h.

◆ m_database

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

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 381 of file AthCommonDataStore.h.

◆ m_energyUnit

std::string CP::BaseFakeBkgTool::m_energyUnit
protected

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 378 of file AthCommonDataStore.h.

◆ m_externalWeight

float CP::BaseFakeBkgTool::m_externalWeight {}
protected

Definition at line 95 of file BaseFakeBkgTool.h.

95{};

◆ m_hasher

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

comes from Event passed to addEvent()

Definition at line 97 of file BaseFakeBkgTool.h.

◆ m_initialized

bool CP::BaseFakeBkgTool::m_initialized = false
protected

Definition at line 78 of file BaseFakeBkgTool.h.

◆ m_inputFiles

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

property InputFiles

Definition at line 127 of file BaseFakeBkgTool.h.

◆ m_lockedSystematicVariations

bool CP::BaseFakeBkgTool::m_lockedSystematicVariations = false
protected

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
protected

Definition at line 79 of file BaseFakeBkgTool.h.

◆ m_particles

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

Definition at line 85 of file BaseFakeBkgTool.h.

◆ m_process

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

'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
protected

property ProgressFileDirectory

Definition at line 139 of file BaseFakeBkgTool.h.

◆ m_progressFileName

std::string CP::BaseFakeBkgTool::m_progressFileName
protected

property ProgressFileName

Definition at line 136 of file BaseFakeBkgTool.h.

◆ m_selectedUncertainties

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

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()
protected

'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
protected

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
protected

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
protected

property TightDecoration

Definition at line 130 of file BaseFakeBkgTool.h.

◆ m_unlimitedSystematicVariations

bool CP::BaseFakeBkgTool::m_unlimitedSystematicVariations = true
protected

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
protected

Definition at line 124 of file BaseFakeBkgTool.h.

◆ m_values_1dhisto_map

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

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
protected

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
protected

Definition at line 110 of file BaseFakeBkgTool.h.

◆ m_varHandleArraysDeclared

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

Definition at line 387 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 386 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: