Returns whether the trigger is supported by the tool or not. The decision depends on the present (random)RunNumber
24 {
25 typedef std::shared_ptr<TH1> TH1_Ptr;
26
28 ASG_TOOL_CLASS( MuonTriggerScaleFactors, CP::IMuonTriggerScaleFactors )
29
30 public:
31
32 MuonTriggerScaleFactors(const std::string& name);
33
34 virtual ~MuonTriggerScaleFactors();
35
37
38
40
42
44
46
48
50
52
54
55 virtual int getReplica_index(const std::string& sysBaseName, const std::string& trigStr) const;
56
59 private:
60
61 virtual CP::CorrectionCode getMuonEfficiency(Double_t& eff,
const TrigMuonEff::Configuration& configuration,
const xAOD::Muon& muon,
const std::string& trigger,
const std::string& systematic)
const;
62
63 virtual CP::CorrectionCode GetTriggerSF_dimu(Double_t& TriggerSF, TrigMuonEff::Configuration& configuration,
const xAOD::MuonContainer& mucont,
const std::string& trigger)
const;
64
65 virtual CP::CorrectionCode GetTriggerSF(Double_t& TriggerSF, TrigMuonEff::Configuration& configuration,
const xAOD::MuonContainer& mucont,
const std::string& trigger)
const;
66
67 virtual CP::CorrectionCode GetTriggerSF(Double_t& TriggerSF, TrigMuonEff::Configuration& configuration,
const xAOD::Muon& muon,
const std::string& trigger)
const;
68
69 virtual CP::CorrectionCode getDimuonEfficiency(Double_t& eff,
const TrigMuonEff::Configuration& configuration,
const xAOD::MuonContainer& mucont,
const std::string& chain,
const std::string& systematic)
const;
70
71 const CP::SystematicSet& appliedSystematics() const {
72 return *m_appliedSystematics;
73 }
74
76
78
79
80 unsigned int encodeHistoName(const std::string_view period, const std::string& Trigger, bool isData, const std::string& Systematic, bool isBarrel = true) const;
81
82 unsigned int encodeHistoName(const std::string& Trigger, const TrigMuonEff::Configuration& configuration, const std::string& Systematic, bool isBarrel = true) const;
83 protected:
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;
86 private:
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;
90
91 CP::CorrectionCode
getThreshold(Int_t& threshold,
const std::string& trigger)
const;
92
93 std::string getTriggerCorrespondingToDimuonTrigger(const std::string& trigger) const;
94 protected:
95
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;
101 private:
102 SG::ReadHandleKey<xAOD::EventInfo> m_eventInfo{this, "EventInfoContName", "EventInfo", "event info key"};
103
104 TDirectory* getTemporaryDirectory(void) const;
105
106
107
108 std::vector<TH1_Ptr> generateReplicas(TH1_Ptr h, int nrep, int seed) const;
109
110 std::unordered_map<CP::SystematicSet, CP::SystematicSet> m_systFilter;
111
112 CP::SystematicSet *m_appliedSystematics{};
113 EfficiencyMap m_efficiencyMap;
114 std::map<EffiHistoIdent, std::vector<TH1_Ptr> > m_efficiencyMapReplicaArray;
115
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"};
118
119
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"};
124
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!!!!!!"};
129
130
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."};
135
136
137 static const std::map<unsigned short int, std::vector< std::tuple<unsigned int,unsigned int,std::string_view> > > m_year_periods;
138 };
139
140}
CP::CorrectionCode getThreshold(Int_t &threshold, const std::string &trigger)
virtual CorrectionCode getTriggerEfficiency(const xAOD::Muon &mu, Double_t &efficiency, const std::string &trigger, Bool_t dataType) const =0
virtual int getBinNumber(const xAOD::Muon &muon, const std::string &trigger) const =0
virtual bool isTriggerSupported(const std::string &trigger) const =0
Returns whether the trigger is supported in the current data-period.
virtual StatusCode initialize(void)=0
virtual CorrectionCode getTriggerScaleFactor(const xAOD::MuonContainer &mucont, Double_t &triggersf, const std::string &trigger) const =0
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 StatusCode
StatusCode definition for legacy code.
Muon_v1 Muon
Reference the current persistent version:
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
int run(int argc, char *argv[])