ATLAS Offline Software
Loading...
Searching...
No Matches
CP::ApplyFakeFactor Class Reference

#include <ApplyFakeFactor.h>

Inheritance diagram for CP::ApplyFakeFactor:
Collaboration diagram for CP::ApplyFakeFactor:

Public Member Functions

 ApplyFakeFactor (const std::string &name)
 Standard constructor.
 ~ApplyFakeFactor ()
 Standard destructor.
virtual StatusCode initialize () override
 Dummy implementation of the initialisation function.
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.
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.
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
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)
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 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 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 StatusCode addEventCustom () override
virtual StatusCode getEventWeightCustom (FakeBkgTools::Weight &weight, const FakeBkgTools::FinalState &fs) override
virtual FakeBkgTools::Client clientForDB () override final
 This indicates which type of efficiencies/fake factor need to be filled.
StatusCode incrementTotalYield ()
 be sure to only call this once per event! (typically at the end of addEvent())
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

std::vector< FakeBkgTools::Yield > m_yields
 accumulated yield for all events (and histogram bins with uncertainties)
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 map in addEventCustom()!
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::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

bool eventSatisfiesCriteria (const FakeBkgTools::FinalState &fs, unsigned long &expectedTightLeptonsBitset)
StatusCode getEventWeightCommon (FakeBkgTools::Weight &weight, const std::string &selection, const std::string &process)
StatusCode mergeSubjobs ()
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

Detailed Description

Definition at line 21 of file ApplyFakeFactor.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

◆ ApplyFakeFactor()

ApplyFakeFactor::ApplyFakeFactor ( const std::string & name)

Standard constructor.

Definition at line 15 of file ApplyFakeFactor.cxx.

15 :
17{
18}
BaseLinearFakeBkgTool(const std::string &toolname)

◆ ~ApplyFakeFactor()

ApplyFakeFactor::~ApplyFakeFactor ( )

Standard destructor.

Definition at line 23 of file ApplyFakeFactor.cxx.

24{
25}

Member Function Documentation

◆ addEvent() [1/2]

StatusCode BaseFakeBkgTool::addEvent ( const ConstDataVector< 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)

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

Implements CP::IFakeBkgTool.

Definition at line 236 of file BaseFakeBkgTool.cxx.

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

◆ addEventCustom()

StatusCode ApplyFakeFactor::addEventCustom ( )
overrideprotectedvirtual

Implements CP::BaseFakeBkgTool.

Definition at line 37 of file ApplyFakeFactor.cxx.

38{
39 m_cachedWeights.clear();
40
41 return incrementTotalYield();
42}
StatusCode incrementTotalYield()
be sure to only call this once per event! (typically at the end of addEvent())
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 ...

◆ addEventImpl()

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

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...
CP::ISelectionReadAccessor * m_tightAccessor
this can't be a unique_ptr as this can cause issues with the dictionary in some particular circumstan...
SG::ConstAccessor< float > m_accRealEff
std::unique_ptr< FakeBkgTools::Database > m_database
bool m_lockedSystematicVariations
when m_unlimitedSystematicVariations=false, keeps track of prior calls to applySystematicVariation() ...
SG::ConstAccessor< float > m_accFakeEff
only used when m_useDB is false
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
overridevirtualinherited

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
overridevirtualinherited

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
finaloverridevirtualinherited

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
finaloverridevirtualinherited

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
finaloverridevirtualinherited

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
finaloverridevirtualinherited

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
finaloverridevirtualinherited

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
finaloverridevirtualinherited

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

◆ assignYieldRange()

StatusCode BaseLinearFakeBkgTool::assignYieldRange ( TH1 * h)
inherited

Definition at line 142 of file BaseLinearFakeBkgTool.cxx.

143{
144 const std::string histname = h->GetName();
145 std::pair<uint32_t, uint32_t> range;
146 for(auto itr=m_histogramYieldsRange.begin();itr!=m_histogramYieldsRange.end();++itr)
147 {
148 if(histname != itr->first->GetName()) continue;
149 range = itr->second;
150 m_histogramYieldsRange.erase(itr);
151 m_histogramYieldsRange.emplace(h, range);
152 return StatusCode::SUCCESS;
153 }
154 range.first = m_yields.size();
155 m_yields.insert(m_yields.end(), std::max(1, h->GetNcells()), FakeBkgTools::Yield{});
156 range.second = m_yields.size() - 1;
157 m_histogramYieldsRange.emplace(h, range);
158 return StatusCode::SUCCESS;
159}
std::vector< FakeBkgTools::Yield > m_yields
accumulated yield for all events (and histogram bins with uncertainties)
std::map< TH1 *, std::pair< uint32_t, uint32_t > > m_histogramYieldsRange

