ATLAS Offline Software
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 
10 using namespace Trig;
11 
12 
13 TrigEgammaMonitorElectronAlgorithm::TrigEgammaMonitorElectronAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ):
15 {}
16 
18 {}
19 
20 
21 
23 {
25 
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 
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());
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 );
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 
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 
151  if (m_forceProbeIsolation) {
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 
grepfile.info
info
Definition: grepfile.py:38
TrigEgammaMonitorElectronAlgorithm::m_offProbeIsolation
Gaudi::Property< std::string > m_offProbeIsolation
Define isolation working point for Probe electron.
Definition: TrigEgammaMonitorElectronAlgorithm.h:45
TrigEgammaMonitorAnalysisAlgorithm::fillEfficiencies
void fillEfficiencies(const std::vector< std::pair< const xAOD::Egamma *, const TrigCompositeUtils::Decision * > > &, const TrigInfo &) const
Definition: TrigEgammaMonitorAnalysisAlgorithm.cxx:42
TrigEgammaMonitorBaseAlgorithm::isIsolated
bool isIsolated(const xAOD::Electron *, const std::string &) const
Check if electron fulfils isolation criteria.
Definition: TrigEgammaMonitorBaseAlgorithm.cxx:112
TrigEgammaMonitorBaseAlgorithm::getTrigInfoMap
const std::map< std::string, TrigInfo > & getTrigInfoMap()
Helper methods.
Definition: TrigEgammaMonitorBaseAlgorithm.h:127
TrigEgammaMonitorElectronAlgorithm::m_forceVetoVeryLoose
Gaudi::Property< bool > m_forceVetoVeryLoose
Definition: TrigEgammaMonitorElectronAlgorithm.h:53
ParticleTest.eg
eg
Definition: ParticleTest.py:29
_triginfo
Definition: TrigEgammaMonitorBaseAlgorithm.h:42
Trig
The common trigger namespace for trigger analysis tools.
Definition: LArCellMonAlg.h:33
TrigEgammaMonitorBaseAlgorithm::getEt
float getEt(const xAOD::Electron *eg) const
Definition: TrigEgammaMonitorBaseAlgorithm.cxx:291
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
TrigEgammaMonitorElectronAlgorithm::m_rmCrack
Gaudi::Property< bool > m_rmCrack
Remove crack region for Probe default True.
Definition: TrigEgammaMonitorElectronAlgorithm.h:55
TrigEgammaMonitorElectronAlgorithm::m_eventInfoDecorKey
SG::ReadDecorHandleKey< xAOD::EventInfo > m_eventInfoDecorKey
Definition: TrigEgammaMonitorElectronAlgorithm.h:58
TrigEgammaMonitorAnalysisAlgorithm::fillDistributions
void fillDistributions(const std::vector< std::pair< const xAOD::Egamma *, const TrigCompositeUtils::Decision * > > &, const TrigInfo &) const
Definition: TrigEgammaMonitorAnalysisAlgorithm.cxx:407
TrigEgammaMonitorElectronAlgorithm::fillHistograms
virtual StatusCode fillHistograms(const EventContext &ctx) const override
adds event to the monitoring histograms
Definition: TrigEgammaMonitorElectronAlgorithm.cxx:46
xAOD::EventInfo_v1::LAr
@ LAr
The LAr calorimeter.
Definition: EventInfo_v1.h:335
TrigEgammaMonitorElectronAlgorithm::m_trigList
std::vector< std::string > m_trigList
List of triggers to study.
Definition: TrigEgammaMonitorElectronAlgorithm.h:39
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
LArEventBitInfo.h
TrigEgammaMonitorElectronAlgorithm::m_offElectronKey
SG::ReadHandleKey< xAOD::ElectronContainer > m_offElectronKey
Event Wise offline ElectronContainer Access and end iterator.
Definition: TrigEgammaMonitorElectronAlgorithm.h:57
TrigEgammaMonitorAnalysisAlgorithm::fillResolutions
void fillResolutions(const std::vector< std::pair< const xAOD::Egamma *, const TrigCompositeUtils::Decision * >> &pairObjs, const TrigInfo &info) const
*****************************************************************************************************...
Definition: TrigEgammaMonitorAnalysisAlgorithm.cxx:914
TrigEgammaMonitorBaseAlgorithm::isHLTTruncated
bool isHLTTruncated() const
Definition: TrigEgammaMonitorBaseAlgorithm.cxx:733
LArEventBitInfo::NOISEBURSTVETO
@ NOISEBURSTVETO
Definition: LArEventBitInfo.h:13
TrigEgammaMonitorBaseAlgorithm::getTrigInfo
TrigInfo getTrigInfo(const std::string &) const
Get the trigger info parsed from the chain name (only single lepton triggers)
Definition: TrigEgammaMonitorBaseAlgorithm.cxx:583
CheckAppliedSFs.e3
e3
Definition: CheckAppliedSFs.py:264
SG::Decorator< bool >
TrigEgammaMonitorBaseAlgorithm::setTrigInfo
void setTrigInfo(const std::string &)
Set the trigger info parsed from the chain name.
Definition: TrigEgammaMonitorBaseAlgorithm.cxx:591
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
xAOD::TrigComposite_v1
Class used to describe composite objects in the HLT.
Definition: TrigComposite_v1.h:52
AthMonitorAlgorithm::GetEventInfo
SG::ReadHandle< xAOD::EventInfo > GetEventInfo(const EventContext &) const
Return a ReadHandle for an EventInfo object (get run/event numbers, etc.)
Definition: AthMonitorAlgorithm.cxx:107
TrigEgammaMonitorElectronAlgorithm::executeNavigation
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
Definition: TrigEgammaMonitorElectronAlgorithm.cxx:103
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
TrigEgammaMonitorBaseAlgorithm::ApplyElectronPid
bool ApplyElectronPid(const xAOD::Electron *eg, const std::string &) const
Get offline electron decision.
Definition: TrigEgammaMonitorBaseAlgorithm.cxx:49
TrigEgammaMonitorElectronAlgorithm::m_trigInputList
Gaudi::Property< std::vector< std::string > > m_trigInputList
List of triggers from menu.
Definition: TrigEgammaMonitorElectronAlgorithm.h:41
TrigEgammaMonitorElectronAlgorithm::initialize
virtual StatusCode initialize() override
initialize
Definition: TrigEgammaMonitorElectronAlgorithm.cxx:22
TrigEgammaMonitorAnalysisAlgorithm::initialize
virtual StatusCode initialize() override
initialize
Definition: TrigEgammaMonitorAnalysisAlgorithm.cxx:17
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
TrigEgammaMonitorBaseAlgorithm::match
const ToolHandle< TrigEgammaMatchingToolMT > & match() const
Get the e/g match tool.
Definition: TrigEgammaMonitorBaseAlgorithm.h:135
TrigEgammaMonitorElectronAlgorithm::~TrigEgammaMonitorElectronAlgorithm
virtual ~TrigEgammaMonitorElectronAlgorithm() override
Definition: TrigEgammaMonitorElectronAlgorithm.cxx:17
TrigEgammaMonitorElectronAlgorithm::m_forcePidSelection
Gaudi::Property< bool > m_forcePidSelection
force pid and crack selection into electron navigation
Definition: TrigEgammaMonitorElectronAlgorithm.h:49
xAOD::EventInfo_v1::isEventFlagBitSet
bool isEventFlagBitSet(EventFlagSubDet subDet, size_t bit) const
Check one particular bit of one particular sub-detector.
Definition: EventInfo_v1.cxx:703
ReadDecorHandle.h
Handle class for reading a decoration on an object.
TrigEgammaMonitorElectronAlgorithm.h
TrigEgammaMonitorElectronAlgorithm::m_forceProbeIsolation
Gaudi::Property< bool > m_forceProbeIsolation
force probe isolation
Definition: TrigEgammaMonitorElectronAlgorithm.h:47
veto
std::vector< std::string > veto
these patterns are anded
Definition: listroot.cxx:191
ConstAccessor.h
Helper class to provide constant type-safe access to aux data.
TrigEgammaMonitorElectronAlgorithm::m_forceEtThr
Gaudi::Property< bool > m_forceEtThr
Definition: TrigEgammaMonitorElectronAlgorithm.h:51
TrigEgammaMonitorAnalysisAlgorithm
Definition: TrigEgammaMonitorAnalysisAlgorithm.h:11
TrigEgammaMonitorElectronAlgorithm::TrigEgammaMonitorElectronAlgorithm
TrigEgammaMonitorElectronAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TrigEgammaMonitorElectronAlgorithm.cxx:13
TrigEgammaMonitorElectronAlgorithm::m_electronIsolationKeyPtCone20
SG::ReadDecorHandleKey< xAOD::ElectronContainer > m_electronIsolationKeyPtCone20
Ensure offline electron isolation decoration is retrieved after being created.
Definition: TrigEgammaMonitorElectronAlgorithm.h:60