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

#include <MuonTriggerScaleFactors.h>

Inheritance diagram for CP::MuonTriggerScaleFactors:
Collaboration diagram for CP::MuonTriggerScaleFactors:

Public Member Functions

 MuonTriggerScaleFactors (const std::string &name)
 
virtual ~MuonTriggerScaleFactors ()
 
virtual StatusCode initialize (void)
 Dummy implementation of the initialisation function. More...
 
virtual CorrectionCode getTriggerScaleFactor (const xAOD::MuonContainer &mucont, Double_t &triggersf, const std::string &trigger) const
 
virtual CorrectionCode getTriggerScaleFactor (const xAOD::Muon &muon, Double_t &triggersf, const std::string &trigger) const
 
virtual CorrectionCode getTriggerEfficiency (const xAOD::Muon &mu, Double_t &efficiency, const std::string &trigger, Bool_t dataType) const
 
virtual bool isAffectedBySystematic (const CP::SystematicVariation &systematic) const
 Declare the interface that this class provides. More...
 
virtual CP::SystematicSet affectingSystematics () const
 returns: the list of all systematics this tool can be affected by More...
 
virtual CP::SystematicSet recommendedSystematics () const
 returns: the list of all systematics this tool recommends to use More...
 
virtual StatusCode applySystematicVariation (const CP::SystematicSet &systConfig)
 effects: configure this tool for the given list of systematic variations. More...
 
virtual int getBinNumber (const xAOD::Muon &muon, const std::string &trigger) const
 
virtual int getReplica_index (const std::string &sysBaseName, const std::string &trigStr) const
 
virtual bool isTriggerSupported (const std::string &trigger) const
 Returns whether the trigger is supported by the tool or not. The decision depends on the present (random)RunNumber. More...
 
virtual void print () const =0
 Print the state of the tool. More...
 
virtual void print () const
 Print the state of the tool. More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Protected Member Functions

virtual std::shared_ptr< TH1 > getEfficiencyHistogram (unsigned int year, const std::string &period, const std::string &trigger, bool isData, const std::string &Systematic, bool isBarrel=true) const
 
virtual std::shared_ptr< TH1 > getEfficiencyHistogram (const std::string &trigger, bool isData, const std::string &Systematic, bool isBarrel=true) const
 
std::string getDataPeriod () const
 
unsigned int getRunNumber () const
 
unsigned int getYear (unsigned int run) const
 
std::string getDataPeriod (unsigned int run) const
 
std::string getDataPeriod (unsigned int runNumber, unsigned int year) const
 
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
 
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed. More...
 

Private Types

typedef std::pair< unsigned int, std::string > YearPeriod
 
typedef std::pair< YearPeriod, unsigned int > EffiHistoIdent
 
typedef std::map< EffiHistoIdent, TH1_PtrEfficiencyMap
 
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

virtual CorrectionCode getMuonEfficiency (Double_t &eff, const TrigMuonEff::Configuration &configuration, const xAOD::Muon &muon, const std::string &trigger, const std::string &systematic) const
 
virtual CorrectionCode GetTriggerSF_dimu (Double_t &TriggerSF, TrigMuonEff::Configuration &configuration, const xAOD::MuonContainer &mucont, const std::string &trigger) const
 
virtual CorrectionCode GetTriggerSF (Double_t &TriggerSF, TrigMuonEff::Configuration &configuration, const xAOD::MuonContainer &mucont, const std::string &trigger) const
 
virtual CorrectionCode GetTriggerSF (Double_t &TriggerSF, TrigMuonEff::Configuration &configuration, const xAOD::Muon &muon, const std::string &trigger) const
 
virtual CorrectionCode getDimuonEfficiency (Double_t &eff, const TrigMuonEff::Configuration &configuration, const xAOD::MuonContainer &mucont, const std::string &chain, const std::string &systematic) const
 
const CP::SystematicSetappliedSystematics () const
 
StatusCode registerSystematics ()
 
StatusCode LoadTriggerMap (unsigned int year)
 
unsigned int encodeHistoName (const std::string &period, const std::string &Trigger, bool isData, const std::string &Systematic, bool isBarrel=true) const
 
unsigned int encodeHistoName (const std::string &Trigger, const TrigMuonEff::Configuration &configuration, const std::string &Systematic, bool isBarrel=true) const
 
CorrectionCode getThreshold (Int_t &threshold, const std::string &trigger) const
 
std::string getTriggerCorrespondingToDimuonTrigger (const std::string &trigger) const
 
TDirectory * getTemporaryDirectory (void) const
 
std::vector< TH1_PtrgenerateReplicas (TH1_Ptr h, int nrep, int seed) const
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

SG::ReadHandleKey< xAOD::EventInfom_eventInfo {this, "EventInfoContName", "EventInfo", "event info key"}
 
std::unordered_map< CP::SystematicSet, CP::SystematicSetm_systFilter
 
CP::SystematicSetm_appliedSystematics
 
std::string m_fileName
 
EfficiencyMap m_efficiencyMap
 
std::map< EffiHistoIdent, std::vector< TH1_Ptr > > m_efficiencyMapReplicaArray
 
std::string m_muonquality
 
std::string m_calibration_version
 
std::string m_custom_dir
 
std::string m_binning
 
bool m_allowZeroSF
 
bool m_experimental
 
int m_forceYear
 
std::string m_forcePeriod
 
std::vector< std::string > m_replicaTriggerList
 
std::set< std::string > m_replicaSet
 
int m_nReplicas
 
int m_ReplicaRandomSeed
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Static Private Attributes

static const std::map< unsigned int, int > m_runNumber_year
 

Detailed Description

Definition at line 30 of file MuonTriggerScaleFactors.h.

Member Typedef Documentation

◆ EfficiencyMap

Definition at line 92 of file MuonTriggerScaleFactors.h.

◆ EffiHistoIdent

typedef std::pair<YearPeriod, unsigned int> CP::MuonTriggerScaleFactors::EffiHistoIdent
private

Definition at line 91 of file MuonTriggerScaleFactors.h.

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

◆ YearPeriod

typedef std::pair<unsigned int, std::string> CP::MuonTriggerScaleFactors::YearPeriod
private

Definition at line 90 of file MuonTriggerScaleFactors.h.

Constructor & Destructor Documentation

◆ MuonTriggerScaleFactors()

CP::MuonTriggerScaleFactors::MuonTriggerScaleFactors ( const std::string &  name)

Definition at line 42 of file MuonTriggerScaleFactors.cxx.

42  :
44  m_systFilter(),
45  m_appliedSystematics(nullptr),
46  m_fileName(),
49  m_muonquality("Medium"),
50  m_calibration_version("240717_mc23ad"),
51  m_custom_dir(),
52  m_binning("fine"),
53  m_allowZeroSF(false),
54  m_experimental(false),
55  m_forceYear(-1),
56  m_forcePeriod(""),
58  m_replicaSet(),
59  m_nReplicas(100),
60  m_ReplicaRandomSeed(12345) {
61 
62  declareProperty("MuonQuality", m_muonquality); // HighPt,Tight,Medium,Loose,LowPt
63  declareProperty("CalibrationRelease", m_calibration_version);
64  // these are for debugging / testing, *not* for general use!
65  declareProperty("filename", m_fileName);
66  declareProperty("CustomInputFolder", m_custom_dir);
67  declareProperty("Binning", m_binning); // fine or coarse
68  declareProperty("UseExperimental", m_experimental); // enable experimental features like single muon SF
69  //Properties needed for TOY setup for a given trigger: No replicas if m_replicaTriggerList is empty
70  declareProperty("ReplicaTriggerList", m_replicaTriggerList, "List of triggers on which we want to generate stat. uncertainty toy replicas.");
71  declareProperty("NReplicas", m_nReplicas, "Number of generated toy replicas, if replicas are required.");
72  declareProperty("ReplicaRandomSeed", m_ReplicaRandomSeed, "Random seed for toy replica generation.");
73  declareProperty("AllowZeroSF", m_allowZeroSF, "If a trigger is not available will return 0 instead of throwing an error. More difficult to spot configuration issues. Use at own risk");
74  declareProperty("forceYear", m_forceYear, "Only for developers. Never use this in any analysis!!!!!!");
75  declareProperty("forcePeriod", m_forcePeriod, "Only for developers. Never use this in any analysis!!!!!!");
76  }

◆ ~MuonTriggerScaleFactors()

CP::MuonTriggerScaleFactors::~MuonTriggerScaleFactors ( )
virtual

Definition at line 78 of file MuonTriggerScaleFactors.cxx.

78 { }

Member Function Documentation

◆ affectingSystematics()

CP::SystematicSet CP::MuonTriggerScaleFactors::affectingSystematics ( ) const
virtual

returns: the list of all systematics this tool can be affected by

Implements CP::IReentrantSystematicsTool.

Definition at line 867 of file MuonTriggerScaleFactors.cxx.

