ATLAS Offline Software
L1EtTools.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
5 // L1EtTools.cxx,
7 
8 #include "L1EtTools.h"
14 
15 namespace LVL1 {
16 
17 //================ Constructor =================================================
18 
19 L1EtTools::L1EtTools(const std::string& t,
20  const std::string& n,
21  const IInterface* p )
22  :
23  AthAlgTool(t,n,p),
24  m_TEMasks(0)
25 {
26  declareInterface<IL1EtTools>(this);
27 
28  // Allow user to specify JetElement thresholds
31  declareProperty( "EtSumJEThresh", m_jetElementThresholdEtSum );
32  declareProperty( "EtMissJEThresh", m_jetElementThresholdEtMiss );
33 
34 }
35 
36 //================ Destructor =================================================
37 
39 {
40 }
41 
42 
43 //================ Initialisation =================================================
44 
46 {
48 
49  return StatusCode::SUCCESS;
50 }
51 
52 //================ Finalisation =================================================
53 
55 {
56  delete m_TEMasks;
57  m_TEMasks = 0;
58  return StatusCode::SUCCESS;
59 }
60 
61 //================ Having map of JetElements facilitates JE->JEM association =====
62 
64  xAOD::JetElementMap_t* jeContainer) const {
65 
66  // Clear map before filling
67  jeContainer->clear();
68 
69  // Step over JEs and put into map
71  JetElementKey testKey(0.0, 0.0);
72 
73  for( it = jetelements->begin(); it < jetelements->end(); ++it ){
74  double jetElementPhi=(*it)->phi();
75  double jetElementEta=(*it)->eta();
76  int key = testKey.jeKey(jetElementPhi,jetElementEta);
77  xAOD::JetElementMap_t::iterator test=jeContainer->find( key );
78  if (test == jeContainer->end()){
79  // add it to the map
80  jeContainer->insert(xAOD::JetElementMap_t::value_type(key,*it)); //and put it in the map.
81  }
82  else{
83  ATH_MSG_ERROR( "JetElement already in map (shouldn't happen!) ");
84  }
85  }//endfor
86 
87 }
88 
89 //=====================Form JEM ET sums ====================
90 
92  DataVector<ModuleEnergy>* modules, int slice) const {
93 
94  modules->clear();
95 
96  // Need map of JetElements as input to ModuleEnergy class creator
98  mapJetElements(jetelements, jeContainer);
99 
100  // Loop over crates, modules and create set of ModuleEnergy objects
101  for (int crate = 0; crate < 2; ++crate) {
102  for (int module = 0; module < 16; ++module) {
104  }
105  }
106 
107  // Clean up after ourselves
108  delete jeContainer;
109 
110 }
111 
112 //=====================Form JEM ET sums ====================
113 
115  DataVector<ModuleEnergy>* modules, int slice) const {
116 
117  modules->clear();
118 
119  // Loop over crates, modules and create set of ModuleEnergy objects
120  for (int crate = 0; crate < 2; ++crate) {
121  for (int module = 0; module < 16; ++module) {
123  }
124  }
125 
126 }
127 
128 //=====================Form JE Crate ET sums ====================
129 
130 void L1EtTools::crateSums(const DataVector<ModuleEnergy>* modules, DataVector<CrateEnergy>* crates, uint32_t maskXE, uint32_t maskTE, bool restricted) const {
131 
132  crates->clear();
133  // Loop over crates and create set of CrateEnergy objects
134  for (int crate = 0; crate < 2; ++crate) {
135  crates->push_back( new CrateEnergy(crate, modules, maskXE, maskTE, restricted) );
136  }
137 
138  return;
139 }
140 
141 //=====================Form JE Crate ET sums ====================
142 
143 void L1EtTools::crateSums(const DataVector<EnergyCMXData>* modules, DataVector<CrateEnergy>* crates, uint32_t maskXE, uint32_t maskTE, bool restricted) const {
144 
145  crates->clear();
146  // Loop over crates and create set of CrateEnergy objects
147  for (int crate = 0; crate < 2; ++crate) {
148  crates->push_back( new CrateEnergy(crate, modules, maskXE, maskTE, restricted) );
149  }
150 
151  return;
152 }
153 
154 //=====================Form System ET sums ====================
155 
157 
158  // This class will take crate sums and form system sums, apply thresholds, etc
159  auto l1Menu = SG::makeHandle( m_L1MenuKey );
160  SystemEnergy result(crates, &(*l1Menu));
161 
162  return result ;
163 }
164 
165 //=====================Return JE Crate ET sums directly =============
166 
168  DataVector<CrateEnergy>* crates, int slice, uint32_t maskXE, uint32_t maskTE, bool restricted) const {
169 
170  crates->clear();
171 
172  // First need to form module sums
174 
175  moduleSums(jetelements, modules, slice);
176 
177  // Loop over crates and create set of CrateEnergy objects
178  for (int crate = 0; crate < 2; ++crate) {
179  crates->push_back( new CrateEnergy(crate, modules, maskXE, maskTE, restricted) );
180  }
181 
182  delete modules;
183 
184  return;
185 }
186 
187 //=====================Return JE Crate ET sums directly =============
188 
190  DataVector<CrateEnergy>* crates, int slice, uint32_t maskXE, uint32_t maskTE, bool restricted) const {
191 
192  crates->clear();
193 
194  // First need to form module sums
196 
197  moduleSums(jemap, modules, slice);
198 
199  // Loop over crates and create set of CrateEnergy objects
200  for (int crate = 0; crate < 2; ++crate) {
201  crates->push_back( new CrateEnergy(crate, modules, maskXE, maskTE, restricted) );
202  }
203 
204  delete modules;
205 
206  return;
207 }
208 
209 //=====================Return final System ET sums directly =============
210 
211 SystemEnergy L1EtTools::systemSums(const xAOD::JetElementContainer* jetelements, int slice, uint32_t maskXE, uint32_t maskTE, bool restricted) const {
212 
213  // First need to form modules and crates
215 
216  crateSums(jetelements, crates, slice, maskXE, maskTE, restricted);
217 
218  // Then do the final summing, thresholding etc
219  auto l1Menu = SG::makeHandle( m_L1MenuKey );
220  SystemEnergy result(crates, &(*l1Menu));
221 
222  delete crates;
223  return result;
224 }
225 
226 //=====================Return final System ET sums directly =============
227 
228 SystemEnergy L1EtTools::systemSums(const xAOD::JetElementMap_t* jemap, int slice, uint32_t maskXE, uint32_t maskTE, bool restricted) const {
229 
230  // First need to form modules and crates
232 
233  crateSums(jemap, crates, slice, maskXE, maskTE, restricted);
234 
235  // Then do the final summing, thresholding etc
236  auto l1Menu = SG::makeHandle( m_L1MenuKey );
237  SystemEnergy result(crates, &(*l1Menu));
238 
239  delete crates;
240  return result;
241 }
242 
243 //============================================================================================
244 
245 } // end of ns
LVL1::L1EtTools::finalize
virtual StatusCode finalize()
standard Athena-Algorithm method
Definition: L1EtTools.cxx:54
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
CTPConfig.h
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
get_generator_info.result
result
Definition: get_generator_info.py:21
LVL1::JetElementKeyBase::jeKey
virtual unsigned int jeKey(const xAOD::TriggerTower &tower)
returns key of passed tower
Definition: JetElementKeyBase.cxx:157
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
LVL1::CrateEnergy
CrateEnergy class declaration Simulates behaviour of the Crate-CMM System CMM logic is done in Energy...
Definition: CrateEnergy.h:34
skel.it
it
Definition: skel.GENtoEVGEN.py:396
LVL1::L1EtTools::m_TEMasks
std::map< int, int > * m_TEMasks
Map of JetElements masked out of TE trigger.
Definition: L1EtTools.h:109
TrigInDetValidation_Base.test
test
Definition: TrigInDetValidation_Base.py:147
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
LVL1::L1EtTools::m_jetElementThresholdEtSum
int m_jetElementThresholdEtSum
Thresholds to apply to JetElements in EtSum and EtMiss triggers.
Definition: L1EtTools.h:105
LVL1::L1EtTools::L1EtTools
L1EtTools(const std::string &, const std::string &, const IInterface *)
Definition: L1EtTools.cxx:19
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
LVL1::L1EtTools::initialize
virtual StatusCode initialize()
standard Athena-Algorithm method
Definition: L1EtTools.cxx:45
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
python.PyAthena.module
module
Definition: PyAthena.py:131
LVL1::L1EtTools::m_L1MenuKey
SG::ReadHandleKey< TrigConf::L1Menu > m_L1MenuKey
Definition: L1EtTools.h:110
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
xAOD::JetElementMap_t
std::map< int, const JetElement * > JetElementMap_t
Definition: Event/xAOD/xAODTrigL1Calo/xAODTrigL1Calo/JetElement.h:18
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
perfmonmt-refit.slice
slice
Definition: perfmonmt-refit.py:52
LVL1::L1EtTools::m_jetElementThresholdEtMiss
int m_jetElementThresholdEtMiss
Definition: L1EtTools.h:106
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
LVL1::ModuleEnergy
This is an internal class, used in the Energy trigger.
Definition: ModuleEnergy.h:45
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TriggerThreshold.h
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
TriggerThresholdValue.h
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
DataVector::clear
void clear()
Erase all the elements in the collection.
L1EtTools.h
LVL1::JetElementKey
The JetElementKey object provides the key for each JetElement depending on its eta,...
Definition: JetElementKey.h:51
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
TrigT1CaloDefs.h
LVL1::L1EtTools::~L1EtTools
virtual ~L1EtTools()
default destructor
Definition: L1EtTools.cxx:38
L1DataDef.h
LVL1::L1EtTools::mapJetElements
void mapJetElements(const xAOD::JetElementContainer *jetelements, xAOD::JetElementMap_t *m_jeContainer) const
Return a map of JetElements.
Definition: L1EtTools.cxx:63
LVL1::SystemEnergy
SystemEnergy class declaration Simulates behaviour of the Crate-CMM System CMM logic is done in Energ...
Definition: SystemEnergy.h:35
LVL1::L1EtTools::systemSums
virtual SystemEnergy systemSums(const DataVector< CrateEnergy > *crates) const
Returns a LVL1::SystemEnergy object.
Definition: L1EtTools.cxx:156
AthAlgTool
Definition: AthAlgTool.h:26
LVL1::L1EtTools::crateSums
virtual void crateSums(const DataVector< ModuleEnergy > *modules, DataVector< CrateEnergy > *crates, uint32_t maskXE=0xff, uint32_t maskTE=0xff, bool restricted=false) const
Returns a vector of LVL1::CrateEnergy objects.
Definition: L1EtTools.cxx:130
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
LVL1::L1EtTools::moduleSums
virtual void moduleSums(const xAOD::JetElementContainer *jetelements, DataVector< ModuleEnergy > *modules, int slice=-1) const
Returns a vector of LVL1::ModuleEnergy objects.
Definition: L1EtTools.cxx:91
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37