ATLAS Offline Software
Loading...
Searching...
No Matches
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
15namespace LVL1 {
16
17//================ Constructor =================================================
18
19L1EtTools::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
33
34}
35
36//================ Destructor =================================================
37
41
42
43//================ Initialisation =================================================
44
46{
47 ATH_CHECK( m_L1MenuKey.initialize() );
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) {
103 modules->push_back( new ModuleEnergy(jeContainer, crate, module, m_jetElementThresholdEtSum, m_jetElementThresholdEtMiss, m_TEMasks, slice) );
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) {
122 modules->push_back( new ModuleEnergy(jemap, crate, module, m_jetElementThresholdEtSum, m_jetElementThresholdEtMiss, m_TEMasks, slice) );
123 }
124 }
125
126}
127
128//=====================Form JE Crate ET sums ====================
129
130void 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
143void 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
211SystemEnergy 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
228SystemEnergy 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
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Derived DataVector<T>.
Definition DataVector.h:795
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
value_type push_back(value_type pElem)
Add an element to the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
void clear()
Erase all the elements in the collection.
CrateEnergy class declaration Simulates behaviour of the Crate-CMM System CMM logic is done in Energy...
Definition CrateEnergy.h:29
virtual unsigned int jeKey(const xAOD::TriggerTower &tower)
returns key of passed tower
The JetElementKey object provides the key for each JetElement depending on its eta,...
SG::ReadHandleKey< TrigConf::L1Menu > m_L1MenuKey
Definition L1EtTools.h:107
virtual StatusCode initialize()
standard Athena-Algorithm method
Definition L1EtTools.cxx:45
virtual ~L1EtTools()
default destructor
Definition L1EtTools.cxx:38
int m_jetElementThresholdEtMiss
Definition L1EtTools.h:103
std::map< int, int > * m_TEMasks
Map of JetElements masked out of TE trigger.
Definition L1EtTools.h:106
L1EtTools(const std::string &, const std::string &, const IInterface *)
Definition L1EtTools.cxx:19
virtual SystemEnergy systemSums(const DataVector< CrateEnergy > *crates) const
Returns a LVL1::SystemEnergy object.
int m_jetElementThresholdEtSum
Thresholds to apply to JetElements in EtSum and EtMiss triggers.
Definition L1EtTools.h:102
virtual StatusCode finalize()
standard Athena-Algorithm method
Definition L1EtTools.cxx:54
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
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.
void mapJetElements(const xAOD::JetElementContainer *jetelements, xAOD::JetElementMap_t *m_jeContainer) const
Return a map of JetElements.
Definition L1EtTools.cxx:63
This is an internal class, used in the Energy trigger.
SystemEnergy class declaration Simulates behaviour of the Crate-CMM System CMM logic is done in Energ...
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
JetElementContainer_v2 JetElementContainer
Define the latest version of the JetElement container.
std::map< int, const JetElement * > JetElementMap_t