867  {
868  CP::SystematicSet mySysSet;
869 
870  mySysSet.insert(CP::SystematicVariation("MUON_EFF_TrigSystUncertainty", 1));
871  mySysSet.insert(CP::SystematicVariation("MUON_EFF_TrigSystUncertainty", -1));
872 
873  //Consider full statUncertainty if TOY replicas are not used
874  if (m_replicaTriggerList.size() == 0) {
875  mySysSet.insert(CP::SystematicVariation("MUON_EFF_TrigStatUncertainty", 1));
876  mySysSet.insert(CP::SystematicVariation("MUON_EFF_TrigStatUncertainty", -1));
877  } else {
878  for (int i = 0; i < m_nReplicas; ++i) { //TOFIX Hack with just up variations! needs ASG reserved words for a clean handling//+++++++
879  mySysSet.insert(CP::SystematicVariation(Form("MUON_EFF_Trig_MCTOY%03d", i), 1));
880  }
881  }
882 
883  return mySysSet;
884  }

◆ appliedSystematics()

const CP::SystematicSet& CP::MuonTriggerScaleFactors::appliedSystematics ( ) const
inlineprivate

Definition at line 74 of file MuonTriggerScaleFactors.h.

74  {
75  return *m_appliedSystematics;
76  }

◆ applySystematicVariation()

StatusCode CP::MuonTriggerScaleFactors::applySystematicVariation ( const CP::SystematicSet systConfig)
virtual

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

Implements CP::ISystematicsTool.

Definition at line 901 of file MuonTriggerScaleFactors.cxx.

901  {
902  // First, check if we already know this systematic configuration
903  auto itr = m_systFilter.find(systConfig);
904 
905  // If it's a new input set, we need to filter it
906  if (itr == m_systFilter.end()) {
907 
908  // New systematic. We need to parse it.
909  static const CP::SystematicSet affectingSys = affectingSystematics();
910  CP::SystematicSet filteredSys;
911  if (!CP::SystematicSet::filterForAffectingSystematics(systConfig, affectingSys, filteredSys)) {
912  ATH_MSG_ERROR("Unsupported combination of systematics passed to the tool!");
913  return StatusCode::FAILURE;
914  }
915 
916  // Insert filtered set into the map
917  itr = m_systFilter.insert(std::make_pair(systConfig, filteredSys)).first;
918  }
919 
920  CP::SystematicSet& mySysConf = itr->second;
921 
922  // Check to see if the set of variations tries to add in the uncertainty up and down. Since the errors
923  // are symetric this would result in 0 and so should not be done.
924  static const CP::SystematicVariation stat_up("MUON_EFF_TrigStatUncertainty", 1);
925  static const CP::SystematicVariation stat_down("MUON_EFF_TrigStatUncertainty", -1);
926  static const CP::SystematicVariation syst_up("MUON_EFF_TrigSystUncertainty", 1);
927  static const CP::SystematicVariation syst_down("MUON_EFF_TrigSystUncertainty", -1);
928 
929  if ((mySysConf.matchSystematic(stat_up) && mySysConf.matchSystematic(stat_down)) || (mySysConf.matchSystematic(syst_up) && mySysConf.matchSystematic(syst_down))) {
930  return StatusCode::FAILURE;
931  }
932 
933  m_appliedSystematics = &mySysConf;
934  return StatusCode::SUCCESS;
935  }

◆ declareGaudiProperty() [1/4]

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

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

Definition at line 170 of file AthCommonDataStore.h.

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

◆ declareGaudiProperty() [2/4]

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

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

Definition at line 156 of file AthCommonDataStore.h.

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

◆ declareGaudiProperty() [3/4]

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

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

Definition at line 184 of file AthCommonDataStore.h.

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

◆ declareGaudiProperty() [4/4]

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

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

Definition at line 199 of file AthCommonDataStore.h.

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

◆ declareProperty() [1/6]

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

Declare a new Gaudi property.

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

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

Definition at line 245 of file AthCommonDataStore.h.

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

◆ declareProperty() [2/6]

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

Declare a new Gaudi property.

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

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

Definition at line 221 of file AthCommonDataStore.h.

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

◆ declareProperty() [3/6]

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

Definition at line 259 of file AthCommonDataStore.h.

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

◆ declareProperty() [4/6]

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

Declare a new Gaudi property.

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

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

Definition at line 333 of file AthCommonDataStore.h.

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

◆ declareProperty() [5/6]

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

Declare a new Gaudi property.

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

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

Definition at line 352 of file AthCommonDataStore.h.

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

◆ declareProperty() [6/6]

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

Definition at line 145 of file AthCommonDataStore.h.

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

◆ detStore()

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

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

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ encodeHistoName() [1/2]

unsigned int CP::MuonTriggerScaleFactors::encodeHistoName ( const std::string &  period,
const std::string &  Trigger,
bool  isData,
const std::string &  Systematic,
bool  isBarrel = true 
) const
private

Definition at line 390 of file MuonTriggerScaleFactors.cxx.

390  {
391  //keep the string as short as possible
392  const std::string histName = period + "_" + Trigger + "_" + (isBarrel ? "b" : "e") + "_" + (isData ? "data" : "mc") + Systematic;
393  return std::hash<std::string>()(histName);
394  }

◆ encodeHistoName() [2/2]

unsigned int CP::MuonTriggerScaleFactors::encodeHistoName ( const std::string &  Trigger,
const TrigMuonEff::Configuration configuration,
const std::string &  Systematic,
bool  isBarrel = true 
) const
private

Definition at line 396 of file MuonTriggerScaleFactors.cxx.

396  {
397  //keep the string as short as possible
398  return encodeHistoName(getDataPeriod(), Trigger, configuration.isData, Systematic, isBarrel);
399 
400  }

◆ evtStore() [1/2]

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

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

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

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

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

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ extraDeps_update_handler()

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

Add StoreName to extra input/output deps as needed.

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

◆ generateReplicas()

std::vector< TH1_Ptr > CP::MuonTriggerScaleFactors::generateReplicas ( TH1_Ptr  h,
int  nrep,
int  seed 
) const
private

Definition at line 345 of file MuonTriggerScaleFactors.cxx.

345  {
346  TRandom3 Rndm(seed);
347  std::vector<TH1_Ptr> replica_v;
348  const int xbins = h->GetNbinsX(), ybins = h->GetNbinsY();
349 
350  for (int t = 0; t < nrep; ++t) {
351  TH2* replica = dynamic_cast<TH2*>(h->Clone(Form("rep%d_%s", t, h->GetName())));
352 
353  for (int x_i = 0; x_i <= xbins; ++x_i) {
354  for (int y_i = 0; y_i <= ybins; ++y_i) {
355  replica->SetBinContent(x_i, y_i, Rndm.Gaus(h->GetBinContent(x_i, y_i), h->GetBinError(x_i, y_i)));
356  }
357  }
358  replica_v.push_back(TH1_Ptr(replica));
359  }
360  return replica_v;
361  }

◆ getBinNumber()

int CP::MuonTriggerScaleFactors::getBinNumber ( const xAOD::Muon muon,
const std::string &  trigger 
) const
virtual

Implements CP::IMuonTriggerScaleFactors.

Definition at line 368 of file MuonTriggerScaleFactors.cxx.

368  {
369  if(!m_experimental){
370  ATH_MSG_ERROR("MuonTriggerScaleFactors::getTriggerScaleFactor This is an experimental function. If you really know what you are doing set UseExperimental property.");
371  return CorrectionCode::Error;
372  }
373 
374  const double mu_eta = muon.eta();
375  const double mu_phi = muon.phi();
376  bool isBarrel = std::abs(mu_eta) < muon_barrel_endcap_boundary;
377  TH1_Ptr cit = getEfficiencyHistogram(trigger, true, "nominal", isBarrel);
378  if(!cit.get()){
379  if(!m_allowZeroSF)
380  ATH_MSG_ERROR("Could not find efficiency map for muon with eta: " << mu_eta << " and phi: " << mu_phi << ". Something is inconsistent. Please check your settings for year, mc and trigger." );
381  return -1;
382  }
383  auto eff_h2 = cit;
384  double mu_phi_corr = mu_phi;
385  if (mu_phi_corr < eff_h2->GetYaxis()->GetXmin()) mu_phi_corr += 2.0 * M_PI;
386  if (mu_phi_corr > eff_h2->GetYaxis()->GetXmax()) mu_phi_corr -= 2.0 * M_PI;
387  return eff_h2->FindFixBin(mu_eta, mu_phi_corr);
388  }

◆ getDataPeriod() [1/3]

std::string CP::MuonTriggerScaleFactors::getDataPeriod ( ) const
protected

Definition at line 735 of file MuonTriggerScaleFactors.cxx.

735  {
736  return getDataPeriod(getRunNumber());
737  }

◆ getDataPeriod() [2/3]

std::string CP::MuonTriggerScaleFactors::getDataPeriod ( unsigned int  run) const
protected

Definition at line 739 of file MuonTriggerScaleFactors.cxx.

739  {
740  return getDataPeriod(run, getYear(run));
741  }

◆ getDataPeriod() [3/3]

std::string CP::MuonTriggerScaleFactors::getDataPeriod ( unsigned int  runNumber,
unsigned int  year 
) const
protected

◆ getDimuonEfficiency()

CorrectionCode CP::MuonTriggerScaleFactors::getDimuonEfficiency ( Double_t &  eff,
const TrigMuonEff::Configuration configuration,
const xAOD::MuonContainer mucont,
const std::string &  chain,
const std::string &  systematic 
) const
privatevirtual

