ATLAS Offline Software
Loading...
Searching...
No Matches
LVL1::L1CPMTools Class Reference

This is a tool to reconstruct the L1 EM/tau trigger sums for a particula] r RoI location from the stored TriggerTowers. More...

#include <L1CPMTools.h>

Inheritance diagram for LVL1::L1CPMTools:
Collaboration diagram for LVL1::L1CPMTools:

Public Types

typedef DataVector< xAOD::CPMTowerCPMTCollection
typedef std::map< int, xAOD::CPMTower * > * CPMTContainer

Public Member Functions

 L1CPMTools (const std::string &, const std::string &, const IInterface *)
 Constructor.
virtual StatusCode initialize () override
 standard Athena-Algorithm method
virtual StatusCode finalize () override
 standard Athena-Algorithm method
virtual void mapTowers (const DataVector< xAOD::CPMTower > *cpmts, xAOD::CPMTowerMap_t *towers) const override
 Tool-based EM/tau algorithm implementation.
virtual void findRoIs (const TrigConf::L1Menu *l1menu, const xAOD::CPMTowerMap_t *towers, DataVector< CPMTobAlgorithm > *tobs, int slice=-1) const override
 Find RoIs in user-supplied map of input towers.
virtual void findRoIs (const TrigConf::L1Menu *l1menu, const DataVector< xAOD::CPMTower > *cpmts, DataVector< CPMTobAlgorithm > *tobs, int slice=-1) const override
 Find RoIs in user-supplied DataVector of input towers.
virtual void findCPMTobRoIs (const TrigConf::L1Menu *l1menu, const xAOD::CPMTowerMap_t *towers, xAOD::CPMTobRoIContainer *rois, int slice=-1) const override
 Form CPM results for specified crate/module using user-supplied map of input towers This version fills a vector of CPMTobRoI for the whole detector.
virtual void findCPMTobRoIs (const TrigConf::L1Menu *l1menu, const DataVector< xAOD::CPMTower > *cpmts, xAOD::CPMTobRoIContainer *rois, int slice=-1) const override
 Form CPM results for specified crate/module using user-supplied vector of input towers This version fills a vector of CPMTobRoI for the whole detector.
virtual void findCPMResults (const TrigConf::L1Menu *l1menu, const xAOD::CPMTowerMap_t *towers, int crate, int module, DataVector< CPMTobRoI > *rois, std::vector< unsigned int > &emCMXData, std::vector< unsigned int > &tauCMXData, int slice=-1) const override
 Form CPM results for specified crate/module using user-supplied map of input towers This version adds to DataVector of CPMTobRoI and returns backplane data words.
virtual CPMTobAlgorithm findRoI (const TrigConf::L1Menu *l1menu, double RoIeta, double RoIphi, const xAOD::CPMTowerMap_t *towers, int slice=-1) const override
 Return RoI object for a specified location.
virtual CPMTobAlgorithm formSums (const TrigConf::L1Menu *l1menu, double RoIeta, double RoIphi, const xAOD::CPMTowerMap_t *towers, int slice=-1) const override
 Form cluster/isolation sums for a given RoI location.
virtual CPMTobAlgorithm formSums (const TrigConf::L1Menu *l1menu, uint32_t roiWord, const xAOD::CPMTowerMap_t *towers, int slice=-1) const override
 Form sums for given RoI.

Private Attributes

CPRoIDecoder m_conv
 Utility for decoding RoI words.

Detailed Description

This is a tool to reconstruct the L1 EM/tau trigger sums for a particula] r RoI location from the stored TriggerTowers.

Used for offline monitoring and trigger reconstruction.

Usage: L1CPMTools->mapTowers() // set up event for analysis L1CPMTools->formSums(eta, phi) // for each RoI L1CPMTools->EmClus() // etc. Return values

Author
Alan Watson Alan..nosp@m.Wats.nosp@m.on@ce.nosp@m.rn.c.nosp@m.h

Definition at line 44 of file L1CPMTools.h.

Member Typedef Documentation

◆ CPMTCollection

◆ CPMTContainer

Definition at line 48 of file L1CPMTools.h.

Constructor & Destructor Documentation

◆ L1CPMTools()

LVL1::L1CPMTools::L1CPMTools ( const std::string & t,
const std::string & n,
const IInterface * p )

Constructor.

Definition at line 19 of file L1CPMTools.cxx.

20: base_class(t,n,p) {}

Member Function Documentation

◆ finalize()

StatusCode LVL1::L1CPMTools::finalize ( )
overridevirtual