◆ CheckHistogramCompatibility()

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

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

FakeBkgTools::Client ApplyFakeFactor::clientForDB ( )
finaloverrideprotectedvirtual

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

Implements CP::BaseFakeBkgTool.

Definition at line 27 of file ApplyFakeFactor.cxx.

◆ 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 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

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

◆ eventSatisfiesCriteria()

bool ApplyFakeFactor::eventSatisfiesCriteria ( const FakeBkgTools::FinalState & fs,
unsigned long & expectedTightLeptonsBitset )
private

Definition at line 133 of file ApplyFakeFactor.cxx.

133 {
134
135 // fill bitset for tight leptons
136 FakeBkgTools::FSBitset tights(0);
137 unsigned int ipart = 0;
138 for(FakeBkgTools::ParticleData& particle : m_particles){
139
140 if(particle.tight){
141 tights.set(ipart);
142 }
143
144 ++ipart;
145 }
146
147 // the logic is following: the event is accepted only if there's at least one "turn a loose lepton into tight" operation that gives the wanted final state
148 FakeBkgTools::FSBitset charges = fs.retrieveCharges(m_particles); // could also use the code above instead, if it is need for other purposes
149 unsigned int nValidCombinations = 0; // count the number of different possible+acceptable final states obtained by changing loose leptons into tight
150 const unsigned long nc = (1<<m_particles.size());
151 for(unsigned long c=0;c<nc;++c) // loop over all possible combinations for n leptons
152 {
153 auto newtights = FakeBkgTools::FSBitset(c);
154 if(!fs.accept_selection(newtights, charges)){
155 ATH_MSG_DEBUG("eventSatisfiesCriteria: failed selection");
156 continue; // discard unwanted combinations (including charge requirements)
157 }
158
159 // if no loose lepton has been "upgraded", not a valid combination:
160 if((newtights | tights) == tights){
161 ATH_MSG_DEBUG("eventSatisfiesCriteria: newtights|tights == tights. newtights is " << newtights << " while tights is " << tights);
162 continue;
163 }
164 // also, the combination can't have tight leptons "downgraded" to loose:
165 if((newtights&tights) != tights){
166 ATH_MSG_DEBUG("eventSatisfiesCriteria: newtights&tights != tights. newtights is " << newtights << " while tights is " << tights);
167 continue;
168 }
169 ++nValidCombinations;
170 expectedTightLeptonsBitset = c;
171 }
172
173 if(!nValidCombinations) return false;
174 if(nValidCombinations > 1) // if > 1, would need to modify getEventWeight() to sum over all different combinations, I think
175 {
176 ATH_MSG_ERROR("this type of selection/process is currently not supported by the fake factor method");
177 return false;
178 }
179 // process argument ignored for the moment. Should probably make sure that nothing exotic was requested.
180
181 return true;
182}
static Double_t fs
std::bitset< maxCombinations()> FSBitset
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses

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

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}
std::set< FakeBkgTools::FinalState > m_cachedFinalStates
std::hash< std::string > m_hasher
comes from Event passed to addEvent()

◆ getEventWeight()

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

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 39 of file BaseLinearFakeBkgTool.cxx.

40{
41 FakeBkgTools::Weight w;
43 weight = w.value(this);
44 return sc;
45}
StatusCode getEventWeightCommon(FakeBkgTools::Weight &weight, const std::string &selection, const std::string &process)
const std::string selection
const std::string process

◆ getEventWeightCommon()

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

Definition at line 47 of file BaseLinearFakeBkgTool.cxx.

48{
49 if(!m_initialized)
50 {
51 ATH_MSG_WARNING("the tool hasn't been initialized");
52 return StatusCode::FAILURE;
53 }
54 weight.uncertainties.clear();
55 bool success = true;
56 auto fs = getCachedFinalState(m_particles.size(), selection, process, success);
57 if(!success) return StatusCode::FAILURE;
58 auto itr = m_cachedWeights.find(fs);
59 if(itr != m_cachedWeights.end())
60 {
61 weight = itr->second;
62 return StatusCode::SUCCESS;
63 }
64 auto sc = getEventWeightCustom(weight, fs);
65 if(sc != StatusCode::SUCCESS) return sc;
66 m_cachedWeights.emplace(fs, weight);
67 return StatusCode::SUCCESS;
68}
FakeBkgTools::FinalState getCachedFinalState(uint8_t nparticles, const std::string &strPID, const std::string &strProc, bool &success)
virtual StatusCode getEventWeightCustom(FakeBkgTools::Weight &weight, const FakeBkgTools::FinalState &fs)=0