Definition at line 676 of file MuonTriggerScaleFactors.cxx.

676  {
677 
678  std::string trigger = getTriggerCorrespondingToDimuonTrigger(chain);
679  Int_t threshold;
680  CorrectionCode result = getThreshold(threshold, trigger);
681  if (result != CorrectionCode::Ok) return result;
682 
684  xAOD::MuonContainer::const_iterator mu2 = mucont.begin() + 1;
685 
686  Double_t eff1 = 0;
687  if ((**mu1).pt() > threshold) {
688  CorrectionCode result1 = getMuonEfficiency(eff1, configuration, (**mu1), trigger, systematic);
689  if (result1 != CorrectionCode::Ok) return result1;
690  }
691  Double_t eff2 = 0;
692  if ((**mu2).pt() > threshold) {
693  CorrectionCode result2 = getMuonEfficiency(eff2, configuration, (**mu2), trigger, systematic);
694  if (result2 != CorrectionCode::Ok) return result2;
695  }
696 
697  eff = eff1 * eff2;
698  return CorrectionCode::Ok;
699  }

◆ getEfficiencyHistogram() [1/2]

TH1_Ptr CP::MuonTriggerScaleFactors::getEfficiencyHistogram ( const std::string &  trigger,
bool  isData,
const std::string &  Systematic,
bool  isBarrel = true 
) const
protectedvirtual

Definition at line 410 of file MuonTriggerScaleFactors.cxx.

410  {
411  unsigned int run = getRunNumber();
412  return getEfficiencyHistogram(getYear(run), getDataPeriod(run), trigger, isData, Systematic, isBarrel);
413  }

◆ getEfficiencyHistogram() [2/2]

TH1_Ptr CP::MuonTriggerScaleFactors::getEfficiencyHistogram ( unsigned int  year,
const std::string &  period,
const std::string &  trigger,
bool  isData,
const std::string &  Systematic,
bool  isBarrel = true 
) const
protectedvirtual

Definition at line 401 of file MuonTriggerScaleFactors.cxx.

401  {
403  EfficiencyMap::const_iterator Itr = m_efficiencyMap.find(Ident);
404 
405  if (Itr == m_efficiencyMap.end()) {
406  return TH1_Ptr();
407  }
408  return Itr->second;
409  }

◆ getKey()

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

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

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

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

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

Definition at line 119 of file AsgTool.cxx.

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

◆ getMuonEfficiency()

CorrectionCode CP::MuonTriggerScaleFactors::getMuonEfficiency ( Double_t &  eff,
const TrigMuonEff::Configuration configuration,
const xAOD::Muon muon,
const std::string &  trigger,
const std::string &  systematic 
) const
privatevirtual

Definition at line 415 of file MuonTriggerScaleFactors.cxx.

415  {
416  const double mu_eta = muon.eta();
417  const double mu_phi = muon.phi();
418  bool isBarrel = std::abs(mu_eta) < muon_barrel_endcap_boundary;
419 
420  TH1_Ptr eff_h2 = nullptr;
421  if (configuration.replicaIndex >= 0) { //Only look into the replicas if asking for them
422 
423  unsigned int run = getRunNumber();
425  std::map<EffiHistoIdent, std::vector<TH1_Ptr> >::const_iterator cit = m_efficiencyMapReplicaArray.find(Ident);
426  if (cit == m_efficiencyMapReplicaArray.end()) {
427  if (m_allowZeroSF) {
428  ATH_MSG_WARNING("Could not find what you are looking for in the efficiency map. The trigger you are looking for, year and mc are not consistent, or the trigger is unavailable in this data period. Returning efficiency = 0.");
429  eff = 0.;
430  return CorrectionCode::Ok;
431  }
432 
433  else {
434  ATH_MSG_ERROR("Could not find what you are looking for in the efficiency map. The trigger you are looking for, year and mc are not consistent, or the trigger is unavailable in this data period. Please check how you set up the tool.");
436  }
437  }
438 
439  if (configuration.replicaIndex >= (int) cit->second.size()) {
440  ATH_MSG_ERROR("MuonTriggerScaleFactors::getMuonEfficiency ; index for replicated histograms is out of range.");
442  }
443 
444  eff_h2 = cit->second[configuration.replicaIndex];
445  } else { //Standard case, look into the usual eff map
446  TH1_Ptr cit = getEfficiencyHistogram(trigger, configuration.isData, systematic, isBarrel);
447  if (cit.get() == nullptr) {
448  if (m_allowZeroSF) {
449  ATH_MSG_WARNING("Could not find what you are looking for in the efficiency map. The trigger you are looking for, year and mc are not consistent, or the trigger is unavailable in this data period. Returning efficiency = 0.");
450  eff = 0.;
451  return CorrectionCode::Ok;
452  } else {
453  ATH_MSG_ERROR("Could not find what you are looking for in the efficiency map. The trigger you are looking for, year and mc are not consistent, or the trigger is unavailable in this data period. Please check how you set up the tool.");
455  }
456  }
457  eff_h2 = cit;
458  }
459 
460  double mu_phi_corr = mu_phi;
461  if (mu_phi_corr < eff_h2->GetYaxis()->GetXmin()) mu_phi_corr += 2.0 * M_PI;
462  if (mu_phi_corr > eff_h2->GetYaxis()->GetXmax()) mu_phi_corr -= 2.0 * M_PI;
463 
464  const int bin = eff_h2->FindFixBin(mu_eta, mu_phi_corr);
465  const double efficiency = eff_h2->GetBinContent(bin);
466 
467  eff = efficiency;
468 
469  ATH_MSG_DEBUG("getMuonEfficiency [eta,phi,phi_corr]=[" << mu_eta << "," << mu_phi << "," << mu_phi_corr << "], ibin=" << bin << " eff=" << eff);
470 
471  return CorrectionCode::Ok;
472 
473  }

◆ getName()

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

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

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

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

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

Definition at line 106 of file AsgTool.cxx.

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

◆ getProperty()

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

Get one of the tool's properties.

◆ getReplica_index()

int CP::MuonTriggerScaleFactors::getReplica_index ( const std::string &  sysBaseName,
const std::string &  trigStr 
) const
virtual

Definition at line 281 of file MuonTriggerScaleFactors.cxx.

281  {
282  if (m_replicaSet.find(trigStr) == m_replicaSet.end()) return -1; //No toys for this trigger
283  std::size_t pos = sysBaseName.find("MCTOY");
284  if (pos == std::string::npos) return -1; //sys variation not affected by TOYS
285  return atoi(sysBaseName.substr(pos + 5, pos + 8).c_str()); //toys for this trigger are around get the 3-digit number
286  }

◆ getRunNumber()

unsigned int CP::MuonTriggerScaleFactors::getRunNumber ( ) const
protected

Definition at line 812 of file MuonTriggerScaleFactors.cxx.

812  {
813  static const SG::AuxElement::ConstAccessor<unsigned int> acc_rnd("RandomRunNumber");
815  if (info.operator->()==nullptr) {
816  ATH_MSG_FATAL("Could not retrieve the xAOD::EventInfo with name: " << m_eventInfo.key() << ". Exiting the code.");
817  throw std::invalid_argument{""};
818  }
819  if (!info->eventType(xAOD::EventInfo::IS_SIMULATION)) {
820  ATH_MSG_DEBUG("The current event is a data event. Return runNumber instead.");
821  return info->runNumber();
822  }
823  if (!acc_rnd.isAvailable(*info)) {
824  if(m_forceYear == -1 && m_forcePeriod == "")
825  ATH_MSG_FATAL("Failed to find the RandomRunNumber decoration. Please call the apply() method from the PileupReweightingTool beforehand in order to get period dependent SFs");
826  throw std::invalid_argument{""};
827  } else if (acc_rnd(*info) == 0) {
828  ATH_MSG_FATAL("Pile up tool has given runNumber 0. Exiting the code.");
829  throw std::invalid_argument{""};
830  }
831 
832  // standard behaviour for MC, get the random RunNumber
833  return acc_rnd(*info);
834  }

◆ getTemporaryDirectory()

TDirectory * CP::MuonTriggerScaleFactors::getTemporaryDirectory ( void  ) const
private

Definition at line 836 of file MuonTriggerScaleFactors.cxx.

836  {
837  gROOT->cd();
838  TDirectory* tempDir = 0;
839  int counter = 0;
840  while (not tempDir) {
841  std::stringstream dirname;
842  dirname << "MuonTriggerScaleFactorsTempDir_%i" << counter;
843  if (gROOT->GetDirectory((dirname.str()).c_str())) {
844  ++counter;
845  continue;
846  }
847  tempDir = gROOT->mkdir((dirname.str()).c_str());
848  if (not tempDir) {
849  ATH_MSG_ERROR("getTemporaryDirectory::Temporary directory could not be created");
850  }
851  }
852  return tempDir;
853  }

◆ getThreshold()

CorrectionCode CP::MuonTriggerScaleFactors::getThreshold ( Int_t &  threshold,
const std::string &  trigger 
) const
private

Definition at line 707 of file MuonTriggerScaleFactors.cxx.

