ATLAS Offline Software
Loading...
Searching...
No Matches
TrigEgammaMonitorElectronAlgorithm.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
9
10using namespace Trig;
11
12
13TrigEgammaMonitorElectronAlgorithm::TrigEgammaMonitorElectronAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ):
14 TrigEgammaMonitorAnalysisAlgorithm( name, pSvcLocator )
15{}
16
19
20
21
23{
25
26 ATH_CHECK(m_offElectronKey.initialize());
28 ATH_CHECK( m_eventInfoDecorKey.initialize() );
29
30 for(auto& trigName : m_trigInputList)
31 {
32 if(getTrigInfoMap().count(trigName) != 0){
33 ATH_MSG_DEBUG("Trigger already booked, removing from trigger list " << trigName);
34 }else {
35 m_trigList.push_back(trigName);
36 setTrigInfo(trigName);
37 }
38 }
39
40
41 return StatusCode::SUCCESS;
42}
43
44
45
46StatusCode TrigEgammaMonitorElectronAlgorithm::fillHistograms( const EventContext& ctx ) const
47{
48
49 ATH_MSG_DEBUG("Executing TrigEgammaMonitorElectronAlgorithm");
50
51 if(isHLTTruncated()){
52 ATH_MSG_DEBUG("HLTResult truncated, skip trigger analysis");
53 return StatusCode::SUCCESS;
54 }
55
56 // Noise burst protection
58 ATH_CHECK(thisEvent.isValid());
59 if ( thisEvent->isEventFlagBitSet(xAOD::EventInfo::LAr,LArEventBitInfo::NOISEBURSTVETO)) {
60 ATH_MSG_DEBUG("LAr Noise Burst Veto, skip trigger analysis");
61 return StatusCode::SUCCESS;
62 }
63
64 ATH_MSG_DEBUG("Chains for Analysis " << m_trigList);
65
66 for(const auto& trigger : m_trigList){
67
68 const TrigInfo info = getTrigInfo(trigger);
69
70 ATH_MSG_DEBUG("Start Chain Analysis ============================= " << trigger << " " << info.trigger);
71
72 std::vector< std::pair<std::shared_ptr<const xAOD::Egamma>, const TrigCompositeUtils::Decision*>> pairObjs;
73 if ( executeNavigation( ctx, info.trigger,info.etthr,info.pidname, pairObjs).isFailure() )
74 {
75 ATH_MSG_DEBUG("executeNavigation Fails");
76 return StatusCode::SUCCESS;
77 }
78
79 std::vector< std::pair<const xAOD::Egamma*, const TrigCompositeUtils::Decision*>> pairObjsRaw;
80 pairObjsRaw.reserve(pairObjs.size());
81 for (const auto& itr : pairObjs) {
82 pairObjsRaw.emplace_back(itr.first.get(), itr.second);
83 }
84
85
86 fillDistributions( pairObjsRaw, info );
87 fillEfficiencies( pairObjsRaw, info, false);
88 fillResolutions( pairObjsRaw, info );
89
90 ATH_MSG_DEBUG("End Chain Analysis ============================= " << trigger);
91 } // End loop over trigger list
92
93
94 return StatusCode::SUCCESS;
95}
96
97
98
99
100
101
102
103StatusCode TrigEgammaMonitorElectronAlgorithm::executeNavigation( const EventContext& ctx,
104 const std::string& trigItem,
105 float etthr,
106 const std::string& pidName,
107 std::vector<std::pair<std::shared_ptr<const xAOD::Egamma>, const TrigCompositeUtils::Decision* >> &pairObjs) const
108{
109
110 ATH_MSG_DEBUG("Apply navigation selection ");
111
113
114 if(!offElectrons.isValid())
115 {
116 ATH_MSG_DEBUG("Failed to retrieve offline Electrons ");
117 return StatusCode::FAILURE;
118 }
119
120
121 const std::string decorName="is"+pidName;
122 for(const auto *const eg : *offElectrons ){
123
124 const TrigCompositeUtils::Decision *dec=nullptr;
125
126 if(!eg->trackParticle()){
127 ATH_MSG_DEBUG("No track Particle");
128 continue;
129 }
130 if(!eg->caloCluster()){
131 ATH_MSG_DEBUG("No caloCluster");
132 continue;
133 }
134
135 if(m_forceEtThr){
136 if( !( getEt(eg) > (etthr-5.)*1.e3) ) continue;
137 }
138
139 if(m_rmCrack){
140 if ( (fabs(eg->eta())>1.37 && fabs(eg->eta())<1.52) || fabs(eg->eta())>2.47 ) continue;
141 }
142
144 if(!ApplyElectronPid(eg,pidName)){
145 ATH_MSG_DEBUG("Fails ElectronID "<< pidName);
146 continue;
147 }
148 ATH_MSG_DEBUG("Passes ElectronID "<< pidName);
149 }
150
152 if (!isIsolated(eg, m_offProbeIsolation)) continue;
153 }
154
156 bool veto = ApplyElectronPid(eg,"lhvloose");
157 if(veto) continue;
158 }
159
160 const auto el = std::make_shared<const xAOD::Electron>(*eg);
161 SG::Decorator<bool> decor (decorName);
162 decor(*el)=static_cast<bool>(true);
163
164 match()->match(el.get(), trigItem, dec, TrigDefs::includeFailedDecisions);
165 //match()->match(el, trigItem, dec);
166 pairObjs.emplace_back(el, dec);
167
168 }
169
170 ATH_MSG_DEBUG("BaseToolMT::Electron TEs " << pairObjs.size() << " found.");
171 return StatusCode::SUCCESS;
172}
173
174
175
176
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
Helper class to provide constant type-safe access to aux data.
Handle class for reading a decoration on an object.
struct _triginfo TrigInfo
SG::ReadHandle< xAOD::EventInfo > GetEventInfo(const EventContext &) const
Return a ReadHandle for an EventInfo object (get run/event numbers, etc.)
Helper class to provide type-safe access to aux data.
Definition Decorator.h:59
virtual bool isValid() override final
Can the handle be successfully dereferenced?
virtual StatusCode initialize() override
initialize
TrigEgammaMonitorAnalysisAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
void fillEfficiencies(const std::vector< std::pair< const xAOD::Egamma *, const TrigCompositeUtils::Decision * > > &, const TrigInfo &, const bool) const
void fillResolutions(const std::vector< std::pair< const xAOD::Egamma *, const TrigCompositeUtils::Decision * > > &pairObjs, const TrigInfo &info) const
*****************************************************************************************************...
void fillDistributions(const std::vector< std::pair< const xAOD::Egamma *, const TrigCompositeUtils::Decision * > > &, const TrigInfo &) const
const std::map< std::string, TrigInfo > & getTrigInfoMap()
Helper methods.
const ToolHandle< TrigEgammaMatchingToolMT > & match() const
Get the e/g match tool.
float getEt(const xAOD::Electron *eg) const
bool ApplyElectronPid(const xAOD::Electron *eg, const std::string &) const
Get offline electron decision.
TrigInfo getTrigInfo(const std::string &) const
Get the trigger info parsed from the chain name (only single lepton triggers)
bool isIsolated(const xAOD::Electron *, const std::string &) const
Check if electron fulfils isolation criteria.
void setTrigInfo(const std::string &)
Set the trigger info parsed from the chain name.
virtual StatusCode initialize() override
initialize
Gaudi::Property< bool > m_rmCrack
Remove crack region for Probe default True.
TrigEgammaMonitorElectronAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode fillHistograms(const EventContext &ctx) const override
adds event to the monitoring histograms
Gaudi::Property< bool > m_forceProbeIsolation
force probe isolation
StatusCode executeNavigation(const EventContext &ctx, const std::string &trigItem, float, const std::string &, std::vector< std::pair< std::shared_ptr< const xAOD::Egamma >, const TrigCompositeUtils::Decision * > > &) const
navigation method called by executeNavigation
SG::ReadDecorHandleKey< xAOD::ElectronContainer > m_electronIsolationKeyPtCone20
Ensure offline electron isolation decoration is retrieved after being created.
SG::ReadHandleKey< xAOD::ElectronContainer > m_offElectronKey
Event Wise offline ElectronContainer Access and end iterator.
SG::ReadDecorHandleKey< xAOD::EventInfo > m_eventInfoDecorKey
Gaudi::Property< std::vector< std::string > > m_trigInputList
List of triggers from menu.
Gaudi::Property< bool > m_forcePidSelection
force pid and crack selection into electron navigation
std::vector< std::string > m_trigList
List of triggers to study.
Gaudi::Property< std::string > m_offProbeIsolation
Define isolation working point for Probe electron.
@ LAr
The LAr calorimeter.
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146
std::vector< std::string > veto
these patterns are anded
Definition listroot.cxx:191
static const unsigned int includeFailedDecisions
Run3 synonym of alsoDeactivateTEs.
The common trigger namespace for trigger analysis tools.