ATLAS Offline Software
GeoCaloCalibHit.icc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //----------------------------------------------------------//
6 // //
7 // Adaptor for CaloCalibHits. //
8 // //
9 // Joe Boudreau Apr 14, 2005 //
10 // Mikhail Leltchouk Apr 30, 2005 //
11 // //
12 // //
13 //----------------------------------------------------------//
14 
15 #include "CaloIdentifier/CaloIdManager.h"
16 #include "CaloDetDescr/CaloDetDescrElement.h"
17 #include "CaloSimEvent/CaloCalibrationHit.h"
18 #include "CaloIdentifier/CaloDM_ID.h"
19 #include "CaloDetDescr/CaloDetDescrManager.h"
20 
21 #include "CLHEP/Units/SystemOfUnits.h"
22 
23 #undef DEBUG_GEOHIT
24 
25 inline GeoCaloCalibHit::GeoCaloCalibHit(const CaloCalibrationHit & hit
26  , const std::string & collectionName
27  , const CaloDetDescrManager* caloMgr)
28  : m_hit(&hit)
29  , m_ddManager(caloMgr)
30 {
31  init(collectionName);
32 }
33 
34 inline GeoCaloCalibHit::operator bool () const {
35  return !m_failed;
36 }
37 
38 inline double GeoCaloCalibHit::energyEM() const
39 {
40  return m_hit->energyEM();
41 }
42 
43 inline double GeoCaloCalibHit::energyNonEM() const
44 {
45  return m_hit->energyNonEM();
46 }
47 
48 inline double GeoCaloCalibHit::energyInvisible() const
49 {
50  return m_hit->energyInvisible();
51 }
52 
53 inline double GeoCaloCalibHit::energyEscaped() const
54 {
55  return m_hit->energyEscaped();
56 }
57 
58 
59 inline double GeoCaloCalibHit::energyTotal() const
60 {
61  return m_hit->energyTotal();
62 }
63 
64 
65 inline double GeoCaloCalibHit::phiMin() const {
66  if (m_ddElement) { // Active and Inactive hits
67  double phi = m_ddElement->phi();
68  double dphi = m_ddElement->dphi();
69  return phi-dphi/2.0;
70  }
71  const CaloDM_ID* dmid = m_ddManager->getCalo_Mgr()->getDM_ID();
72  int phiIndex=dmid->phi(m_hit->cellID()); // Dead material hits
73  int n_phi=32;
74  if(abs(m_subdet) == 4 && m_type==2 && (m_region == 2 || m_region == 3) ) {
75  n_phi=16;
76  return (phiIndex-0.5)*M_PI/n_phi;
77  }
78  return phiIndex*M_PI/n_phi;
79 }
80 
81 inline double GeoCaloCalibHit::phiMax() const {
82  if (m_ddElement) { // Active and Inactive hits
83  double phi = m_ddElement->phi();
84  double dphi = m_ddElement->dphi();
85  return phi+dphi/2.0;
86  }
87  const CaloDM_ID* dmid = m_ddManager->getCalo_Mgr()->getDM_ID();
88  int phiIndex=dmid->phi(m_hit->cellID()); // Dead material hits
89  int n_phi=32;
90  if(abs(m_subdet) == 4 && m_type==2 && (m_region == 2 || m_region == 3) ) {
91  n_phi=16;
92  return (phiIndex+0.5)*M_PI/n_phi;
93  }
94  return (phiIndex+1.)*M_PI/n_phi;
95 }
96 
97 inline double GeoCaloCalibHit::phi() const {
98  if (m_ddElement) { // Active and Inactive hits
99  double phi = m_ddElement->phi();
100  return phi;
101  }
102  const CaloDM_ID* dmid = m_ddManager->getCalo_Mgr()->getDM_ID();
103  int phiIndex=dmid->phi(m_hit->cellID()); // Dead material hits
104  int n_phi=32;
105  if(abs(m_subdet) == 4 && m_type==2 && (m_region == 2 || m_region == 3) ) {
106  n_phi=16;
107  return (phiIndex)*M_PI/n_phi; // phiBin=0 means between hec module 0 and hec module 1, i.e. 11.25deg
108  }
109  return (phiIndex+0.5)*M_PI/n_phi;
110 }
111 
112 
113 inline double GeoCaloCalibHit::etaMin() const {
114  if (m_ddElement) { // Active and Inactive hits
115  double eta = m_ddElement->eta();
116  double deta = m_ddElement->deta();
117  return eta-deta/2.0;
118  }
119  double halfEta = 0.05; // Dead material hits
120  if ((m_type==1 && m_sampling==3 && m_region==1) ||
121  (m_type==2 && m_region==3)) {
122  halfEta = 0.1;
123  }
124  return eta()-halfEta;
125 }
126 
127 inline double GeoCaloCalibHit::etaMax() const {
128  if (m_ddElement) { // Active and Inactive hits
129  double eta = m_ddElement->eta();
130  double deta = m_ddElement->deta();
131  return eta+deta/2.0;
132  }
133  double halfEta = 0.05; // Dead material hits
134  if ((m_type==1 && m_sampling==3 && m_region==1) ||
135  (m_type==2 && m_region==3)) {
136  halfEta = 0.1;
137  }
138  return eta()+halfEta;
139 }
140 
141 inline double GeoCaloCalibHit::eta() const {
142  if (m_ddElement) { // Active and Inactive hits
143  double eta = m_ddElement->eta();
144  return eta;
145  }
146  const CaloDM_ID* dmid = m_ddManager->getCalo_Mgr()->getDM_ID();
147  int etaIndex=dmid->eta(m_hit->cellID()); // Dead material hits
148  double dEta = 0.1;
149  if ((m_type==1 && m_sampling==3 && m_region==1) ||
150  (m_type==2 && m_region==3)) {
151  dEta = 0.2;
152  }
153  double etaCenter = m_etaOffset + (etaIndex+0.5)*dEta;
154 
155  bool isNegative = dmid->pos_neg_z(m_hit->cellID())<0;
156  if (isNegative) {
157  etaCenter = -etaCenter;
158  }
159  return etaCenter;
160 }
161 
162 inline std::string GeoCaloCalibHit::hitType() const {
163  if (m_hitType==ACTIVE) return "LArCalibrationHitActive";
164  if (m_hitType==INACTIVE) return "LArCalibrationHitInactive";
165  if (m_hitType==DEAD) return "LArCalibrationHitDeadMaterial";
166  if (m_hitType==TILEAI) return "TileCalibrationCellHitCnt"; // Old format
167  if (m_hitType==TILEDM) return "TileCalibrationDMHitCnt";// Old format
168  if (m_hitType==TILEACTIVE) return "TileCalibHitActiveCell"; // New format
169  if (m_hitType==TILEINACTIVE) return "TileCalibHitInactiveCell";// New format
170  if (m_hitType==TILEDEAD) return "TileCalibHitDeadMaterial";// New format
171  if (m_hitType==UNRECOGNIZED) return "UNRECOGNIZED hit collection";
172  return "UNRECOGNIZED hit collection";
173 }
174 
175 inline void GeoCaloCalibHit::init(const std::string & collectionName) {
176 
177  if (collectionName=="LArCalibrationHitActive") {
178  m_hitType=ACTIVE;
179  }
180  else if (collectionName=="LArCalibrationHitInactive") {
181  m_hitType=INACTIVE;
182  }
183  else if (collectionName=="LArCalibrationHitDeadMaterial") {
184  m_hitType=DEAD;
185  }
186  else if (collectionName=="TileCalibrationCellHitCnt") {
187  m_hitType=TILEAI;
188  }
189  else if (collectionName=="TileCalibrationDMHitCnt") {
190  m_hitType=TILEDM;
191  }
192  else if (collectionName=="TileCalibHitDeadMaterial") {
193  m_hitType=TILEDEAD;
194  }
195  else if (collectionName=="TileCalibHitActiveCell") {
196  m_hitType=TILEACTIVE;
197  }
198  else if (collectionName=="TileCalibHitInactiveCell") {
199  m_hitType=TILEINACTIVE;
200  }
201  else {
202  m_hitType=UNRECOGNIZED;
203  m_failed=true;
204  return;
205  }
206 
207  m_ddElement = getDetDescrElement();
208 
209  //bool inactive = collectionName=="LArCalibrationHitInactive";
210 
211  // Default values of m_etaOffset, m_distance, m_isBarrel(hit orientation)
212  m_etaOffset = 0.;
213  m_distance=230*CLHEP::mm;
214  m_isBarrel=true;
215 
216  // if (abs(m_subdet)>= 4) { // Dead hits: LAr: m_subdet= +-4, Tile: m_subdet= +-5)
217  if (m_hitType==DEAD || m_hitType==TILEDM || m_hitType==TILEDEAD) { // Dead hits: LAr: m_subdet= +-4, Tile: m_subdet= +-5)
218  // from Calorimeter/ CaloIdentifier/ CaloIdentifier/ CaloDM_ID.h
219 
220  const CaloDM_ID* dmid = m_ddManager->getCalo_Mgr()->getDM_ID();
221  m_subdet = dmid->pos_neg_z(m_hit->cellID());
222  m_type = dmid->dmat(m_hit->cellID());
223  m_sampling = dmid->sampling(m_hit->cellID());
224  m_region = dmid->region(m_hit->cellID());
225  m_etaBin = dmid->eta(m_hit->cellID());
226  m_phiBin = dmid->phi(m_hit->cellID());
227 
228  } else { // Active and Inactive hit ID from Calorimeter/ CaloIdentifier/ CaloIdentifier/ CaloCell_ID.h
229 
230  const CaloCell_ID* cellid = m_ddManager->getCaloCell_ID();
231  m_subdet = 1 + cellid->sub_calo(m_hit->cellID());
232  m_type = cellid->pos_neg(m_hit->cellID());
233  m_sampling = cellid->calo_sample(m_hit->cellID());
234  m_region = cellid->region(m_hit->cellID());
235  m_etaBin = cellid->eta(m_hit->cellID());
236  m_phiBin = cellid->phi(m_hit->cellID());
237 
238  }
239 
240  // Values of m_etaOffset, m_distance, m_isBarrel(hit orientation) which are different from default
241  // To help navigate through statements we will use in comments below
242  // labeling key=abs(subdet)*1000+type*100+sampling*10+region;
243 
244  // for LAr Dead hits:
245  if (abs(m_subdet) == 4) { // subdet = 4 LAr.
246  switch (m_type) {
247  case 1: // type = 1
248  switch (m_sampling) {
249  case 0: // sampling = 0 Inner Detector
250  switch (m_region) {
251  case 0: // 4100
252  m_distance= 250*CLHEP::mm;
253  return;
254  case 1: // 4101
255  m_distance= 270*CLHEP::mm; // largest radius for this zone
256  return;
257  case 2: // 4102
258  m_distance= 405*CLHEP::mm;
259  return;
260  case 3: // 4103
261  m_distance= 595*CLHEP::mm;
262  return;
263  case 4: // 4104
264  m_distance= 815*CLHEP::mm;
265  return;
266  case 5: // 4105
267  m_distance=1065*CLHEP::mm;
268  return;
269  default:
270 #ifdef DEBUG_GEOHIT
271  std::cout <<"Warning 0, GeoCaloCalibHit with (subdet,type,sampling,region,eta,phi) = "
272  <<m_subdet<<", "<<m_type<<", "<<m_sampling<<", "<<m_region
273  <<m_etaBin<<", "<<m_phiBin
274  << " not decoded" <<std::endl;
275 #endif
276  m_failed=true;
277  return;
278  }
279  break;
280  case 1: // sampling = 1 - in front of and in active LAr calorimeters
281  switch (m_region) {
282  case 0: // 4110
283  m_distance=1250*CLHEP::mm;
284  return;
285  case 1: // 4111
286  m_distance=1375*CLHEP::mm;
287  return;
288  case 2: // 4112
289  m_distance=1410*CLHEP::mm;
290  return;
291  case 3: // 4113
292  m_distance=1490*CLHEP::mm;
293  return;
294  case 4: // 4114
295  m_etaOffset = 1.5;
296  m_distance=3490*CLHEP::mm;
297  m_isBarrel=false;
298  return;
299  case 5: // 4115
300  m_etaOffset = 1.5;
301  m_distance=3511*CLHEP::mm;
302  m_isBarrel=false;
303  return;
304  case 6: // 4116
305  m_etaOffset = 1.3;
306  m_distance=3640*CLHEP::mm;
307  m_isBarrel=false;
308  return;
309  case 7: // 4117
310  m_etaOffset = 3.2;
311  m_distance=3700*CLHEP::mm;
312  m_isBarrel=false;
313  return;
314  default:
315 #ifdef DEBUG_GEOHIT
316  std::cout <<"Warning 1, GeoCaloCalibHit with (subdet,type,sampling,region,eta,phi) = "
317  <<m_subdet<<", "<<m_type<<", "<<m_sampling<<", "<<m_region
318  <<m_etaBin<<", "<<m_phiBin
319  << " not decoded" <<std::endl;
320 #endif
321  m_failed=true;
322  return;
323  }
324  break;
325  case 2: // sampling = 2 - dead materials between active calorimeters
326  switch (m_region) {
327  case 0: // 4120
328  m_distance=2170*CLHEP::mm;
329  return;
330  case 1: // 4121
331  m_distance=2990*CLHEP::mm; // radius of lower part - feedthrough
332  return;
333  case 2: // 4122
334  m_etaOffset = 1.0;
335  m_distance=3300*CLHEP::mm; // z
336  m_isBarrel=false; // partly around EMB but in front of Extended Barrel of Tile
337  return;
338  case 3: // 4123
339  m_etaOffset = 1.5;
340  m_distance=4250*CLHEP::mm;
341  m_isBarrel=false;
342  return;
343  case 4: // 4124
344  m_etaOffset = 1.5;
345  m_distance=5110*CLHEP::mm;
346  m_isBarrel=false;
347  return;
348  case 5: // 4125
349  m_etaOffset = 1.0;
350  m_distance=2100*CLHEP::mm; // R
351  return;
352  default:
353 #ifdef DEBUG_GEOHIT
354  std::cout <<"Warning 2, GeoCaloCalibHit with (subdet,type,sampling,region,eta,phi) = "
355  <<m_subdet<<", "<<m_type<<", "<<m_sampling<<", "<<m_region
356  <<m_etaBin<<", "<<m_phiBin
357  << " not decoded" <<std::endl;
358 #endif
359  m_failed=true;
360  return;
361  }
362  break;
363  case 3: // sampling = 3
364  // Eta granularity in region 1 sampling 3 is twice that of previous cases.
365  switch(m_region) {
366  case 0: // 4130
367  m_etaOffset = 1.7;
368  m_distance=6200*CLHEP::mm;
369  m_isBarrel=false;
370  return;
371  case 1: // 4131
372  m_etaOffset = 5.0;
373  m_distance=6300*CLHEP::mm;
374  m_isBarrel=false;
375  return;
376  case 2: // 4132
377  m_etaOffset = 8.0;
378  m_distance=3500*CLHEP::mm; //or can be attached to end of InDet cavity
379  m_isBarrel=false;
380  return;
381  default:
382 #ifdef DEBUG_GEOHIT
383  std::cout <<"Warning 4, GeoCaloCalibHit with (subdet,type,sampling,region,eta,phi) = "
384  <<m_subdet<<", "<<m_type<<", "<<m_sampling<<", "<<m_region
385  <<m_etaBin<<", "<<m_phiBin
386  << " not decoded" <<std::endl;
387 #endif
388  m_failed=true;
389  return;
390  }
391  default:
392 #ifdef DEBUG_GEOHIT
393  std::cout <<"Warning 5, GeoCaloCalibHit with (subdet,type,sampling,region,eta,phi) = "
394  <<m_subdet<<", "<<m_type<<", "<<m_sampling<<", "<<m_region
395  <<m_etaBin<<", "<<m_phiBin
396  << " not decoded" <<std::endl;
397 #endif
398  m_failed=true;
399  return;
400  }
401  case 2: // type = 2
402  switch (m_region) {
403  case 0: // region = 0 crack between EMB halfs
404  switch (m_sampling) {
405  case 0: // 4200
406  // distances should be checked with experts
407  m_distance= 1550*CLHEP::mm;
408  return;
409  case 1: // 4210
410  m_distance= 1600*CLHEP::mm;
411  return;
412  case 2: // 4220
413  m_distance= 1750*CLHEP::mm;
414  return;
415  case 3: // 4230
416  m_distance= 1900*CLHEP::mm;
417  return;
418  default:
419 #ifdef DEBUG_GEOHIT
420  std::cout <<"Warning 6, GeoCaloCalibHit with (subdet,type,sampling,region,eta,phi) = "
421  <<m_subdet<<", "<<m_type<<", "<<m_sampling<<", "<<m_region
422  <<m_etaBin<<", "<<m_phiBin
423  << " not decoded" <<std::endl;
424 #endif
425  m_failed=true;
426  return;
427  }
428  case 1: // region = 1 dead materials between inner and outer EMEC wheels
429  m_isBarrel=false;
430  m_etaOffset = 2.45;
431  switch (m_sampling) {
432  case 0: // 4201
433  // distances should be checked with experts
434  m_distance=3700*CLHEP::mm;
435  return;
436  case 1: // 4211
437  m_distance=3800*CLHEP::mm;
438  return;
439  case 2: // 4221
440  m_distance=3950*CLHEP::mm;
441  return;
442  case 3: // 4231
443  m_distance=4150*CLHEP::mm;
444  return;
445  default:
446 #ifdef DEBUG_GEOHIT
447  std::cout <<"Warning 7, GeoCaloCalibHit with (subdet,type,sampling,region,eta,phi) = "
448  <<m_subdet<<", "<<m_type<<", "<<m_sampling<<", "<<m_region
449  <<m_etaBin<<", "<<m_phiBin
450  << " not decoded" <<std::endl;
451 #endif
452  m_failed=true;
453  return;
454  }
455  case 2: // region = 2 - azimuthal cracks between HEC modules (wedges) - outer
456  m_isBarrel=false;
457  m_etaOffset = 1.5;
458  switch (m_sampling) {
459  case 0: // 4202
460  // distances should be checked with experts
461  m_distance=4417*CLHEP::mm;
462  return;
463  case 1: // 4212
464  m_distance=4825*CLHEP::mm;
465  return;
466  case 2: // 4222
467  m_distance=5393*CLHEP::mm;
468  return;
469  case 3: // 4232
470  m_distance=5861*CLHEP::mm;
471  return;
472  default:
473 #ifdef DEBUG_GEOHIT
474  std::cout <<"Warning 8, GeoCaloCalibHit with (subdet,type,sampling,region,eta,phi) = "
475  <<m_subdet<<", "<<m_type<<", "<<m_sampling<<", "<<m_region
476  <<m_etaBin<<", "<<m_phiBin
477  << " not decoded" <<std::endl;
478 #endif
479  m_failed=true;
480  return;
481  }
482  case 3: // region = 3 - azimuthal cracks between HEC modules (wedges) - inner
483  m_isBarrel=false;
484  m_etaOffset = 2.5;
485  switch (m_sampling) {
486  case 0: // 4203
487  // distances should be checked with experts
488  m_distance=4417*CLHEP::mm;
489  return;
490  case 1: // 4213
491  m_distance=4825*CLHEP::mm;
492  return;
493  case 2: // 4223
494  m_distance=5393*CLHEP::mm;
495  return;
496  case 3: // 4233
497  m_distance=5861*CLHEP::mm;
498  return;
499  default:
500 #ifdef DEBUG_GEOHIT
501  std::cout <<"Warning 9, GeoCaloCalibHit with (subdet,type,sampling,region,eta,phi) = "
502  <<m_subdet<<", "<<m_type<<", "<<m_sampling<<", "<<m_region
503  <<m_etaBin<<", "<<m_phiBin
504  << " not decoded" <<std::endl;
505 #endif
506  m_failed=true;
507  return;
508  }
509  case 4: // region = 4 - dead materials between HEC and FCal
510  m_isBarrel=false;
511  m_etaOffset = 3.0;
512  switch (m_sampling) {
513  case 0: // 4204
514  // distances should be checked with experts
515  m_distance=4600*CLHEP::mm;
516  return;
517  case 1: // 4214
518  m_distance=4920*CLHEP::mm;
519  return;
520  case 2: // 4224
521  m_distance=5400*CLHEP::mm;
522  return;
523  case 3: // 4234
524  m_distance=5820*CLHEP::mm;
525  return;
526  default:
527 #ifdef DEBUG_GEOHIT
528  std::cout <<"Warning 10, GeoCaloCalibHit with (subdet,type,sampling,region,eta,phi) = "
529  <<m_subdet<<", "<<m_type<<", "<<m_sampling<<", "<<m_region
530  <<m_etaBin<<", "<<m_phiBin
531  << " not decoded" <<std::endl;
532 #endif
533  m_failed=true;
534  return;
535  }
536  case 5: // region = 4 - dead materials between HEC and FCal
537  m_isBarrel=false;
538  m_etaOffset = 3.0;
539  switch (m_sampling) {
540  case 0: // 4205
541  // distances should be checked with experts
542  m_distance=4340*CLHEP::mm;
543  return;
544  case 1: // 4215
545  m_distance=4668*CLHEP::mm;
546  return;
547  case 2: // 4225
548  m_distance=5138*CLHEP::mm;
549  return;
550  case 3: // 4235
551  m_distance=5602*CLHEP::mm;
552  return;
553  default:
554 #ifdef DEBUG_GEOHIT
555  std::cout <<"Warning 11, GeoCaloCalibHit with (subdet,type,sampling,region,eta,phi) = "
556  <<m_subdet<<", "<<m_type<<", "<<m_sampling<<", "<<m_region
557  <<m_etaBin<<", "<<m_phiBin
558  << " not decoded" <<std::endl;
559 #endif
560  m_failed=true;
561  return;
562  }
563 
564  }
565  }
566  }
567  // --------------------------- Tile Dead hits --------------------------------------
568  // Values of m_etaOffset, m_distance, m_isBarrel(hit orientation) which are different from default
569  else if (abs(m_subdet) == 5) { //for Tile Dead hits
570 
571  switch (m_type) {
572  case 1: // type = 1
573  switch (m_sampling) {
574  case 0: // sampling = 0, front plate of the module (1 CLHEP::cm Fe along R)
575  switch (m_region) {
576  case 0: // 5100, region = 0 - barrel 0.0 < eta < 1.0
577  m_distance= 2295*CLHEP::mm;
578  return;
579  case 1: // 5101, region = 1 - ext.barrel 1.1 < eta < 1.6
580  m_distance= 2295*CLHEP::mm;
581  m_etaOffset = 1.1;
582  return;
583  default:
584 #ifdef DEBUG_GEOHIT
585  std::cout <<"Warning 12, GeoCaloCalibHit with (subdet,type,sampling,region,eta,phi) = "
586  <<m_subdet<<", "<<m_type<<", "<<m_sampling<<", "<<m_region
587  <<m_etaBin<<", "<<m_phiBin
588  << " not decoded" <<std::endl;
589 #endif
590  m_failed=true;
591  return;
592  }
593  break;
594  case 1: // sampling = 1, end plates of the module ( Fe at fixed Z )
595  m_isBarrel=false;
596  switch (m_region) {
597  case 0: // 5110 - region = 0 - end of barrel 0.7 < eta < 1.1
598  m_distance= 2810*CLHEP::mm; // z, thickness = 20 mm
599  m_etaOffset = 0.7;
600  return;
601  case 1: // 5111 - region = 1 - smaller Z end of ext barrel 0.9 < eta < 1.2
602  m_distance= 3527*CLHEP::mm; // z, thickness = 15 mm
603  m_etaOffset = 0.9;
604  return;
605  case 2: // 5112 - region = 2 - higher Z end of ext barrel 1.3 < eta < 1.7
606  m_distance= 6100*CLHEP::mm; // z, thickness = 20 mm
607  m_etaOffset = 1.3;
608  return;
609  default:
610 #ifdef DEBUG_GEOHIT
611  std::cout <<"Warning 13, GeoCaloCalibHit with (subdet,type,sampling,region,eta,phi) = "
612  <<m_subdet<<", "<<m_type<<", "<<m_sampling<<", "<<m_region
613  <<m_etaBin<<", "<<m_phiBin
614  << " not decoded" <<std::endl;
615 #endif
616  m_failed=true;
617  return;
618  }
619  break;
620  case 2: // sampling = 2, so-called "girder" - iron at higher R
621  m_distance= 3900*CLHEP::mm; // R, should be checked with experts
622  switch (m_region) {
623  case 0: // 5120 - region = 0 - barrel 0. < eta < 0.7
624  // nothing to do
625  return;
626  case 1: // 5121 - region = 1 - ext barrel 0.9 < eta < 1.3
627  m_etaOffset = 0.9;
628  return;
629  case 2: // 5122 - region = 2 - gap between barrel and ext barrel 0.7 < eta < 0.9
630  m_etaOffset = 0.7;
631  return;
632  default:
633 #ifdef DEBUG_GEOHIT
634  std::cout <<"Warning 14, GeoCaloCalibHit with (subdet,type,sampling,region,eta,phi) = "
635  <<m_subdet<<", "<<m_type<<", "<<m_sampling<<", "<<m_region
636  <<m_etaBin<<", "<<m_phiBin
637  << " not decoded" <<std::endl;
638 #endif
639  m_failed=true;
640  return;
641  }
642  break;
643  case 3: // 5130 - sampling = 3, leakage outside Tile calorimeters, 0.0 < eta < 1.7; usually is in LAr DM hit container
644  m_distance = 3980*CLHEP::mm;
645  return;
646  default:
647  m_failed = true;
648  return;
649  } // over samplings
650  case 2: // type == 2, 5200
651  if (m_region !=0 || m_sampling !=0) {
652  m_failed = true;
653  return;
654  }
655  m_etaOffset = 0.0;
656  m_distance = 4000*CLHEP::mm;
657  m_isBarrel = true;
658  return;
659  default:
660 #ifdef DEBUG_GEOHIT
661  std::cout <<"Warning 15, GeoCaloCalibHit with (subdet,type,sampling,region,eta,phi) = "
662  <<m_subdet<<", "<<m_type<<", "<<m_sampling<<", "<<m_region
663  <<m_etaBin<<", "<<m_phiBin
664  << " not decoded" <<std::endl;
665 #endif
666  m_failed=true;
667  return;
668  } // over types for Tile DM hits
669 #ifdef DEBUG_GEOHIT
670  std::cout <<"Warning 16, GeoCaloCalibHit with (subdet,type,sampling,region,eta,phi) = "
671  <<m_subdet<<", "<<m_type<<", "<<m_sampling<<", "<<m_region
672  <<m_etaBin<<", "<<m_phiBin
673  << " not decoded" <<std::endl;
674 #endif
675 
676  }
677 
678  // ------------------------ Active and Inactive hits --------------------------------
679  // Values of m_etaOffset, m_distance are calculated in eta(), distance()
680  // Value of m_isBarrel(hit orientation) which is different from default is defined here
681  else if (m_subdet == 1) { // LAr EM hits
682  if (abs(m_type)>1){ // EMEC
683  m_isBarrel=false;
684  }
685  if (abs(m_type) == 2){ // EMEC Outer Wheel
686  m_sampling = m_sampling - 4; // adjustment to ATL-SOFT-2001-004 definition
687  }
688  if (abs(m_type) == 3){ // EMEC Outer Wheel
689  m_sampling = m_sampling - 6; // adjustment to ATL-SOFT-2001-004 definition
690  }
691  }
692  else if (m_subdet == 2) { // LAr HEC hits
693  m_isBarrel=false;
694  m_sampling = m_sampling - 8; // adjustment to ATL-SOFT-2001-004 definition
695  }
696  else if (m_subdet == 3) { // LAr FCal hits
697  m_isBarrel=false;
698  }
699  else {
700  }
701 
702 }
703 
704 inline double GeoCaloCalibHit::distance() const {
705 
706  if (m_ddElement) { // Active and Inactive hits
707  return m_isBarrel ? m_ddElement->r() : fabs(m_ddElement->z());
708  }
709  return m_distance; // Dead hits
710 }
711 
712 inline bool GeoCaloCalibHit::isBarrel() const {
713  return m_isBarrel;
714 }
715 
716 inline bool GeoCaloCalibHit::isEndcap() const {
717  return !isBarrel();
718 }
719 
720 inline int GeoCaloCalibHit::subdet() const {
721  return m_subdet;
722 }
723 
724 inline int GeoCaloCalibHit::type() const {
725  return m_type;
726 }
727 
728 inline int GeoCaloCalibHit::sampling() const {
729  return m_sampling;
730 }
731 
732 inline int GeoCaloCalibHit::region() const {
733  return m_region;
734 }
735 
736 inline const CaloDetDescrElement* GeoCaloCalibHit::getDetDescrElement() const
737 {
738  return (m_hitType!=DEAD && m_hitType!=TILEDM && m_hitType!=TILEDEAD)
739  ? m_ddManager->get_element(m_hit->cellID())
740  : nullptr;
741 }