707  {
708  std::size_t index = trigger.find("HLT_mu");
709  if (index != std::string::npos) {
710  std::string rawNumber = trigger.substr(index + 6);
711  if (!rawNumber.empty() && isdigit(rawNumber[0])) {
712  std::stringstream(rawNumber) >> threshold;
713  if (threshold < 10) threshold = 10000;
714  else threshold = (threshold + 1) * 1000;
715  return CorrectionCode::Ok;
716  }
717  }
718  ATH_MSG_ERROR("MuonTriggerScaleFactors::getThreshold Could not extract threshold for trigger " << trigger);
719  return CorrectionCode::Error;
720  }

◆ getTriggerCorrespondingToDimuonTrigger()

std::string CP::MuonTriggerScaleFactors::getTriggerCorrespondingToDimuonTrigger ( const std::string &  trigger) const
private

Definition at line 701 of file MuonTriggerScaleFactors.cxx.

701  {
702  if (trigger.find("2mu10") != std::string::npos) return "HLT_mu10";
703  if (trigger.find("2mu14") != std::string::npos) return "HLT_mu14";
704  throw std::runtime_error("Unknown dimuon trigger");
705  }

◆ getTriggerEfficiency()

CorrectionCode CP::MuonTriggerScaleFactors::getTriggerEfficiency ( const xAOD::Muon mu,
Double_t &  efficiency,
const std::string &  trigger,
Bool_t  dataType 
) const
virtual

Implements CP::IMuonTriggerScaleFactors.

Definition at line 288 of file MuonTriggerScaleFactors.cxx.

288  {
289  if (trigger.empty()) {
290  ATH_MSG_ERROR("MuonTriggerScaleFactors::getTriggerEfficiency Trigger must have value.");
291  return CorrectionCode::Error;
292  }
293  TrigMuonEff::Configuration configuration;
294  configuration.isData = dataType;
295  configuration.replicaIndex = -1;
296  Int_t threshold;
297  CorrectionCode result = getThreshold(threshold, trigger);
298  if (result != CorrectionCode::Ok) return result;
299  if (mu.pt() < threshold) {
300  efficiency = 0;
301  return CorrectionCode::Ok;
302  }
303 
304  // Pre-define uncertainty variations
305  static const CP::SystematicVariation stat_up("MUON_EFF_TrigStatUncertainty", 1);
306  static const CP::SystematicVariation stat_down("MUON_EFF_TrigStatUncertainty", -1);
307  static const CP::SystematicVariation syst_up("MUON_EFF_TrigSystUncertainty", 1);
308  static const CP::SystematicVariation syst_down("MUON_EFF_TrigSystUncertainty", -1);
309 
310  std::string systype = "";
311  if (appliedSystematics().matchSystematic(syst_down) && !dataType) {
312  systype = "syst_down";
313  } else if (appliedSystematics().matchSystematic(syst_up) && !dataType) {
314  systype = "syst_up";
315  } else if (appliedSystematics().matchSystematic(stat_down)) {
316  systype = "stat_down";
317  } else if (appliedSystematics().matchSystematic(stat_up)) {
318  systype = "stat_up";
319  } else {
320  systype = "nominal";
321  }
322 
323  // Toys, if found, will overwrite the data hists stat with the generated toy
324  //+++++++++++++
325  // The best way is the use of filterByName with the 000MCTOY at the end. See:
326  // if( !(appliedSystematics().filterByBaseName("MUON_EFF_Trig_MCTOY000")).empty()){//The following is a hack!!!
327  //++++++++++THE FOLLOWING IS A PARTIAL HACK!!!
328  if (!appliedSystematics().empty() && configuration.isData == true) {
329  configuration.replicaIndex = getReplica_index(appliedSystematics().begin()->basename(), trigger);
330  if (configuration.replicaIndex != -1) systype = "replicas";
331  }
332  CorrectionCode cc = getMuonEfficiency(efficiency, configuration, mu, trigger, systype);
333  return cc;
334  }

◆ getTriggerScaleFactor() [1/2]

CorrectionCode CP::MuonTriggerScaleFactors::getTriggerScaleFactor ( const xAOD::Muon muon,
Double_t &  triggersf,
const std::string &  trigger 
) const
virtual

Implements CP::IMuonTriggerScaleFactors.

Definition at line 232 of file MuonTriggerScaleFactors.cxx.

232  {
233  if(!m_experimental){
234  ATH_MSG_ERROR("MuonTriggerScaleFactors::getTriggerScaleFactor This is an experimental function. If you really know what you are doing set UseExperimental property.");
235  return CorrectionCode::Error;
236  }
237 
238  if (trigger.empty()) {
239  ATH_MSG_ERROR("MuonTriggerScaleFactors::getTriggerScaleFactor Trigger must have value.");
240  return CorrectionCode::Error;
241  }
242 
243  TrigMuonEff::Configuration configuration;
244 
245  if (trigger == "HLT_mu8noL1")
246  ATH_MSG_WARNING("What you are trying to do is not correct. For di-muon triggers you should get the efficiency with getTriggerEfficiency and compute the SF by yourself.");
247  else if (trigger.find("HLT_2mu10") != std::string::npos || trigger.find("HLT_2mu14") != std::string::npos)
248  ATH_MSG_WARNING("Di-muon trigger scale factors for single reco muons are not supported!");
249  else
250  return GetTriggerSF(triggersf, configuration, muon, trigger);
251  return CorrectionCode::Ok;
252  }

◆ getTriggerScaleFactor() [2/2]

CorrectionCode CP::MuonTriggerScaleFactors::getTriggerScaleFactor ( const xAOD::MuonContainer mucont,
Double_t &  triggersf,
const std::string &  trigger 
) const
virtual

Implements CP::IMuonTriggerScaleFactors.

Definition at line 254 of file MuonTriggerScaleFactors.cxx.

254  {
255  if (trigger.empty()) {
256  ATH_MSG_ERROR("MuonTriggerScaleFactors::getTriggerScaleFactor Trigger must have value.");
257  return CorrectionCode::Error;
258  }
259 
260  TrigMuonEff::Configuration configuration;
261 
262  if (trigger == "HLT_mu8noL1") {
263  ATH_MSG_WARNING("What you are trying to do is not correct. For di-muon triggers you should get the efficiency with getTriggerEfficiency and compute the SF by yourself.");
264  }
265  else if (trigger.find("HLT_2mu10") != std::string::npos || trigger.find("HLT_2mu14") != std::string::npos) {
266  CorrectionCode cc = GetTriggerSF_dimu(triggersf, configuration, mucont, trigger);
267  return cc;
268  } else {
269  CorrectionCode cc = GetTriggerSF(triggersf, configuration, mucont, trigger);
270  return cc;
271  }
272  return CorrectionCode::Ok;
273  }

◆ GetTriggerSF() [1/2]

CorrectionCode CP::MuonTriggerScaleFactors::GetTriggerSF ( Double_t &  TriggerSF,
TrigMuonEff::Configuration configuration,
const xAOD::Muon muon,
const std::string &  trigger 
) const
privatevirtual

Definition at line 613 of file MuonTriggerScaleFactors.cxx.

613  {
614  Int_t threshold;
615  CorrectionCode result = getThreshold(threshold, trigger);
616  if (result != CorrectionCode::Ok)
617  return result;
618 
619  double eff_data = 0., eff_mc = 0.;
620 
621  if (mu.pt() < threshold) {
622  eff_data = 0.;
623  eff_mc = 0.;
624  TriggerSF = 1.;
625  return CorrectionCode::Ok;
626  }
627 
628  std::string muon_trigger_name = trigger;
629  std::string data_err = "";
630  std::string mc_err = "";
631 
632  // Pre-define uncertainty variations
633  static const CP::SystematicVariation stat_up("MUON_EFF_TrigStatUncertainty", 1);
634  static const CP::SystematicVariation stat_down("MUON_EFF_TrigStatUncertainty", -1);
635  static const CP::SystematicVariation syst_up("MUON_EFF_TrigSystUncertainty", 1);
636  static const CP::SystematicVariation syst_down("MUON_EFF_TrigSystUncertainty", -1);
637 
638  if (appliedSystematics().matchSystematic(syst_down)) {
639  data_err = "nominal";
640  mc_err = "syst_up";
641  } else if (appliedSystematics().matchSystematic(syst_up)) {
642  data_err = "nominal";
643  mc_err = "syst_down";
644  } else if (appliedSystematics().matchSystematic(stat_down)) {
645  data_err = "stat_down";
646  mc_err = "nominal";
647  } else if (appliedSystematics().matchSystematic(stat_up)) {
648  data_err = "stat_up";
649  mc_err = "nominal";
650  } else {
651  data_err = "nominal";
652  mc_err = "nominal";
653  }
654 
655  if (!appliedSystematics().empty()) {
656  configuration.replicaIndex = getReplica_index(appliedSystematics().begin()->basename(), trigger);
657  if (configuration.replicaIndex != -1) data_err = "replicas";
658  }
659 
660  configuration.isData = true;
661  CorrectionCode result_data = getMuonEfficiency(eff_data, configuration, mu, muon_trigger_name, data_err);
662  if (result_data != CorrectionCode::Ok)
663  return result_data;
664  configuration.isData = false;
665  configuration.replicaIndex = -1;
666  CorrectionCode result_mc = getMuonEfficiency(eff_mc, configuration, mu, muon_trigger_name, mc_err);
667  if (result_mc != CorrectionCode::Ok)
668  return result_mc;
669  if (eff_data == 0)
670  TriggerSF = 0;
671  if (std::abs(eff_mc) > 0.0001)
672  TriggerSF = eff_data / eff_mc;
673  return CorrectionCode::Ok;
674  }

