ATLAS Offline Software
Loading...
Searching...
No Matches
jSuperCellTowerMapper.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6
9
10
11// This is a class which is designed to receive in a list of supercells and a list of jTowers and match them together appropriately.
12
13
14/* 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?
15
16LOOK HERE!: athena/Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.def
17
18*/
19
20
21namespace LVL1 {
22
23jSuperCellTowerMapper::jSuperCellTowerMapper(const std::string& type,const std::string& name,const IInterface* parent):
24 AthAlgTool(type,name,parent)
25{
26 declareInterface<IjSuperCellTowerMapper>(this);
27
28}
29
34
36{
37
38 ATH_CHECK( m_scellsCollectionSGKey.initialize() );
40
41 return StatusCode::SUCCESS;
42
43}
44
45StatusCode jSuperCellTowerMapper::AssignTriggerTowerMapper(std::unique_ptr<jTowerContainer> & my_jTowerContainerRaw) const {
46
47 static constexpr float pi_over_32 = M_PI/32;
48
50 if(!triggerTowerCollection.isValid()) {
51 ATH_MSG_ERROR("Could not retrieve collection " << m_triggerTowerCollectionSGKey.key() );
52 return StatusCode::FAILURE;
53 }
54 for(auto eachTower : *triggerTowerCollection) {
55 if(std::fabs(eachTower->eta())<1.5 && eachTower->sampling()==1) {
56 int i_phi = static_cast<int>(eachTower->phi()/pi_over_32);
57 int etaSign{-1};
58 int towerID_Modifier{100000};
59 if (eachTower->eta() > 0) {
60 etaSign = 1;
61 towerID_Modifier = 200000;
62 }
63 int i_eta = static_cast<int>(eachTower->eta() * 10) * etaSign;
64 if(i_eta * etaSign == -14) {
65 towerID_Modifier = 300000;
66 } else if (i_eta * etaSign == 14) {
67 towerID_Modifier = 400000;
68 }
69
70 int towerid = FindTowerIDForSuperCell(i_eta, i_phi) + towerID_Modifier;
71 LVL1::jTower * targetTower;
72 if((targetTower = my_jTowerContainerRaw->findTower(towerid))) {
73 if (targetTower->getET_float(1, 0) > 0) {
74 ATH_MSG_WARNING("\n==== jSuperCellTowerMapper ============ Hadronic layer energy filled more than once - it will be ignored. (Needs investigation). Please report this!");
75 }
76
77 targetTower->set_TileCal_Et(1, static_cast<int>(eachTower->cpET()) * 500.); // cf 500.0
78 } else {
79 ATH_MSG_WARNING("\n==== jSuperCellTowerMapper ============ Tower ID is officially unknown - it will be ignored. (Needs investigation). Please report this!");
80 }
81 }
82 }
83 return StatusCode::SUCCESS;
84}
85
86
87 // works for real supercells from MC
88 StatusCode jSuperCellTowerMapper::AssignSuperCellsToTowers(std::unique_ptr<jTowerContainer> & my_jTowerContainerRaw) const
89{
90
91 bool doPrint = false;
92
94 if(!scellsCollection.isValid()) {
95 ATH_MSG_ERROR("Could not retrieve collection " << m_scellsCollectionSGKey.key() );
96 return StatusCode::FAILURE;
97 }
98
99 //const CaloCell_Base_ID* idHelper = caloIdManager->getCaloCell_SuperCell_ID(); // getting the id helper class
100 const CaloCell_Base_ID* idHelper = nullptr;
101 ATH_CHECK( detStore()->retrieve (idHelper, "CaloCell_SuperCell_ID") );
102
103 for (const CaloCell* cell : * scellsCollection) {
104
105 const CaloSampling::CaloSample sample = (cell)->caloDDE()->getSampling(); // corresponds 'module' for FCAL/MiniFCAL
106 const Identifier ID = (cell)->ID(); // super cell unique ID
107 int region = idHelper->region(ID); // no region for FCAL, is 'depth' for MiniFCAL
108 int layer = -1;
109 int pos_neg = idHelper->pos_neg(ID); // corresponds to 'barrel_ec' for LArEM
110 int eta_index = idHelper->eta(ID);
111 const int phi_index = idHelper->phi(ID);
112 float et = (cell)->energy()/cosh((cell)->eta());
113 int prov = (cell)->provenance();
114
115
116 float eta_min = 0.0;//idHelper->eta_min(ID);
117 float eta_max = idHelper->eta_max(ID);
118 float eta0 = idHelper->eta0(ID);
119 float phi_min = 0.0;//idHelper->phi_min(ID);
120 float phi_max = idHelper->phi_max(ID);
121 float phi0 = idHelper->phi0(ID);
122
123 /*
124 CaloSampling:
125 PreSamplerB 0 (LAr Barrel)
126 EMB1 1
127 EMB2 2
128 EMB3 3
129
130 PreSamplerE 4 (LAr EM Endcap)
131 EME1 5
132 EME2 6
133 EME3 7
134
135 HEC0 8 (Hadronic Endcap)
136 HEC1 9
137 HEC2 10
138 HEC3 11
139
140 TileBar0 12 (Tile Barrel)
141 TileBar1 13
142 TileBar2 14
143
144 TileGap1 15 (ITC and Scintillator)
145 TileGap2 16
146 TileGap3 17
147
148 TileExt0 18 (Tile Extended Barrel)
149 TileExt1 19
150 TileExt2 20
151
152 FCAL0 21 (Forward EM Endcap)
153 FCAL1 22
154 FCAL2 23
155
156 MINIFCAL0 24
157 MINIFCAL1 25
158 MINIFCAL2 26
159 MINIFCAL3 27
160
161 Unknown 28
162 */
163
164 //We need NOT to explicitly avoid +/- 3 pos_neg supercells! These go beyond |eta| == 2.5 - we WANT these for the jFEX!
165 //PrintCellSpec(sample, layer, region, eta_index, phi_index, pos_neg, -999/*iJTower*/, -999/*iCell*/, prov, ID, false, eta_min, eta_max, eta0, phi_min, phi_max, phi0);
166 //if(std::abs(pos_neg) == 3){ /*continue;*/ } //PrintCellSpec(sample, layer, region, eta_index, phi_index, pos_neg, -999/*iJTower*/, -999/*iCell*/, prov, ID, false, eta_min, eta_max, eta0, phi_min, phi_max, phi0); continue; }
167
168 // 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)
169 switch(sample) {
170 case CaloSampling::PreSamplerB: {
171 break;
172 }
173 case CaloSampling::EMB1: {
174 if(region == 1) {
175 eta_index += 56;
176 }
177 break;
178 }
179 case CaloSampling::EMB2: {
180 if(region == 1) {
181 eta_index += 56;
182 }
183 break;
184 }
185 case CaloSampling::EMB3: {
186 break;
187 }
188 case CaloSampling::PreSamplerE: {
189 eta_index += 15;
190 break;
191 }
192 case CaloSampling::EME1: {
193 if(region == 0) {
194 eta_index += 14;
195 }
196 else if (region == 1) { /* doesn't exist */ }
197 else if (region == 2) {
198 eta_index += 60;
199 }
200 else if (region == 3) {
201 eta_index += 108; //6 supercell region
202 }
203 else if (region == 4) {
204 eta_index += 80;
205 }
206 else if (region == 5) {
207 eta_index += 24;
208 }
209 break;
210 }
211 case CaloSampling::EME2: {
212 if(region == 0) {
213 if(eta0 < 2.5) {
214 eta_index += 14;
215 }
216 else {
217 eta_index += 25;
218 }
219 }
220 else if (region == 1) {
221 if(eta0 < 2.5) {
222 eta_index += 57;
223 }
224 else {
225 eta_index += 28;
226 }
227 }
228 break;
229 }
230 case CaloSampling::EME3: {
231 if(region == 0) {
232 if(/*eta0 < 2.5*/ phi_max == 63) {
233 //if(eta0 < 2.5) {
234 eta_index += 15; // We should use eta0 here but the MC information is bugged for EME3 positive-side supercells
235 }
236 else {
237 eta_index += 25;
238 }
239 }
240 else if (region == 1) {
241 if(/*eta0 < 2.5*/ phi_max == 63) {
242 //if(eta0 < 2.5) {
243 eta_index += 15; // We should use eta0 here but the MC information is bugged for EME3 positive-side supercells
244 }
245 else {
246 eta_index += 28;
247 }
248 }
249 break;
250 }
251 case CaloSampling::HEC0:
252 case CaloSampling::HEC1:
253 case CaloSampling::HEC2:
254 case CaloSampling::HEC3: {
255 if(region == 0){
256 eta_index += 15;
257 }
258 else if (region == 1){ // to push these supercells to 2.5 and above
259 eta_index += 25;
260 }
261 break;
262 }
263 default: {
264 /*ATH_MSG_DEBUG("Not doing anything since sample = " << sample);*/ break;
265 }
266 }
267
268
269 FindAndConnectTower(my_jTowerContainerRaw,sample,region,layer,pos_neg,eta_index,phi_index,ID,et,prov,doPrint, eta_min, eta_max, eta0, phi_min, phi_max, phi0);
270
271 }
272
273 //multi linear digitisation encoding after filling all TT with the corresponding SC
274 for(auto tmpTower : *my_jTowerContainerRaw){
275 tmpTower->Do_LAr_encoding();
276 }
277
278 return StatusCode::SUCCESS;
279
280}
281
282
283void jSuperCellTowerMapper::ConnectSuperCellToTower(std::unique_ptr<jTowerContainer> & my_jTowerContainerRaw,int iJTower, Identifier ID, int iCell, float et, int layer) const {
284
285 LVL1::jTower * tmpTower = my_jTowerContainerRaw->findTower(iJTower);
286 if(tmpTower){
287 tmpTower->set_LAr_Et(ID,iCell,et,layer);
288 }
289
290}
291
292int jSuperCellTowerMapper::FindAndConnectTower(std::unique_ptr<jTowerContainer> & my_jTowerContainerRaw,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, float eta_min, float eta_max, float eta0, float phi_min, float phi_max, float phi0) const
293{
294
295 // bool for the special case of 1.8 < eta < 2.0 only in the front layer
296 bool doenergysplit = false;
297
298 // bool as a flag to enable or disable the connection of supercells to towers according to their location and identities
299 bool validcell = true;
300
301 // We tell the jTower which supercell unique ID is in each of it's available 'slots'
302 int towereta = -99; // to be filled with tower eta value to help find it
303 int towerphi = -99; // to be filled with tower phi value to help find it
304 int iJTower = -99; // The tower ID which the supercell will be assigned to
305 int iCell = -1; // The position within the Tower that the supercell will be assigned to
306 int towerID_Modifier = -999999999; // adjustable tower ID modifier to fit tower Id scheme
307
308 /*
309 ** iCell Numbering Scheme **
310
311 Let's use the following scheme (from low to high eta regardless of detector side):
312 Layer 0: Cell 0 (Anything EM related)
313 Layer 1: Cell 1 (HEC or TILE, if we have them!)
314 */
315
316
317 /*
318 ** Structure of the EMB in Supercells **
319
320 0 < 1.4 in steps of 0.1 == 14 towers
321 1.4 < 1.52 in steps of 0.12 ==> THIS TOWER IS MOVED TO TRANS TOWER REGION
322 14 towers total (all by presampler)
323 64 towers in phi in total
324
325 896 towers in EMB per side
326 1792 towers in EMB total
327 */
328
329 /*
330 ** Structure of the TRANS in Supercells **
331
332 1.4 < 1.5, 1 special tower made from EMB and EME supercells together
333 1 tower in eta
334 64 towers in phi
335
336 64 towers in TRANS total
337 */
338
339 /*
340 ** Structure of the EMEC in Supercells **
341
342 1.375 < 1.5, funny behaviour, treated as 1 special tower ==> 1 tower === TRANSITION TOWER NOW!
343 1.5 < 1.8 standard towers by presampler ==> 3 towers
344 1.8 < 2.0 standard towers by back ==> 2 towers
345 2.0 < 2.4 standard towers by back ==> 4 towers
346 2.4 < 2.5 standard tower by back ==> 1 tower
347 2.5 < 3.1, funny behaviour, treated as 3 wide towers ==> 3 towers. Also wide in phi!
348 3.1 < 3.2 standard tower by back ==> 1 tower. Also wide in phi!
349 10 towers in eta in total (by different means) (IGNORING ABOVE |ETA| > 2.5)
350 64 towers initially in phi (IGNORING ABOVE |ETA| > 2.5)
351
352 640 towers in EME per side
353 1280 towers in EME total
354 */
355
356
357 /*
358 ** Structure of the HEC in Supercells **
359
360 1.5 - 2.5, [Region 0] standard towers by presampler ==> layer on top of existing towers
361
362 */
363
364 /*
365 ** Notes on overall structure **
366 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!
367 */
368
369 /*
370 ** Notes on Tower ID Number Scheme **
371
372 Left Barrel IETower = 100000 + X;
373 Right Barrel IETower = 200000 + X;
374 Left TRANS IETower = 300000 + X;
375 Right TRANS IETower = 400000 + X;
376 Left Endcap IETower = 500000 + X;
377 Right Endcap IETower = 600000 + X;
378 Left FCAL IETower = 700000 + X;
379 Right FCAL IETower = 800000 + X;
380 Left Hadronic Endcap IETower = 11100000 + X --> These are just Layer 5 of Endcap Towers. They will never be generated as standalone jTowers.
381 Right Hadronic Endcap IETower = 22200000 + X --> These are just Layer 5 of Endcap Towers. They will never be generated as standalone jTowers.
382
383 */
384
385
386 //----------------------------------------------------------
387
388 // Begin assigning supercells to Towers
389
390 //----------------------------------------------------------
391
392 switch (sample) {
393 // E.M. Barrel (EMB)
394 case CaloSampling::PreSamplerB: { // DONE
395 // Presampler of the EMBarrel. Supercells are 0.1 x 0.1 unless stated otherwise
396 // Region 0 has 14 supercells in 0 < eta < 1.4 and 64 supercells in phi.
397 // 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.
398
399 layer = 0; // By definition for jFEX
400
401 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
402 towerphi = phi_index; // phi is standard also
403
404 if(eta_index == 14) { // special treatment for TRANSITION tower
405 if(pos_neg < 0) {
406 towerID_Modifier = 300000;
407 }
408 else if(pos_neg > 0) {
409 towerID_Modifier = 400000;
410 }
411 iCell = 0; // By definition for jFEX
412 }
413 else { // standard treatment for non-transition towers
414 if(pos_neg < 0) {
415 towerID_Modifier = 100000;
416 }
417 else if(pos_neg > 0) {
418 towerID_Modifier = 200000;
419 }
420 iCell = 0; // By definition for jFEX
421 }
422
423 break;
424 }
425 case CaloSampling::EMB1:
426 case CaloSampling::EMB2: {
427 // Layer 1 of the EMBarrel. Supercells are 0.025 x 0.1 unless stated otherwise
428 // Region 0 has 56 supercells in 0 < eta < 1.4 and 64 supercells in phi.
429 // Region 1 has 3 supercells in 1.4 < eta < 1.475 and 64 supercells in phi.
430
431 // Layer 2 of the EMBarrel. Supercells are 0.025 x 0.1 unless stated otherwise
432 // Region 0 has 56 supercells in 0 < eta < 1.4 and 64 supercells in phi.
433 // Region 1 has 1 supercells (0.075 x 0.1) in 1.4 < eta < 1.475 and 64 supercells in phi.
434
435 if (region == 0) {
436 towereta = eta_index / 4; // this divides integers by 4 and truncates away the decimals (rounds DOWN to an integer)
437 towerphi = phi_index;
438 if(pos_neg < 0) {
439 towerID_Modifier = 100000;
440 }
441 else if(pos_neg > 0) {
442 towerID_Modifier = 200000;
443 }
444 }
445 else if (region == 1) {
446 towereta = 14; // hardcoded but is correct
447 towerphi = phi_index;
448 if(pos_neg < 0) {
449 towerID_Modifier = 300000;
450 }
451 else if(pos_neg > 0) {
452 towerID_Modifier = 400000;
453 }
454 }
455 else {
456 ATH_MSG_DEBUG("[CaloSampling::EMB1 or CaloSampling::EMB2] -> invalid 'region' value: " << region << " (Under investigation) ");
457 }
458
459 switch(sample) {
460 case CaloSampling::EMB1: {
461 iCell = 0; // By definition for jFEX
462 layer = 0; // By definition for jFEX
463 break;
464 }
465 case CaloSampling::EMB2: {
466 //if (region == 0) { iCell = (eta_index % 4) + 5; }
467 //else if (region == 1){ iCell = 5; }
468 iCell = 0; // By definition for jFEX
469 layer = 0; // By definition for jFEX
470 break;
471 }
472 default: {
473 ATH_MSG_DEBUG("CaloSampling::EMBX -> invalid sample for assigning iCell value! " << sample << " (Under investigation) ");
474 break;
475 }
476 }
477
478 break;
479 }
480 case CaloSampling::EMB3: {
481 // Layer 3 of the EMBarrel. Supercells are 0.1 x 0.1 unless stated otherwise
482 // Region 0 has 14 supercells in 0 < eta < 1.4 and 64 supercells in phi.
483 // Region 1 does not exist
484
485 layer = 0; // By definition for jFEX
486 towereta = eta_index; // Analogous to PreSamplerB
487 towerphi = phi_index;
488
489 iCell = 0; // By definition for jFEX
490
491 if(pos_neg < 0) {
492 towerID_Modifier = 100000;
493 }
494 else if(pos_neg > 0) {
495 towerID_Modifier = 200000;
496 }
497
498 break;
499 }
500 // E.M. End-cap (EMEC)
501 case CaloSampling::PreSamplerE: {
502 // Region 1 has 3 supercells in 1.5 < eta < 1.8, and 64 supercells in phi.
503 // Supercells are 0.1 x 0.1.
504
505 layer = 0; // By definition for jFEX
506
507 towereta = eta_index;
508 towerphi = phi_index;
509
510 iCell = 0; // By definition for jFEX
511
512 if(pos_neg < 0) {
513 towerID_Modifier = 500000;
514 }
515 else if(pos_neg > 0) {
516 towerID_Modifier = 600000;
517 }
518
519 break;
520 }
521 case CaloSampling::EME1: {
522 // Layer 1 of the EM End-Cap. Supercells very frequently change in size.
523 // Region 0 has 1 supercell in 1.375 < eta < 1.5, and 64 supercells in phi. Supercells are 0.125 x 0.1.
524 // Region 1 has 12 supercells in 1.5 < eta < 1.8, and 64 supercells in phi. Supercells are 0.025 x 0.1.
525 // 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.
526 // Region 3 has 16 supercells in 2.0 < eta < 2.4, and 64 supercells in phi. Supercells are 0.025 x 0.1.
527 // Region 4 has 1 supercell in 2.4 < eta < 2.5, and 64 supercells in phi. Supercells are 0.1 x 0.1.
528 // Region 5 has 3 supercells in 2.5 < eta < 3.1, and 32 supercells in phi. Supercells are 0.2 x 0.2.
529 // Region 6 has 1 supercell in 3.1 < eta < 3.2, and 32 supercells in phi. Supercells are 0.1 x 0.2
530
531 // 1.375 < 1.5, funny behaviour, treated as 1 special tower ==> 1 tower
532 // 1.5 < 1.8 standard towers by presampler ==> 3 towers
533 // 1.8 < 2.0 standard towers by back ==> 2 towers
534 // 2.0 < 2.4 standard towers by back ==> 4 towers
535 // 2.4 < 2.5 standard tower by back ==> 1 tower
536 // 2.5 < 3.1, funny behaviour, treated as 3 wide towers ==> 3 towers
537 // 3.1 < 3.2, funny behaviour, treated as 1 tower ==> 1 tower
538 // 15 towers in total (by different means)
539
540 layer = 0; // By definition for jFEX
541
542 switch (region) {
543 case 0: { // special treatment for transition region
544
545 towereta = eta_index;
546 towerphi = phi_index;
547
548 iCell = 0; // By definition for jFEX
549 break;
550 }
551 case 2: {
552
553 towereta = (eta_index / 4);
554 towerphi = phi_index;
555
556 //iCell = (eta_index % 4) + 1;
557 iCell = 0; // By definition for jFEX
558 break;
559 }
560 case 3: {
561
562 // calc ID
563 towereta = (eta_index / 6);
564 towerphi = phi_index;
565
566 //iCell = (eta_index % 6) + 1;
567 iCell = 0; // By definition for jFEX
568
569 /*
570 if(iCell == 1){ iCell = 1; doenergysplit = false; }
571 else if( iCell == 2 ){ iCell = 1; doenergysplit = true; }
572 else if( iCell == 3 ){ iCell = 2; doenergysplit = false; }
573 else if( iCell == 4 ){ iCell = 3; doenergysplit = false; }
574 else if( iCell == 5 ){ iCell = 3; doenergysplit = true; }
575 else if( iCell == 6 ){ iCell = 4; doenergysplit = false; }
576 */
577
578 break;
579
580 // OUTDATED CODE LEFT HERE AS A FRIENDLY REMINDER OF SPECIAL STRUCTURE INCASE A FUTURE ISSUE ARISES======================
581 // Begin Dima---
582 // This is the special region, with 6 supercells per tower
583 // Idea here is to divide 2 out of 6 by 2 and add half ET to each of 2 "normal" SC
584 //iJTower = (eta_index / 6) + 18;
585
586 // These are the cells we will split
587 //if (eta_index % 3 == 1) {
588 //iCell = (eta_index % 6 < 3 ? 0 : 2);
589 //iCell2 = iCell + 1;
590 //} else {
591 // These ones just need assigning to the correct location
592 // So that 0, 2, 3, 5 => 0, 1, 2, 3
593 //iCell = (eta_index % 6) / 1.45;
594 //}
595 // end DIMA---
596 // ======================================================================================================================
597 }
598 case 4: {
599
600 towereta = (eta_index / 4);
601 towerphi = phi_index;
602
603 //iCell = (eta_index % 4) + 1;
604 iCell = 0; // By definition for jFEX
605 break;
606 }
607 case 5: {
608
609 towereta = eta_index ;
610 towerphi = phi_index;
611
612 //iCell = 1;
613 iCell = 0; // By definition for jFEX
614 break;
615 }
616 default: {
617 ATH_MSG_DEBUG("CaloSampling::EME1 -> invalid 'region' value: " << region << " (Under investigation) ");
618 break;
619 }
620 break;
621 }
622
623 if(region != 0) {
624 if(pos_neg < 0) {
625 towerID_Modifier = 500000;
626 }
627 else if(pos_neg > 0) {
628 towerID_Modifier = 600000;
629 }
630 }
631 else if(region == 0) {
632 // TRANSITION REGION TREATMENT!
633 if(pos_neg < 0) {
634 towerID_Modifier = 300000;
635 }
636 else if(pos_neg > 0) {
637 towerID_Modifier = 400000;
638 }
639 }
640
641 break;
642 }
643 case CaloSampling::EME2: {
644
645 // Layer 2 of the EM End-Cap. Supercells very frequently change in size.
646 // Region 0 has 1 supercell in 1.375 < eta < 1.425, and 64 supercells in phi. Supercells are 0.05 x 0.1.
647 // These are in the MC as Region 0 posneg +-2
648 // Region 1 has 43 supercells in 1.425 < eta < 2.5, and 64 supercells in phi. Supercells are 0.025 x 0.1.
649 // These are all bunched together in the MC as Region 1 posneg +-2
650
651 // Region 0 also has 3 supercells in 2.5 < eta < 3.1, and 32 supercells in phi. Supercells are 0.2 x 0.2.
652 // These are all bunched together in the MC as Region 1 posneg +-3
653 // Region 1 also has 1 supercell in 3.1 < eta < 3.2, and 32 supercells in phi. Supercells are 0.1 x 0.2.
654 // These are in the MC as Region 1 posneg +-3
655
656 // Focusing 20/01/2021 to finding these jFEX cells in the specified ranges - will update this note if they are found and understood.
657 // 20/01/2021: These supercells have been found. Check log file eme2_phi0.log
658 // 20/01/2021: Side note - does this mean we have the structure of EME2 completely wrong in eSuperCellTowerMapper? Need to check... eFEX IMPORTANT
659
660 // from code way up above we have:
661 /*
662 case CaloSampling::EME2: {
663 if(region == 0){ eta_index += 14; }
664 else if (region == 1){ eta_index += 57; }
665 break;
666 }
667 */
668
669 layer = 0; // By definition for jFEX
670
671 switch (region) {
672 case 0: { // special treatment for TRANSITON region
673
674 //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
675 layer = 0; // By definition for jFEX
676
677 switch (std::abs(pos_neg)) {
678 case 2: {
679 towereta = eta_index;
680 towerphi = phi_index;
681 break;
682 }
683 case 3: {
684 towereta = eta_index;
685 towerphi = phi_index;
686 break;
687 }
688 default: {
689 ATH_MSG_DEBUG("CaloSampling::EME2 -> invalid 'pos_neg' value: " << pos_neg << " (Under investigation) ");
690 break;
691 }
692 }
693
694 iCell = 0; // By definition for jFEX since the jTower only has one big EM section
695
696 break;
697 }
698 case 1: {
699
700 switch (std::abs(pos_neg)) {
701 case 2: {
702 towereta = (eta_index / 4);
703 towerphi = phi_index;
704 break;
705 }
706 case 3: {
707 towereta = eta_index;
708 towerphi = phi_index;
709 break;
710 }
711 default: {
712 ATH_MSG_DEBUG("CaloSampling::EME2 -> invalid 'pos_neg' value: " << pos_neg << " (Under investigation) ");
713 break;
714 }
715 }
716
717
718 iCell = 0; // By definition for jFEX since the jTower only has one big EM section
719
720 break;
721 }
722 default: {
723 ATH_MSG_DEBUG("CaloSampling::EME2 -> invalid 'region' value: " << region << " (Under investigation) ");
724 break;
725 }
726 break;
727 }
728
729/* if(region == 0) {
730 // TRANSITION REGION TREATMENT!
731 if(eta0 < 1.5) {
732 //if(eta0 < 2.5) {
733 if(pos_neg < 0) {
734 towerID_Modifier = 300000;
735 }
736 else if(pos_neg > 0) {
737 towerID_Modifier = 400000;
738 }
739 }
740 else {
741 if(pos_neg < 0) {
742 towerID_Modifier = 500000;
743 }
744 else if(pos_neg > 0) {
745 towerID_Modifier = 600000;
746 }
747 }
748 }
749 else {
750 //if( (eta_index / 4) < 15 ){
751 //if(eta0 < 2.5) {
752 if(eta0 < 1.5) {
753 if(pos_neg < 0) {
754 towerID_Modifier = 300000;
755 }
756 else if(pos_neg > 0) {
757 towerID_Modifier = 400000;
758 }
759 }
760 else {
761 if(pos_neg < 0) {
762 towerID_Modifier = 500000;
763 }
764 else if(pos_neg > 0) {
765 towerID_Modifier = 600000;
766 }
767 }
768 }*/
769
770
771 // testing *********************************
772 if(region == 0) {
773 if(eta0 < 2.5) {
774 if(pos_neg < 0) {
775 towerID_Modifier = 300000;
776 }
777 else if(pos_neg > 0) {
778 towerID_Modifier = 400000;
779 }
780 }
781 else {
782 if(pos_neg < 0) {
783 towerID_Modifier = 500000;
784 }
785 else if(pos_neg > 0) {
786 towerID_Modifier = 600000;
787 }
788 }
789 }
790 else {
791 if(eta0 <= 1.5) {
792 if(towereta < 15) {
793 if(pos_neg < 0 && pos_neg > -3) {
794 towerID_Modifier = 300000;
795 }
796 else if(pos_neg > 0 && pos_neg < 3) {
797 towerID_Modifier = 400000;
798 }
799 }
800 else {
801 if(pos_neg < 0 && pos_neg >= -3) {
802 towerID_Modifier = 500000;
803 }
804 else if(pos_neg > 0 && pos_neg <= 3) {
805 towerID_Modifier = 600000;
806 }
807 }
808 }
809 else {
810 if(pos_neg < 0) {
811 towerID_Modifier = 500000;
812 }
813 else if(pos_neg > 0) {
814 towerID_Modifier = 600000;
815 }
816 }
817 }
818 // end of testing *********************************
819
820 break;
821 }
822 case CaloSampling::EME3: {
823
824 // Layer 3 of the EM End-Cap. Supercells are 0.1 x 0.1 unless stated otherwise.
825 // Region 0 does not exist. - FALSE!
826 // Region 1 has 3 supercells in 1.5 < eta < 1.8, and 64 supercells in phi. Supercells are 0.1 x 0.1.
827 // Region 2 has 2 supercells in 1.8 < eta < 2.0, and 64 supercells in phi. Supercells are 0.1 x 0.1.
828 // Region 3 has 4 supercells in 2.0 < eta < 2.4, and 64 supercells in phi. Supercells are 0.1 x 0.1.
829 // Region 4 has 1 supercells in 2.4 < eta < 2.5, and 64 supercells in phi. Supercells are 0.1 x 0.1.
831 // No other Regions exist
832 // Actually there should be supercells here in also covering 2.5 < eta < 3.1 and 3.1 < eta < 3.2, in the same vein as EME2 - let's find them! // JFEX IMPORTANT
833 // Focusing 20/01/2021 to finding these jFEX cells in the specified ranges - will update this note if they are found and understood
834 // 21/01/2021: These supercells have been found. Check log file eme2_phi0.log
835 // 21/01/2021: Side note - does this mean we have the structure of EME2 completely wrong in eSuperCellTowerMapper? Need to check... eFEX IMPORTANT
836
837 // The supercells for the 2.5<eta<3.1 are bunched together in the MC as Region 0 posneg +-3
838 // The supercells from the 3.1<eta<3.2 are in the MC as Region 1 posneg +-3
839
840
841 // from code way up above we have:
842 //case CaloSampling::EME3: { eta_index += 15; break; }
843
844 layer = 0; // By definition for jFEX
845
846 switch (region) {
847 case 0: {
848
849 towereta = eta_index;
850 towerphi = phi_index;
851
852 iCell = 0; // By definition for jFEX
853
854 break;
855 }
856 case 1: {
857 towereta = eta_index;
858 towerphi = phi_index;
859 iCell = 0; // By definition for jFEX
860 break;
861 }
862 default: {
863 ATH_MSG_DEBUG("CaloSampling::EME3 -> invalid 'region' value: " << region << " (Under investigation) ");
864 break;
865 }
866 break;
867 }
868
869 if(pos_neg < 0) {
870 towerID_Modifier = 500000;
871 }
872 else if(pos_neg > 0) {
873 towerID_Modifier = 600000;
874 }
875
876 break;
877 }
878 // Hadronic End-cap (HEC)
879 case CaloSampling::HEC0:
880 case CaloSampling::HEC1:
881 case CaloSampling::HEC2:
882 case CaloSampling::HEC3: {
883
884 // All Layers of the Hadronic End-Cap.
885 // Region 0 has 10 supercells in 1.5 < eta < 2.5, and 32 supercells in phi. Supercells are 0.1 x 0.1. [posneg +-2]
886 // Region 1 has 4 supercells in 2.5 < eta < 3.3, and 16 supercells in phi. Supercells are 0.2 x 0.2. [posneg +-2] // JFEX IMPORTANT
887
888 // VERIFIED THAT I CAN SEE THESE MC IN THE MC ON 21/02/2021
889 towereta = eta_index;
890 towerphi = phi_index;
891
892 layer = 1; // By definition for jFEX
893 iCell = 1; //for all cases HEC0, HEC1, HEC2, HEC3
894 switch(region) {
895 case 0: {
896
897 towereta = eta_index;
898 towerphi = phi_index;
899
900 layer = 1; // By definition for jFEX
901 iCell = 1; //for all cases HEC0, HEC1, HEC2, HEC3
902
903 break;
904
905 }
906 case 1: {
907
908 towereta = eta_index;
909 towerphi = phi_index;
910
911 layer = 1; // By definition for jFEX
912 iCell = 1; //for all cases HEC0, HEC1, HEC2, HEC3
913
914 break;
915
916 }
917 default: {
918 break;
919 }
920 }
921 // Tower connection
922 if(pos_neg < 0) {
923 towerID_Modifier = 500000;
924 }
925 else if(pos_neg > 0) {
926 towerID_Modifier = 600000;
927 }
928
929 break;
930 }
931 case CaloSampling::TileBar0:
932 case CaloSampling::TileBar1:
933 case CaloSampling::TileBar2: {
934 //REPORT_MESSAGE_WITH_CONTEXT (MSG::DEBUG, "jSuperCellTowerMapper") << "Supercell is from Tile Barrel - it will be ignored.";
935 validcell = false;
936 //PrintCellSpec(sample, layer, region, eta_index, phi_index, pos_neg, iJTower, iCell, prov, ID, doenergysplit, eta_min, eta_max, eta0, phi_min, phi_max, phi0);
937 ATH_MSG_DEBUG("\n==== jSuperCellTowerMapper ============ Supercell is from Tile Barrel - it will be ignored.");
938 break;
939 }
940 case CaloSampling::TileGap1:
941 case CaloSampling::TileGap2:
942 case CaloSampling::TileGap3: {
943 ATH_MSG_DEBUG("\n==== jSuperCellTowerMapper ============ Supercell is from Tile Gap (ITC and scintillator) - it will be ignored.");
944 //PrintCellSpec(sample, layer, region, eta_index, phi_index, pos_neg, iJTower, iCell, prov, ID, doenergysplit, eta_min, eta_max, eta0, phi_min, phi_max, phi0);
945 validcell = false;
946 break;
947 }
948 case CaloSampling::TileExt0:
949 case CaloSampling::TileExt1:
950 case CaloSampling::TileExt2: {
951 ATH_MSG_DEBUG("\n==== jSuperCellTowerMapper ============ Supercell is from Tile Extended Barrel - it will be ignored.");
952 //PrintCellSpec(sample, layer, region, eta_index, phi_index, pos_neg, iJTower, iCell, prov, ID, doenergysplit, eta_min, eta_max, eta0, phi_min, phi_max, phi0);
953 validcell = false;
954 break;
955 }
956 case CaloSampling::FCAL0:
957 case CaloSampling::FCAL1:
958 case CaloSampling::FCAL2: {
959 // FCAL 0 Region [NOT SPECIFIED IN MC] has 12 supercells in 3.2 < eta < 4.88, and 16 supercells in phi. Supercells are 0.14 x 0.4. posneg +-2
960 // FCAL 1 Region [NOT SPECIFIED IN MC] has 8 supercells in 3.2 < eta < 4.48, and 16 supercells in phi. Supercells are 0.16 x 0.4. posneg +-2
961 // FCAL 2 Region [NOT SPECIFIED IN MC] has 4 supercells in 3.2 < eta < 4.48, and 16 supercells in phi. Supercells are 0.32 x 0.4. posneg +-2
962
963 switch (sample) {
964 case CaloSampling::FCAL0: {
965 if(pos_neg < 0) {
966 towerID_Modifier = 700000;
967 }
968 else if(pos_neg > 0) {
969 towerID_Modifier = 800000;
970 }
971 iCell = 0;
972 layer = 0;
973 break;
974 }
975 case CaloSampling::FCAL1: {
976 if(pos_neg < 0) {
977 towerID_Modifier = 900000;
978 }
979 else if(pos_neg > 0) {
980 towerID_Modifier = 1000000;
981 }
982 iCell = 1;
983 layer = 1;
984 break;
985 }
986 case CaloSampling::FCAL2: {
987 if(pos_neg < 0) {
988 towerID_Modifier = 1100000;
989 }
990 else if(pos_neg > 0) {
991 towerID_Modifier = 1200000;
992 }
993 iCell = 1;
994 layer = 1;
995 break;
996 }
997 //coverity[DEADCODE]
998 default: {
999 break;
1000 }
1001 }
1002
1003 towereta = eta_index;
1004 towerphi = phi_index;
1005
1006 break;
1007
1008 }
1009 case CaloSampling::MINIFCAL0:
1010 case CaloSampling::MINIFCAL1:
1011 case CaloSampling::MINIFCAL2:
1012 case CaloSampling::MINIFCAL3: {
1013 ATH_MSG_DEBUG("\n==== jSuperCellTowerMapper ============ Supercells is from MiniFCAL - it will be ignored.");
1014 validcell = false;
1015 break;
1016 }
1017 case CaloSampling::Unknown: {
1018 ATH_MSG_WARNING("\n==== jSuperCellTowerMapper ============ Supercell sampling is officially unknown - it will be ignored. (Needs investigation). Please report this!");
1019 validcell = false;
1020 break;
1021 }
1022 default: {
1023 ATH_MSG_DEBUG("\n==== jSuperCellTowerMapper ============ Supercell has invalid CaloSampling value: " << sample << " (Needs investigation). Please report this!");
1024 validcell = false;
1025 break;
1026 }
1027 }
1028
1029
1030 if(validcell) {
1031 iJTower = FindTowerIDForSuperCell(towereta, towerphi) + towerID_Modifier;
1032
1033 //Applying the SCell masking!
1034 if( (prov >> 7 & 1) and m_apply_masking ){
1035 //if masked then Et = 0
1036 et = 0.0;
1037 }
1038 if(doPrint) {
1039 PrintCellSpec(sample, layer, region, eta_index, phi_index, pos_neg, iJTower, iCell, prov, ID, doenergysplit, eta_min, eta_max, eta0, phi_min, phi_max, phi0);
1040 }
1041 ConnectSuperCellToTower( my_jTowerContainerRaw, iJTower, ID, iCell, et, layer);
1042
1043
1044 }
1045 else {
1046 PrintCellSpec(sample, layer, region, eta_index, phi_index, pos_neg, iJTower, iCell, prov, ID, doenergysplit, eta_min, eta_max, eta0, phi_min, phi_max, phi0,false);
1047 }
1048
1049 // END ITERATING OVER SUPER CELLS+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++
1050
1051 return 1;
1052}
1053
1054
1055
1056int jSuperCellTowerMapper::FindTowerIDForSuperCell(int towereta, int towerphi) const
1057{
1058 return (towerphi + (64 * towereta));
1059}
1060
1061 void jSuperCellTowerMapper::PrintCellSpec(const CaloSampling::CaloSample sample, int layer, const int region, const int eta_index, const int phi_index, const int pos_neg, int iJTower, int iCell, int prov, Identifier ID ,bool doenergysplit, float eta_min, float eta_max, float eta0, float phi_min, float phi_max, float phi0,bool cellValid) const
1062{
1063
1064 std::string sampleName = "";
1065
1066 switch (sample) {
1067 case CaloSampling::PreSamplerB: { sampleName = "PreSamplerB"; break; }
1068 case CaloSampling::EMB1: { sampleName = "EMB1"; break; }
1069 case CaloSampling::EMB2: { sampleName = "EMB2"; break; }
1070 case CaloSampling::EMB3: { sampleName = "EMB3"; break; }
1071 case CaloSampling::PreSamplerE: { sampleName = "PreSamplerE"; break; }
1072 case CaloSampling::EME1: { sampleName = "EME1"; break; }
1073 case CaloSampling::EME2: { sampleName = "EME2"; break; }
1074 case CaloSampling::EME3: { sampleName = "EME3"; break; }
1075 case CaloSampling::HEC0: { sampleName = "HEC0"; break; }
1076 case CaloSampling::HEC1: { sampleName = "HEC1"; break; }
1077 case CaloSampling::HEC2: { sampleName = "HEC2"; break; }
1078 case CaloSampling::HEC3: { sampleName = "HEC3"; break; }
1079 case CaloSampling::FCAL0: { sampleName = "FCAL0"; break; }
1080 case CaloSampling::FCAL1: { sampleName = "FCAL1"; break; }
1081 case CaloSampling::FCAL2: { sampleName = "FCAL2"; break; }
1082 default: {
1083 ATH_MSG_DEBUG("\n==== jSuperCellTowerMapper ============ Supercell has invalid CaloSampling value: " << sample << " (Needs investigation). Please report this!");
1084 break;
1085 }
1086 }
1087
1088 if(cellValid){
1089 ATH_MSG_DEBUG("ASSIGNED CELL::: CASE: " << sampleName
1090 << "\tSample: " << sample
1091 << "\tLayer: " << layer
1092 << "\tRegion: " << region
1093 << "\tEta0: " << eta0
1094 << "\tEta_min: " << eta_min
1095 << "\tEta_max: " << eta_max
1096 << "\tEta_Index: " << eta_index
1097 << "\tPhi0: " << phi0
1098 << "\tPhi_min: " << phi_min
1099 << "\tPhi_max: " << phi_max
1100 << "\tPhi_Index: " << phi_index
1101 << "\tPosNeg: " << pos_neg
1102 << "\tiJTower: " << iJTower
1103 << "\tiCell: " << iCell
1104 << "\tDoEnergySplit: " << doenergysplit
1105 << "\tProvenance: " << prov
1106 << "\tID: " << ID
1107 << " ");
1108 }
1109 else{
1110 ATH_MSG_DEBUG("INVALID CELL IDENTIFIED::: CASE: " << sampleName
1111 << "\tSample: " << sample
1112 << "\tLayer: " << layer
1113 << "\tRegion: " << region
1114 << "\tEta0: " << eta0
1115 << "\tEta_min: " << eta_min
1116 << "\tEta_max: " << eta_max
1117 << "\tEta_Index: " << eta_index
1118 << "\tPhi0: " << phi0
1119 << "\tPhi_min: " << phi_min
1120 << "\tPhi_max: " << phi_max
1121 << "\tPhi_Index: " << phi_index
1122 << "\tPosNeg: " << pos_neg
1123 << "\tiJTower: " << iJTower
1124 << "\tiCell: " << iCell
1125 << "\tDoEnergySplit: " << doenergysplit
1126 << "\tProvenance: " << prov
1127 << "\tID: " << ID
1128 << " ");
1129 }
1130
1131 return;
1132}
1133
1134
1136 std::string sampleName ="";
1137 switch (sample) {
1138 case CaloSampling::PreSamplerB: { sampleName = "PreSamplerB"; break; }
1139 case CaloSampling::EMB1: { sampleName = "EMB1"; break; }
1140 case CaloSampling::EMB2: { sampleName = "EMB2"; break; }
1141 case CaloSampling::EMB3: { sampleName = "EMB3"; break; }
1142 case CaloSampling::PreSamplerE: { sampleName = "PreSamplerE"; break; }
1143 case CaloSampling::EME1: { sampleName = "EME1"; break; }
1144 case CaloSampling::EME2: { sampleName = "EME2"; break; }
1145 case CaloSampling::EME3: { sampleName = "EME3"; break; }
1146 case CaloSampling::HEC0: { sampleName = "HEC0"; break; }
1147 case CaloSampling::HEC1: { sampleName = "HEC1"; break; }
1148 case CaloSampling::HEC2: { sampleName = "HEC2"; break; }
1149 case CaloSampling::HEC3: { sampleName = "HEC3"; break; }
1150 case CaloSampling::FCAL0: { sampleName = "FCAL0"; break; }
1151 case CaloSampling::FCAL1: { sampleName = "FCAL1"; break; }
1152 case CaloSampling::FCAL2: { sampleName = "FCAL2"; break; }
1153 default: {
1154 ATH_MSG_DEBUG("\n==== jSuperCellTowerMapper ============ Supercell has invalid CaloSampling value: " << sample << " (Needs investigation). Please report this!");
1155 sampleName = "----";
1156 break;
1157 }
1158 }
1159 return sampleName;
1160}
1161
1162
1163} // end of LVL1 namespace
1164
#define M_PI
Scalar eta() const
pseudorapidity method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
Helper class for offline supercell identifiers.
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).
float phi0(const Identifier regId) const
minimum LAr phi for this region
int phi_max(const Identifier regId) const
max value of phi index (-999 == failure)
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_max(const Identifier regId) const
max value of eta index (-999 == failure)
int eta(const Identifier id) const
LAr field values (NOT_VALID == invalid request).
float eta0(const Identifier regId) const
minimum LAr eta for this region
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
virtual StatusCode AssignSuperCellsToTowers(std::unique_ptr< jTowerContainer > &my_jTowerContainerRaw) const override
SG::ReadHandleKey< CaloCellContainer > m_scellsCollectionSGKey
virtual StatusCode initialize() override
standard Athena-Algorithm method
virtual StatusCode AssignTriggerTowerMapper(std::unique_ptr< jTowerContainer > &my_jTowerContainerRaw) const override
virtual int FindAndConnectTower(std::unique_ptr< jTowerContainer > &my_jTowerContainerRaw, 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, float eta_min, float eta_max, float eta0, float phi_min, float phi_max, float phi0) const override
virtual int FindTowerIDForSuperCell(int towereta, int towerphi) const override
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, float eta_min, float eta_max, float eta0, float phi_min, float phi_max, float phi0, bool cellValid=true) const override
jSuperCellTowerMapper(const std::string &type, const std::string &name, const IInterface *parent)
virtual void ConnectSuperCellToTower(std::unique_ptr< jTowerContainer > &my_jTowerContainerRaw, int iETower, Identifier ID, int iCell, float et, int layer) const override
std::string DetectorName(const CaloSampling::CaloSample sample) const
Gaudi::Property< bool > m_apply_masking
SG::ReadHandleKey< xAOD::TriggerTowerContainer > m_triggerTowerCollectionSGKey
The jTower class is an interface object for jFEX trigger algorithms The purposes are twofold:
Definition jTower.h:36
void set_TileCal_Et(int layer, int et)
Definition jTower.cxx:106
float getET_float(unsigned int layer, int cell=0) const
Get ET of a specified cell in MeV FLOAT VERSION.
Definition jTower.cxx:188
void set_LAr_Et(Identifier ID, int cell, float et, int layer)
Set LAr supercell position ID.
Definition jTower.cxx:123
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.