26 return StatusCode::FAILURE;
50 std::unordered_map<std::string, TrigGlobEffCorr::ImportData::TrigDef> triggerDefs;
52 auto it = triggerDict.find(key);
53 if (it != triggerDict.end()) {
54 triggerDefs[it->second] = trigDef;
59 std::unordered_map<std::string, std::vector<std::string> > trigMap;
70 std::map<std::string, std::string> triggerCombination;
71 auto combineStrings = [](
const std::vector<std::string>& input ) {
72 std::string combinedString;
74 for (
const auto & i : input) {
76 combinedString +=
" || ";
81 return combinedString;
83 for (
const auto &[year, triggers] : trigMap) {
84 if (triggers.empty())
continue;
85 if (triggerCombination.find(year) == triggerCombination.end()) {
86 triggerCombination[year] =
"";
88 triggerCombination[year] +=
" || ";
90 triggerCombination[year] += combineStrings(triggers);
94 std::map<std::string,std::string> electronLegsPerKey, photonLegsPerKey;
105 std::map<std::string, std::string> legsPerTool;
109 ToolHandleArray<IAsgElectronEfficiencyCorrectionTool> electronEffTools, electronSFTools;
113 for (
const auto &[trigKey, triggers] : electronLegsPerKey) {
114 if (trigKey == nameForDefaultSF) {
115 auto [itr, added] = legsPerTool.emplace(nameForDefaultSF, triggers);
116 if (!added) itr->second +=
"," + triggers;
120 for (
bool isSFTool : {
true,
false}) {
122 "AsgElectronEfficiencyCorrectionTool/ElTrigEff_"
125 ANA_CHECK(t->setProperty(
"MapFilePath",
"ElectronEfficiencyCorrection/2015_2025/rel22.2/2025_Run2Rel22_Recommendation_v3/map1.txt"));
129 ANA_CHECK(t->setProperty(
"TriggerKey", isSFTool ? trigKey :
"Eff_" + trigKey ));
130 ANA_CHECK(t->setProperty(
"CorrelationModel",
"TOTAL"));
132 ANA_CHECK(t->setProperty(
"OutputLevel",
msg().level()));
135 auto& handles = (isSFTool? electronSFTools : electronEffTools);
136 handles.push_back(t->getHandle());
137 std::string
name = handles[handles.size()-1].name();
138 legsPerTool[
name] = triggers;
146 ToolHandleArray<IAsgPhotonEfficiencyCorrectionTool> photonEffTools, photonSFTools;
150 for (
const auto &[trigKey, triggers] : photonLegsPerKey) {
151 if (trigKey == nameForDefaultSF) {
152 auto [itr, added] = legsPerTool.emplace(nameForDefaultSF, triggers);
153 if (!added) itr->second +=
"," + triggers;
157 for (
bool isSFTool : {
true,
false}) {
159 "AsgPhotonEfficiencyCorrectionTool/PhTrigEff_"
160 + std::to_string(isSFTool) +
"_" + std::to_string(nTools) +
"_" +
m_photonIsol.value());
162 ANA_CHECK(t->setProperty(
"MapFilePath",
"PhotonEfficiencyCorrection/2015_2018/rel21.2/Summer2020_Rec_v1/map3.txt"));
165 ANA_CHECK(t->setProperty(
"TriggerKey", isSFTool ? trigKey :
"Eff_" + trigKey ));
167 ANA_CHECK(t->setProperty(
"OutputLevel",
msg().level()));
170 auto& handles = (isSFTool? photonSFTools : photonEffTools);
171 handles.push_back(t->getHandle());
172 std::string
name = handles[handles.size()-1].name();
173 legsPerTool[
name] = triggers;
181 ToolHandleArray<CP::IMuonTriggerScaleFactors> muonTools;
196 std::string s = trig;
197 std::replace(s.begin(), s.end(),
'-',
'_');
198 std::replace(s.begin(), s.end(),
'.',
'p');
222 return StatusCode::SUCCESS;
237 std::vector<const xAOD::Electron*> selectedElectrons;
238 std::vector<const xAOD::Photon*> selectedPhotons;
239 std::vector<const xAOD::Muon*> selectedMuons;
264 if (selectedElectrons.empty() && selectedMuons.empty() && selectedPhotons.empty()) sf = 1.0;
268 m_tgecTool->getEfficiencyScaleFactor(selectedElectrons, selectedMuons, selectedPhotons,
277 bool matched =
false;
278 if (!(selectedElectrons.empty() && selectedMuons.empty() && selectedPhotons.empty())) {
280 ANA_CHECK(
m_tgecTool->checkTriggerMatching(matched, selectedElectrons, selectedMuons, selectedPhotons));
284 if(flag) matched =
true;
289 if (matched) filter.setPassed(
true);
296 return StatusCode::SUCCESS;
303 return StatusCode::SUCCESS;
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
a reporter class that combines the filter decisions for all systematics
a systematics aware filter reporter
a data handle for reading systematics varied input data
SysListHandle m_systematicsList
asg::AnaToolHandle< ITrigGlobalEfficiencyCorrectionTool > m_tgecTool
Trigger Global Efficiency Correction Tool handle.
Gaudi::Property< std::vector< std::string > > m_trigList_2024
SysReadHandle< xAOD::EventInfo > m_eventInfoHandle
EventInfo to decorate.
Gaudi::Property< std::vector< std::string > > m_trigList_2018
virtual StatusCode finalize() final override
Gaudi::Property< std::string > m_electronIsol
electron Isolation
Gaudi::Property< std::vector< std::string > > m_trigList_2023
Gaudi::Property< std::string > m_separateMatchingDecorSuffix
separate chain matching decorator suffix
std::unordered_map< std::string, SysWriteDecorHandle< bool > > m_separateMatchingDecorators
Gaudi::Property< std::vector< std::string > > m_separateMatchingTriggers
store separate trigger matching flags for each trigger
Gaudi::Property< std::string > m_electronID
electron ID
ToolHandle< Trig::IMatchingTool > m_trigMatchingTool
trigger matching tool
Gaudi::Property< std::string > m_photonIsol
photon Isolation
std::vector< asg::AnaToolHandle< IAsgPhotonEfficiencyCorrectionTool > > m_photonToolsFactory
RAII on-the-fly tool creation for photons.
SysWriteDecorHandle< char > m_matchingDecoration
decoration of the global trigger matching flag
SysReadSelectionHandle m_muonSelection
input muon selection
Gaudi::Property< std::vector< std::string > > m_trigList_2017
Gaudi::Property< bool > m_noFilter
whether to not apply an event filter
Gaudi::Property< std::string > m_muonID
muon quality
std::vector< asg::AnaToolHandle< IAsgElectronEfficiencyCorrectionTool > > m_electronToolsFactory
RAII on-the-fly tool creation for electrons.
Gaudi::Property< int > m_numToys
number of toy experiments to run to estimate the trigger combination efficiency, instead of using an ...
SysReadSelectionHandle m_electronSelection
input electron selection
Gaudi::Property< std::vector< std::string > > m_trigList_2015
list of triggers or trigger chains
Gaudi::Property< bool > m_doMatchingOnly
whether to only run the global trigger matching, and not compute efficiency SFs
SysWriteDecorHandle< float > m_scaleFactorDecoration
decoration of the global trigger SF
TrigGlobalEfficiencyAlg(const std::string &name, ISvcLocator *pSvcLocator=nullptr)
Gaudi::Property< std::vector< std::string > > m_trigList_2022
virtual StatusCode initialize() final override
asg::AnaToolHandle< IMuonTriggerScaleFactors > m_muonTool
the muon trigger SF handle
SysReadSelectionHandle m_photonSelection
input photon selection
Gaudi::Property< std::vector< std::string > > m_trigList_2016
Gaudi::Property< std::vector< std::string > > m_trigList_2025
std::unordered_map< std::string, bool > m_separateMatchingFlags
SysReadHandle< xAOD::PhotonContainer > m_photonsHandle
input photon collection
virtual StatusCode execute() final override
SysReadHandle< xAOD::ElectronContainer > m_electronsHandle
input electron collection
SysFilterReporterParams m_filterParams
the filter reporter params
Gaudi::Property< bool > m_isRun3Geo
whether to use Run 3 settings
SysReadHandle< xAOD::MuonContainer > m_muonsHandle
input muon collection
AnaAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
constructor with parameters
const std::map< std::size_t, std::string > & getDictionary() const
const std::map< std::size_t, TrigDef > & getTriggerDefs() const
This module defines the arguments passed from the BATCH driver to the BATCH worker.
PhotonContainer_v1 PhotonContainer
Definition of the current "photon container version".
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
EventInfo_v1 EventInfo
Definition of the latest event info version.
Muon_v1 Muon
Reference the current persistent version:
Photon_v1 Photon
Definition of the current "egamma version".
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
Electron_v1 Electron
Definition of the current "egamma version".