◆ GetTriggerSF() [2/2]

CorrectionCode CP::MuonTriggerScaleFactors::GetTriggerSF ( Double_t &  TriggerSF,
TrigMuonEff::Configuration configuration,
const xAOD::MuonContainer mucont,
const std::string &  trigger 
) const
privatevirtual

Definition at line 534 of file MuonTriggerScaleFactors.cxx.

534  {
535  Int_t threshold;
536  CorrectionCode result = getThreshold(threshold, trigger);
537  if (result != CorrectionCode::Ok) return result;
538 
539  double rate_not_fired_data = 1.;
540  double rate_not_fired_mc = 1.;
541 
542  for (const auto mu : mucont) {
543 
544  double eff_data = 0., eff_mc = 0.;
545 
546  if (mu->pt() < threshold) {
547 
548  eff_data = 0.;
549  eff_mc = 0.;
550 
551  } else {
552 
553  std::string muon_trigger_name = trigger;
554  std::string data_err = "";
555  std::string mc_err = "";
556 
557  // Pre-define uncertainty variations
558  static const CP::SystematicVariation stat_up("MUON_EFF_TrigStatUncertainty", 1);
559  static const CP::SystematicVariation stat_down("MUON_EFF_TrigStatUncertainty", -1);
560  static const CP::SystematicVariation syst_up("MUON_EFF_TrigSystUncertainty", 1);
561  static const CP::SystematicVariation syst_down("MUON_EFF_TrigSystUncertainty", -1);
562 
563  if (appliedSystematics().matchSystematic(syst_down)) {
564  data_err = "nominal";
565  mc_err = "syst_up";
566  } else if (appliedSystematics().matchSystematic(syst_up)) {
567  data_err = "nominal";
568  mc_err = "syst_down";
569  } else if (appliedSystematics().matchSystematic(stat_down)) {
570  data_err = "stat_down";
571  mc_err = "nominal";
572  } else if (appliedSystematics().matchSystematic(stat_up)) {
573  data_err = "stat_up";
574  mc_err = "nominal";
575  } else {
576  data_err = "nominal";
577  mc_err = "nominal";
578  }
579 
580  //Toys, if found, will overwrite the data hists, on which toys for stat uncertainty have been generated
581  //+++++++++++++
582  //The best way is the use of filterByName with the 000MCTOY at the end. See:
583  // if( !(appliedSystematics().filterByBaseName("MUON_EFF_Trig_MCTOY000")).empty()){//The following is a hack!!!
584  //++++++++++The following is a hack!!!
585  if (!appliedSystematics().empty()) {
586  configuration.replicaIndex = getReplica_index(appliedSystematics().begin()->basename(), trigger);
587  if (configuration.replicaIndex != -1) data_err = "replicas";
588  }
589 
590  configuration.isData = true;
591  CorrectionCode result_data = getMuonEfficiency(eff_data, configuration, *mu, muon_trigger_name, data_err);
592  if (result_data != CorrectionCode::Ok) return result_data;
593  configuration.isData = false;
594  configuration.replicaIndex = -1;
595  CorrectionCode result_mc = getMuonEfficiency(eff_mc, configuration, *mu, muon_trigger_name, mc_err);
596  if (result_mc != CorrectionCode::Ok) return result_mc;
597  }
598  rate_not_fired_data *= (1. - eff_data);
599  rate_not_fired_mc *= (1. - eff_mc);
600  }
601 
602  double event_SF = 1.;
603  if (1 - rate_not_fired_data == 0) event_SF = 0;
604  if ((mucont.size()) and (std::abs(1. - rate_not_fired_mc) > 0.0001)) {
605 
606  event_SF = (1. - rate_not_fired_data) / (1. - rate_not_fired_mc);
607  }
608  TriggerSF = event_SF;
609 
610  return CorrectionCode::Ok;
611  }

◆ GetTriggerSF_dimu()

CorrectionCode CP::MuonTriggerScaleFactors::GetTriggerSF_dimu ( Double_t &  TriggerSF,
TrigMuonEff::Configuration configuration,
const xAOD::MuonContainer mucont,
const std::string &  trigger 
) const
privatevirtual

Definition at line 475 of file MuonTriggerScaleFactors.cxx.

475  {
476 
477  if (mucont.size() != 2) {
478  ATH_MSG_FATAL("MuonTriggerScaleFactors::GetTriggerSF;Currently dimuon trigger chains only implemented for events with exactly 2 muons.");
479  }
480  ATH_MSG_DEBUG("The trigger that you choose : " << trigger);
481 
482  Double_t eff_data = 0;
483  Double_t eff_mc = 0;
484 
485  std::string data_err = "";
486  std::string mc_err = "";
487 
488  if (appliedSystematics().matchSystematic(CP::SystematicVariation("MUON_EFF_TrigSystUncertainty", -1))) {
489  data_err = "nominal";
490  mc_err = "syst_up";
491  } else if (appliedSystematics().matchSystematic(CP::SystematicVariation("MUON_EFF_TrigSystUncertainty", 1))) {
492  data_err = "nominal";
493  mc_err = "syst_down";
494  } else if (appliedSystematics().matchSystematic(CP::SystematicVariation("MUON_EFF_TrigStatUncertainty", -1))) {
495  data_err = "stat_down";
496  mc_err = "nominal";
497  } else if (appliedSystematics().matchSystematic(CP::SystematicVariation("MUON_EFF_TrigStatUncertainty", 1))) {
498  data_err = "stat_up";
499  mc_err = "nominal";
500  } else {
501  data_err = "nominal";
502  mc_err = "nominal";
503  }
504 
505  //Toys, if found, will overwrite the data hists with the sys generated with one toy
506  //+++++++++++++
507  //The best way is the use of filterByName with the 000MCTOY at the end. See:
508  // if( !(appliedSystematics().filterByBaseName("MUON_EFF_Trig_MCTOY000")).empty()){//The following is a hack!!!
509  //++++++++++THE FOLLOWING IS A PARTIAL HACK!!!
510  if (!appliedSystematics().empty()) {
511  configuration.replicaIndex = getReplica_index(appliedSystematics().begin()->basename(), trigger);
512  if (configuration.replicaIndex != -1) data_err = "replicas";
513  }
514 
515  configuration.isData = true;
516  CorrectionCode result = getDimuonEfficiency(eff_data, configuration, mucont, trigger, data_err);
517  if (result != CorrectionCode::Ok) return result;
518 
519  configuration.isData = false;
520  configuration.replicaIndex = -1;
521  result = getDimuonEfficiency(eff_mc, configuration, mucont, trigger, mc_err);
522  if (result != CorrectionCode::Ok) return result;
523 
524  double event_SF = 1.;
525 
526  if (std::abs(1. - eff_mc) > 0.0001) {
527  event_SF = eff_data / eff_mc;
528  }
529 
530  TriggerSF = event_SF;
531  return CorrectionCode::Ok;
532  }

◆ getYear()

unsigned int CP::MuonTriggerScaleFactors::getYear ( unsigned int  run) const
protected

Definition at line 722 of file MuonTriggerScaleFactors.cxx.

722  {
723  if(m_forceYear != -1){
724  return m_forceYear;
725  }
726 
727  int year=2050;
728  auto lower = m_runNumber_year.lower_bound(run);
729  if (lower != m_runNumber_year.end()){
730  year=lower->second;
731  }
732  return year;
733  }

◆ initialize()

StatusCode CP::MuonTriggerScaleFactors::initialize ( void  )
virtual

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.

Definition at line 201 of file MuonTriggerScaleFactors.cxx.

201  {
202 
203  ATH_MSG_INFO("MuonQuality = '" << m_muonquality << "'");
204  ATH_MSG_INFO("Binning = '" << m_binning << "'");
205  ATH_MSG_INFO("CalibrationRelease = '" << m_calibration_version << "'");
206  ATH_MSG_INFO("CustomInputFolder = '" << m_custom_dir << "'");
207  ATH_MSG_INFO("AllowZeroSF = " << m_allowZeroSF);
208  ATH_MSG_INFO("experimental = " << m_experimental);
209 
211 
212  if (registerSystematics() != StatusCode::SUCCESS) {
213  return StatusCode::FAILURE;
214  }
215 
216  if (applySystematicVariation(CP::SystematicSet()) != StatusCode::SUCCESS) {
217  ATH_MSG_ERROR("Could not configure for nominal settings");
218  return StatusCode::FAILURE;
219  }
220  // Initialize indexes of replicas for trigges which are asked
221  for (auto trigToy : m_replicaTriggerList)
222  m_replicaSet.insert(trigToy);
223 
224  ATH_MSG_INFO("MuonTriggerScaleFactors::initialize");
225  constexpr auto years_to_run = std::to_array<int>({2015, 2016, 2017, 2018, 2022, 2023});
226  for (const int &year: years_to_run) {
228  }
229  return StatusCode::SUCCESS;
230  }

