ATLAS Offline Software
Loading...
Searching...
No Matches
eSuperCellTowerMapper.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5
7#include "GaudiKernel/MsgStream.h"
9
10// This is a class which is designed to receive in a list of supercells and a list of eTowers and match them together appropriately.
11
12
13/* VERY IMPORTANT NOTE. ARE YOU CONFUSED ABOUT SAMPLING IDs? WANT TO KNOW WHERE ON EARTH THEY COME FROM? FINDING OBSCURE VALUES THAT ARE APPARENTLY MEANINGLESS?
14
15LOOK HERE!: athena/Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.def
16
17*/
18
19
20namespace LVL1 {
21
22eSuperCellTowerMapper::eSuperCellTowerMapper(const std::string& type,const std::string& name,const IInterface* parent):
23 AthAlgTool(type,name,parent)
24{
25 declareInterface<IeSuperCellTowerMapper>(this);
26
27}
28
33
35{
36
37 ATH_CHECK( m_scellsCollectionSGKey.initialize() );
40 return StatusCode::SUCCESS;
41
42}
43
44StatusCode eSuperCellTowerMapper::AssignTriggerTowerMapper(std::unique_ptr<eTowerContainer> & my_eTowerContainerRaw) const {
45
46 static constexpr float pi_over_32 = M_PI/32;
47
49 if(!triggerTowerCollection.isValid()){
50 ATH_MSG_FATAL("Could not retrieve collection " << m_triggerTowerCollectionSGKey.key() );
51 return StatusCode::FAILURE;
52 }
53
54
55 for(auto eachTower : *triggerTowerCollection) {
56 if(std::abs(eachTower->eta())<1.5 && eachTower->sampling()==1) {
57 int i_phi = static_cast<int>(eachTower->phi()/pi_over_32);
58 int etaSign{-1};
59 int towerID_Modifier{100000};
60 if (eachTower->eta() > 0) {
61 etaSign = 1;
62 towerID_Modifier = 200000;
63 }
64 int i_eta = static_cast<int>(eachTower->eta() * 10) * etaSign;
65 if(i_eta * etaSign == -14) {
66 towerID_Modifier = 300000;
67 } else if (i_eta * etaSign == 14) {
68 towerID_Modifier = 400000;
69 }
70
71 int towerid = FindTowerIDForSuperCell(i_eta, i_phi) + towerID_Modifier;
72 LVL1::eTower * targetTower;
73 if((targetTower = my_eTowerContainerRaw->findTower(towerid))) {
74 if (targetTower->getET_float(4, 0) > 0) {
75 ATH_MSG_WARNING("\n==== eSuperCellTowerMapper ============ Hadronic layer energy filled more than once - it will be ignored. (Needs investigation). Please report this!");
76 }
77 targetTower->setET(10, static_cast<int>(eachTower->cpET()) * 500., 4); // cf 0.5 * 1000.0
78 } else {
79 ATH_MSG_WARNING("\n==== eSuperCellTowerMapper ============ Tower id is officially unknown - it will be ignored. (Needs investigation). Please report this!");
80 }
81 }
82 }
83 return StatusCode::SUCCESS;
84}
85
87 return;
88}
89
90 // works for real supercells from MC
91 StatusCode eSuperCellTowerMapper::AssignSuperCellsToTowers(std::unique_ptr<eTowerContainer> & my_eTowerContainerRaw) const
92{
93
94 bool doPrint = false;
95
97 if(!scellsCollection.isValid()){
98 ATH_MSG_FATAL("Could not retrieve collection " << m_scellsCollectionSGKey.key() );
99 return StatusCode::FAILURE;
100 }
101
102 //const CaloCell_Base_ID* idHelper = caloIdManager->getCaloCell_SuperCell_ID(); // getting the id helper class
103 const CaloCell_Base_ID* idHelper = nullptr;
104 ATH_CHECK( detStore()->retrieve (idHelper, "CaloCell_SuperCell_ID") );
105 for (const CaloCell* cell : * scellsCollection){
106
107 // Discard masked cells from monitoring
108 int SCprov = (cell)->provenance()&0xFFF;
109 bool isMasked = (SCprov&0x80)==0x80;
110
111 if (isMasked) continue;
112
113 const CaloSampling::CaloSample sample = (cell)->caloDDE()->getSampling();
114 const Identifier ID = (cell)->ID(); // super cell unique ID
115 int region = idHelper->region(ID);
116 float et = 12.5*std::round((cell)->energy()/(12.5*cosh((cell)->eta())));
117 int pos_neg = idHelper->pos_neg(ID);
118 //We need to explicitly avoid +/- 3 pos_neg supercells! These go beyond |eta| == 2.5
119 if(abs(pos_neg) == 3){ continue; }
120 // mapping with csv file
121 if(m_eFEXSuperCellTowerIdProviderTool->ifhaveinputfile()){
122 int towerid{ -1 };
123 int slot{ -1 };
124 bool doenergysplit { false };
125 ATH_CHECK( m_eFEXSuperCellTowerIdProviderTool->geteTowerIDandslot(ID.get_compact(), towerid, slot, doenergysplit) );
126 // ignore invalid SuperCell
127 if (towerid == -1) {
128 continue;
129 }
130 int layer_tem = -1;
131 // Layer 0: Cell 0
132 // Layer 1: Cell 1, 2, 3, 4
133 // Layer 2: Cell 5, 6, 7, 8
134 // Layer 3: Cell 9
135 // Layer 4: Cell 10 (HEC or TILE, if we have them!)
136 if (slot == 0) {
137 layer_tem = 0;
138 } else if (slot <= 4) {
139 layer_tem = 1;
140 } else if (slot <= 8) {
141 layer_tem = 2;
142 } else if (slot == 9) {
143 layer_tem = 3;
144 } else {
145 layer_tem = 4;
146 }
147
148 ConnectSuperCellToTower( my_eTowerContainerRaw, towerid, ID, slot, et, layer_tem, doenergysplit);
149 continue;
150 }
151 int layer = -1;
152 int eta_index = idHelper->eta(ID);
153 const int phi_index = idHelper->phi(ID);
154 int prov = (cell)->provenance();
155
156 /*
157 CaloSampling:
158 PreSamplerB 0
159 EMB1 1
160 EMB2 2
161 EMB3 3
162
163 PreSamplerE 4
164 EME1 5
165 EME2 6
166 EME3 7
167
168 HEC0 8
169 HEC1 9
170 HEC2 10
171 HEC3 11
172
173 TileBar0 12 (Tile Barrel)
174 TileBar1 13
175 TileBar2 14
176
177 TileGap1 15 (ITC and Scintillator)
178 TileGap2 16
179 TileGap3 17
180
181 TileExt0 18 (Tile Extended Barrel)
182 TileExt1 19
183 TileExt2 20
184
185 FCAL0 21 (Forward EM Endcap)
186 FCAL1 22
187 FCAL2 23
188
189 MINIFCAL0 24
190 MINIFCAL1 25
191 MINIFCAL2 26
192 MINIFCAL3 27
193
194 Unknown 28
195 */
196
197 // LOCAL TO GLOBAL ETA INDEX PATCH - USE A 'TOWER OFFSET' TO MARK THE START OF THE ETA_INDEX COUNTING (e.g. the rounded eta value of the innermost supercell)
198 switch(sample){
199 case CaloSampling::PreSamplerB: { break; }
200 case CaloSampling::EMB1: {
201 if(region == 1){ eta_index += 56; }
202 break;
203 }
204 case CaloSampling::EMB2: {
205 if(region == 1){ eta_index += 56; }
206 break;
207 }
208 case CaloSampling::EMB3: { break; }
209 case CaloSampling::PreSamplerE: { eta_index += 15; break; }
210 case CaloSampling::EME1: {
211 if(region == 0){ eta_index += 14; }
212 else if (region == 1){ /* doesn't exist */ }
213 else if (region == 2){ eta_index += 60; }
214 else if (region == 3){ eta_index += 108; } //6 supercell region
215 else if (region == 4){ eta_index += 80; }
216 else if (region == 5){ eta_index += 24; }
217 break;
218 }
219 case CaloSampling::EME2: {
220 if(region == 0){ eta_index += 14; }
221 else if (region == 1){ eta_index += 57; }
222 break;
223 }
224 case CaloSampling::EME3: { eta_index += 15; break; }
225 case CaloSampling::HEC0:
226 case CaloSampling::HEC1:
227 case CaloSampling::HEC2:
228 case CaloSampling::HEC3: { eta_index += 15; break; }
229 default: { /*ATH_MSG_DEBUG("Not doing anything since sample = " << sample);*/ break; }
230 }
231
232
233 FindAndConnectTower(my_eTowerContainerRaw,sample,region,layer,pos_neg,eta_index,phi_index,ID,et,prov,doPrint);
234 }
235
236 return StatusCode::SUCCESS;
237
238}
239
240
241void eSuperCellTowerMapper::ConnectSuperCellToTower(std::unique_ptr<eTowerContainer> & my_eTowerContainerRaw,int iETower, Identifier ID, int iCell, float et, int layer, bool doenergysplit) const {
242
243 LVL1::eTower * tmpTower = my_eTowerContainerRaw->findTower(iETower);
244
245 if(tmpTower){
246 tmpTower->setSCID(ID,iCell,et,layer,doenergysplit);
247 }
248
249}
250
251 int eSuperCellTowerMapper::FindAndConnectTower(std::unique_ptr<eTowerContainer> & my_eTowerContainerRaw,CaloSampling::CaloSample sample,const int region, int layer, const int pos_neg, const int eta_index, const int phi_index, Identifier ID, float et, int prov,bool doPrint) const
252{
253
254 // bool for the special case of 1.8 < eta < 2.0 only in the front layer
255 bool doenergysplit = false;
256
257 // bool as a flag to enable or disable the connection of supercells to towers according to their location and identities
258 bool validcell = true;
259
260 // We tell the eTower which supercell unique ID is in each of it's available 'slots'
261 int towereta = -99; // to be filled with tower eta value to help find it
262 int towerphi = -99; // to be filled with tower phi value to help find it
263 int iETower = -99; // The tower ID which the supercell will be assigned to
264 int iCell = -1; // The position within the Tower that the supercell will be assigned to
265 int towerID_Modifier = -999999999; // adjustable tower ID modifier to fit tower Id scheme
266
267 /*
268 ** iCell Numbering Scheme **
269
270 Let's use the following scheme (from low to high eta regardless of detector side):
271 Layer 0: Cell 0
272 Layer 1: Cell 1, 2, 3, 4
273 Layer 2: Cell 5, 6, 7, 8
274 Layer 3: Cell 9
275 Layer 4: Cell 10 (HEC or TILE, if we have them!)
276 */
277
278
279 /*
280 ** Structure of the EMB in Supercells **
281
282 0 < 1.4 in steps of 0.1 == 14 towers
283 1.4 < 1.52 in steps of 0.12 ==> THIS TOWER IS MOVED TO TRANS TOWER REGION
284 14 towers total (all by presampler)
285 64 towers in phi in total
286
287 896 towers in EMB per side
288 1792 towers in EMB total
289 */
290
291 /*
292 ** Structure of the TRANS in Supercells **
293
294 1.4 < 1.5, 1 special tower made from EMB and EME supercells together
295 1 tower in eta
296 64 towers in phi
297
298 64 towers in TRANS total
299 */
300
301 /*
302 ** Structure of the EMEC in Supercells **
303
304 1.375 < 1.5, funny behaviour, treated as 1 special tower ==> 1 tower === TRANSITION TOWER NOW!
305 1.5 < 1.8 standard towers by presampler ==> 3 towers
306 1.8 < 2.0 standard towers by back ==> 2 towers
307 2.0 < 2.4 standard towers by back ==> 4 towers
308 2.4 < 2.5 standard tower by back ==> 1 tower
309 2.5 < 3.1, funny behaviour, treated as 3 wide towers ==> 3 towers. Also wide in phi! ===> WE DON'T CARE ABOUT |ETA| > 2.5
310 3.1 < 3.2 standard tower by back ==> 1 tower. Also wide in phi! ===> WE DON'T CARE ABOUT |ETA| > 2.5
311 10 towers in eta in total (by different means) (IGNORING ABOVE |ETA| > 2.5)
312 64 towers initially in phi (IGNORING ABOVE |ETA| > 2.5)
313
314 640 towers in EME per side
315 1280 towers in EME total
316 */
317
318
319 /*
320 ** Structure of the HEC in Supercells **
321
322 1.5 - 2.5, [Region 0] standard towers by presampler ==> layer on top of existing towers
323
324 */
325
326 /*
327 ** Notes on overall structure **
328 Total number of expected towers can be as high as: 896+640 = 1536 per side + 64 transition region towers (TRANS) each side = 3200 total <=== This is the correct value!
329 */
330
331 /*
332 ** Notes on Tower ID Number Scheme **
333
334 Left Barrel IETower = 100000 + X
335 Right Barrel IETower = 200000 + X
336 Left TRANS IETower = 300000 + X;
337 Right TRANS IETower = 400000 + X;
338 Left Endcap IETower = 500000 + X
339 Right Endcap IETower = 600000 + X
340 Left Hadronic Endcap IETower = 11100000 + X --> These are just Layer 5 of Endcap Towers. They will never be generated as standalone eTowers.
341 Right Hadronic Endcap IETower = 22200000 + X --> These are just Layer 5 of Endcap Towers. They will never be generated as standalone eTowers.
342
343 */
344
345
346 //----------------------------------------------------------
347
348 // Begin assigning supercells to Towers
349
350 //----------------------------------------------------------
351
352 switch (sample) {
353 // E.M. Barrel (EMB)
354 case CaloSampling::PreSamplerB: { // DONE
355 // Presampler of the EMBarrel. Supercells are 0.1 x 0.1 unless stated otherwise
356 // Region 0 has 14 supercells in 0 < eta < 1.4 and 64 supercells in phi.
357 // Region 0 has 1 supercell (0.12 x 0.1) in 1.4 < eta < 1.52 and 64 supercells in phi. // Documentation describes this as Region 1 but the code does not. We go with Region 0.
358
359 layer = 0; // By definition
360
361 towereta = eta_index; // Layer 0 has super cells which are 0.1 x 0.1 - i.e. the full width of a tower - sothe eta_index matches up to the Tower Eta
362 towerphi = phi_index; // phi is standard also
363
364 if(eta_index == 14){ // special treatment for TRANSITION tower
365 if(pos_neg < 0){ towerID_Modifier = 300000; }
366 else if(pos_neg > 0){ towerID_Modifier = 400000; }
367 iCell = 0; // By definition
368 }
369 else{ // standard treatment for non-transition towers
370 if(pos_neg < 0){ towerID_Modifier = 100000; }
371 else if(pos_neg > 0){ towerID_Modifier = 200000; }
372 iCell = 0; // By definition
373 }
374
375 break;
376 }
377 case CaloSampling::EMB1:
378 case CaloSampling::EMB2: {
379 // Layer 1 of the EMBarrel. Supercells are 0.025 x 0.1 unless stated otherwise
380 // Region 0 has 56 supercells in 0 < eta < 1.4 and 64 supercells in phi.
381 // Region 1 has 3 supercells in 1.4 < eta < 1.475 and 64 supercells in phi.
382
383 // Layer 2 of the EMBarrel. Supercells are 0.025 x 0.1 unless stated otherwise
384 // Region 0 has 56 supercells in 0 < eta < 1.4 and 64 supercells in phi.
385 // Region 1 has 1 supercells (0.075 x 0.1) in 1.4 < eta < 1.475 and 64 supercells in phi.
386
387 if (region == 0) {
388 towereta = eta_index / 4; // this divides integers by 4 and truncates away the decimals (rounds DOWN to an integer)
389 towerphi = phi_index;
390 if(pos_neg < 0){ towerID_Modifier = 100000; }
391 else if(pos_neg > 0){ towerID_Modifier = 200000; }
392 }
393 else if (region == 1){
394 towereta = 14; // hardcoded but is correct
395 towerphi = phi_index;
396 if(pos_neg < 0){ towerID_Modifier = 300000; }
397 else if(pos_neg > 0){ towerID_Modifier = 400000; }
398 }
399 else {
400 ATH_MSG_DEBUG("[CaloSampling::EMB1 or CaloSampling::EMB2] -> invalid 'region' value: " << region << " (Under investigation) ");
401 }
402
403 switch(sample){
404 case CaloSampling::EMB1: {
405 iCell = (eta_index % 4) + 1;
406 layer = 1;
407 break;
408 }
409 case CaloSampling::EMB2: {
410 if (region == 0) { iCell = (eta_index % 4) + 5; }
411 else if (region == 1){ iCell = 5; }
412 layer = 2;
413 break;
414 }
415 default: {
416 ATH_MSG_DEBUG("CaloSampling::EMBX -> invalid sample for assigning iCell value! " << sample << " (Under investigation) ");
417 break;
418 }
419 }
420
421 break;
422 }
423 case CaloSampling::EMB3: {
424 // Layer 3 of the EMBarrel. Supercells are 0.1 x 0.1 unless stated otherwise
425 // Region 0 has 14 supercells in 0 < eta < 1.4 and 64 supercells in phi.
426 // Region 1 does not exist
427
428 layer = 3; // By definiton
429 towereta = eta_index; // Analogous to PreSamplerB
430 towerphi = phi_index;
431
432 iCell = 9; // By definition;
433
434 if(pos_neg < 0){ towerID_Modifier = 100000; }
435 else if(pos_neg > 0){ towerID_Modifier = 200000; }
436
437 break;
438 }
439 // E.M. End-cap (EMEC)
440 case CaloSampling::PreSamplerE: {
441 // Region 1 has 3 supercells in 1.5 < eta < 1.8, and 64 supercells in phi.
442 // Supercells are 0.1 x 0.1.
443
444 layer = 0;
445
446 towereta = eta_index;
447 towerphi = phi_index;
448
449 iCell = 0; // By definition
450
451 if(pos_neg < 0){ towerID_Modifier = 500000; }
452 else if(pos_neg > 0){ towerID_Modifier = 600000; }
453
454 break;
455 }
456 case CaloSampling::EME1: {
457 // Layer 1 of the EM End-Cap. Supercells very frequently change in size.
458 // Region 0 has 1 supercell in 1.375 < eta < 1.5, and 64 supercells in phi. Supercells are 0.125 x 0.1.
459 // Region 1 has 12 supercells in 1.5 < eta < 1.8, and 64 supercells in phi. Supercells are 0.025 x 0.1.
460 // Region 2 has 6 (now 12??) supercells in 1.8 < eta < 2.0, and 64 supercells in phi. Supercells are 0.0333 (0.016667 ???) x 0.1.
461 // Region 3 has 16 supercells in 2.0 < eta < 2.4, and 64 supercells in phi. Supercells are 0.025 x 0.1.
462 // Region 4 has 1 supercell in 2.4 < eta < 2.5, and 64 supercells in phi. Supercells are 0.1 x 0.1.
463 // Region 5 has 3 supercells in 2.5 < eta < 3.1, and 32 supercells in phi. Supercells are 0.2 x 0.2.
464 // Region 6 has 1 supercell in 3.1 < eta < 3.2, and 32 supercells in phi. Supercells are 0.1 x 0.2
465
466 // 1.375 < 1.5, funny behaviour, treated as 1 special tower ==> 1 tower
467 // 1.5 < 1.8 standard towers by presampler ==> 3 towers
468 // 1.8 < 2.0 standard towers by back ==> 2 towers
469 // 2.0 < 2.4 standard towers by back ==> 4 towers
470 // 2.4 < 2.5 standard tower by back ==> 1 tower
471 // 2.5 < 3.1, funny behaviour, treated as 3 wide towers ==> 3 towers
472 // 3.1 < 3.2, funny behaviour, treated as 1 tower ==> 1 tower
473 // 15 towers in total (by different means)
474
475 layer = 1; // By definition
476
477 switch (region) {
478 case 0: { // special treatment for transition region
479
480 towereta = eta_index;
481 towerphi = phi_index;
482
483 iCell = 4; // Placement based on advice from Alan Watson
484 break;
485 }
486 case 2: {
487
488 towereta = (eta_index / 4);
489 towerphi = phi_index;
490
491 iCell = (eta_index % 4) + 1;
492 break;
493 }
494 case 3: {
495
496 // calc ID
497 towereta = (eta_index / 6);
498 towerphi = phi_index;
499
500 iCell = (eta_index % 6) + 1;
501
502 if(iCell == 1){ iCell = 1; doenergysplit = false; }
503 else if( iCell == 2 ){ iCell = 1; doenergysplit = true; }
504 else if( iCell == 3 ){ iCell = 2; doenergysplit = false; }
505 else if( iCell == 4 ){ iCell = 3; doenergysplit = false; }
506 else if( iCell == 5 ){ iCell = 3; doenergysplit = true; }
507 else if( iCell == 6 ){ iCell = 4; doenergysplit = false; }
508
509 break;
510
511 // OUTDATED CODE LEFT HERE AS A FRIENDLY REMINDER OF SPECIAL STRUCTURE INCASE A FUTURE ISSUE ARISES======================
512 // Begin Dima---
513 // This is the special region, with 6 supercells per tower
514 // Idea here is to divide 2 out of 6 by 2 and add half ET to each of 2 "normal" SC
515 //iETower = (eta_index / 6) + 18;
516
517 // These are the cells we will split
518 //if (eta_index % 3 == 1) {
519 //iCell = (eta_index % 6 < 3 ? 0 : 2);
520 //iCell2 = iCell + 1;
521 //} else {
522 // These ones just need assigning to the correct location
523 // So that 0, 2, 3, 5 => 0, 1, 2, 3
524 //iCell = (eta_index % 6) / 1.45;
525 //}
526 // end DIMA---
527 // ======================================================================================================================
528 }
529 case 4: {
530
531 towereta = (eta_index / 4);
532 towerphi = phi_index;
533
534 iCell = (eta_index % 4) + 1;
535 break;
536 }
537 case 5: {
538
539 towereta = eta_index ;
540 towerphi = phi_index;
541
542 iCell = 1;
543 break;
544 }
545 default: {
546 // This should never fire because we don't go beyond 2.5
547 ATH_MSG_DEBUG("CaloSampling::EME1 -> invalid 'region' value: " << region << " (Under investigation) ");
548 break;
549 }
550 break;
551 }
552
553 if(region != 0){
554 if(pos_neg < 0){ towerID_Modifier = 500000; }
555 else if(pos_neg > 0){ towerID_Modifier = 600000; }
556 }
557 else if(region == 0){
558 // TRANSITION REGION TREATMENT!
559 if(pos_neg < 0){ towerID_Modifier = 300000; }
560 else if(pos_neg > 0){ towerID_Modifier = 400000; }
561 }
562
563 break;
564 }
565 case CaloSampling::EME2: {
566
567 // Layer 2 of the EM End-Cap. Supercells very frequently change in size.
568 // Region 0 has 1 supercell in 1.375 < eta < 1.425, and 64 supercells in phi. Supercells are 0.05 x 0.1.
569 // Region 0 also has 3 supercells in 1.425 < eta < 1.5, and 64 supercells in phi. Supercells are 0.025 x 0.1
570 // Region 1 has 12 supercells in 1.5 < eta < 1.8, and 64 supercells in phi. Supercells are 0.025 x 0.1.
571 // Region 2 has 8 supercells in 1.8 < eta < 2.0, and 64 supercells in phi. Supercells are 0.025 x 0.1.
572 // Region 3 has 16 supercells in 2.0 < eta < 2.4, and 64 supercells in phi. Supercells are 0.025 x 0.1.
573 // Region 4 has 4 supercells in 2.4 < eta < 2.5, and 64 supercells in phi. Supercells are 0.025 x 0.1.
574 // Region 5 has 3 supercells in 2.5 < eta < 3.1, and 32 supercells in phi. Supercells are 0.2 x 0.2.
575 // Region 6 has 1 supercell in 3.1 < eta < 3.2, and 32 supercells in phi. Supercells are 0.1 x 0.2
576
577 layer = 2;
578
579 switch (region) {
580 case 0: { // special treatment for TRANSITON region
581
582 layer = 3; // change layer label for ET threshold treatment since we are treating this as a layer3 cell - it's an extreme special case cell as part of the transition region
583
584 towereta = eta_index;
585 towerphi = phi_index;
586
587 iCell = 9;
588
589 break;
590 }
591 case 1: {
592
593 towereta = (eta_index / 4);
594 towerphi = phi_index;
595
596 iCell = (eta_index % 4) + 5;
597
598 break;
599 }
600 default: {
601 ATH_MSG_DEBUG("CaloSampling::EME2 -> invalid 'region' value: " << region << " (Under investigation) ");
602 break;
603 }
604 break;
605 }
606
607 if(region == 0){
608 // TRANSITION REGION TREATMENT!
609 if(pos_neg < 0){ towerID_Modifier = 300000; }
610 else if(pos_neg > 0){ towerID_Modifier = 400000; }
611 }
612 else {
613 if( (eta_index / 4) < 15 ){
614 if(pos_neg < 0){ towerID_Modifier = 300000; }
615 else if(pos_neg > 0){ towerID_Modifier = 400000; }
616 }
617 else{
618 if(pos_neg < 0){ towerID_Modifier = 500000; }
619 else if(pos_neg > 0){ towerID_Modifier = 600000; }
620 }
621 }
622
623 break;
624 }
625 case CaloSampling::EME3: {
626
627 // Layer 3 of the EM End-Cap. Supercells are 0.1 x 0.1 unless stated otherwise.
628 // Region 0 does not exist.
629 // Region 1 has 3 supercells in 1.5 < eta < 1.8, and 64 supercells in phi. Supercells are 0.1 x 0.1.
630 // Region 2 has 2 supercells in 1.8 < eta < 2.0, and 64 supercells in phi. Supercells are 0.1 x 0.1.
631 // Region 3 has 4 supercells in 2.0 < eta < 2.4, and 64 supercells in phi. Supercells are 0.1 x 0.1.
632 // Region 4 has 1 supercells in 2.4 < eta < 2.5, and 64 supercells in phi. Supercells are 0.1 x 0.1.
633 // No other Regions exist
634
635 layer = 3; // By definition
636
637 switch (region) {
638 case 0: {
639
640 towereta = eta_index;
641 towerphi = phi_index;
642
643 iCell = 9; // By definition
644
645 break;
646 }
647 default: {
648 ATH_MSG_DEBUG("CaloSampling::EME3 -> invalid 'region' value: " << region << " (Under investigation) ");
649 break;
650 }
651 break;
652 }
653
654 if(pos_neg < 0){ towerID_Modifier = 500000; }
655 else if(pos_neg > 0){ towerID_Modifier = 600000; }
656
657 break;
658 }
659 // Hadronic End-cap (HEC)
660 case CaloSampling::HEC0:
661 case CaloSampling::HEC1:
662 case CaloSampling::HEC2:
663 case CaloSampling::HEC3: {
664
665 // All Layers of the Hadronic End-Cap.
666 // Region 0 has 10 supercells in 1.5 < eta < 2.5, and 32 supercells in phi. Supercells are 0.1 x 0.1.
667 // Region 1 has 4 supercells in 2.5 < eta < 3.3, and 16 supercells in phi. Supercells are 0.2 x 0.2.
668
669 switch(region){
670 case 0: {
671
672 towereta = eta_index;
673 towerphi = phi_index;
674
675 layer = 4; // By definition
676
677 switch (sample){ // only one supercell per layer in all regions for HECX
678 case CaloSampling::HEC0: { iCell = 10; break; }
679 case CaloSampling::HEC1: { iCell = 11; break; }
680 case CaloSampling::HEC2: { iCell = 12; break; }
681 case CaloSampling::HEC3: { iCell = 13; break; }
682 default: {
683 ATH_MSG_DEBUG("CaloSampling::HECX -> invalid sample for assigning iCell value! " << sample << " (Under investigation) ");
684 break;
685 }
686 }
687 break;
688
689 }
690 case 1: {
691 validcell = false; // any region 1 HEC cells are actually with eta > 2.5
692 //ATH_MSG_DEBUG("CaloSampling::HECX Region 1 invalid as outside of eta range!");
693 break;
694 }
695 default: { break; }
696 }
697
698 // Tower connection
699 if(pos_neg < 0){ towerID_Modifier = 500000; }
700 else if(pos_neg > 0){ towerID_Modifier = 600000; }
701
702 break;
703 }
704 case CaloSampling::TileBar0:
705 case CaloSampling::TileBar1:
706 case CaloSampling::TileBar2: {
707 REPORT_MESSAGE_WITH_CONTEXT (MSG::DEBUG, "eSuperCellTowerMapper") << "Supercell is from Tile Barrel - it will be ignored.";
708 validcell = false;
709 //ATH_MSG_DEBUG("\n==== eSuperCellTowerMapper ============ Supercell is from Tile Barrel - it will be ignored.");
710 break;
711 }
712 case CaloSampling::TileGap1:
713 case CaloSampling::TileGap2:
714 case CaloSampling::TileGap3: {
715 //ATH_MSG_DEBUG("\n==== eSuperCellTowerMapper ============ Supercell is from Tile Gap (ITC and scintillator) - it will be ignored.");
716 validcell = false;
717 break;
718 }
719 case CaloSampling::TileExt0:
720 case CaloSampling::TileExt1:
721 case CaloSampling::TileExt2: {
722 //ATH_MSG_DEBUG("\n==== eSuperCellTowerMapper ============ Supercell is from Tile Extended Barrel - it will be ignored.");
723 validcell = false;
724 break;
725 }
726 case CaloSampling::FCAL0:
727 case CaloSampling::FCAL1:
728 case CaloSampling::FCAL2: {
729 //ATH_MSG_DEBUG("\n==== eSuperCellTowerMapper ============ Supercell is from Forward EM endcap - it will be ignored.");
730 validcell = false;
731 break;
732 }
733 case CaloSampling::MINIFCAL0:
734 case CaloSampling::MINIFCAL1:
735 case CaloSampling::MINIFCAL2:
736 case CaloSampling::MINIFCAL3: {
737 //ATH_MSG_DEBUG("\n==== eSuperCellTowerMapper ============ Supercells is from MiniFCAL - it will be ignored.");
738 validcell = false;
739 break;
740 }
741 case CaloSampling::Unknown: {
742 //ATH_MSG_WARNING("\n==== eSuperCellTowerMapper ============ Supercell sampling is officially unknown - it will be ignored. (Needs investigation). Please report this!");
743 validcell = false;
744 break;
745 }
746 default: {
747 ATH_MSG_DEBUG("\n==== eSuperCellTowerMapper ============ Supercell has invalid CaloSampling value: " << sample << " (Needs investigation). Please report this!");
748 validcell = false;
749 break;
750 }
751 }
752
753 if(validcell){
754 iETower = FindTowerIDForSuperCell(towereta, towerphi) + towerID_Modifier;
755
756 // Identify eTowers at eta < 0 and re-order layer 1/2 cells manually
757 // Algorithms want order to be increasing eta, not increasing |eta|
758 if (iETower < 200000 || (iETower > 300000 && iETower < 400000) || (iETower > 500000 && iETower < 600000)) {
759 if (layer == 1) {
760 iCell = 5 - iCell;
761 if (doenergysplit) iCell -= 1; // Need special treatment here because of way energy splitting works
762 } else if (layer == 2) {
763 iCell = 13 - iCell;
764 }
765 }
766
767 // Only one layer-1 cell in the region 2.4 < |eta| < 2.5. Set the slot to zero to match the behaviour of the firmware.
768 int etaIndex = (iETower%100000)/64;
769 if (iETower > 500000 && etaIndex == 24 && iCell < 5) iCell = 0; // Map final layer 1 cell into layer 0 slot
770
771 if(doPrint){
772 PrintCellSpec(sample, layer, region, eta_index, phi_index, pos_neg, iETower, iCell, prov, ID, doenergysplit);
773 }
774 ConnectSuperCellToTower( my_eTowerContainerRaw, iETower, ID, iCell, et, layer, doenergysplit);
775 }
776
777 // END ITERATING OVER SUPER CELLS+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++
778
779 return 1;
780
781 }
782
783int eSuperCellTowerMapper::FindTowerIDForSuperCell(int towereta, int towerphi) const
784{
785 return (towerphi + (64 * towereta));
786}
787
788 void eSuperCellTowerMapper::PrintCellSpec(const CaloSampling::CaloSample sample, int layer, const int region, const int eta_index, const int phi_index, const int pos_neg, int iETower, int iCell, int prov, Identifier ID ,bool doenergysplit)
789const {
790
791 std::string sampleName = "";
792
793 switch (sample) {
794 case CaloSampling::PreSamplerB: { sampleName = "PreSamplerB"; break; }
795 case CaloSampling::EMB1: { sampleName = "EMB1"; break; }
796 case CaloSampling::EMB2: { sampleName = "EMB2"; break; }
797 case CaloSampling::EMB3: { sampleName = "EMB3"; break; }
798 case CaloSampling::PreSamplerE: { sampleName = "PreSamplerE"; break; }
799 case CaloSampling::EME1: { sampleName = "EME1"; break; }
800 case CaloSampling::EME2: { sampleName = "EME2"; break; }
801 case CaloSampling::EME3: { sampleName = "EME3"; break; }
802 case CaloSampling::HEC0: { sampleName = "HEC0"; break; }
803 case CaloSampling::HEC1: { sampleName = "HEC1"; break; }
804 case CaloSampling::HEC2: { sampleName = "HEC2"; break; }
805 case CaloSampling::HEC3: { sampleName = "HEC3"; break; }
806 default: {
807 ATH_MSG_DEBUG("\n==== eSuperCellTowerMapper ============ Supercell has invalid CaloSampling value: " << sample << " (Needs investigation). Please report this!");
808 break;
809 }
810 }
811
812 ATH_MSG_DEBUG("ASSIGNED CELL::: CASE: " << sampleName
813 << "\tSample: " << sample
814 << "\tLayer: " << layer
815 << "\tRegion: " << region
816 << "\tEta_Index: " << eta_index
817 << "\tPhi_Index: " << phi_index
818 << "\tPosNeg: " << pos_neg
819 << "\tiETower: " << iETower
820 << "\tiCell: " << iCell
821 << "\tDoEnergySplit: " << doenergysplit
822 << "\tProvenance: " << prov
823 << "\tID: " << ID
824 << " ");
825
826 return;
827}
828
830 std::string sampleName ="";
831 switch (sample) {
832 case CaloSampling::PreSamplerB: { sampleName = "PreSamplerB"; break; }
833 case CaloSampling::EMB1: { sampleName = "EMB1"; break; }
834 case CaloSampling::EMB2: { sampleName = "EMB2"; break; }
835 case CaloSampling::EMB3: { sampleName = "EMB3"; break; }
836 case CaloSampling::PreSamplerE: { sampleName = "PreSamplerE"; break; }
837 case CaloSampling::EME1: { sampleName = "EME1"; break; }
838 case CaloSampling::EME2: { sampleName = "EME2"; break; }
839 case CaloSampling::EME3: { sampleName = "EME3"; break; }
840 case CaloSampling::HEC0: { sampleName = "HEC0"; break; }
841 case CaloSampling::HEC1: { sampleName = "HEC1"; break; }
842 case CaloSampling::HEC2: { sampleName = "HEC2"; break; }
843 case CaloSampling::HEC3: { sampleName = "HEC3"; break; }
844 case CaloSampling::FCAL0: { sampleName = "FCAL0"; break; }
845 case CaloSampling::FCAL1: { sampleName = "FCAL1"; break; }
846 case CaloSampling::FCAL2: { sampleName = "FCAL2"; break; }
847 default: {
848 ATH_MSG_DEBUG("\n==== jSuperCellTowerMapper ============ Supercell has invalid CaloSampling value: " << sample << " (Needs investigation). Please report this!");
849 sampleName = "----";
850 break;
851 }
852 }
853 return sampleName;
854}
855
856} // end of LVL1 namespace
#define M_PI
Scalar eta() const
pseudorapidity method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
std::vector< Identifier > ID
Helpers for checking error return status codes and reporting errors.
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
const ServiceHandle< StoreGateSvc > & detStore() const
Helper base class for offline cell identifiers.
int phi(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
int region(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
int pos_neg(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
int eta(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
virtual StatusCode AssignSuperCellsToTowers(std::unique_ptr< eTowerContainer > &my_eTowerContainerRaw) const override
std::string DectectorName(const CaloSampling::CaloSample sample) const
virtual void ConnectSuperCellToTower(std::unique_ptr< eTowerContainer > &my_eTowerContainerRaw, int iETower, Identifier ID, int iCell, float et, int layer, bool doenergysplit) const override
ToolHandle< eFEXSuperCellTowerIdProvider > m_eFEXSuperCellTowerIdProviderTool
virtual int FindAndConnectTower(std::unique_ptr< eTowerContainer > &my_eTowerContainerRaw, CaloSampling::CaloSample sample, const int region, int layer, const int pos_neg, const int eta_index, const int phi_index, Identifier ID, float et, int prov, bool doPrint) const override
SG::ReadHandleKey< CaloCellContainer > m_scellsCollectionSGKey
SG::ReadHandleKey< xAOD::TriggerTowerContainer > m_triggerTowerCollectionSGKey
virtual StatusCode initialize() override
standard Athena-Algorithm method
virtual void PrintCellSpec(const CaloSampling::CaloSample sample, int layer, const int region, const int eta_index, const int phi_index, const int pos_neg, int iETower, int iCell, int prov, Identifier ID, bool doenergysplit) const override
eSuperCellTowerMapper(const std::string &type, const std::string &name, const IInterface *parent)
virtual StatusCode AssignTriggerTowerMapper(std::unique_ptr< eTowerContainer > &my_eTowerContainerRaw) const override
virtual int FindTowerIDForSuperCell(int towereta, int towerphi) const override
virtual void reset() const override
The eTower class is an interface object for eFEX trigger algorithms The purposes are twofold:
Definition eTower.h:38
float getET_float(unsigned int layer, int cell=0) const
Get ET of a specified cell in MeV FLOAT VERSION.
Definition eTower.cxx:183
void setET(int cell, float et, int layer, bool ignoreDisable=false)
Definition eTower.cxx:99
void setSCID(Identifier ID, int cell, float et, int layer, bool doenergysplit)
Set supercell position ID.
Definition eTower.cxx:110
virtual bool isValid() override final
Can the handle be successfully dereferenced?
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Extra patterns decribing particle interation process.