standard Athena-Algorithm method

Finalisation.

Definition at line 31 of file L1CPMTools.cxx.

32{
33 return StatusCode::SUCCESS;
34}

◆ findCPMResults()

void LVL1::L1CPMTools::findCPMResults ( const TrigConf::L1Menu * l1menu,
const xAOD::CPMTowerMap_t * towers,
int crate,
int module,
DataVector< CPMTobRoI > * rois,
std::vector< unsigned int > & emCMXData,
std::vector< unsigned int > & tauCMXData,
int slice = -1 ) const
overridevirtual

Form CPM results for specified crate/module using user-supplied map of input towers This version adds to DataVector of CPMTobRoI and returns backplane data words.

Form results for a specified module.

This tool appends to an existing DataVector of results, so do not clear that. But reset & resize the module results vectors, to be safe

Count RoIs of each type (for correct filling of backplane words)

Process reference towers within this CPM's coverage

Loop over all reference towers in order of TOB readout. As only 1 TOB possible per chip/side, order within these doesn't matter

If want to be clever and test whether worth proceeding before evaluating window, this would be the place to put the test

Form algorithm object for this location

Did it pass as EM TOB? If so: Create TOB RoI object and push back into system results Add bit to presence map Add TOB to backplane data (if not overflowed)

Same for TAU hypothesis

Definition at line 39 of file L1CPMTools.cxx.

41 {
42
45 emCMXData.clear();
46 emCMXData.resize(4);
47 tauCMXData.clear();
48 tauCMXData.resize(4);
49
51 int nEmTobs = 0;
52 int nTauTobs = 0;
53
55
56 int iPhiMin = crate*16;
57 int iEtaMin = (module-1)*4 - 28;
58
61 for (int iChip = 0; iChip < 8; ++iChip) {
62 for (int iSide = 0; iSide < 2; ++iSide) {
63 for (int iPhi = 0; iPhi < 2; ++iPhi) {
64 int ip = iPhiMin + 2*iChip + iPhi;
65 for (int iEta = 0; iEta < 2; ++iEta) {
66 int ie = iEtaMin + 2*iSide + iEta;
67
68 float eta = ie*0.1 + 0.05;
69 float phi = ip*M_PI/32 + M_PI/64;
70
73
75 CPMTobAlgorithm tob(eta, phi, towers, l1menu, slice); // quicker to do both in one go, though maybe not cleaner
76
81 if (tob.isEMRoI()) {
82 int et = tob.EMClusET();
83 int isol = tob.EMIsolWord();
84 int location = (iSide << 2) + (iPhi << 1) + iEta;
85
86 CPMTobRoI* emRoI = new CPMTobRoI(crate, module, iChip, location, TrigT1CaloDefs::emTobType, et, isol);
87 rois->push_back(emRoI);
88
89 unsigned int offset = iChip*2 + iSide;
90 emCMXData[0] |= (1 << offset);
91
92 unsigned int lc = (iPhi << 1) + iEta;
93 switch (nEmTobs) {
94 case 0:
95 emCMXData[1] += et;
96 emCMXData[0] += (isol<<18);
97 emCMXData[0] += (lc<<16);
98 break;
99 case 1:
100 emCMXData[1] += (et<<8);
101 emCMXData[1] += (isol<<18);
102 emCMXData[1] += (lc<<16);
103 break;
104 case 2:
105 emCMXData[2] += et;
106 emCMXData[2] += (isol<<18);
107 emCMXData[2] += (lc<<16);
108 break;
109 case 3:
110 emCMXData[2] += (et<<8);
111 emCMXData[3] += (isol<<10);
112 emCMXData[3] += (lc<<8);
113 break;
114 case 4:
115 emCMXData[3] += et;
116 emCMXData[3] += (isol<<18);
117 emCMXData[3] += (lc<<16);
118 break;
119 }
120 nEmTobs++;
121
122 } // Found EM TOB
123
125 if (tob.isTauRoI()) {
126 int et = tob.TauClusET();
127 int isol = tob.TauIsolWord();
128 int location = (iSide << 2) + (iPhi << 1) + iEta;
129
130 CPMTobRoI* tauRoI = new CPMTobRoI(crate, module, iChip, location, TrigT1CaloDefs::tauTobType, et, isol);
131 rois->push_back(tauRoI);
132
133 unsigned int offset = iChip*2 + iSide;
134 tauCMXData[0] |= (1 << offset);
135
136 unsigned int lc = (iPhi << 1) + iEta;
137 switch (nTauTobs) {
138 case 0:
139 tauCMXData[1] += et;
140 tauCMXData[0] += (isol<<18);
141 tauCMXData[0] += (lc<<16);
142 break;
143 case 1:
144 tauCMXData[1] += (et<<8);
145 tauCMXData[1] += (isol<<18);
146 tauCMXData[1] += (lc<<16);
147 break;
148 case 2:
149 tauCMXData[2] += et;
150 tauCMXData[2] += (isol<<18);
151 tauCMXData[2] += (lc<<16);
152 break;
153 case 3:
154 tauCMXData[2] += (et<<8);
155 tauCMXData[3] += (isol<<10);
156 tauCMXData[3] += (lc<<8);
157 break;
158 case 4:
159 tauCMXData[3] += et;
160 tauCMXData[3] += (isol<<18);
161 tauCMXData[3] += (lc<<16);
162 break;
163 }
164 nTauTobs++;
165
166 } // Found Tau TOB
167
168 } // eta within chip/side
169 } // phi within chip/side
170 } // side (L/R) of chip
171 } // chip (0-7) within module
172
173 // Finally set parity bits for data words
174 for (unsigned int word = 0; word < 4; ++word) {
175 unsigned int parity = 1;
176 for (unsigned int bit = 0; bit < 24; ++bit) if ( ( (emCMXData[word]>>bit) & 1) > 0 ) parity++;
177 parity &= 1;
178 emCMXData[word] |= (parity<<23);
179
180 parity = 1;
181 for (unsigned int bit = 0; bit < 24; ++bit) if ( ( (tauCMXData[word]>>bit) & 1) > 0 ) parity++;
182 parity &= 1;
183 tauCMXData[word] |= (parity<<23);
184 }
185
186
187}
#define M_PI
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
float et(const xAOD::jFexSRJetRoI *j)
@ iPhi
Definition ParamDefs.h:47
setScale setgFexType iEta
CPMTobRoI_v1 CPMTobRoI
Define the latest version of the CPMTobRoI class.