◆ 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 CP::MuonTriggerScaleFactors::isAffectedBySystematic ( const CP::SystematicVariation systematic) const
virtual

Declare the interface that this class provides.

returns: whether this tool is affected by the given systematics

Implements CP::ISystematicsTool.

Definition at line 858 of file MuonTriggerScaleFactors.cxx.

858  {
859  if (!systematic.empty()) {
861  return sys.find(systematic) != sys.end();
862  }
863  return true;
864  }

◆ isTriggerSupported()

bool CP::MuonTriggerScaleFactors::isTriggerSupported ( const std::string &  trigger) const
virtual

Returns whether the trigger is supported by the tool or not. The decision depends on the present (random)RunNumber.

Implements CP::IMuonTriggerScaleFactors.

Definition at line 363 of file MuonTriggerScaleFactors.cxx.

363  {
364  TH1_Ptr H1 = getEfficiencyHistogram(trigger, true, "nominal");
365  return H1.get() != nullptr;
366  }

◆ LoadTriggerMap()

StatusCode CP::MuonTriggerScaleFactors::LoadTriggerMap ( unsigned int  year)
private

Definition at line 80 of file MuonTriggerScaleFactors.cxx.

80  {
81  std::string fileName = m_fileName;
82  if (fileName.empty()) {
83  if (year == 2015) fileName = "muontrigger_sf_2015_mc20a_v1.root";
84  else if (year == 2016) fileName = "muontrigger_sf_2016_mc20a_v1.root";
85  else if (year == 2017) fileName = "muontrigger_sf_2017_mc20d_v1.root";
86  else if (year == 2018) fileName = "muontrigger_sf_2018_mc20e_v2.root";
87  else if (year == 2022) fileName = "muontrigger_sf_2022_mc23a_v02.root";
88  else if (year == 2023) fileName = "muontrigger_sf_2023_mc23d_v02.root";
89  else{
90  ATH_MSG_WARNING("There is no SF file for year " << year << " yet");
91  return StatusCode::SUCCESS;
92  }
93  }
94 
95  TDirectory* origDir = gDirectory;
96 
97  std::string filePath;
98 
99  if (m_custom_dir.empty()) {
100  filePath = PathResolverFindCalibFile(Form("MuonEfficiencyCorrections/%s/%s", m_calibration_version.c_str(), fileName.c_str()));
101  if (filePath.empty()) {
102  ATH_MSG_ERROR("Unable to resolve the input file " << fileName << " via PathResolver.");
103  }
104  }
105  else {
106  ATH_MSG_INFO("Note: setting up with user specified input file location " << m_custom_dir << " - this is not encouraged!");
107  filePath = PathResolverFindCalibFile(Form("%s/%s", m_custom_dir.c_str(), fileName.c_str()));
108  }
109 
110  TFile* file = TFile::Open(filePath.c_str());
111 
112  if (file == nullptr || !file->IsOpen()) {
113  ATH_MSG_FATAL("MuonTriggerScaleFactors::initialize Couldn't open file " << filePath);
114  return StatusCode::FAILURE;
115  }
116  TDirectory* tempDir = getTemporaryDirectory();
117  tempDir->cd();
118 
119  static const std::vector<std::string> type { "data", "mc" };
120  static const std::vector<std::string> region { "barrel", "endcap" };
121  static const std::vector<std::string> systematic { "nominal", "stat_up", "stat_down", "syst_up", "syst_down" };
122  if(m_muonquality.compare("LowPt") == 0)
123  m_muonquality = "Medium";
124  const std::string quality = m_muonquality;
125  TDirectory* qualityDirectory = file->GetDirectory(m_muonquality.c_str());
126  if (qualityDirectory == nullptr) {
127  ATH_MSG_FATAL("MuonTriggerScaleFactors::initialize cannot find directory with selected quality");
128  return StatusCode::FAILURE;
129  }
130  TKey* periodKey;
131  TIter nextPeriod(qualityDirectory->GetListOfKeys());
132  while ((periodKey = (TKey*) nextPeriod())) {
133  if (not periodKey->IsFolder()) continue;
134  TDirectory* periodDirectory = qualityDirectory->GetDirectory(periodKey->GetName());
135  std::string periodName = std::string(periodKey->GetName());
136  std::string periodName_InMap = periodName.substr(std::string("Period").size(), periodName.size());
137  YearPeriod period = YearPeriod(year, periodName_InMap);
138  TKey* triggerKey;
139  TIter nextTrigger(periodDirectory->GetListOfKeys());
140  while ((triggerKey = (TKey*) nextTrigger())) {
141  if (not triggerKey->IsFolder()) continue;
142  TDirectory* triggerDirectory = periodDirectory->GetDirectory(triggerKey->GetName());
143  std::string triggerName = std::string(triggerKey->GetName());
144  if(!std::set<std::string>{"HLT_mu26_ivarmedium", "HLT_mu50", "HLT_mu26_ivarmedium_OR_HLT_mu50"}.count(triggerName) && m_binning == "coarse"){
145  ATH_MSG_DEBUG("Coarse binning not supported for di-muon trigger legs at the moment");
146  continue;
147  }
148  for (const auto& iregion : region) {
149  bool isBarrel = iregion.find("barrel") != std::string::npos;
150  for (const auto& itype : type) {
151  bool isData = itype.find("data") != std::string::npos;
152  std::string histname = ("_MuonTrigEff_" + periodName + "_" + triggerName + "_" + quality + "_" + "_EtaPhi_" + m_binning + "_" + iregion + "_" + itype);
153  for (const auto& isys : systematic) {
154  if (itype.find("data") != std::string::npos && isys.find("syst") != std::string::npos) continue;
155  std::string path = "eff_etaphi_" + m_binning + "_" + iregion + "_" + itype + "_" + isys;
156  TH2* hist = dynamic_cast<TH2*>(triggerDirectory->Get(path.c_str()));
157  if (not hist) {
158 
159  ATH_MSG_FATAL("MuonTriggerScaleFactors::initialize " << path << " not found under trigger " << triggerName << " and period " << periodName << " for year: " << year);
160  continue;
161  }
162  hist->SetDirectory(0);
163 
164  EffiHistoIdent HistoId = EffiHistoIdent(period, encodeHistoName(periodName_InMap, triggerName, isData, isys, isBarrel));
165  if (m_efficiencyMap.find(HistoId) != m_efficiencyMap.end()) {
166  ATH_MSG_FATAL("MuonTriggerScaleFactors::initialize(): histogram " << path << " is duplicated for year" << year << " in period " << periodName);
167  return StatusCode::FAILURE;
168  }
169  m_efficiencyMap.insert(std::pair<EffiHistoIdent, TH1_Ptr>(HistoId, std::shared_ptr < TH1 > (hist)));
170 
171  }
172  //If the trigger is chosen for toy evaluation, generate all the replicas from
173  // NOMINAL with STAT variations stored in the data hist, load them in corresponding vector
174  if (m_replicaSet.find(triggerName) != m_replicaSet.end() && itype.find("data") != std::string::npos) {
175 
176  TH1_Ptr Nominal_H = getEfficiencyHistogram(year, periodName, triggerName, isData, "nominal", isBarrel);
177  TH1_Ptr StatUp_H = getEfficiencyHistogram(year, periodName, triggerName, isData, "stat_up", isBarrel);
178 
179  TH1_Ptr tmp_h2 = TH1_Ptr(dynamic_cast<TH2F*>(Nominal_H->Clone(Form("tmp_h2_%s", Nominal_H->GetName()))));
180  const int xbins = tmp_h2->GetNbinsX(), ybins = tmp_h2->GetNbinsY();
181  for (int x_i = 0; x_i <= xbins; ++x_i) {
182  for (int y_i = 0; y_i <= ybins; ++y_i) {
183  double statErr = std::abs(tmp_h2->GetBinContent(x_i, y_i) - StatUp_H->GetBinContent(x_i, y_i));
184  tmp_h2->SetBinError(x_i, y_i, statErr);
185  }
186  }
188  }
189  }
190  }
191  }
192  }
193  file->Close();
194  delete file;
195  origDir->cd();
196  return StatusCode::SUCCESS;
197  }

◆ msg() [1/2]

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg() [2/2]

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

Definition at line 27 of file AthCommonMsg.h.

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

◆ msg_level_name()

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

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

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

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

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

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

Definition at line 101 of file AsgTool.cxx.

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

◆ msgLvl()

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

Definition at line 30 of file AthCommonMsg.h.

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

◆ outputHandles()

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

Return this algorithm's output handles.

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

◆ print() [1/2]

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

◆ print() [2/2]

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

◆ recommendedSystematics()

CP::SystematicSet CP::MuonTriggerScaleFactors::recommendedSystematics ( ) const
virtual

returns: the list of all systematics this tool recommends to use

Implements CP::IReentrantSystematicsTool.

Definition at line 897 of file MuonTriggerScaleFactors.cxx.

897  {
898  return affectingSystematics();
899  }

◆ registerSystematics()

StatusCode CP::MuonTriggerScaleFactors::registerSystematics ( )
private

Definition at line 887 of file MuonTriggerScaleFactors.cxx.