◆ getEventWeightCustom()

StatusCode ApplyFakeFactor::getEventWeightCustom ( FakeBkgTools::Weight & weight,
const FakeBkgTools::FinalState & fs )
overrideprotectedvirtual

Implements CP::BaseLinearFakeBkgTool.

Definition at line 44 of file ApplyFakeFactor.cxx.

45 {
46
47 ATH_MSG_DEBUG("entering getEventWeight");
48
49 // for the FF, we can handle the following (e.g. for a 2L final state):
50 // N_LT, N_TL, N_LL
51 // but not N_RR, N_FR, etc. (other than via the MC for N_RR)
52 // and not N_TT, since this is part of what we want to estimate
53 //
54 // in general, we want to compute N_TT^{RF,FR,FF} = N_TT - N_TT^{RR}
55 // which might need to be coded up as its own string
56 //
57 // maybe we want to only allow strProc == ">=1F"
58
59 // reset initial values since they will be multiplied by
60 // each lepton's FF and rel uncertainty
61 outputEventWeight.nominal = 1;
62 outputEventWeight.uncertainties.clear();
63
64 // check if the event satisfies the selection of interest
65 // e.g. LT vs. TL, SS events, etc.
66 unsigned long expectedTightLeptonsBitset = 0;
67 if(!eventSatisfiesCriteria(fs, expectedTightLeptonsBitset)){
68
69 ATH_MSG_DEBUG("event failed eventSatisfiesCriteria");
70
71 // for an inappropriate event for our desired selection,
72 // return a weight of 0 and uncertainties of 0
73 outputEventWeight.nominal = 0;
74
75 // quit now, since the event does not satisfy our selection
76 return StatusCode::SUCCESS;
77 }
78
79 ATH_MSG_DEBUG("event passed eventSatisfiesCriteria!");
80
81 // in principle m_particles may also include baseline,
82 // but we only want to have loose and tight at this stage!
83 // User must *only* pass loose and tight leptons to the tool
84 unsigned int nLooseLeps = 0;
85 unsigned int ipart = 0;
86 const FakeBkgTools::FSBitset newtights(expectedTightLeptonsBitset);
87
88 for(FakeBkgTools::ParticleData& particle : m_particles){
89
90 // only antiID (loose) leptons need an FF applied
91 if(particle.tight) continue;
92 if(!newtights[ipart++]) continue; // only multiply fake factors from loose leptons that are supposed to be tight in the wanted final state
93
94 // FIXME when we load in the FFs, need to allow for e.g. pT, eta binning and arbitrary parameterizations
95 float FF_value = particle.fake_factor.nominal;
96 ATH_MSG_DEBUG("FF_value is " << FF_value);
97 outputEventWeight.nominal *= FF_value;
98 for(auto const& particleUncPair : particle.fake_factor.uncertainties){
99
100 float FF_abs_err_up = particleUncPair.second.up;
101 float FF_abs_err_down = particleUncPair.second.down;
102
103 float FF_rel_err_up = FF_abs_err_up / fabs(FF_value);
104 float FF_rel_err_down = FF_abs_err_down / fabs(FF_value);
105
106 // note that these are all relative uncertainties at this stage
107 auto& unc = outputEventWeight.uncertainties.emplace(particleUncPair.first, FakeBkgTools::Uncertainty{1.f, 1.f}).first->second;
108 unc.up *= (1+FF_rel_err_up);
109 unc.down *= (1-FF_rel_err_down);
110 }
111 ++nLooseLeps;
112 // nLooseLeps will only count loose leptons "upgraded" to tight.
113 }
114
115 // Subtraction for double counting of events with two antiID leptons
116 // which have had a FF applied, to "promote" them to a tight lepton.
117 // It turns out this is true for all even multiplicities.
118 if(nLooseLeps % 2 == 0){
119 outputEventWeight.nominal *= -1;
120 }
121
122
123 for(auto& eventUncPair : outputEventWeight.uncertainties){
124 eventUncPair.second.up = (eventUncPair.second.up - 1.f) * outputEventWeight.nominal;
125 eventUncPair.second.down = (1.f - eventUncPair.second.down) * outputEventWeight.nominal;
126 }
127
128 ATH_MSG_DEBUG("outputEventWeight.nominal is " << outputEventWeight.nominal);
129
130 return StatusCode::SUCCESS;
131}
bool eventSatisfiesCriteria(const FakeBkgTools::FinalState &fs, unsigned long &expectedTightLeptonsBitset)

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

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

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 70 of file BaseLinearFakeBkgTool.cxx.