◆ findCPMTobRoIs() [1/2]

void LVL1::L1CPMTools::findCPMTobRoIs ( const TrigConf::L1Menu * l1menu,
const DataVector< xAOD::CPMTower > * cpmts,
xAOD::CPMTobRoIContainer * rois,
int slice = -1 ) const
overridevirtual

Form CPM results for specified crate/module using user-supplied vector of input towers This version fills a vector of CPMTobRoI for the whole detector.

Find all CPMTobRoIs in the event.

Need a map of CPMTowers as input

Now find the RoIs in this map

Clean up

Definition at line 192 of file L1CPMTools.cxx.

192 {
193
196 mapTowers(cpmts, towers);
197
199 findCPMTobRoIs(l1menu, towers, rois, slice);
200
202 for (xAOD::CPMTowerMap_t::iterator it = towers->begin(); it != towers->end(); ++it) {
203 delete (*it).second;
204 }
205 delete towers;
206
207}
virtual void mapTowers(const DataVector< xAOD::CPMTower > *cpmts, xAOD::CPMTowerMap_t *towers) const override
Tool-based EM/tau algorithm implementation.
virtual void findCPMTobRoIs(const TrigConf::L1Menu *l1menu, const xAOD::CPMTowerMap_t *towers, xAOD::CPMTobRoIContainer *rois, int slice=-1) const override
Form CPM results for specified crate/module using user-supplied map of input towers This version fill...
std::map< int, const CPMTower * > CPMTowerMap_t

◆ findCPMTobRoIs() [2/2]

void LVL1::L1CPMTools::findCPMTobRoIs ( const TrigConf::L1Menu * l1menu,
const xAOD::CPMTowerMap_t * towers,
xAOD::CPMTobRoIContainer * rois,
int slice = -1 ) const
overridevirtual

Form CPM results for specified crate/module using user-supplied map of input towers This version fills a vector of CPMTobRoI for the whole detector.

Find all CPMTobRoIs in the event.

Clear results vector to be safe

Now step through CPMTower map
Each tower could be reference tower of 4 RoIs
But need to ensure we don't double count, so we use
a std::map to keep track of which RoIs already exist

Definition at line 211 of file L1CPMTools.cxx.