887  {
889  if (registry.registerSystematics(*this) != StatusCode::SUCCESS) {
890  ATH_MSG_ERROR("Failed to add systematic to list of recommended systematics.");
891  return StatusCode::FAILURE;
892  }
893  return StatusCode::SUCCESS;
894  }

◆ renounce()

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

Definition at line 380 of file AthCommonDataStore.h.

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

◆ renounceArray()

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

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ sysInitialize()

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

Perform system initialization for an algorithm.

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

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

◆ sysStart()

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

Handle START transition.

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

◆ updateVHKA()

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

Definition at line 308 of file AthCommonDataStore.h.

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

Member Data Documentation

◆ m_allowZeroSF

bool CP::MuonTriggerScaleFactors::m_allowZeroSF
private

Definition at line 126 of file MuonTriggerScaleFactors.h.

◆ m_appliedSystematics

CP::SystematicSet* CP::MuonTriggerScaleFactors::m_appliedSystematics
private

Definition at line 115 of file MuonTriggerScaleFactors.h.

◆ m_binning

std::string CP::MuonTriggerScaleFactors::m_binning
private

Definition at line 125 of file MuonTriggerScaleFactors.h.

◆ m_calibration_version

std::string CP::MuonTriggerScaleFactors::m_calibration_version
private

Definition at line 123 of file MuonTriggerScaleFactors.h.

◆ m_custom_dir

std::string CP::MuonTriggerScaleFactors::m_custom_dir
private

Definition at line 124 of file MuonTriggerScaleFactors.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_efficiencyMap

EfficiencyMap CP::MuonTriggerScaleFactors::m_efficiencyMap
private

Definition at line 117 of file MuonTriggerScaleFactors.h.

◆ m_efficiencyMapReplicaArray

std::map<EffiHistoIdent, std::vector<TH1_Ptr> > CP::MuonTriggerScaleFactors::m_efficiencyMapReplicaArray
private

Definition at line 118 of file MuonTriggerScaleFactors.h.

◆ m_eventInfo

SG::ReadHandleKey<xAOD::EventInfo> CP::MuonTriggerScaleFactors::m_eventInfo {this, "EventInfoContName", "EventInfo", "event info key"}
private

Definition at line 105 of file MuonTriggerScaleFactors.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_experimental

bool CP::MuonTriggerScaleFactors::m_experimental
private

Definition at line 127 of file MuonTriggerScaleFactors.h.

◆ m_fileName

std::string CP::MuonTriggerScaleFactors::m_fileName
private

Definition at line 116 of file MuonTriggerScaleFactors.h.

◆ m_forcePeriod

std::string CP::MuonTriggerScaleFactors::m_forcePeriod
private

Definition at line 129 of file MuonTriggerScaleFactors.h.

◆ m_forceYear

int CP::MuonTriggerScaleFactors::m_forceYear
private

Definition at line 128 of file MuonTriggerScaleFactors.h.

◆ m_muonquality

std::string CP::MuonTriggerScaleFactors::m_muonquality
private

Definition at line 120 of file MuonTriggerScaleFactors.h.

◆ m_nReplicas

int CP::MuonTriggerScaleFactors::m_nReplicas
private

Definition at line 133 of file MuonTriggerScaleFactors.h.

◆ m_ReplicaRandomSeed

int CP::MuonTriggerScaleFactors::m_ReplicaRandomSeed
private

Definition at line 134 of file MuonTriggerScaleFactors.h.

◆ m_replicaSet

std::set<std::string> CP::MuonTriggerScaleFactors::m_replicaSet
private

Definition at line 132 of file MuonTriggerScaleFactors.h.

◆ m_replicaTriggerList

std::vector<std::string> CP::MuonTriggerScaleFactors::m_replicaTriggerList
private

Definition at line 131 of file MuonTriggerScaleFactors.h.

◆ m_runNumber_year

const std::map< unsigned int, int > CP::MuonTriggerScaleFactors::m_runNumber_year
staticprivate
Initial value:
= {
{284484,2015},
{311481,2016},
{340453,2017},
{364292,2018},
{440613,2022},
{456749,2023}
}

Definition at line 137 of file MuonTriggerScaleFactors.h.

◆ m_systFilter

std::unordered_map<CP::SystematicSet, CP::SystematicSet> CP::MuonTriggerScaleFactors::m_systFilter
private

Definition at line 113 of file MuonTriggerScaleFactors.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.