71{
72 if(!m_initialized)
73 {
74 ATH_MSG_WARNING("the tool hasn't been initialized");
75 return StatusCode::FAILURE;
76 }
77 if(m_progressFileName.length() && m_progressFileName != "none")
78 {
80 }
81 auto& total = m_yields.at(0);
82 yield = total.value(this);
83 yieldStatErrorUp = sqrt(total.stat2.up);
84 yieldStatErrorDown = sqrt(total.stat2.down);
85 for(auto& kv : m_histogramYieldsRange)
86 {
87 for(int i=0;i<kv.first->GetNcells();++i)
88 {
89 auto& thisYield = m_yields.at(kv.second.first + i);
90 kv.first->SetBinContent(i, thisYield.value(this));
91 kv.first->SetBinError(i, thisYield.stat());
92 }
93 }
94 return StatusCode::SUCCESS;
95}
std::string m_progressFileName
property ProgressFileName

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

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

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)
std::vector< std::string > m_inputFiles
property InputFiles

◆ incrementTotalYield()

StatusCode BaseLinearFakeBkgTool::incrementTotalYield ( )
protectedinherited

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 97 of file BaseLinearFakeBkgTool.cxx.

98{
99 FakeBkgTools::Weight eventWeight;
102 m_yields.at(0).add(eventWeight, m_externalWeight);
103 for(auto& kv : m_values_1dhisto_map)
104 {
105 unsigned index = m_histogramYieldsRange.at(kv.first).first + kv.first->FindBin(*kv.second);
106 m_yields.at(index).add(eventWeight, m_externalWeight);
107 }
108 for(auto& kv : m_values_2dhisto_map)
109 {
110 unsigned index = m_histogramYieldsRange.at(kv.first).first + kv.first->FindBin(*kv.second.first, *kv.second.second);
111 m_yields.at(index).add(eventWeight, m_externalWeight);
112 }
113 for(auto& kv : m_values_3dhisto_map)
114 {
115 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));
116 m_yields.at(index).add(eventWeight, m_externalWeight);
117 }
118 return StatusCode::SUCCESS;
119}
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
'selection' settings used to compute the total yield / fill histograms
std::string m_process
'process' settings used to compute the total yield / fill histograms
std::map< TH1 *, const float * > m_values_1dhisto_map

◆ initialize()

StatusCode ApplyFakeFactor::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 CP::BaseLinearFakeBkgTool.

Definition at line 32 of file ApplyFakeFactor.cxx.

33{
35}
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.

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

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

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

◆ mergeSubjobs()

StatusCode BaseLinearFakeBkgTool::mergeSubjobs ( )
privateinherited

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 222 of file BaseLinearFakeBkgTool.cxx.

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

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

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
overridevirtualinherited

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 BaseLinearFakeBkgTool::register1DHistogram ( TH1 * h1,
const float * val )
overridevirtualinherited

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 121 of file BaseLinearFakeBkgTool.cxx.

122{
124 if(sc != StatusCode::SUCCESS) return sc;
125 return assignYieldRange(h1);
126}
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 ...

◆ register2DHistogram()

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

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 128 of file BaseLinearFakeBkgTool.cxx.

129{
130 auto sc = BaseFakeBkgTool::register2DHistogram(h2, xval, yval);
131 if(sc != StatusCode::SUCCESS) return sc;
132 return assignYieldRange(h2);
133}
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 ...

◆ register3DHistogram()

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

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 135 of file BaseLinearFakeBkgTool.cxx.

136{
137 auto sc = BaseFakeBkgTool::register3DHistogram(h3, xval, yval, zval);
138 if(sc != StatusCode::SUCCESS) return sc;
139 return assignYieldRange(h3);
140}
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 ...

◆ 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();
384 }
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 364 of file AthCommonDataStore.h.

364 {
366 }

◆ saveProgress()

StatusCode BaseLinearFakeBkgTool::saveProgress ( TDirectory * dir)
overridevirtualinherited

Implements CP::IFakeBkgTool.

Definition at line 161 of file BaseLinearFakeBkgTool.cxx.

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

◆ 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 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) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_accFakeEff

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

only used when m_useDB is false

Definition at line 177 of file BaseFakeBkgTool.h.

◆ m_accRealEff

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

Definition at line 175 of file BaseFakeBkgTool.h.

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

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

Definition at line 67 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.

95{};

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

Definition at line 73 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
protectedinherited

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

Definition at line 63 of file BaseLinearFakeBkgTool.h.


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