ATLAS Offline Software
Loading...
Searching...
No Matches
TrigGlobalEfficiencyAlg.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7#ifndef TRIGGER_ANALYSIS_ALGORITHMS__TRIG_GLOBAL_EFFICIENCY_ALG_H
8#define TRIGGER_ANALYSIS_ALGORITHMS__TRIG_GLOBAL_EFFICIENCY_ALG_H
9
10// Algorithm includes
17
18// Framework includes
23#include <AsgTools/AsgTool.h>
24#include <AsgTools/ToolHandle.h>
27
28#include <map>
29#include <memory>
30#include <string>
31#include <vector>
32
33// Trigger includes
39
40namespace CP
41{
43 public:
44 TrigGlobalEfficiencyAlg(const std::string& name, ISvcLocator* pSvcLocator = nullptr);
45
46 virtual StatusCode initialize() final override;
47 virtual StatusCode execute(const EventContext& ctx) final override;
48 virtual StatusCode finalize() final override;
49
50 private:
60 template <typename ToolInterface, typename SetToolPropertiesFn>
61 StatusCode makeEgammaTools(std::vector<ToolHandle<ToolInterface> >& toolsFactory,
62 ToolHandleArray<ToolInterface>& effTools,
63 ToolHandleArray<ToolInterface>& sfTools,
64 const std::map<std::string, std::string>& legsPerKey,
65 const std::string& toolNamePrefix,
66 const std::string& toolNameSuffix,
67 const SetToolPropertiesFn& setToolProperties,
68 std::map<std::string, std::string>& legsPerTool);
69
71
73 Gaudi::Property<bool> m_isRun3Geo {this, "isRun3Geo", false, "use Run 3 settings for efficiency correction tools?"};
74
76 ToolHandle<Trig::IMatchingTool> m_trigMatchingTool;
77
80
82 Gaudi::Property<std::vector<std::string>> m_trigList_2015 {this, "triggers_2015", {}, "2015 trigger selection list"};
83 Gaudi::Property<std::vector<std::string>> m_trigList_2016 {this, "triggers_2016", {}, "2016 trigger selection list"};
84 Gaudi::Property<std::vector<std::string>> m_trigList_2017 {this, "triggers_2017", {}, "2017 trigger selection list"};
85 Gaudi::Property<std::vector<std::string>> m_trigList_2018 {this, "triggers_2018", {}, "2018 trigger selection list"};
86 Gaudi::Property<std::vector<std::string>> m_trigList_2022 {this, "triggers_2022", {}, "2022 trigger selection list"};
87 Gaudi::Property<std::vector<std::string>> m_trigList_2023 {this, "triggers_2023", {}, "2023 trigger selection list"};
88 Gaudi::Property<std::vector<std::string>> m_trigList_2024 {this, "triggers_2024", {}, "2024 trigger selection list"};
89 Gaudi::Property<std::vector<std::string>> m_trigList_2025 {this, "triggers_2025", {}, "2025 trigger selection list"};
90
92 Gaudi::Property<bool> m_noFilter {this, "noFilter", false, "whether to not apply an event filter"};
94 SysFilterReporterParams m_filterParams {this, "global trigger matching"};
95
97 Gaudi::Property<bool> m_doMatchingOnly {this, "doMatchingOnly", false, "whether to disable efficiency SFs and apply matching only"};
98
100 Gaudi::Property<std::vector<std::string>> m_separateMatchingTriggers {this, "separateMatchingTriggers", {}, "triggers to store individual trigger matching flags for"};
101 std::unordered_map<std::string, SysWriteDecorHandle<bool>> m_separateMatchingDecorators;
102 std::unordered_map<std::string, bool> m_separateMatchingFlags;
103
105 Gaudi::Property<std::string> m_separateMatchingDecorSuffix {this, "separateMatchingDecorationSuffix", "", "suffix for the separate chain matching decorators"};
106
109 this, "scaleFactorDecoration", "", "the decoration for the global trigger efficiency scale factor"
110 };
111
114 this, "matchingDecoration", "", "the decoration for the global trigger matching decision"
115 };
116
119 this, "electrons", "", "the electron container to use"
120 };
121
124 this, "electronSelection", "", "the selection on the input electrons"
125 };
126
129 this, "muons", "", "the muon container to use"
130 };
131
134 this, "muonSelection", "", "the selection on the input muons"
135 };
136
139 this, "photons", "", "the photon container to use"
140 };
141
144 this, "photonSelection", "", "the selection on the input photons"
145 };
146
149 this, "eventInfoContainer", "EventInfo", "the EventInfo container to decorate to"
150 };
151
152
156 std::vector<ToolHandle<IAsgElectronEfficiencyCorrectionTool> > m_electronToolsFactory;
158 std::vector<ToolHandle<IAsgPhotonEfficiencyCorrectionTool> > m_photonToolsFactory;
160 std::vector<std::shared_ptr<void> > m_toolsCleanup;
161
163 Gaudi::Property<std::string> m_campaign {this, "campaign", "", "the MC campaign to get the scale factors for"};
165 Gaudi::Property<std::string> m_electronID {this, "electronID", "", "electron ID WP"};
167 Gaudi::Property<std::string> m_electronIsol {this, "electronIsol", "", "electron Isolation WP"};
169 Gaudi::Property<std::string> m_photonIsol {this, "photonIsol", "", "photon Isolation WP"};
171 Gaudi::Property<std::string> m_muonID {this, "muonID", "", "muon ID/Quality WP"};
172
175 Gaudi::Property<int> m_numToys {this, "numberOfToys", 0, "number of toy experiments"};
176
178 unsigned long long m_nScaleFactorFailures = 0;
179
180 }; // class TrigGlobalEfficiencyAlg
181} // namespace CP
182
183#endif /* TRIGGER_ANALYSIS_ALGORITHMS__TRIG_GLOBAL_EFFICIENCY_ALG_H */
the properties and persistent data for systematics aware filter reporters
a class managing the property to configure the list of systematics to process
a data handle for reading systematics varied input data
a data handle for reading systematically varied selection properties from objects
a data handle for reading systematics varied input data
asg::AnaToolHandle< ITrigGlobalEfficiencyCorrectionTool > m_tgecTool
Trigger Global Efficiency Correction Tool handle.
Gaudi::Property< std::vector< std::string > > m_trigList_2024
Gaudi::Property< std::string > m_campaign
MC campaign.
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< std::shared_ptr< void > > m_toolsCleanup
keeps the tools created via m_electronToolsFactory/m_photonToolsFactory alive in AnalysisBase
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
unsigned long long m_nScaleFactorFailures
number of events for which the global trigger scale factor computation failed
Gaudi::Property< int > m_numToys
number of toy experiments to run to estimate the trigger combination efficiency, instead of using an ...
StatusCode makeEgammaTools(std::vector< ToolHandle< ToolInterface > > &toolsFactory, ToolHandleArray< ToolInterface > &effTools, ToolHandleArray< ToolInterface > &sfTools, const std::map< std::string, std::string > &legsPerKey, const std::string &toolNamePrefix, const std::string &toolNameSuffix, const SetToolPropertiesFn &setToolProperties, std::map< std::string, std::string > &legsPerTool)
create one efficiency and one scale factor tool per electron/photon trigger key
std::vector< ToolHandle< IAsgPhotonEfficiencyCorrectionTool > > m_photonToolsFactory
on-the-fly public tool creation for photons
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
std::vector< ToolHandle< IAsgElectronEfficiencyCorrectionTool > > m_electronToolsFactory
on-the-fly public tool creation for electrons
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
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
the (new) base class for EventLoop algorithms
virtual::StatusCode execute()
execute this algorithm
a modified tool handle that allows its owner to configure new tools from the C++ side
Select isolated Photons, Electrons and Muons.