211 {
212
214 rois->clear();
215
220
221 TriggerTowerKey testKey(0.0, 0.0);
222 std::map<int, int> analysed;
223 xAOD::CPMTowerMap_t::const_iterator cpmt = towers->begin();
224 for ( ; cpmt != towers->end(); ++cpmt) {
225 double eta = (*cpmt).second->eta();
226 double phi = (*cpmt).second->phi();
227 for (int i = -1; i <= 0; ++i) {
228 for (int j = -1; j <= 0; ++j) {
229 double tempEta = eta + i*0.1;
230 double tempPhi = phi + j*0.1;
231 int key = testKey.ttKey(tempPhi,tempEta);
232 std::map<int, int>::iterator test = analysed.find(key);
233 if (test == analysed.end()) {
234 analysed.insert(std::map<int, int>::value_type(key,1));
235
236 CPMTobAlgorithm tob(tempEta, tempPhi, towers, l1menu, slice);
237
238 // Did this pass as an EM TOB?
239 if (tob.isEMRoI()) {
240 xAOD::CPMTobRoI* emRoI = tob.EMCPMTobRoI();
241 if (emRoI != 0) rois->push_back(emRoI);
242 }
243
244 // Did this pass as a Tau TOB?
245 if (tob.isTauRoI()) {
246 xAOD::CPMTobRoI* tauRoI = tob.TauCPMTobRoI();
247 if (tauRoI != 0) rois->push_back(tauRoI);
248 }
249
250 } // Not analysed this one already
251 } // phi neighbours
252 } // eta neighbours
253 } // iterate over CPM Towers
254
255}

◆ findRoI()

CPMTobAlgorithm LVL1::L1CPMTools::findRoI ( const TrigConf::L1Menu * l1menu,
double RoIeta,
double RoIphi,
const xAOD::CPMTowerMap_t * towers,
int slice = -1 ) const
overridevirtual

Return RoI object for a specified location.

Return RoI for given coordinates.

Definition at line 348 of file L1CPMTools.cxx.

348 {
349 // Performs all processing for this location
350 return CPMTobAlgorithm(RoIeta, RoIphi, towers, l1menu, slice);
351}

◆ findRoIs() [1/2]

void LVL1::L1CPMTools::findRoIs ( const TrigConf::L1Menu * l1menu,
const DataVector< xAOD::CPMTower > * cpmts,
DataVector< CPMTobAlgorithm > * tobs,
int slice = -1 ) const
overridevirtual

Find RoIs in user-supplied DataVector of input towers.

Find list of TOBs from user-supplied vector of CPMTowers.

Need a map of CPMTowers as input

Now find the RoIs in this map

Clean up

Definition at line 258 of file L1CPMTools.cxx.

258 {
259
262 mapTowers(cpmts, towers);
263
265 findRoIs(l1menu, towers, tobs, slice);
266
268 for (xAOD::CPMTowerMap_t::iterator it = towers->begin(); it != towers->end(); ++it) {
269 delete (*it).second;
270 }
271 delete towers;
272}
virtual void findRoIs(const TrigConf::L1Menu *l1menu, const xAOD::CPMTowerMap_t *towers, DataVector< CPMTobAlgorithm > *tobs, int slice=-1) const override
Find RoIs in user-supplied map of input towers.

◆ findRoIs() [2/2]

void LVL1::L1CPMTools::findRoIs ( const TrigConf::L1Menu * l1menu,
const xAOD::CPMTowerMap_t * towers,
DataVector< CPMTobAlgorithm > * tobs,
int slice = -1 ) const
overridevirtual

Find RoIs in user-supplied map of input towers.

Find list of TOBs from user-supplied map of CPMTowers.

Clear results vector to be safe

Now step through CPMTower map
Each tower could be reference tower of 4 RoIs
But need to ensure we don't double count, so we use
a std::map to keep track of which RoIs already exist

Definition at line 276 of file L1CPMTools.cxx.

276 {
277
279 tobs->clear();
280
285
286 TriggerTowerKey testKey(0.0, 0.0);
287 std::map<int, int> analysed;
288 xAOD::CPMTowerMap_t::const_iterator cpmt = towers->begin();
289 for ( ; cpmt != towers->end(); ++cpmt) {
290 double eta = (*cpmt).second->eta();
291 double phi = (*cpmt).second->phi();
292 for (int i = -1; i <= 0; ++i) {
293 for (int j = -1; j <= 0; ++j) {
294 double tempEta = eta + i*0.1;
295 double tempPhi = phi + j*0.1;
296 int key = testKey.ttKey(tempPhi,tempEta);
297 std::map<int, int>::iterator test = analysed.find(key);
298 if (test == analysed.end()) {
299 analysed.insert(std::map<int, int>::value_type(key,1));
300
301 CPMTobAlgorithm* tob = new CPMTobAlgorithm(tempEta, tempPhi, towers, l1menu, slice);
302 if ( (tob->isEMRoI() || tob->isTauRoI()) ) tobs->push_back(tob);
303 else delete tob;
304 } // not done this one already
305 } // phi neighbours
306 } // eta neighbours
307 } // iterate over CPM Towers
308
309}
value_type push_back(value_type pElem)
Add an element to the end of the collection.
void clear()
Erase all the elements in the collection.

