 |
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, V, H > &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, V, H > &hndl, const SG::VarHandleKeyType &) |
| specialization for handling Gaudi::Property<SG::VarHandleKey> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyArrayType &) |
| specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleType &) |
| specialization for handling Gaudi::Property<SG::VarHandleBase> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T, V, H > &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 914 of file MuonTriggerScaleFactors.cxx.
925 ATH_MSG_ERROR(
"Unsupported combination of systematics passed to the tool!");
926 return StatusCode::FAILURE;
930 itr =
m_systFilter.insert(std::make_pair(systConfig, filteredSys)).first;
943 return StatusCode::FAILURE;
947 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);
253 return PBASE::declareProperty(
name,hndl,
doc);
◆ 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.
229 return PBASE::declareProperty(
name,hndl,
doc);
◆ 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.
338 return PBASE::declareProperty(
name, property,
doc);
◆ 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 347 of file MuonTriggerScaleFactors.cxx.
349 std::vector<TH1_Ptr> replica_v;
350 const int xbins =
h->GetNbinsX(),
ybins =
h->GetNbinsY();
352 for (
int t = 0;
t < nrep; ++
t) {
353 TH2* replica =
dynamic_cast<TH2*
>(
h->Clone(Form(
"rep%d_%s",
t,
h->GetName())));
355 for (
int x_i = 0; x_i <=
xbins; ++x_i) {
356 for (
int y_i = 0; y_i <=
ybins; ++y_i) {
357 replica->SetBinContent(x_i, y_i, Rndm.Gaus(
h->GetBinContent(x_i, y_i),
h->GetBinError(x_i, y_i)));
360 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 370 of file MuonTriggerScaleFactors.cxx.
372 ATH_MSG_ERROR(
"MuonTriggerScaleFactors::getTriggerScaleFactor This is an experimental function. If you really know what you are doing set UseExperimental property.");
382 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." );
386 double mu_phi_corr =
mu_phi;
387 if (mu_phi_corr < eff_h2->GetYaxis()->GetXmin()) mu_phi_corr += 2.0 *
M_PI;
388 if (mu_phi_corr > eff_h2->GetYaxis()->GetXmax()) mu_phi_corr -= 2.0 *
M_PI;
389 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
127 return (
proxy ==
nullptr ? 0 :
proxy->sgkey() );
128 #endif // XAOD_STANDALONE
◆ getMuonEfficiency()
Definition at line 417 of file MuonTriggerScaleFactors.cxx.
430 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.");
436 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.");
441 if (configuration.
replicaIndex >= (
int) cit->second.size()) {
442 ATH_MSG_ERROR(
"MuonTriggerScaleFactors::getMuonEfficiency ; index for replicated histograms is out of range.");
449 if (cit.get() ==
nullptr) {
451 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.");
455 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.");
462 double mu_phi_corr =
mu_phi;
463 if (mu_phi_corr < eff_h2->GetYaxis()->GetXmin()) mu_phi_corr += 2.0 *
M_PI;
464 if (mu_phi_corr > eff_h2->GetYaxis()->GetXmax()) mu_phi_corr -= 2.0 *
M_PI;
466 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
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 825 of file MuonTriggerScaleFactors.cxx.
828 if (
info.operator->()==
nullptr) {
830 throw std::invalid_argument{
""};
833 ATH_MSG_DEBUG(
"The current event is a data event. Return runNumber instead.");
834 return info->runNumber();
836 if (!acc_rnd.isAvailable(*
info)) {
838 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");
839 throw std::invalid_argument{
""};
840 }
else if (acc_rnd(*
info) == 0) {
841 ATH_MSG_FATAL(
"Pile up tool has given runNumber 0. Exiting the code.");
842 throw std::invalid_argument{
""};
846 return acc_rnd(*
info);
◆ getTemporaryDirectory()
TDirectory * CP::MuonTriggerScaleFactors::getTemporaryDirectory |
( |
void |
| ) |
const |
|
private |
Definition at line 849 of file MuonTriggerScaleFactors.cxx.
851 TDirectory* tempDir = 0;
853 while (not tempDir) {
856 if (gROOT->GetDirectory((
dirname.str()).c_str())) {
860 tempDir = gROOT->mkdir((
dirname.str()).c_str());
862 ATH_MSG_ERROR(
"getTemporaryDirectory::Temporary directory could not be created");
◆ getThreshold()
CorrectionCode CP::MuonTriggerScaleFactors::getThreshold |
( |
Int_t & |
threshold, |
|
|
const std::string & |
trigger |
|
) |
| const |
|
private |
Definition at line 709 of file MuonTriggerScaleFactors.cxx.
710 std::size_t
index = trigger.find(
"HLT_mu");
711 if (
index != std::string::npos) {
712 std::string rawNumber = trigger.substr(
index + 6);
713 if (!rawNumber.empty() && isdigit(rawNumber[0])) {
714 std::stringstream(rawNumber) >>
threshold;
720 ATH_MSG_ERROR(
"MuonTriggerScaleFactors::getThreshold Could not extract threshold for trigger " << trigger);
◆ getTriggerCorrespondingToDimuonTrigger()
std::string CP::MuonTriggerScaleFactors::getTriggerCorrespondingToDimuonTrigger |
( |
const std::string & |
trigger | ) |
const |
|
private |
Definition at line 703 of file MuonTriggerScaleFactors.cxx.
704 if (trigger.find(
"2mu10") != std::string::npos)
return "HLT_mu10";
705 if (trigger.find(
"2mu14") != std::string::npos)
return "HLT_mu14";
706 throw std::runtime_error(
"Unknown dimuon trigger");
◆ getTriggerEfficiency()
◆ getTriggerScaleFactor() [1/2]
Implements CP::IMuonTriggerScaleFactors.
Definition at line 234 of file MuonTriggerScaleFactors.cxx.
236 ATH_MSG_ERROR(
"MuonTriggerScaleFactors::getTriggerScaleFactor This is an experimental function. If you really know what you are doing set UseExperimental property.");
240 if (trigger.empty()) {
241 ATH_MSG_ERROR(
"MuonTriggerScaleFactors::getTriggerScaleFactor Trigger must have value.");
247 if (trigger ==
"HLT_mu8noL1")
248 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.");
249 else if (trigger.find(
"HLT_2mu10") != std::string::npos || trigger.find(
"HLT_2mu14") != std::string::npos)
250 ATH_MSG_WARNING(
"Di-muon trigger scale factors for single reco muons are not supported!");
◆ getTriggerScaleFactor() [2/2]
Implements CP::IMuonTriggerScaleFactors.
Definition at line 256 of file MuonTriggerScaleFactors.cxx.
257 if (trigger.empty()) {
258 ATH_MSG_ERROR(
"MuonTriggerScaleFactors::getTriggerScaleFactor Trigger must have value.");
264 if (trigger ==
"HLT_mu8noL1") {
265 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.");
267 else if (trigger.find(
"HLT_2mu10") != std::string::npos || trigger.find(
"HLT_2mu14") != std::string::npos) {
271 CorrectionCode
cc =
GetTriggerSF(triggersf, configuration, mucont, trigger);
◆ GetTriggerSF() [1/2]
Definition at line 615 of file MuonTriggerScaleFactors.cxx.
621 double eff_data = 0., eff_mc = 0.;
630 std::string muon_trigger_name = trigger;
631 std::string data_err =
"";
632 std::string mc_err =
"";
641 data_err =
"nominal";
644 data_err =
"nominal";
645 mc_err =
"syst_down";
647 data_err =
"stat_down";
650 data_err =
"stat_up";
653 data_err =
"nominal";
659 if (configuration.
replicaIndex != -1) data_err =
"replicas";
662 configuration.
isData =
true;
663 CorrectionCode result_data =
getMuonEfficiency(eff_data, configuration,
mu, muon_trigger_name, data_err);
666 configuration.
isData =
false;
668 CorrectionCode result_mc =
getMuonEfficiency(eff_mc, configuration,
mu, muon_trigger_name, mc_err);
673 if (std::abs(eff_mc) > 0.0001)
674 TriggerSF = eff_data / eff_mc;
◆ GetTriggerSF() [2/2]
Definition at line 536 of file MuonTriggerScaleFactors.cxx.
541 double rate_not_fired_data = 1.;
542 double rate_not_fired_mc = 1.;
544 for (
const auto mu : mucont) {
546 double eff_data = 0., eff_mc = 0.;
555 std::string muon_trigger_name = trigger;
556 std::string data_err =
"";
557 std::string mc_err =
"";
566 data_err =
"nominal";
569 data_err =
"nominal";
570 mc_err =
"syst_down";
572 data_err =
"stat_down";
575 data_err =
"stat_up";
578 data_err =
"nominal";
589 if (configuration.
replicaIndex != -1) data_err =
"replicas";
592 configuration.
isData =
true;
593 CorrectionCode result_data =
getMuonEfficiency(eff_data, configuration, *
mu, muon_trigger_name, data_err);
595 configuration.
isData =
false;
597 CorrectionCode result_mc =
getMuonEfficiency(eff_mc, configuration, *
mu, muon_trigger_name, mc_err);
600 rate_not_fired_data *= (1. - eff_data);
601 rate_not_fired_mc *= (1. - eff_mc);
604 double event_SF = 1.;
605 if (1 - rate_not_fired_data == 0) event_SF = 0;
606 if ((mucont.size()) and (std::abs(1. - rate_not_fired_mc) > 0.0001)) {
608 event_SF = (1. - rate_not_fired_data) / (1. - rate_not_fired_mc);
610 TriggerSF = event_SF;
◆ GetTriggerSF_dimu()
Definition at line 477 of file MuonTriggerScaleFactors.cxx.
479 if (mucont.
size() != 2) {
480 ATH_MSG_FATAL(
"MuonTriggerScaleFactors::GetTriggerSF;Currently dimuon trigger chains only implemented for events with exactly 2 muons.");
484 Double_t eff_data = 0;
487 std::string data_err =
"";
488 std::string mc_err =
"";
491 data_err =
"nominal";
494 data_err =
"nominal";
495 mc_err =
"syst_down";
497 data_err =
"stat_down";
500 data_err =
"stat_up";
503 data_err =
"nominal";
514 if (configuration.
replicaIndex != -1) data_err =
"replicas";
517 configuration.
isData =
true;
521 configuration.
isData =
false;
526 double event_SF = 1.;
528 if (std::abs(1. - eff_mc) > 0.0001) {
529 event_SF = eff_data / eff_mc;
532 TriggerSF = event_SF;
◆ getYear()
unsigned int CP::MuonTriggerScaleFactors::getYear |
( |
unsigned int |
run | ) |
const |
|
protected |
◆ 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 203 of file MuonTriggerScaleFactors.cxx.
215 return StatusCode::FAILURE;
220 return StatusCode::FAILURE;
227 constexpr
auto years_to_run = std::to_array<int>({2015, 2016, 2017, 2018, 2022, 2023, 2024});
228 for (
const int &
year: years_to_run) {
231 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 81 of file MuonTriggerScaleFactors.cxx.
84 if (
year == 2015)
fileName =
"muontrigger_sf_2015_mc20a_v3.root";
85 else if (
year == 2016)
fileName =
"muontrigger_sf_2016_mc20a_v3.root";
86 else if (
year == 2017)
fileName =
"muontrigger_sf_2017_mc20d_v3.root";
87 else if (
year == 2018)
fileName =
"muontrigger_sf_2018_mc20e_v3.root";
88 else if (
year == 2022)
fileName =
"muontrigger_sf_2022_mc23a_v3.root";
89 else if (
year == 2023)
fileName =
"muontrigger_sf_2023_mc23d_v3.root";
90 else if (
year == 2024)
fileName =
"muontrigger_sf_2024_mc23e_v1.root";
93 return StatusCode::SUCCESS;
108 ATH_MSG_INFO(
"Note: setting up with user specified input file location " <<
m_custom_dir <<
" - this is not encouraged!");
114 if (
file ==
nullptr || !
file->IsOpen()) {
116 return StatusCode::FAILURE;
121 static const std::vector<std::string>
type {
"data",
"mc" };
122 static const std::vector<std::string> region {
"barrel",
"endcap" };
123 static const std::vector<std::string> systematic {
"nominal",
"stat_up",
"stat_down",
"syst_up",
"syst_down" };
128 if (qualityDirectory ==
nullptr) {
129 ATH_MSG_FATAL(
"MuonTriggerScaleFactors::initialize cannot find directory with selected quality");
130 return StatusCode::FAILURE;
133 TIter nextPeriod(qualityDirectory->GetListOfKeys());
134 while ((periodKey = (TKey*) nextPeriod())) {
135 if (not periodKey->IsFolder())
continue;
136 TDirectory* periodDirectory = qualityDirectory->GetDirectory(periodKey->GetName());
137 std::string
periodName = std::string(periodKey->GetName());
141 TIter nextTrigger(periodDirectory->GetListOfKeys());
142 while ((triggerKey = (TKey*) nextTrigger())) {
143 if (not triggerKey->IsFolder())
continue;
144 TDirectory* triggerDirectory = periodDirectory->GetDirectory(triggerKey->GetName());
145 std::string triggerName = std::string(triggerKey->GetName());
146 if(!std::set<std::string>{
"HLT_mu26_ivarmedium",
"HLT_mu50",
"HLT_mu26_ivarmedium_OR_HLT_mu50"}.count(triggerName) &&
m_binning ==
"coarse"){
147 ATH_MSG_DEBUG(
"Coarse binning not supported for di-muon trigger legs at the moment");
150 for (
const auto& iregion : region) {
151 bool isBarrel = iregion.find(
"barrel") != std::string::npos;
152 for (
const auto& itype :
type) {
153 bool isData = itype.find(
"data") != std::string::npos;
155 for (
const auto& isys : systematic) {
156 if (itype.find(
"data") != std::string::npos && isys.find(
"syst") != std::string::npos)
continue;
157 std::string
path =
"eff_etaphi_" +
m_binning +
"_" + iregion +
"_" + itype +
"_" + isys;
158 TH2*
hist =
dynamic_cast<TH2*
>(triggerDirectory->Get(
path.c_str()));
161 ATH_MSG_FATAL(
"MuonTriggerScaleFactors::initialize " <<
path <<
" not found under trigger " << triggerName <<
" and period " <<
periodName <<
" for year: " <<
year);
164 hist->SetDirectory(0);
169 return StatusCode::FAILURE;
171 m_efficiencyMap.insert(std::pair<EffiHistoIdent, TH1_Ptr>(HistoId, std::shared_ptr < TH1 > (
hist)));
181 TH1_Ptr tmp_h2 =
TH1_Ptr(
dynamic_cast<TH2F*
>(Nominal_H->Clone(Form(
"tmp_h2_%s", Nominal_H->GetName()))));
182 const int xbins = tmp_h2->GetNbinsX(),
ybins = tmp_h2->GetNbinsY();
183 for (
int x_i = 0; x_i <=
xbins; ++x_i) {
184 for (
int y_i = 0; y_i <=
ybins; ++y_i) {
185 double statErr = std::abs(tmp_h2->GetBinContent(x_i, y_i) - StatUp_H->GetBinContent(x_i, y_i));
186 tmp_h2->SetBinError(x_i, y_i, statErr);
198 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, LundVariablesTool, 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, LundVariablesTool, 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 900 of file MuonTriggerScaleFactors.cxx.
902 if (
registry.registerSystematics(*
this) != StatusCode::SUCCESS) {
903 ATH_MSG_ERROR(
"Failed to add systematic to list of recommended systematics.");
904 return StatusCode::FAILURE;
906 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_runNumber_year
const std::map< unsigned int, int > CP::MuonTriggerScaleFactors::m_runNumber_year |
|
staticprivate |
Initial value:= {
{284484,2015},
{311481,2016},
{340453,2017},
{364292,2018},
{440613,2022},
{456749,2023},
{486706,2024}
}
Definition at line 137 of file MuonTriggerScaleFactors.h.
◆ 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
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
def TH2F(name, title, nxbins, bins_par2, bins_par3, bins_par4, bins_par5=None, bins_par6=None, path='', **kwargs)
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
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
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="")
static const std::map< unsigned int, int > m_runNumber_year
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
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
bool empty() const noexcept
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.
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