ATLAS Offline Software
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | 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< TH1getEfficiencyHistogram (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< TH1getEfficiencyHistogram (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
 

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 32 of file MuonTriggerScaleFactors.cxx.

32  :
34  m_systFilter(),
35  m_appliedSystematics(nullptr),
36  m_fileName(),
39  m_muonquality("Medium"),
40  m_calibration_version("230222_Winter_r22"),
41  m_custom_dir(),
42  m_binning("fine"),
43  m_allowZeroSF(false),
44  m_experimental(false),
45  m_forceYear(-1),
46  m_forcePeriod(""),
48  m_replicaSet(),
49  m_nReplicas(100),
50  m_ReplicaRandomSeed(12345) {
51 
52  declareProperty("MuonQuality", m_muonquality); // HighPt,Tight,Medium,Loose,LowPt
53  declareProperty("CalibrationRelease", m_calibration_version);
54  // these are for debugging / testing, *not* for general use!
55  declareProperty("filename", m_fileName);
56  declareProperty("CustomInputFolder", m_custom_dir);
57  declareProperty("Binning", m_binning); // fine or coarse
58  declareProperty("UseExperimental", m_experimental); // enable experimental features like single muon SF
59  //Properties needed for TOY setup for a given trigger: No replicas if m_replicaTriggerList is empty
60  declareProperty("ReplicaTriggerList", m_replicaTriggerList, "List of triggers on which we want to generate stat. uncertainty toy replicas.");
61  declareProperty("NReplicas", m_nReplicas, "Number of generated toy replicas, if replicas are required.");
62  declareProperty("ReplicaRandomSeed", m_ReplicaRandomSeed, "Random seed for toy replica generation.");
63  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");
64  declareProperty("forceYear", m_forceYear, "Only for developers. Never use this in any analysis!!!!!!");
65  declareProperty("forcePeriod", m_forcePeriod, "Only for developers. Never use this in any analysis!!!!!!");
66  }

◆ ~MuonTriggerScaleFactors()

CP::MuonTriggerScaleFactors::~MuonTriggerScaleFactors ( )
virtual

Definition at line 68 of file MuonTriggerScaleFactors.cxx.

68 { }

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 853 of file MuonTriggerScaleFactors.cxx.

853  {
854  CP::SystematicSet mySysSet;
855 
856  mySysSet.insert(CP::SystematicVariation("MUON_EFF_TrigSystUncertainty", 1));
857  mySysSet.insert(CP::SystematicVariation("MUON_EFF_TrigSystUncertainty", -1));
858 
859  //Consider full statUncertainty if TOY replicas are not used
860  if (m_replicaTriggerList.size() == 0) {
861  mySysSet.insert(CP::SystematicVariation("MUON_EFF_TrigStatUncertainty", 1));
862  mySysSet.insert(CP::SystematicVariation("MUON_EFF_TrigStatUncertainty", -1));
863  } else {
864  for (int i = 0; i < m_nReplicas; ++i) { //TOFIX Hack with just up variations! needs ASG reserved words for a clean handling//+++++++
865  mySysSet.insert(CP::SystematicVariation(Form("MUON_EFF_Trig_MCTOY%03d", i), 1));
866  }
867  }
868 
869  return mySysSet;
870  }

◆ 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 887 of file MuonTriggerScaleFactors.cxx.

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

◆ 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 382 of file MuonTriggerScaleFactors.cxx.

382  {
383  //keep the string as short as possible
384  const std::string histName = period + "_" + Trigger + "_" + (isBarrel ? "b" : "e") + "_" + (isData ? "data" : "mc") + Systematic;
385  return std::hash<std::string>()(histName);
386  }

◆ 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 388 of file MuonTriggerScaleFactors.cxx.

388  {
389  //keep the string as short as possible
390  return encodeHistoName(getDataPeriod(), Trigger, configuration.isData, Systematic, isBarrel);
391 
392  }

◆ 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 337 of file MuonTriggerScaleFactors.cxx.

337  {
338  TRandom3 Rndm(seed);
339  std::vector<TH1_Ptr> replica_v;
340  const int xbins = h->GetNbinsX(), ybins = h->GetNbinsY();
341 
342  for (int t = 0; t < nrep; ++t) {
343  TH2* replica = dynamic_cast<TH2*>(h->Clone(Form("rep%d_%s", t, h->GetName())));
344 
345  for (int x_i = 0; x_i <= xbins; ++x_i) {
346  for (int y_i = 0; y_i <= ybins; ++y_i) {
347  replica->SetBinContent(x_i, y_i, Rndm.Gaus(h->GetBinContent(x_i, y_i), h->GetBinError(x_i, y_i)));
348  }
349  }
350  replica_v.push_back(TH1_Ptr(replica));
351  }
352  return replica_v;
353  }

◆ getBinNumber()

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

Implements CP::IMuonTriggerScaleFactors.

Definition at line 360 of file MuonTriggerScaleFactors.cxx.

360  {
361  if(!m_experimental){
362  ATH_MSG_ERROR("MuonTriggerScaleFactors::getTriggerScaleFactor This is an experimental function. If you really know what you are doing set UseExperimental property.");
363  return CorrectionCode::Error;
364  }
365 
366  const double mu_eta = muon.eta();
367  const double mu_phi = muon.phi();
368  bool isBarrel = std::abs(mu_eta) < muon_barrel_endcap_boundary;
369  TH1_Ptr cit = getEfficiencyHistogram(trigger, true, "nominal", isBarrel);
370  if(!cit.get()){
371  if(!m_allowZeroSF)
372  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." );
373  return -1;
374  }
375  auto eff_h2 = cit;
376  double mu_phi_corr = mu_phi;
377  if (mu_phi_corr < eff_h2->GetYaxis()->GetXmin()) mu_phi_corr += 2.0 * M_PI;
378  if (mu_phi_corr > eff_h2->GetYaxis()->GetXmax()) mu_phi_corr -= 2.0 * M_PI;
379  return eff_h2->FindFixBin(mu_eta, mu_phi_corr);
380  }

◆ getDataPeriod() [1/3]

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

Definition at line 725 of file MuonTriggerScaleFactors.cxx.

725  {
726  return getDataPeriod(getRunNumber());
727  }

◆ getDataPeriod() [2/3]

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

Definition at line 729 of file MuonTriggerScaleFactors.cxx.

729  {
730  return getDataPeriod(run, getYear(run));
731  }

◆ 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 668 of file MuonTriggerScaleFactors.cxx.

668  {
669 
671  Int_t threshold;
672  CorrectionCode result = getThreshold(threshold, trigger);
673  if (result != CorrectionCode::Ok) return result;
674 
676  xAOD::MuonContainer::const_iterator mu2 = mucont.begin() + 1;
677 
678  Double_t eff1 = 0;
679  if ((**mu1).pt() > threshold) {
680  CorrectionCode result1 = getMuonEfficiency(eff1, configuration, (**mu1), trigger, systematic);
681  if (result1 != CorrectionCode::Ok) return result1;
682  }
683  Double_t eff2 = 0;
684  if ((**mu2).pt() > threshold) {
685  CorrectionCode result2 = getMuonEfficiency(eff2, configuration, (**mu2), trigger, systematic);
686  if (result2 != CorrectionCode::Ok) return result2;
687  }
688 
689  eff = eff1 * eff2;
690  return CorrectionCode::Ok;
691  }

◆ 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 402 of file MuonTriggerScaleFactors.cxx.

402  {
403  unsigned int run = getRunNumber();
405  }

◆ 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 393 of file MuonTriggerScaleFactors.cxx.

393  {
395  EfficiencyMap::const_iterator Itr = m_efficiencyMap.find(Ident);
396 
397  if (Itr == m_efficiencyMap.end()) {
398  return TH1_Ptr();
399  }
400  return Itr->second;
401  }

◆ 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 407 of file MuonTriggerScaleFactors.cxx.

407  {
408  const double mu_eta = muon.eta();
409  const double mu_phi = muon.phi();
410  bool isBarrel = std::abs(mu_eta) < muon_barrel_endcap_boundary;
411 
412  TH1_Ptr eff_h2 = nullptr;
413  if (configuration.replicaIndex >= 0) { //Only look into the replicas if asking for them
414 
415  unsigned int run = getRunNumber();
417  std::map<EffiHistoIdent, std::vector<TH1_Ptr> >::const_iterator cit = m_efficiencyMapReplicaArray.find(Ident);
418  if (cit == m_efficiencyMapReplicaArray.end()) {
419  if (m_allowZeroSF) {
420  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.");
421  eff = 0.;
422  return CorrectionCode::Ok;
423  }
424 
425  else {
426  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.");
428  }
429  }
430 
431  if (configuration.replicaIndex >= (int) cit->second.size()) {
432  ATH_MSG_ERROR("MuonTriggerScaleFactors::getMuonEfficiency ; index for replicated histograms is out of range.");
434  }
435 
436  eff_h2 = cit->second[configuration.replicaIndex];
437  } else { //Standard case, look into the usual eff map
438  TH1_Ptr cit = getEfficiencyHistogram(trigger, configuration.isData, systematic, isBarrel);
439  if (cit.get() == nullptr) {
440  if (m_allowZeroSF) {
441  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.");
442  eff = 0.;
443  return CorrectionCode::Ok;
444  } else {
445  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.");
447  }
448  }
449  eff_h2 = cit;
450  }
451 
452  double mu_phi_corr = mu_phi;
453  if (mu_phi_corr < eff_h2->GetYaxis()->GetXmin()) mu_phi_corr += 2.0 * M_PI;
454  if (mu_phi_corr > eff_h2->GetYaxis()->GetXmax()) mu_phi_corr -= 2.0 * M_PI;
455 
456  const int bin = eff_h2->FindFixBin(mu_eta, mu_phi_corr);
457  const double efficiency = eff_h2->GetBinContent(bin);
458 
459  eff = efficiency;
460 
461  ATH_MSG_DEBUG("getMuonEfficiency [eta,phi,phi_corr]=[" << mu_eta << "," << mu_phi << "," << mu_phi_corr << "], ibin=" << bin << " eff=" << eff);
462 
463  return CorrectionCode::Ok;
464 
465  }

◆ 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 273 of file MuonTriggerScaleFactors.cxx.

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

◆ getRunNumber()

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

Definition at line 798 of file MuonTriggerScaleFactors.cxx.

798  {
799  static const SG::AuxElement::ConstAccessor<unsigned int> acc_rnd("RandomRunNumber");
801  if (info.operator->()==nullptr) {
802  ATH_MSG_FATAL("Could not retrieve the xAOD::EventInfo with name: " << m_eventInfo.key() << ". Exiting the code.");
803  throw std::invalid_argument{""};
804  }
805  if (!info->eventType(xAOD::EventInfo::IS_SIMULATION)) {
806  ATH_MSG_DEBUG("The current event is a data event. Return runNumber instead.");
807  return info->runNumber();
808  }
809  if (!acc_rnd.isAvailable(*info)) {
810  if(m_forceYear == -1 && m_forcePeriod == "")
811  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");
812  throw std::invalid_argument{""};
813  } else if (acc_rnd(*info) == 0) {
814  ATH_MSG_FATAL("Pile up tool has given runNumber 0. Exiting the code.");
815  throw std::invalid_argument{""};
816  }
817 
818  // standard behaviour for MC, get the random RunNumber
819  return acc_rnd(*info);
820  }

◆ getTemporaryDirectory()

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

Definition at line 822 of file MuonTriggerScaleFactors.cxx.

822  {
823  gROOT->cd();
824  TDirectory* tempDir = 0;
825  int counter = 0;
826  while (not tempDir) {
827  std::stringstream dirname;
828  dirname << "MuonTriggerScaleFactorsTempDir_%i" << counter;
829  if (gROOT->GetDirectory((dirname.str()).c_str())) {
830  ++counter;
831  continue;
832  }
833  tempDir = gROOT->mkdir((dirname.str()).c_str());
834  if (not tempDir) {
835  ATH_MSG_ERROR("getTemporaryDirectory::Temporary directory could not be created");
836  }
837  }
838  return tempDir;
839  }

◆ getThreshold()

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

Definition at line 699 of file MuonTriggerScaleFactors.cxx.

699  {
700  std::size_t index = trigger.find("HLT_mu");
701  if (index != std::string::npos) {
702  std::string rawNumber = trigger.substr(index + 6);
703  if (!rawNumber.empty() && isdigit(rawNumber[0])) {
704  std::stringstream(rawNumber) >> threshold;
705  if (threshold < 10) threshold = 10000;
706  else threshold = (threshold + 1) * 1000;
707  return CorrectionCode::Ok;
708  }
709  }
710  ATH_MSG_ERROR("MuonTriggerScaleFactors::getThreshold Could not extract threshold for trigger " << trigger);
711  return CorrectionCode::Error;
712  }

◆ getTriggerCorrespondingToDimuonTrigger()

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

Definition at line 693 of file MuonTriggerScaleFactors.cxx.

693  {
694  if (trigger.find("2mu10") != std::string::npos) return "HLT_mu10";
695  if (trigger.find("2mu14") != std::string::npos) return "HLT_mu14";
696  throw std::runtime_error("Unknown dimuon trigger");
697  }

◆ 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 280 of file MuonTriggerScaleFactors.cxx.

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

◆ 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 224 of file MuonTriggerScaleFactors.cxx.

224  {
225  if(!m_experimental){
226  ATH_MSG_ERROR("MuonTriggerScaleFactors::getTriggerScaleFactor This is an experimental function. If you really know what you are doing set UseExperimental property.");
227  return CorrectionCode::Error;
228  }
229 
230  if (trigger.empty()) {
231  ATH_MSG_ERROR("MuonTriggerScaleFactors::getTriggerScaleFactor Trigger must have value.");
232  return CorrectionCode::Error;
233  }
234 
235  TrigMuonEff::Configuration configuration;
236 
237  if (trigger == "HLT_mu8noL1")
238  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.");
239  else if (trigger.find("HLT_2mu10") != std::string::npos || trigger.find("HLT_2mu14") != std::string::npos)
240  ATH_MSG_WARNING("Di-muon trigger scale factors for single reco muons are not supported!");
241  else
242  return GetTriggerSF(triggersf, configuration, muon, trigger);
243  return CorrectionCode::Ok;
244  }

◆ 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 246 of file MuonTriggerScaleFactors.cxx.

246  {
247  if (trigger.empty()) {
248  ATH_MSG_ERROR("MuonTriggerScaleFactors::getTriggerScaleFactor Trigger must have value.");
249  return CorrectionCode::Error;
250  }
251 
252  TrigMuonEff::Configuration configuration;
253 
254  if (trigger == "HLT_mu8noL1") {
255  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.");
256  }
257  else if (trigger.find("HLT_2mu10") != std::string::npos || trigger.find("HLT_2mu14") != std::string::npos) {
258  CorrectionCode cc = GetTriggerSF_dimu(triggersf, configuration, mucont, trigger);
259  return cc;
260  } else {
261  CorrectionCode cc = GetTriggerSF(triggersf, configuration, mucont, trigger);
262  return cc;
263  }
264  return CorrectionCode::Ok;
265  }

◆ 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 605 of file MuonTriggerScaleFactors.cxx.

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

◆ 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 526 of file MuonTriggerScaleFactors.cxx.

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

◆ 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 467 of file MuonTriggerScaleFactors.cxx.

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

◆ getYear()

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

Definition at line 714 of file MuonTriggerScaleFactors.cxx.

714  {
715  if(m_forceYear != -1){
716  return m_forceYear;
717  }
718  if (run <= 284484) return 2015;
719  else if (run <= 311481) return 2016;
720  else if (run <= 340453) return 2017;
721  else if (run <= 364292) return 2018;
722  else return 2022;
723  }

◆ 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 190 of file MuonTriggerScaleFactors.cxx.

190  {
191 
192  ATH_MSG_INFO("MuonQuality = '" << m_muonquality << "'");
193  ATH_MSG_INFO("Binning = '" << m_binning << "'");
194  ATH_MSG_INFO("CalibrationRelease = '" << m_calibration_version << "'");
195  ATH_MSG_INFO("CustomInputFolder = '" << m_custom_dir << "'");
196  ATH_MSG_INFO("AllowZeroSF = " << m_allowZeroSF);
197  ATH_MSG_INFO("experimental = " << m_experimental);
198 
200 
201  if (registerSystematics() != StatusCode::SUCCESS) {
202  return StatusCode::FAILURE;
203  }
204 
205  if (applySystematicVariation(CP::SystematicSet()) != StatusCode::SUCCESS) {
206  ATH_MSG_ERROR("Could not configure for nominal settings");
207  return StatusCode::FAILURE;
208  }
209  // Initialize indexes of replicas for trigges which are asked
210  for (auto trigToy : m_replicaTriggerList)
211  m_replicaSet.insert(trigToy);
212 
213  ATH_MSG_INFO("MuonTriggerScaleFactors::initialize");
214  static const int years_to_run[5] = {2015, 2016, 2017, 2018, 2022};
215  for (const int &year: years_to_run) {
216 
217  // skip 2022 Tight WP as it is not supported
218  if ((year == 2022) && (m_muonquality == "Tight")) continue;
220  }
221  return StatusCode::SUCCESS;
222  }

◆ 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 844 of file MuonTriggerScaleFactors.cxx.

844  {
845  if (!systematic.empty()) {
847  return sys.find(systematic) != sys.end();
848  }
849  return true;
850  }

◆ 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 355 of file MuonTriggerScaleFactors.cxx.

355  {
356  TH1_Ptr H1 = getEfficiencyHistogram(trigger, true, "nominal");
357  return H1.get() != nullptr;
358  }

◆ LoadTriggerMap()

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

Definition at line 70 of file MuonTriggerScaleFactors.cxx.

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

◆ 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 883 of file MuonTriggerScaleFactors.cxx.

883  {
884  return affectingSystematics();
885  }

◆ registerSystematics()

StatusCode CP::MuonTriggerScaleFactors::registerSystematics ( )
private

Definition at line 873 of file MuonTriggerScaleFactors.cxx.

873  {
875  if (registry.registerSystematics(*this) != StatusCode::SUCCESS) {
876  ATH_MSG_ERROR("Failed to add systematic to list of recommended systematics.");
877  return StatusCode::FAILURE;
878  }
879  return StatusCode::SUCCESS;
880  }

◆ 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_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:853
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:693
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:273
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
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
CP::MuonTriggerScaleFactors::getYear
unsigned int getYear(unsigned int run) const
Definition: MuonTriggerScaleFactors.cxx:714
athena.path
path
python interpreter configuration --------------------------------------—
Definition: athena.py:126
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
TH2F
Definition: rootspy.cxx:420
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:668
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:337
CP::MuonTriggerScaleFactors::m_allowZeroSF
bool m_allowZeroSF
Definition: MuonTriggerScaleFactors.h:126
CP::MuonTriggerScaleFactors::getTemporaryDirectory
TDirectory * getTemporaryDirectory(void) const
Definition: MuonTriggerScaleFactors.cxx:822
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
dirname
std::string dirname(std::string name)
Definition: utils.cxx:200
PixelAthClusterMonAlgCfg.ybins
ybins
Definition: PixelAthClusterMonAlgCfg.py:163
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:54
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
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
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:887
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
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:467
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
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:92
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CP::MuonTriggerScaleFactors::LoadTriggerMap
StatusCode LoadTriggerMap(unsigned int year)
Definition: MuonTriggerScaleFactors.cxx:70
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
TH2
Definition: rootspy.cxx:373
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:725
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:192
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:407
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:798
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:382
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:616
python.grid.isData
def isData(dataset)
Definition: grid.py:491
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
CP::MuonTriggerScaleFactors::registerSystematics
StatusCode registerSystematics()
Definition: MuonTriggerScaleFactors.cxx:873
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:790
CP::MuonTriggerScaleFactors::getThreshold
CorrectionCode getThreshold(Int_t &threshold, const std::string &trigger) const
Definition: MuonTriggerScaleFactors.cxx:699
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:393
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
PhysDESDM_Quirks.trigger
trigger
Definition: PhysDESDM_Quirks.py:27
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:526
CP::MuonTriggerScaleFactors::m_forceYear
int m_forceYear
Definition: MuonTriggerScaleFactors.h:128
beamspotman.basename
basename
Definition: beamspotman.py:640