The documentation for this class was generated from the following files:
grepfile.info
info
Definition: grepfile.py:38
python.Dso.registry
registry
Definition: Control/AthenaServices/python/Dso.py:159
CP::MuonTriggerScaleFactors::affectingSystematics
virtual CP::SystematicSet affectingSystematics() const
returns: the list of all systematics this tool can be affected by
Definition: MuonTriggerScaleFactors.cxx:867
python.AtlRunQueryAMI.period
period
Definition: AtlRunQueryAMI.py:225
CP::MuonTriggerScaleFactors::m_replicaSet
std::set< std::string > m_replicaSet
Definition: MuonTriggerScaleFactors.h:132
CP::MuonTriggerScaleFactors::getTriggerCorrespondingToDimuonTrigger
std::string getTriggerCorrespondingToDimuonTrigger(const std::string &trigger) const
Definition: MuonTriggerScaleFactors.cxx:701
xAOD::muon
@ muon
Definition: TrackingPrimitives.h:195
CP::MuonTriggerScaleFactors::getReplica_index
virtual int getReplica_index(const std::string &sysBaseName, const std::string &trigStr) const
Definition: MuonTriggerScaleFactors.cxx:281
CP::TH1_Ptr
std::shared_ptr< TH1 > TH1_Ptr
Definition: MuonTriggerScaleFactors.h:28
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
CP::MuonTriggerScaleFactors::m_ReplicaRandomSeed
int m_ReplicaRandomSeed
Definition: MuonTriggerScaleFactors.h:134
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
get_generator_info.result
result
Definition: get_generator_info.py:21
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
CP::MuonTriggerScaleFactors::getYear
unsigned int getYear(unsigned int run) const
Definition: MuonTriggerScaleFactors.cxx:722
athena.path
path
python interpreter configuration --------------------------------------—
Definition: athena.py:128
runLayerRecalibration.chain
chain
Definition: runLayerRecalibration.py:175
CP::MuonTriggerScaleFactors::appliedSystematics
const CP::SystematicSet & appliedSystematics() const
Definition: MuonTriggerScaleFactors.h:74
AddEmptyComponent.histName
string histName
Definition: AddEmptyComponent.py:64
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
CP::MuonTriggerScaleFactors::m_muonquality
std::string m_muonquality
Definition: MuonTriggerScaleFactors.h:120
CP::MuonTriggerScaleFactors::m_binning
std::string m_binning
Definition: MuonTriggerScaleFactors.h:125
TrigMuonEff::Configuration::isData
bool isData
Definition: IMuonTriggerScaleFactors.h:24
CP::MuonTriggerScaleFactors::getDimuonEfficiency
virtual CorrectionCode getDimuonEfficiency(Double_t &eff, const TrigMuonEff::Configuration &configuration, const xAOD::MuonContainer &mucont, const std::string &chain, const std::string &systematic) const
Definition: MuonTriggerScaleFactors.cxx:676
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
index
Definition: index.py:1
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
CP::MuonTriggerScaleFactors::m_appliedSystematics
CP::SystematicSet * m_appliedSystematics
Definition: MuonTriggerScaleFactors.h:115
plotmaker.hist
hist
Definition: plotmaker.py:148
CP::MuonTriggerScaleFactors::m_forcePeriod
std::string m_forcePeriod
Definition: MuonTriggerScaleFactors.h:129
CP::MuonTriggerScaleFactors::m_nReplicas
int m_nReplicas
Definition: MuonTriggerScaleFactors.h:133
CP::MuonTriggerScaleFactors::EffiHistoIdent
std::pair< YearPeriod, unsigned int > EffiHistoIdent
Definition: MuonTriggerScaleFactors.h:91
CP::MuonTriggerScaleFactors::generateReplicas
std::vector< TH1_Ptr > generateReplicas(TH1_Ptr h, int nrep, int seed) const
Definition: MuonTriggerScaleFactors.cxx:345
CP::MuonTriggerScaleFactors::m_allowZeroSF
bool m_allowZeroSF
Definition: MuonTriggerScaleFactors.h:126
CP::MuonTriggerScaleFactors::getTemporaryDirectory
TDirectory * getTemporaryDirectory(void) const
Definition: MuonTriggerScaleFactors.cxx:836
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
dirname
std::string dirname(std::string name)
Definition: utils.cxx:200
PixelAthClusterMonAlgCfg.ybins
ybins
Definition: PixelAthClusterMonAlgCfg.py:169
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
M_PI
#define M_PI
Definition: ActiveFraction.h:11
bin
Definition: BinsDiffFromStripMedian.h:43
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
downloadSingle.dataType
string dataType
Definition: downloadSingle.py:18
CP::MuonTriggerScaleFactors::m_replicaTriggerList
std::vector< std::string > m_replicaTriggerList
Definition: MuonTriggerScaleFactors.h:131
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
CP::SystematicVariation
Definition: SystematicVariation.h:47
python.AtlRunQueryAMI.year
year
Definition: AtlRunQueryAMI.py:226
xAOD::EventInfo_v1::IS_SIMULATION
@ IS_SIMULATION
true: simulation, false: data
Definition: EventInfo_v1.h:151
python.TrigEgammaMonitorHelper.TH2F
def TH2F(name, title, nxbins, bins_par2, bins_par3, bins_par4, bins_par5=None, bins_par6=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:45
empty
bool empty(TH1 *h)
Definition: computils.cxx:294
DeMoAtlasDataLoss.periodName
list periodName
Definition: DeMoAtlasDataLoss.py:129
CP::MuonTriggerScaleFactors::applySystematicVariation
virtual StatusCode applySystematicVariation(const CP::SystematicSet &systConfig)
effects: configure this tool for the given list of systematic variations.
Definition: MuonTriggerScaleFactors.cxx:901
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:27
CP::MuonTriggerScaleFactors::GetTriggerSF_dimu
virtual CorrectionCode GetTriggerSF_dimu(Double_t &TriggerSF, TrigMuonEff::Configuration &configuration, const xAOD::MuonContainer &mucont, const std::string &trigger) const
Definition: MuonTriggerScaleFactors.cxx:475
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
TrigMuonEff::Configuration
structure to hold variables to configure behaviour of the tool
Definition: IMuonTriggerScaleFactors.h:23
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
CP::CorrectionCode::OutOfValidityRange
@ OutOfValidityRange
Input object is out of validity range.
Definition: CorrectionCode.h:37
CP::CorrectionCode::Error
@ Error
Some error happened during the object correction.
Definition: CorrectionCode.h:36
efficiency
void efficiency(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
Definition: dependence.cxx:128
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
FortranAlgorithmOptions.fileName
fileName
Definition: FortranAlgorithmOptions.py:13
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
PixelAthClusterMonAlgCfg.histname
histname
Definition: PixelAthClusterMonAlgCfg.py:106
ParseInputs.gDirectory
gDirectory
Definition: Final2012/ParseInputs.py:133
lumiFormat.i
int i
Definition: lumiFormat.py:85
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CP::MuonTriggerScaleFactors::m_runNumber_year
static const std::map< unsigned int, int > m_runNumber_year
Definition: MuonTriggerScaleFactors.h:137
CP::MuonTriggerScaleFactors::LoadTriggerMap
StatusCode LoadTriggerMap(unsigned int year)
Definition: MuonTriggerScaleFactors.cxx:80
mergePhysValFiles.origDir
origDir
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:24
CP::MuonTriggerScaleFactors::m_calibration_version
std::string m_calibration_version
Definition: MuonTriggerScaleFactors.h:123
file
TFile * file
Definition: tile_monitor.h:29
python.xAODType.dummy
dummy
Definition: xAODType.py:4
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
MSG::name
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition: MsgLevel.cxx:19
run
Definition: run.py:1
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
TrigMuonEff::Configuration::replicaIndex
int replicaIndex
index of replicated histograms to access
Definition: IMuonTriggerScaleFactors.h:25
plotIsoValidation.mu_phi
mu_phi
Definition: plotIsoValidation.py:152
python.TriggerAnalysisConfig.Trigger
def Trigger(seq)
Definition: TriggerAnalysisConfig.py:128
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
CP::MuonTriggerScaleFactors::getDataPeriod
std::string getDataPeriod() const
Definition: MuonTriggerScaleFactors.cxx:735
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
CP::SystematicSet::insert
void insert(const SystematicVariation &systematic)
description: insert a systematic into the set
Definition: SystematicSet.cxx:88
hancool.filePath
string filePath
Definition: hancool.py:28
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
threshold
Definition: chainparser.cxx:74
CP::MuonTriggerScaleFactors::getMuonEfficiency
virtual CorrectionCode getMuonEfficiency(Double_t &eff, const TrigMuonEff::Configuration &configuration, const xAOD::Muon &muon, const std::string &trigger, const std::string &systematic) const
Definition: MuonTriggerScaleFactors.cxx:415
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
LArCellBinning.xbins
int xbins
Definition: LArCellBinning.py:163
PathResolverFindCalibFile
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
Definition: PathResolver.cxx:431
CP::MuonTriggerScaleFactors::m_eventInfo
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfo
Definition: MuonTriggerScaleFactors.h:105
CP::MuonTriggerScaleFactors::m_fileName
std::string m_fileName
Definition: MuonTriggerScaleFactors.h:116
CP::MuonTriggerScaleFactors::m_custom_dir
std::string m_custom_dir
Definition: MuonTriggerScaleFactors.h:124
CP::MuonTriggerScaleFactors::m_systFilter
std::unordered_map< CP::SystematicSet, CP::SystematicSet > m_systFilter
Definition: MuonTriggerScaleFactors.h:113
CP::MuonTriggerScaleFactors::YearPeriod
std::pair< unsigned int, std::string > YearPeriod
Definition: MuonTriggerScaleFactors.h:90
CP::CorrectionCode::Ok
@ Ok
The correction was done successfully.
Definition: CorrectionCode.h:38
CP::MuonTriggerScaleFactors::getRunNumber
unsigned int getRunNumber() const
Definition: MuonTriggerScaleFactors.cxx:812
a
TList * a
Definition: liststreamerinfos.cxx:10
CP::MuonTriggerScaleFactors::m_efficiencyMap
EfficiencyMap m_efficiencyMap
Definition: MuonTriggerScaleFactors.h:117
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
CP::SystematicVariation::empty
bool empty() const
returns: whether this is an empty systematic, i.e.
Definition: SystematicVariation.cxx:294
CP::MuonTriggerScaleFactors::encodeHistoName
unsigned int encodeHistoName(const std::string &period, const std::string &Trigger, bool isData, const std::string &Systematic, bool isBarrel=true) const
Definition: MuonTriggerScaleFactors.cxx:390
CP::SystematicRegistry
This module implements the central registry for handling systematic uncertainties with CP tools.
Definition: SystematicRegistry.h:25
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
CP::SystematicSet::matchSystematic
bool matchSystematic(const SystematicVariation &systematic, MATCHTYPE type=FULL) const
Definition: SystematicSet.cxx:128
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
python.LArCondContChannels.isBarrel
isBarrel
Definition: LArCondContChannels.py:659
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
CP::MuonTriggerScaleFactors::registerSystematics
StatusCode registerSystematics()
Definition: MuonTriggerScaleFactors.cxx:887
CxxUtils::atoi
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
Definition: Control/CxxUtils/Root/StringUtils.cxx:85
plotIsoValidation.mu_eta
mu_eta
Definition: plotIsoValidation.py:151
dqt_zlumi_alleff_HIST.eff
int eff
Definition: dqt_zlumi_alleff_HIST.py:113
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
CP::MuonTriggerScaleFactors::getThreshold
CorrectionCode getThreshold(Int_t &threshold, const std::string &trigger) const
Definition: MuonTriggerScaleFactors.cxx:707
CP::MuonTriggerScaleFactors::m_experimental
bool m_experimental
Definition: MuonTriggerScaleFactors.h:127
test_pyathena.counter
counter
Definition: test_pyathena.py:15
Analysis::Systematic
@ Systematic
Definition: CalibrationDataInterfaceROOT.h:70
SG::DataProxy
Definition: DataProxy.h:44
CaloNoise_fillDB.mu
mu
Definition: CaloNoise_fillDB.py:53
CP::MuonTriggerScaleFactors::getEfficiencyHistogram
virtual std::shared_ptr< TH1 > getEfficiencyHistogram(unsigned int year, const std::string &period, const std::string &trigger, bool isData, const std::string &Systematic, bool isBarrel=true) const
Definition: MuonTriggerScaleFactors.cxx:401
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
dumpTgcDigiThreshold.threshold
list threshold
Definition: dumpTgcDigiThreshold.py:34
CP::MuonTriggerScaleFactors::m_efficiencyMapReplicaArray
std::map< EffiHistoIdent, std::vector< TH1_Ptr > > m_efficiencyMapReplicaArray
Definition: MuonTriggerScaleFactors.h:118
CP::SystematicSet::filterForAffectingSystematics
static StatusCode filterForAffectingSystematics(const SystematicSet &systConfig, const SystematicSet &affectingSystematics, SystematicSet &filteredSystematics)
description: filter the systematics for the affected systematics returns: success guarantee: strong f...
Definition: SystematicSet.cxx:213
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
fitman.k
k
Definition: fitman.py:528
python.handimod.cc
int cc
Definition: handimod.py:523
CP::SystematicRegistry::getInstance
static SystematicRegistry & getInstance()
Get the singleton instance of the registry for the curren thread.
Definition: SystematicRegistry.cxx:25
CP::MuonTriggerScaleFactors::GetTriggerSF
virtual CorrectionCode GetTriggerSF(Double_t &TriggerSF, TrigMuonEff::Configuration &configuration, const xAOD::MuonContainer &mucont, const std::string &trigger) const
Definition: MuonTriggerScaleFactors.cxx:534
CP::MuonTriggerScaleFactors::m_forceYear
int m_forceYear
Definition: MuonTriggerScaleFactors.h:128
beamspotman.basename
basename
Definition: beamspotman.py:640