![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
#include <MuonTriggerScaleFactors.h>
|
| 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 |
|
|
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...
|
|
|
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::SystematicSet & | appliedSystematics () 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_Ptr > | generateReplicas (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...
|
|
Definition at line 30 of file MuonTriggerScaleFactors.h.
◆ EfficiencyMap
◆ EffiHistoIdent
◆ StoreGateSvc_t
◆ YearPeriod
◆ MuonTriggerScaleFactors()
CP::MuonTriggerScaleFactors::MuonTriggerScaleFactors |
( |
const std::string & |
name | ) |
|
◆ ~MuonTriggerScaleFactors()
CP::MuonTriggerScaleFactors::~MuonTriggerScaleFactors |
( |
| ) |
|
|
virtual |
◆ affectingSystematics()
◆ appliedSystematics()
◆ applySystematicVariation()
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.
898 ATH_MSG_ERROR(
"Unsupported combination of systematics passed to the tool!");
899 return StatusCode::FAILURE;
903 itr =
m_systFilter.insert(std::make_pair(systConfig, filteredSys)).first;
916 return StatusCode::FAILURE;
920 return StatusCode::SUCCESS;
◆ declareGaudiProperty() [1/4]
specialization for handling Gaudi::Property<SG::VarHandleKeyArray>
Definition at line 170 of file AthCommonDataStore.h.
175 hndl.documentation());
◆ declareGaudiProperty() [2/4]
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition at line 156 of file AthCommonDataStore.h.
161 hndl.documentation());
◆ declareGaudiProperty() [3/4]
specialization for handling Gaudi::Property<SG::VarHandleBase>
Definition at line 184 of file AthCommonDataStore.h.
189 hndl.documentation());
◆ declareGaudiProperty() [4/4]
◆ declareProperty() [1/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation 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.
250 this->declare(hndl.
vhKey());
251 hndl.
vhKey().setOwner(
this);
◆ declareProperty() [2/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation 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.
◆ declareProperty() [3/6]
◆ declareProperty() [4/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation 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.
◆ declareProperty() [5/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation 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.
◆ declareProperty() [6/6]
◆ 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 |
◆ encodeHistoName() [2/2]
◆ evtStore() [1/2]
◆ evtStore() [2/2]
◆ extraDeps_update_handler()
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.
339 std::vector<TH1_Ptr> replica_v;
340 const int xbins =
h->GetNbinsX(),
ybins =
h->GetNbinsY();
342 for (
int t = 0;
t < nrep; ++
t) {
343 TH2* replica =
dynamic_cast<TH2*
>(
h->Clone(Form(
"rep%d_%s",
t,
h->GetName())));
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)));
350 replica_v.push_back(
TH1_Ptr(replica));
◆ 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.
362 ATH_MSG_ERROR(
"MuonTriggerScaleFactors::getTriggerScaleFactor This is an experimental function. If you really know what you are doing set UseExperimental property.");
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." );
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);
◆ getDataPeriod() [1/3]
std::string CP::MuonTriggerScaleFactors::getDataPeriod |
( |
| ) |
const |
|
protected |
◆ getDataPeriod() [2/3]
std::string CP::MuonTriggerScaleFactors::getDataPeriod |
( |
unsigned int |
run | ) |
const |
|
protected |
◆ getDataPeriod() [3/3]
std::string CP::MuonTriggerScaleFactors::getDataPeriod |
( |
unsigned int |
runNumber, |
|
|
unsigned int |
year |
|
) |
| const |
|
protected |
◆ getDimuonEfficiency()
◆ getEfficiencyHistogram() [1/2]
TH1_Ptr CP::MuonTriggerScaleFactors::getEfficiencyHistogram |
( |
const std::string & |
trigger, |
|
|
bool |
isData, |
|
|
const std::string & |
Systematic, |
|
|
bool |
isBarrel = true |
|
) |
| const |
|
protectedvirtual |
◆ 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 |
◆ getKey()
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
-
ptr | The 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.
121 #ifdef XAOD_STANDALONE
124 return evtStore()->event()->getKey( ptr );
127 return (
proxy ==
nullptr ? 0 :
proxy->sgkey() );
128 #endif // XAOD_STANDALONE
◆ getMuonEfficiency()
Definition at line 407 of file MuonTriggerScaleFactors.cxx.
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.");
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.");
431 if (configuration.
replicaIndex >= (
int) cit->second.size()) {
432 ATH_MSG_ERROR(
"MuonTriggerScaleFactors::getMuonEfficiency ; index for replicated histograms is out of range.");
439 if (cit.get() ==
nullptr) {
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.");
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.");
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;
456 const int bin = eff_h2->FindFixBin(
mu_eta, mu_phi_corr);
◆ 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
-
ptr | The 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.
108 #ifdef XAOD_STANDALONE
111 return evtStore()->event()->getName( ptr );
114 static const std::string
dummy =
"";
116 #endif // XAOD_STANDALONE
◆ 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 |
◆ getRunNumber()
unsigned int CP::MuonTriggerScaleFactors::getRunNumber |
( |
| ) |
const |
|
protected |
Definition at line 798 of file MuonTriggerScaleFactors.cxx.
801 if (
info.operator->()==
nullptr) {
803 throw std::invalid_argument{
""};
806 ATH_MSG_DEBUG(
"The current event is a data event. Return runNumber instead.");
807 return info->runNumber();
809 if (!acc_rnd.isAvailable(*
info)) {
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{
""};
819 return acc_rnd(*
info);
◆ getTemporaryDirectory()
TDirectory * CP::MuonTriggerScaleFactors::getTemporaryDirectory |
( |
void |
| ) |
const |
|
private |
Definition at line 822 of file MuonTriggerScaleFactors.cxx.
824 TDirectory* tempDir = 0;
826 while (not tempDir) {
829 if (gROOT->GetDirectory((
dirname.str()).c_str())) {
833 tempDir = gROOT->mkdir((
dirname.str()).c_str());
835 ATH_MSG_ERROR(
"getTemporaryDirectory::Temporary directory could not be created");
◆ getThreshold()
CorrectionCode CP::MuonTriggerScaleFactors::getThreshold |
( |
Int_t & |
threshold, |
|
|
const std::string & |
trigger |
|
) |
| const |
|
private |
◆ getTriggerCorrespondingToDimuonTrigger()
std::string CP::MuonTriggerScaleFactors::getTriggerCorrespondingToDimuonTrigger |
( |
const std::string & |
trigger | ) |
const |
|
private |
Definition at line 693 of file MuonTriggerScaleFactors.cxx.
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");
◆ getTriggerEfficiency()
◆ getTriggerScaleFactor() [1/2]
Implements CP::IMuonTriggerScaleFactors.
Definition at line 224 of file MuonTriggerScaleFactors.cxx.
226 ATH_MSG_ERROR(
"MuonTriggerScaleFactors::getTriggerScaleFactor This is an experimental function. If you really know what you are doing set UseExperimental property.");
231 ATH_MSG_ERROR(
"MuonTriggerScaleFactors::getTriggerScaleFactor Trigger must have value.");
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!");
◆ getTriggerScaleFactor() [2/2]
◆ GetTriggerSF() [1/2]
Definition at line 605 of file MuonTriggerScaleFactors.cxx.
611 double eff_data = 0., eff_mc = 0.;
620 std::string muon_trigger_name =
trigger;
621 std::string data_err =
"";
622 std::string mc_err =
"";
631 data_err =
"nominal";
634 data_err =
"nominal";
635 mc_err =
"syst_down";
637 data_err =
"stat_down";
640 data_err =
"stat_up";
643 data_err =
"nominal";
649 if (configuration.
replicaIndex != -1) data_err =
"replicas";
652 configuration.
isData =
true;
653 CorrectionCode result_data =
getMuonEfficiency(eff_data, configuration,
mu, muon_trigger_name, data_err);
656 configuration.
isData =
false;
658 CorrectionCode result_mc =
getMuonEfficiency(eff_mc, configuration,
mu, muon_trigger_name, mc_err);
663 if (std::abs(eff_mc) > 0.0001)
664 TriggerSF = eff_data / eff_mc;
◆ GetTriggerSF() [2/2]
Definition at line 526 of file MuonTriggerScaleFactors.cxx.
531 double rate_not_fired_data = 1.;
532 double rate_not_fired_mc = 1.;
534 for (
const auto mu : mucont) {
536 double eff_data = 0., eff_mc = 0.;
545 std::string muon_trigger_name =
trigger;
546 std::string data_err =
"";
547 std::string mc_err =
"";
556 data_err =
"nominal";
559 data_err =
"nominal";
560 mc_err =
"syst_down";
562 data_err =
"stat_down";
565 data_err =
"stat_up";
568 data_err =
"nominal";
579 if (configuration.
replicaIndex != -1) data_err =
"replicas";
582 configuration.
isData =
true;
583 CorrectionCode result_data =
getMuonEfficiency(eff_data, configuration, *
mu, muon_trigger_name, data_err);
585 configuration.
isData =
false;
587 CorrectionCode result_mc =
getMuonEfficiency(eff_mc, configuration, *
mu, muon_trigger_name, mc_err);
590 rate_not_fired_data *= (1. - eff_data);
591 rate_not_fired_mc *= (1. - eff_mc);
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)) {
598 event_SF = (1. - rate_not_fired_data) / (1. - rate_not_fired_mc);
600 TriggerSF = event_SF;
◆ GetTriggerSF_dimu()
Definition at line 467 of file MuonTriggerScaleFactors.cxx.
469 if (mucont.
size() != 2) {
470 ATH_MSG_FATAL(
"MuonTriggerScaleFactors::GetTriggerSF;Currently dimuon trigger chains only implemented for events with exactly 2 muons.");
474 Double_t eff_data = 0;
477 std::string data_err =
"";
478 std::string mc_err =
"";
481 data_err =
"nominal";
484 data_err =
"nominal";
485 mc_err =
"syst_down";
487 data_err =
"stat_down";
490 data_err =
"stat_up";
493 data_err =
"nominal";
504 if (configuration.
replicaIndex != -1) data_err =
"replicas";
507 configuration.
isData =
true;
511 configuration.
isData =
false;
516 double event_SF = 1.;
518 if (std::abs(1. - eff_mc) > 0.0001) {
519 event_SF = eff_data / eff_mc;
522 TriggerSF = event_SF;
◆ getYear()
unsigned int CP::MuonTriggerScaleFactors::getYear |
( |
unsigned int |
run | ) |
const |
|
protected |
Definition at line 714 of file MuonTriggerScaleFactors.cxx.
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;
◆ 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.
202 return StatusCode::FAILURE;
207 return StatusCode::FAILURE;
214 static const int years_to_run[5] = {2015, 2016, 2017, 2018, 2022};
215 for (
const int &
year: years_to_run) {
221 return StatusCode::SUCCESS;
◆ inputHandles()
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()
◆ isTriggerSupported()
bool CP::MuonTriggerScaleFactors::isTriggerSupported |
( |
const std::string & |
trigger | ) |
const |
|
virtual |
◆ LoadTriggerMap()
StatusCode CP::MuonTriggerScaleFactors::LoadTriggerMap |
( |
unsigned int |
year | ) |
|
|
private |
Definition at line 70 of file MuonTriggerScaleFactors.cxx.
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";
80 return StatusCode::SUCCESS;
95 ATH_MSG_INFO(
"Note: setting up with user specified input file location " <<
m_custom_dir <<
" - this is not encouraged!");
101 if (
file ==
nullptr || !
file->IsOpen()) {
103 return StatusCode::FAILURE;
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" };
115 if (qualityDirectory ==
nullptr) {
116 ATH_MSG_FATAL(
"MuonTriggerScaleFactors::initialize cannot find directory with selected quality");
117 return StatusCode::FAILURE;
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());
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");
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()));
148 ATH_MSG_FATAL(
"MuonTriggerScaleFactors::initialize " <<
path <<
" not found under trigger " << triggerName <<
" and period " <<
periodName <<
" for year: " <<
year);
151 hist->SetDirectory(0);
156 return StatusCode::FAILURE;
158 m_efficiencyMap.insert(std::pair<EffiHistoIdent, TH1_Ptr>(HistoId, std::shared_ptr < TH1 > (
hist)));
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);
185 return StatusCode::SUCCESS;
◆ msg() [1/2]
◆ msg() [2/2]
◆ 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.
◆ msgLvl()
◆ outputHandles()
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 the state of the tool.
Implements asg::IAsgTool.
Reimplemented in JetRecTool, JetFinder, JetModifiedMassDrop, JetFromPseudojet, JetReclusterer, JetReclusteringTool, JetTruthLabelingTool, JetPileupLabelingTool, HI::HIPileupTool, top::TopObjectSelection, JetDumper, JetBottomUpSoftDrop, JetRecursiveSoftDrop, JetSoftDrop, JetConstituentsRetriever, JetSubStructureMomentToolsBase, JetSplitter, JetToolRunner, JetPruner, JetPseudojetRetriever, JetTrimmer, AsgHelloTool, and KtDeltaRTool.
Definition at line 131 of file AsgTool.cxx.
◆ print() [2/2]
virtual void asg::IAsgTool::print |
( |
| ) |
const |
|
pure virtualinherited |
Print the state of the tool.
Implemented in JetRecTool, JetFinder, JetModifiedMassDrop, JetFromPseudojet, JetReclusterer, JetReclusteringTool, JetTruthLabelingTool, JetPileupLabelingTool, HI::HIPileupTool, top::TopObjectSelection, asg::AsgTool, JetDumper, JetBottomUpSoftDrop, JetRecursiveSoftDrop, JetSoftDrop, JetConstituentsRetriever, JetSubStructureMomentToolsBase, JetSplitter, JetToolRunner, JetPruner, JetPseudojetRetriever, JetTrimmer, AsgHelloTool, and KtDeltaRTool.
◆ recommendedSystematics()
◆ registerSystematics()
StatusCode CP::MuonTriggerScaleFactors::registerSystematics |
( |
| ) |
|
|
private |
Definition at line 873 of file MuonTriggerScaleFactors.cxx.
875 if (
registry.registerSystematics(*
this) != StatusCode::SUCCESS) {
876 ATH_MSG_ERROR(
"Failed to add systematic to list of recommended systematics.");
877 return StatusCode::FAILURE;
879 return StatusCode::SUCCESS;
◆ renounce()
◆ renounceArray()
◆ sysInitialize()
◆ sysStart()
Handle START transition.
We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.
◆ updateVHKA()
◆ m_allowZeroSF
bool CP::MuonTriggerScaleFactors::m_allowZeroSF |
|
private |
◆ m_appliedSystematics
◆ m_binning
std::string CP::MuonTriggerScaleFactors::m_binning |
|
private |
◆ m_calibration_version
std::string CP::MuonTriggerScaleFactors::m_calibration_version |
|
private |
◆ m_custom_dir
std::string CP::MuonTriggerScaleFactors::m_custom_dir |
|
private |
◆ m_detStore
◆ m_efficiencyMap
◆ m_efficiencyMapReplicaArray
◆ m_eventInfo
◆ m_evtStore
◆ m_experimental
bool CP::MuonTriggerScaleFactors::m_experimental |
|
private |
◆ m_fileName
std::string CP::MuonTriggerScaleFactors::m_fileName |
|
private |
◆ m_forcePeriod
std::string CP::MuonTriggerScaleFactors::m_forcePeriod |
|
private |
◆ m_forceYear
int CP::MuonTriggerScaleFactors::m_forceYear |
|
private |
◆ m_muonquality
std::string CP::MuonTriggerScaleFactors::m_muonquality |
|
private |
◆ m_nReplicas
int CP::MuonTriggerScaleFactors::m_nReplicas |
|
private |
◆ m_ReplicaRandomSeed
int CP::MuonTriggerScaleFactors::m_ReplicaRandomSeed |
|
private |
◆ m_replicaSet
std::set<std::string> CP::MuonTriggerScaleFactors::m_replicaSet |
|
private |
◆ m_replicaTriggerList
std::vector<std::string> CP::MuonTriggerScaleFactors::m_replicaTriggerList |
|
private |
◆ m_systFilter
◆ m_varHandleArraysDeclared
◆ m_vhka
The documentation for this class was generated from the following files:
virtual CP::SystematicSet affectingSystematics() const
returns: the list of all systematics this tool can be affected by
std::set< std::string > m_replicaSet
std::string getTriggerCorrespondingToDimuonTrigger(const std::string &trigger) const
virtual int getReplica_index(const std::string &sysBaseName, const std::string &trigStr) const
std::shared_ptr< TH1 > TH1_Ptr
Const iterator class for DataVector/DataList.
unsigned int getYear(unsigned int run) const
path
python interpreter configuration --------------------------------------—
const CP::SystematicSet & appliedSystematics() const
std::string m_muonquality
virtual CorrectionCode getDimuonEfficiency(Double_t &eff, const TrigMuonEff::Configuration &configuration, const xAOD::MuonContainer &mucont, const std::string &chain, const std::string &systematic) const
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
CP::SystematicSet * m_appliedSystematics
std::string m_forcePeriod
std::pair< YearPeriod, unsigned int > EffiHistoIdent
std::vector< TH1_Ptr > generateReplicas(TH1_Ptr h, int nrep, int seed) const
TDirectory * getTemporaryDirectory(void) const
std::string dirname(std::string name)
Class to wrap a set of SystematicVariations.
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
std::vector< std::string > m_replicaTriggerList
Helper class to provide constant type-safe access to aux data.
const std::string & key() const
Return the StoreGate ID for the referenced object.
@ IS_SIMULATION
true: simulation, false: data
virtual StatusCode applySystematicVariation(const CP::SystematicSet &systConfig)
effects: configure this tool for the given list of systematic variations.
virtual void setOwner(IDataHandleHolder *o)=0
virtual CorrectionCode GetTriggerSF_dimu(Double_t &TriggerSF, TrigMuonEff::Configuration &configuration, const xAOD::MuonContainer &mucont, const std::string &trigger) const
structure to hold variables to configure behaviour of the tool
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
@ OutOfValidityRange
Input object is out of validity range.
@ Error
Some error happened during the object correction.
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="")
StatusCode LoadTriggerMap(unsigned int year)
std::string m_calibration_version
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
int replicaIndex
index of replicated histograms to access
virtual void renounce()=0
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
std::string getDataPeriod() const
void insert(const SystematicVariation &systematic)
description: insert a systematic into the set
virtual CorrectionCode getMuonEfficiency(Double_t &eff, const TrigMuonEff::Configuration &configuration, const xAOD::Muon &muon, const std::string &trigger, const std::string &systematic) const
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfo
std::unordered_map< CP::SystematicSet, CP::SystematicSet > m_systFilter
std::pair< unsigned int, std::string > YearPeriod
@ Ok
The correction was done successfully.
unsigned int getRunNumber() const
EfficiencyMap m_efficiencyMap
#define ATH_MSG_WARNING(x)
bool empty() const
returns: whether this is an empty systematic, i.e.
unsigned int encodeHistoName(const std::string &period, const std::string &Trigger, bool isData, const std::string &Systematic, bool isBarrel=true) const
This module implements the central registry for handling systematic uncertainties with CP tools.
bool matchSystematic(const SystematicVariation &systematic, MATCHTYPE type=FULL) const
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
StatusCode registerSystematics()
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
CorrectionCode getThreshold(Int_t &threshold, const std::string &trigger) const
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
size_type size() const noexcept
Returns the number of elements in the collection.
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
std::map< EffiHistoIdent, std::vector< TH1_Ptr > > m_efficiencyMapReplicaArray
static StatusCode filterForAffectingSystematics(const SystematicSet &systConfig, const SystematicSet &affectingSystematics, SystematicSet &filteredSystematics)
description: filter the systematics for the affected systematics returns: success guarantee: strong f...
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
static SystematicRegistry & getInstance()
Get the singleton instance of the registry for the curren thread.
virtual CorrectionCode GetTriggerSF(Double_t &TriggerSF, TrigMuonEff::Configuration &configuration, const xAOD::MuonContainer &mucont, const std::string &trigger) const