◆ formSums() [1/2]

CPMTobAlgorithm LVL1::L1CPMTools::formSums ( const TrigConf::L1Menu * l1menu,
double RoIeta,
double RoIphi,
const xAOD::CPMTowerMap_t * towers,
int slice = -1 ) const
overridevirtual

Form cluster/isolation sums for a given RoI location.

Form clusters for given coordinates.

Definition at line 355 of file L1CPMTools.cxx.

355 {
356 // Performs all processing for this location
357 return CPMTobAlgorithm(RoIeta, RoIphi, towers, l1menu, slice);
358}

◆ formSums() [2/2]

CPMTobAlgorithm LVL1::L1CPMTools::formSums ( const TrigConf::L1Menu * l1menu,
uint32_t roiWord,
const xAOD::CPMTowerMap_t * towers,
int slice = -1 ) const
overridevirtual

Form sums for given RoI.

Definition at line 362 of file L1CPMTools.cxx.

362 {
363 // Find RoI coordinate
364 CoordinateRange coord = m_conv.coordinate(roiWord);
365 float RoIphi = coord.phi();
366 float RoIeta = coord.eta();
367
368 // Performs all processing for this location
369 return CPMTobAlgorithm(RoIeta, RoIphi, towers, l1menu, slice);
370}
double coord
Type of coordination system.
CPRoIDecoder m_conv
Utility for decoding RoI words.
Definition L1CPMTools.h:92

◆ initialize()

StatusCode LVL1::L1CPMTools::initialize ( )
overridevirtual

standard Athena-Algorithm method

Initialisation.

Definition at line 24 of file L1CPMTools.cxx.

25{
26 return StatusCode::SUCCESS;
27}

◆ mapTowers()

void LVL1::L1CPMTools::mapTowers ( const DataVector< xAOD::CPMTower > * cpmts,
xAOD::CPMTowerMap_t * towers ) const
overridevirtual

Tool-based EM/tau algorithm implementation.

CPMTower map from user-supplied vector of CPMTowers.

Map CPMTowers from user-supplied DataVector of inputs

Definition at line 312 of file L1CPMTools.cxx.

312 {
313
314 // Clear map before filling
315 towers->clear();
316
317 // Step over all CPMTowers and put into map
319 TriggerTowerKey testKey(0.0, 0.0);
320
321 for( it = cpmts->begin(); it != cpmts->end(); ++it ){
322 double TriggerTowerEta=(*it)->eta();
323 if (fabs(TriggerTowerEta) < 2.5) { // limit of em/tau coverage
324 double TriggerTowerPhi=(*it)->phi();
325 int key = testKey.ttKey(TriggerTowerPhi,TriggerTowerEta);
326 xAOD::CPMTowerMap_t::iterator test=towers->find( key );
327 if (test != towers->end()){
328 ATH_MSG_ERROR( "ERROR: tower already in map!" );
329 }
330 else {
331 std::vector<uint8_t> emEt = (*it)->emEnergyVec();
332 std::vector<uint8_t> hadEt = (*it)->hadEnergyVec();
333 bool nonZero = false;
334 for (std::vector<uint8_t>::iterator it2 = emEt.begin(); it2 != emEt.end(); ++it2)
335 if ((*it2) > 0) nonZero = true;
336 for (std::vector<uint8_t>::iterator it2 = hadEt.begin(); it2 != hadEt.end(); ++it2)
337 if ((*it2) > 0) nonZero = true;
338 if (nonZero) towers->insert(xAOD::CPMTowerMap_t::value_type(key,(*it)));
339 }
340 }
341 }//endfor
342
343 return;
344}
#define ATH_MSG_ERROR(x)
DataModel_detail::const_iterator< DataVector > const_iterator
Standard const_iterator.
Definition DataVector.h:838
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.

Member Data Documentation

◆ m_conv

CPRoIDecoder LVL1::L1CPMTools::m_conv
private

Utility for decoding RoI words.

Definition at line 92 of file L1CPMTools.h.


The documentation for this class was generated from the following files: