|
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 901 of file MuonTriggerScaleFactors.cxx.
912 ATH_MSG_ERROR(
"Unsupported combination of systematics passed to the tool!");
913 return StatusCode::FAILURE;
917 itr =
m_systFilter.insert(std::make_pair(systConfig, filteredSys)).first;
930 return StatusCode::FAILURE;
934 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 345 of file MuonTriggerScaleFactors.cxx.
347 std::vector<TH1_Ptr> replica_v;
348 const int xbins =
h->GetNbinsX(),
ybins =
h->GetNbinsY();
350 for (
int t = 0;
t < nrep; ++
t) {
351 TH2* replica =
dynamic_cast<TH2*
>(
h->Clone(Form(
"rep%d_%s",
t,
h->GetName())));
353 for (
int x_i = 0; x_i <=
xbins; ++x_i) {
354 for (
int y_i = 0; y_i <=
ybins; ++y_i) {
355 replica->SetBinContent(x_i, y_i, Rndm.Gaus(
h->GetBinContent(x_i, y_i),
h->GetBinError(x_i, y_i)));
358 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 368 of file MuonTriggerScaleFactors.cxx.
370 ATH_MSG_ERROR(
"MuonTriggerScaleFactors::getTriggerScaleFactor This is an experimental function. If you really know what you are doing set UseExperimental property.");
380 ATH_MSG_ERROR(
"Could not find efficiency map for muon with eta: " <<
mu_eta <<
" and phi: " <<
mu_phi <<
". Something is inconsistent. Please check your settings for year, mc and trigger." );
384 double mu_phi_corr =
mu_phi;
385 if (mu_phi_corr < eff_h2->GetYaxis()->GetXmin()) mu_phi_corr += 2.0 *
M_PI;
386 if (mu_phi_corr > eff_h2->GetYaxis()->GetXmax()) mu_phi_corr -= 2.0 *
M_PI;
387 return eff_h2->FindFixBin(
mu_eta, mu_phi_corr);
◆ 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 415 of file MuonTriggerScaleFactors.cxx.
428 ATH_MSG_WARNING(
"Could not find what you are looking for in the efficiency map. The trigger you are looking for, year and mc are not consistent, or the trigger is unavailable in this data period. Returning efficiency = 0.");
434 ATH_MSG_ERROR(
"Could not find what you are looking for in the efficiency map. The trigger you are looking for, year and mc are not consistent, or the trigger is unavailable in this data period. Please check how you set up the tool.");
439 if (configuration.
replicaIndex >= (
int) cit->second.size()) {
440 ATH_MSG_ERROR(
"MuonTriggerScaleFactors::getMuonEfficiency ; index for replicated histograms is out of range.");
447 if (cit.get() ==
nullptr) {
449 ATH_MSG_WARNING(
"Could not find what you are looking for in the efficiency map. The trigger you are looking for, year and mc are not consistent, or the trigger is unavailable in this data period. Returning efficiency = 0.");
453 ATH_MSG_ERROR(
"Could not find what you are looking for in the efficiency map. The trigger you are looking for, year and mc are not consistent, or the trigger is unavailable in this data period. Please check how you set up the tool.");
460 double mu_phi_corr =
mu_phi;
461 if (mu_phi_corr < eff_h2->GetYaxis()->GetXmin()) mu_phi_corr += 2.0 *
M_PI;
462 if (mu_phi_corr > eff_h2->GetYaxis()->GetXmax()) mu_phi_corr -= 2.0 *
M_PI;
464 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 812 of file MuonTriggerScaleFactors.cxx.
815 if (
info.operator->()==
nullptr) {
817 throw std::invalid_argument{
""};
820 ATH_MSG_DEBUG(
"The current event is a data event. Return runNumber instead.");
821 return info->runNumber();
823 if (!acc_rnd.isAvailable(*
info)) {
825 ATH_MSG_FATAL(
"Failed to find the RandomRunNumber decoration. Please call the apply() method from the PileupReweightingTool beforehand in order to get period dependent SFs");
826 throw std::invalid_argument{
""};
827 }
else if (acc_rnd(*
info) == 0) {
828 ATH_MSG_FATAL(
"Pile up tool has given runNumber 0. Exiting the code.");
829 throw std::invalid_argument{
""};
833 return acc_rnd(*
info);
◆ getTemporaryDirectory()
TDirectory * CP::MuonTriggerScaleFactors::getTemporaryDirectory |
( |
void |
| ) |
const |
|
private |
Definition at line 836 of file MuonTriggerScaleFactors.cxx.
838 TDirectory* tempDir = 0;
840 while (not tempDir) {
843 if (gROOT->GetDirectory((
dirname.str()).c_str())) {
847 tempDir = gROOT->mkdir((
dirname.str()).c_str());
849 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 707 of file MuonTriggerScaleFactors.cxx.
708 std::size_t
index = trigger.find(
"HLT_mu");
709 if (
index != std::string::npos) {
710 std::string rawNumber = trigger.substr(
index + 6);
711 if (!rawNumber.empty() && isdigit(rawNumber[0])) {
712 std::stringstream(rawNumber) >>
threshold;
718 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 701 of file MuonTriggerScaleFactors.cxx.
702 if (trigger.find(
"2mu10") != std::string::npos)
return "HLT_mu10";
703 if (trigger.find(
"2mu14") != std::string::npos)
return "HLT_mu14";
704 throw std::runtime_error(
"Unknown dimuon trigger");
◆ getTriggerEfficiency()
◆ getTriggerScaleFactor() [1/2]
Implements CP::IMuonTriggerScaleFactors.
Definition at line 232 of file MuonTriggerScaleFactors.cxx.
234 ATH_MSG_ERROR(
"MuonTriggerScaleFactors::getTriggerScaleFactor This is an experimental function. If you really know what you are doing set UseExperimental property.");
238 if (trigger.empty()) {
239 ATH_MSG_ERROR(
"MuonTriggerScaleFactors::getTriggerScaleFactor Trigger must have value.");
245 if (trigger ==
"HLT_mu8noL1")
246 ATH_MSG_WARNING(
"What you are trying to do is not correct. For di-muon triggers you should get the efficiency with getTriggerEfficiency and compute the SF by yourself.");
247 else if (trigger.find(
"HLT_2mu10") != std::string::npos || trigger.find(
"HLT_2mu14") != std::string::npos)
248 ATH_MSG_WARNING(
"Di-muon trigger scale factors for single reco muons are not supported!");
◆ getTriggerScaleFactor() [2/2]
Implements CP::IMuonTriggerScaleFactors.
Definition at line 254 of file MuonTriggerScaleFactors.cxx.
255 if (trigger.empty()) {
256 ATH_MSG_ERROR(
"MuonTriggerScaleFactors::getTriggerScaleFactor Trigger must have value.");
262 if (trigger ==
"HLT_mu8noL1") {
263 ATH_MSG_WARNING(
"What you are trying to do is not correct. For di-muon triggers you should get the efficiency with getTriggerEfficiency and compute the SF by yourself.");
265 else if (trigger.find(
"HLT_2mu10") != std::string::npos || trigger.find(
"HLT_2mu14") != std::string::npos) {
269 CorrectionCode
cc =
GetTriggerSF(triggersf, configuration, mucont, trigger);
◆ GetTriggerSF() [1/2]
Definition at line 613 of file MuonTriggerScaleFactors.cxx.
619 double eff_data = 0., eff_mc = 0.;
628 std::string muon_trigger_name = trigger;
629 std::string data_err =
"";
630 std::string mc_err =
"";
639 data_err =
"nominal";
642 data_err =
"nominal";
643 mc_err =
"syst_down";
645 data_err =
"stat_down";
648 data_err =
"stat_up";
651 data_err =
"nominal";
657 if (configuration.
replicaIndex != -1) data_err =
"replicas";
660 configuration.
isData =
true;
661 CorrectionCode result_data =
getMuonEfficiency(eff_data, configuration,
mu, muon_trigger_name, data_err);
664 configuration.
isData =
false;
666 CorrectionCode result_mc =
getMuonEfficiency(eff_mc, configuration,
mu, muon_trigger_name, mc_err);
671 if (std::abs(eff_mc) > 0.0001)
672 TriggerSF = eff_data / eff_mc;
◆ GetTriggerSF() [2/2]
Definition at line 534 of file MuonTriggerScaleFactors.cxx.
539 double rate_not_fired_data = 1.;
540 double rate_not_fired_mc = 1.;
542 for (
const auto mu : mucont) {
544 double eff_data = 0., eff_mc = 0.;
553 std::string muon_trigger_name = trigger;
554 std::string data_err =
"";
555 std::string mc_err =
"";
564 data_err =
"nominal";
567 data_err =
"nominal";
568 mc_err =
"syst_down";
570 data_err =
"stat_down";
573 data_err =
"stat_up";
576 data_err =
"nominal";
587 if (configuration.
replicaIndex != -1) data_err =
"replicas";
590 configuration.
isData =
true;
591 CorrectionCode result_data =
getMuonEfficiency(eff_data, configuration, *
mu, muon_trigger_name, data_err);
593 configuration.
isData =
false;
595 CorrectionCode result_mc =
getMuonEfficiency(eff_mc, configuration, *
mu, muon_trigger_name, mc_err);
598 rate_not_fired_data *= (1. - eff_data);
599 rate_not_fired_mc *= (1. - eff_mc);
602 double event_SF = 1.;
603 if (1 - rate_not_fired_data == 0) event_SF = 0;
604 if ((mucont.size()) and (std::abs(1. - rate_not_fired_mc) > 0.0001)) {
606 event_SF = (1. - rate_not_fired_data) / (1. - rate_not_fired_mc);
608 TriggerSF = event_SF;
◆ GetTriggerSF_dimu()
Definition at line 475 of file MuonTriggerScaleFactors.cxx.
477 if (mucont.
size() != 2) {
478 ATH_MSG_FATAL(
"MuonTriggerScaleFactors::GetTriggerSF;Currently dimuon trigger chains only implemented for events with exactly 2 muons.");
482 Double_t eff_data = 0;
485 std::string data_err =
"";
486 std::string mc_err =
"";
489 data_err =
"nominal";
492 data_err =
"nominal";
493 mc_err =
"syst_down";
495 data_err =
"stat_down";
498 data_err =
"stat_up";
501 data_err =
"nominal";
512 if (configuration.
replicaIndex != -1) data_err =
"replicas";
515 configuration.
isData =
true;
519 configuration.
isData =
false;
524 double event_SF = 1.;
526 if (std::abs(1. - eff_mc) > 0.0001) {
527 event_SF = eff_data / eff_mc;
530 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 201 of file MuonTriggerScaleFactors.cxx.
213 return StatusCode::FAILURE;
218 return StatusCode::FAILURE;
225 constexpr
auto years_to_run = std::to_array<int>({2015, 2016, 2017, 2018, 2022, 2023});
226 for (
const int &
year: years_to_run) {
229 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 80 of file MuonTriggerScaleFactors.cxx.
83 if (
year == 2015)
fileName =
"muontrigger_sf_2015_mc20a_v1.root";
84 else if (
year == 2016)
fileName =
"muontrigger_sf_2016_mc20a_v1.root";
85 else if (
year == 2017)
fileName =
"muontrigger_sf_2017_mc20d_v1.root";
86 else if (
year == 2018)
fileName =
"muontrigger_sf_2018_mc20e_v2.root";
87 else if (
year == 2022)
fileName =
"muontrigger_sf_2022_mc23a_v02.root";
88 else if (
year == 2023)
fileName =
"muontrigger_sf_2023_mc23d_v02.root";
91 return StatusCode::SUCCESS;
106 ATH_MSG_INFO(
"Note: setting up with user specified input file location " <<
m_custom_dir <<
" - this is not encouraged!");
112 if (
file ==
nullptr || !
file->IsOpen()) {
114 return StatusCode::FAILURE;
119 static const std::vector<std::string>
type {
"data",
"mc" };
120 static const std::vector<std::string> region {
"barrel",
"endcap" };
121 static const std::vector<std::string> systematic {
"nominal",
"stat_up",
"stat_down",
"syst_up",
"syst_down" };
126 if (qualityDirectory ==
nullptr) {
127 ATH_MSG_FATAL(
"MuonTriggerScaleFactors::initialize cannot find directory with selected quality");
128 return StatusCode::FAILURE;
131 TIter nextPeriod(qualityDirectory->GetListOfKeys());
132 while ((periodKey = (TKey*) nextPeriod())) {
133 if (not periodKey->IsFolder())
continue;
134 TDirectory* periodDirectory = qualityDirectory->GetDirectory(periodKey->GetName());
135 std::string
periodName = std::string(periodKey->GetName());
139 TIter nextTrigger(periodDirectory->GetListOfKeys());
140 while ((triggerKey = (TKey*) nextTrigger())) {
141 if (not triggerKey->IsFolder())
continue;
142 TDirectory* triggerDirectory = periodDirectory->GetDirectory(triggerKey->GetName());
143 std::string triggerName = std::string(triggerKey->GetName());
144 if(!std::set<std::string>{
"HLT_mu26_ivarmedium",
"HLT_mu50",
"HLT_mu26_ivarmedium_OR_HLT_mu50"}.count(triggerName) &&
m_binning ==
"coarse"){
145 ATH_MSG_DEBUG(
"Coarse binning not supported for di-muon trigger legs at the moment");
148 for (
const auto& iregion : region) {
149 bool isBarrel = iregion.find(
"barrel") != std::string::npos;
150 for (
const auto& itype :
type) {
151 bool isData = itype.find(
"data") != std::string::npos;
152 std::string
histname = (
"_MuonTrigEff_" +
periodName +
"_" + triggerName +
"_" + quality +
"_" +
"_EtaPhi_" +
m_binning +
"_" + iregion +
"_" + itype);
153 for (
const auto& isys : systematic) {
154 if (itype.find(
"data") != std::string::npos && isys.find(
"syst") != std::string::npos)
continue;
155 std::string
path =
"eff_etaphi_" +
m_binning +
"_" + iregion +
"_" + itype +
"_" + isys;
156 TH2*
hist =
dynamic_cast<TH2*
>(triggerDirectory->Get(
path.c_str()));
159 ATH_MSG_FATAL(
"MuonTriggerScaleFactors::initialize " <<
path <<
" not found under trigger " << triggerName <<
" and period " <<
periodName <<
" for year: " <<
year);
162 hist->SetDirectory(0);
167 return StatusCode::FAILURE;
169 m_efficiencyMap.insert(std::pair<EffiHistoIdent, TH1_Ptr>(HistoId, std::shared_ptr < TH1 > (
hist)));
179 TH1_Ptr tmp_h2 =
TH1_Ptr(
dynamic_cast<TH2F*
>(Nominal_H->Clone(Form(
"tmp_h2_%s", Nominal_H->GetName()))));
180 const int xbins = tmp_h2->GetNbinsX(),
ybins = tmp_h2->GetNbinsY();
181 for (
int x_i = 0; x_i <=
xbins; ++x_i) {
182 for (
int y_i = 0; y_i <=
ybins; ++y_i) {
183 double statErr = std::abs(tmp_h2->GetBinContent(x_i, y_i) - StatUp_H->GetBinContent(x_i, y_i));
184 tmp_h2->SetBinError(x_i, y_i, statErr);
196 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, 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, 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 887 of file MuonTriggerScaleFactors.cxx.
889 if (
registry.registerSystematics(*
this) != StatusCode::SUCCESS) {
890 ATH_MSG_ERROR(
"Failed to add systematic to list of recommended systematics.");
891 return StatusCode::FAILURE;
893 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}
}
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
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
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
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
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