5#ifndef MUONTRIGGERSCALEFACTORS_H_
6#define MUONTRIGGERSCALEFACTORS_H_
14#include "TDirectory.h"
19#include <unordered_map>
24namespace ADD_CMODE(CP) {
25 typedef std::shared_ptr<TH1> TH1_Ptr;
32 MuonTriggerScaleFactors(
const std::string& name);
34 virtual ~MuonTriggerScaleFactors();
53 virtual int getBinNumber(
const xAOD::Muon& muon,
const std::string& trigger)
const;
55 virtual int getReplica_index(
const std::string& sysBaseName,
const std::string& trigStr)
const;
58 virtual bool isTriggerSupported(
const std::string& trigger)
const;
72 return *m_appliedSystematics;
80 unsigned int encodeHistoName(
const std::string_view period,
const std::string& Trigger,
bool isData,
const std::string& Systematic,
bool isBarrel =
true)
const;
82 unsigned int encodeHistoName(
const std::string& Trigger,
const TrigMuonEff::Configuration& configuration,
const std::string& Systematic,
bool isBarrel =
true)
const;
84 virtual std::shared_ptr<TH1> getEfficiencyHistogram(
unsigned int year,
const std::string_view period,
const std::string& trigger,
bool isData,
const std::string& Systematic,
bool isBarrel =
true)
const;
85 virtual std::shared_ptr<TH1> getEfficiencyHistogram(
const std::string& trigger,
bool isData,
const std::string& Systematic,
bool isBarrel =
true)
const;
87 typedef std::pair<unsigned int, std::string> YearPeriod;
88 typedef std::pair<YearPeriod, unsigned int> EffiHistoIdent;
89 typedef std::map<EffiHistoIdent, TH1_Ptr> EfficiencyMap;
91 CP::CorrectionCode
getThreshold(Int_t& threshold,
const std::string& trigger)
const;
93 std::string getTriggerCorrespondingToDimuonTrigger(
const std::string& trigger)
const;
96 const std::string_view getDataPeriod()
const;
97 unsigned int getRunNumber()
const;
98 unsigned int getYear(
unsigned int run)
const;
99 const std::string_view getDataPeriod(
unsigned int run)
const;
100 const std::string_view getDataPeriod(
unsigned int runNumber,
unsigned int year)
const;
102 SG::ReadHandleKey<xAOD::EventInfo> m_eventInfo{
this,
"EventInfoContName",
"EventInfo",
"event info key"};
104 TDirectory* getTemporaryDirectory(
void)
const;
108 std::vector<TH1_Ptr> generateReplicas(TH1_Ptr h,
int nrep,
int seed)
const;
110 std::unordered_map<CP::SystematicSet, CP::SystematicSet> m_systFilter;
112 CP::SystematicSet *m_appliedSystematics{};
113 EfficiencyMap m_efficiencyMap;
114 std::map<EffiHistoIdent, std::vector<TH1_Ptr> > m_efficiencyMapReplicaArray;
116 Gaudi::Property<std::string> m_muonQuality {
this,
"MuonQuality",
"Medium",
"the muon quality to get the scale factors for"};
117 Gaudi::Property<std::string> m_campaign {
this,
"Campaign",
"",
"the MC campaign to get the scale factors for"};
120 Gaudi::Property<std::string> m_calibrationVersion {
this,
"CalibrationVersion",
"261003_FallUpdate",
"the calibration version to use"};
121 Gaudi::Property<std::string> m_customInputFolder {
this,
"CustomInputFolder",
"",
"the custom input folder to use (debugging only)"};
122 Gaudi::Property<std::map<unsigned int, std::string>> m_customInputFilePerYear {
this,
"CustomInputFilePerYear", {},
"the custom input file to use per year (debugging only)"};
123 Gaudi::Property<std::string> m_binning {
this,
"Binning",
"fine",
"the binning to use"};
125 Gaudi::Property<bool> m_allowZeroSF {
this,
"AllowZeroSF",
false,
"if a trigger is not available will return 0 instead of throwing an error. More difficult to spot configuration issues. Use at own risk"};
126 Gaudi::Property<bool> m_experimental {
this,
"UseExperimental",
false,
"enable experimental features like single muon SF"};
127 Gaudi::Property<int> m_forceYear {
this,
"ForceYear", -1,
"Only for developers. Never use this in any analysis!!!!!!"};
128 Gaudi::Property<std::string> m_forcePeriod {
this,
"ForcePeriod",
"",
"Only for developers. Never use this in any analysis!!!!!!"};
131 Gaudi::Property<std::vector<std::string>> m_replicaTriggerList {
this,
"ReplicaTriggerList", {},
"List of triggers on which we want to generate stat. uncertainty toy replicas."};
132 std::set<std::string> m_replicaSet;
133 Gaudi::Property<int> m_nReplicas {
this,
"NReplicas", 100,
"Number of generated toy replicas, if replicas are required."};
134 Gaudi::Property<int> m_ReplicaRandomSeed {
this,
"ReplicaRandomSeed", 12345,
"Random seed for toy replica generation."};
137 static const std::map<unsigned short int, std::vector< std::tuple<unsigned int,unsigned int,std::string_view> > > m_year_periods;