ATLAS Offline Software
CaloCell_Base_ID.icc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 /**
5  * @file CaloIdentifier/CaloCell_Base_ID.icc
6  * @author scott snyder <snyder@bnl.gov>
7  * @date Jul, 2012
8  * @brief Helper base class for offline cell identifiers
9  */
10 
11 
12 //--------------------
13 // Inline definitions
14 //--------------------
15 
16 //----------------------------------------------------------------------------
17 inline Identifier
18 CaloCell_Base_ID::region_id (const int subCalo,
19  const int barec_or_posneg,
20  const int sampling_or_fcalmodule,
21  const int region_or_dummy,
22  bool checks) const
23 {
24  Identifier result(0); // this returns a pixel identifier [2.1.-2.0.0]
25  if( subCalo == LAREM ) {
26  return m_emHelper->region_id(barec_or_posneg, sampling_or_fcalmodule, region_or_dummy, checks);
27  }
28  else if( subCalo == LARHEC ) {
29  return m_hecHelper->region_id(barec_or_posneg, sampling_or_fcalmodule, region_or_dummy, checks);
30  }
31  else if( subCalo == LARFCAL ) {
32  return m_fcalHelper->module_id(barec_or_posneg, sampling_or_fcalmodule, checks);
33  }
34  else if( subCalo == LARMINIFCAL ) {
35  return m_minifcalHelper->module_id(barec_or_posneg, sampling_or_fcalmodule, checks);
36  }
37  else if( subCalo == TILE ) {
38  return m_tileHelper->region_id(barec_or_posneg, sampling_or_fcalmodule, checks);
39  }
40  else {
41  return(result);
42  }
43 }
44 
45 inline Identifier
46 CaloCell_Base_ID::region_id (const int subCalo,
47  const int barec_or_posneg,
48  const int sampling_or_fcalmodule,
49  const int region_or_dummy ) const
50 {
51  return region_id (subCalo, barec_or_posneg, sampling_or_fcalmodule,
52  region_or_dummy, do_checks());
53 }
54 
55 //----------------------------------------------------------------------------
56 inline Identifier
57 CaloCell_Base_ID::cell_id (const int subCalo,
58  const int barec_or_posneg,
59  const int sampling_or_fcalmodule,
60  const int region_or_dummy,
61  const int eta,
62  const int phi,
63  bool checks) const
64 {
65  Identifier result(0);
66  if( subCalo == LAREM ) {
67  return m_emHelper->channel_id(barec_or_posneg, sampling_or_fcalmodule, region_or_dummy, eta, phi, checks);
68  }
69  else if( subCalo == LARHEC ) {
70  return m_hecHelper->channel_id(barec_or_posneg, sampling_or_fcalmodule, region_or_dummy, eta, phi, checks);
71  }
72  else if( subCalo == LARFCAL ) {
73  return m_fcalHelper->channel_id(barec_or_posneg, sampling_or_fcalmodule, eta, phi, checks);
74  }
75  else if( subCalo == LARMINIFCAL ) {
76  return m_minifcalHelper->channel_id(barec_or_posneg, sampling_or_fcalmodule, region_or_dummy, eta, phi, checks);
77  }
78  else if( subCalo == TILE ) {
79  return m_tileHelper->cell_id(barec_or_posneg, sampling_or_fcalmodule, region_or_dummy, eta, phi, checks);
80  }
81  else {
82  return(result);
83  }
84 }
85 
86 inline Identifier
87 CaloCell_Base_ID::cell_id (const int subCalo,
88  const int barec_or_posneg,
89  const int sampling_or_fcalmodule,
90  const int region_or_dummy,
91  const int eta,
92  const int phi) const
93 {
94  return cell_id (subCalo, barec_or_posneg, sampling_or_fcalmodule,
95  region_or_dummy, eta, phi, do_checks());
96 }
97 
98 //----------------------------------------------------------------------------
99 inline Identifier
100 CaloCell_Base_ID::region_id ( const Identifier cellId ) const
101 {
102  Identifier result(0);
103  if(m_emHelper->is_lar_em(cellId)) {
104  return m_emHelper->region_id(cellId);
105  }
106  else if(m_emHelper->is_lar_hec(cellId)) {
107  return m_hecHelper->region_id(cellId);
108  }
109  else if(m_emHelper->is_lar_minifcal(cellId)) {
110  // must do minifcal before fcal because miniFCAL IS FCAL
111  return m_minifcalHelper->module_id(cellId);
112  }
113  else if(m_emHelper->is_lar_fcal(cellId)) {
114  return m_fcalHelper->module_id(cellId);
115  }
116  else if(m_emHelper->is_tile(cellId)) {
117  return m_tileHelper->region_id(cellId);
118  }
119  else {
120  return(result);
121  }
122 }
123 
124 //----------------------------------------------------------------------------
125 inline Identifier
126 CaloCell_Base_ID::cell_id (const Identifier regionId,
127  const int eta,
128  const int phi,
129  int depth,
130  bool checks) const
131 {
132  Identifier result(0);
133  if(m_emHelper->is_lar_em(regionId)) {
134  return m_emHelper->channel_id(regionId,eta,phi,checks);
135  }
136  else if(m_emHelper->is_lar_hec(regionId)) {
137  return m_hecHelper->channel_id(regionId,eta,phi,checks);
138  }
139  else if(m_emHelper->is_lar_minifcal(regionId)) {
140  // must do minifcal before fcal because miniFCAL IS FCAL
141  return m_minifcalHelper->channel_id(regionId, depth,eta,phi,checks);
142  }
143  else if(m_emHelper->is_lar_fcal(regionId)) {
144  return m_fcalHelper->channel_id(regionId,eta,phi,checks);
145  }
146  else {
147  return(result);
148  }
149 }
150 
151 inline Identifier
152 CaloCell_Base_ID::cell_id (const Identifier regionId,
153  const int eta,
154  const int phi,
155  int depth) const
156 {
157  return cell_id (regionId, eta, phi, depth, do_checks());
158 }
159 
160 //----------------------------------------------------------------------------
161 inline Identifier
162 CaloCell_Base_ID::region_id (const IdentifierHash caloRegionHash) const
163 {
164  return(m_region_vec[caloRegionHash]);
165 }
166 
167 //----------------------------------------------------------------------------
168 inline Identifier
169 CaloCell_Base_ID::region_id (const int subCalo,
170  const IdentifierHash subCaloRegionHash) const
171 {
172  return(m_region_vec[subCaloRegionHash + m_reg_min[subCalo]]);
173 }
174 
175 //----------------------------------------------------------------------------
176 inline Identifier
177 CaloCell_Base_ID::cell_id (const IdentifierHash caloCellHash) const
178 {
179  return(m_cell_vec[caloCellHash]);
180 }
181 
182 //----------------------------------------------------------------------------
183 inline Identifier
184 CaloCell_Base_ID::cell_id (const int subCalo, const IdentifierHash subCaloCellHash) const
185 {
186  return(m_cell_vec[subCaloCellHash + m_cell_min[subCalo]]);
187 }
188 
189 //----------------------------------------------------------------------------
190 inline IdentifierHash
191 CaloCell_Base_ID::calo_region_hash (const Identifier regionId) const
192 {
193  std::vector<Identifier>::const_iterator it = std::lower_bound(m_region_vec.begin(),m_region_vec.end(),regionId);
194  if ( it != m_region_vec.end() ){
195  return (it - m_region_vec.begin());
196  }
197  return (NOT_VALID);
198 }
199 
200 //----------------------------------------------------------------------------
201 inline IdentifierHash
202 CaloCell_Base_ID::subcalo_region_hash (const Identifier regionId, int& subCalo) const
203 {
204  subCalo = LAREM ;
205  if(is_hec(regionId)) {
206  subCalo = LARHEC ;
207  }
208  else if (is_minifcal(regionId)) {
209  // must do minifcal before fcal because miniFCAL IS FCAL
210  subCalo = LARMINIFCAL ;
211  }
212  else if (is_fcal(regionId)) {
213  subCalo = LARFCAL ;
214  }
215  else if (is_tile(regionId)) {
216  subCalo = TILE ;
217  }
218  std::vector<Identifier>::const_iterator it = std::lower_bound(m_region_vec.begin(),m_region_vec.end(),regionId);
219  if ( it != m_region_vec.end() ){
220  return (it - m_region_vec.begin() - m_reg_min[subCalo]);
221  }
222  return (NOT_VALID);
223 }
224 
225 //----------------------------------------------------------------------------
226 inline IdentifierHash
227 CaloCell_Base_ID::subcalo_cell_hash (const Identifier cellId, int& subCalo) const
228 {
229  subCalo = get_subcalo (cellId);
230  switch (subCalo) {
231 
232  // LArEM / HEC have subdetector-specific optimized methods.
233  case LAREM:
234  return m_emHelper->channel_hash (cellId);
235  case LARHEC:
236  return m_hecHelper->channel_hash (cellId);
237  case LARFCAL:
238  case TILE:
239  case LARMINIFCAL:
240  return m_helpers[subCalo]->channel_hash (cellId);
241  default:
242  return NOT_VALID;
243  }
244 }
245 
246 //----------------------------------------------------------------------------
247 inline IdentifierHash
248 CaloCell_Base_ID::calo_cell_hash (const Identifier cellId) const
249 {
250  int subcalo;
251  IdentifierHash hash = subcalo_cell_hash (cellId, subcalo);
252  if (hash != NOT_VALID)
253  return m_cell_min[subcalo] + hash;
254  return NOT_VALID;
255 }
256 
257 //----------------------------------------------------------------------------
258 inline CaloCell_Base_ID::size_type CaloCell_Base_ID::calo_cell_hash_max () const
259 {
260  return m_cell_hash_max;
261 }
262 
263 //----------------------------------------------------------------------------
264 inline CaloCell_Base_ID::size_type CaloCell_Base_ID::calo_region_hash_max () const
265 {
266  return m_region_hash_max;
267 }
268 
269 //----------------------------------------------------------------------------
270 inline void CaloCell_Base_ID::calo_cell_hash_range (const Identifier id, IdentifierHash& caloCellMin, IdentifierHash& caloCellMax) const
271 {
272  if(m_emHelper->is_lar_em(id)) {
273  caloCellMin = m_cell_min[LAREM];
274  caloCellMax = m_cell_max[LAREM];
275  }
276  else if(m_emHelper->is_lar_hec(id)) {
277  caloCellMin = m_cell_min[LARHEC];
278  caloCellMax = m_cell_max[LARHEC];
279  }
280  else if(m_emHelper->is_lar_minifcal(id)) {
281  // must do minifcal before fcal because miniFCAL IS FCAL
282  caloCellMin = m_cell_min[LARMINIFCAL];
283  caloCellMax = m_cell_max[LARMINIFCAL];
284  }
285  else if(m_emHelper->is_lar_fcal(id)) {
286  caloCellMin = m_cell_min[LARFCAL];
287  caloCellMax = m_cell_max[LARFCAL];
288  }
289  else if(m_emHelper->is_tile(id)) {
290  caloCellMin = m_cell_min[TILE];
291  caloCellMax = m_cell_max[TILE];
292  }
293  else {
294  caloCellMin = NOT_VALID;
295  caloCellMax = NOT_VALID;
296  }
297 }
298 
299 //----------------------------------------------------------------------------
300 inline void CaloCell_Base_ID::calo_reg_hash_range (const Identifier id, IdentifierHash& caloRegMin, IdentifierHash& caloRegMax) const
301 {
302  if(m_emHelper->is_lar_em(id)) {
303  caloRegMin = m_reg_min[LAREM];
304  caloRegMax = m_reg_max[LAREM];
305  }
306  else if(m_emHelper->is_lar_hec(id)) {
307  caloRegMin = m_reg_min[LARHEC];
308  caloRegMax = m_reg_max[LARHEC];
309  }
310  else if(m_emHelper->is_lar_minifcal(id)) {
311  // must do minifcal before fcal because miniFCAL IS FCAL
312  caloRegMin = m_reg_min[LARMINIFCAL];
313  caloRegMax = m_reg_max[LARMINIFCAL];
314  }
315  else if(m_emHelper->is_lar_fcal(id)) {
316  caloRegMin = m_reg_min[LARFCAL];
317  caloRegMax = m_reg_max[LARFCAL];
318  }
319  else if(m_emHelper->is_tile(id)) {
320  caloRegMin = m_reg_min[TILE];
321  caloRegMax = m_reg_max[TILE];
322  }
323  else {
324  caloRegMin = NOT_VALID;
325  caloRegMax = NOT_VALID;
326  }
327 }
328 
329 //----------------------------------------------------------------------------
330 inline void CaloCell_Base_ID::calo_cell_hash_range (const int subCalo, IdentifierHash& caloCellMin, IdentifierHash& caloCellMax) const
331 {
332  caloCellMin = m_cell_min[subCalo];
333  caloCellMax = m_cell_max[subCalo];
334 }
335 
336 //----------------------------------------------------------------------------
337 inline void CaloCell_Base_ID::calo_reg_hash_range (const int subCalo, IdentifierHash& caloRegMin, IdentifierHash& caloRegMax) const
338 {
339  caloRegMin = m_reg_min[subCalo];
340  caloRegMax = m_reg_max[subCalo];
341 }
342 
343 //----------------------------------------------------------------------------
344 inline IdentifierHash CaloCell_Base_ID::subcalo_cell_hash ( const IdentifierHash caloHash, int& subCalo) const
345 {
346  if(caloHash < m_cell_max[LAREM]) {
347  subCalo = LAREM;
348  }
349  else if(caloHash < m_cell_max[LARHEC] ) {
350  subCalo = LARHEC;
351  }
352  else if(caloHash < m_cell_max[LARFCAL] ) {
353  subCalo = LARFCAL;
354  }
355  else if(caloHash < m_cell_max[TILE] ) {
356  subCalo = TILE;
357  }
358  else if(caloHash < m_cell_max[LARMINIFCAL] ) {
359  subCalo = LARMINIFCAL;
360  }
361  else {
362  subCalo = NOT_VALID;
363  return(NOT_VALID);
364  }
365  return( caloHash - m_cell_min[subCalo]) ;
366 }
367 
368 //----------------------------------------------------------------------------
369 inline IdentifierHash CaloCell_Base_ID::subcalo_region_hash ( const IdentifierHash caloHash, int& subCalo) const
370 {
371  if(caloHash < m_reg_max[LAREM]) {
372  subCalo = LAREM;
373  }
374  else if(caloHash < m_reg_max[LARHEC] ) {
375  subCalo = LARHEC;
376  }
377  else if(caloHash < m_reg_max[LARFCAL] ) {
378  subCalo = LARFCAL;
379  }
380  else if(caloHash < m_reg_max[TILE] ) {
381  subCalo = TILE;
382  }
383  else if(caloHash < m_reg_max[LARMINIFCAL] ) {
384  subCalo = LARMINIFCAL;
385  }
386  else {
387  subCalo = NOT_VALID;
388  return(NOT_VALID);
389  }
390  return( caloHash - m_reg_min[subCalo]) ;
391 }
392 
393 //----------------------------------------------------------------------------
394 inline IdentifierHash CaloCell_Base_ID::calo_cell_hash (const int subCalo, const IdentifierHash subCaloHash) const
395 {
396  return( subCaloHash + m_cell_min[subCalo]) ;
397 }
398 
399 
400 //----------------------------------------------------------------------------
401 inline IdentifierHash CaloCell_Base_ID::calo_region_hash (const int subCalo, const IdentifierHash subCaloHash) const
402 {
403  return( subCaloHash + m_reg_min[subCalo]) ;
404 }
405 
406 //----------------------------------------------------------------------------
407 inline CaloCell_Base_ID::id_iterator CaloCell_Base_ID::cell_begin () const
408 {
409  return(m_cell_vec.begin());
410 }
411 
412 //----------------------------------------------------------------------------
413 inline CaloCell_Base_ID::id_iterator CaloCell_Base_ID::cell_end () const
414 {
415  return(m_cell_vec.end());
416 }
417 
418 //----------------------------------------------------------------------------
419 inline CaloCell_Base_ID::id_range CaloCell_Base_ID::cell_range () const
420 {
421  return id_range (cell_begin(), cell_end());
422 }
423 
424 //----------------------------------------------------------------------------
425 inline
426 CaloCell_Base_ID::id_iterator
427 CaloCell_Base_ID::cell_begin (const int subCalo) const
428 {
429  return m_helpers[subCalo]->channels().begin();
430 }
431 
432 //----------------------------------------------------------------------------
433 inline
434 CaloCell_Base_ID::id_iterator
435 CaloCell_Base_ID::cell_end (const int subCalo) const
436 {
437  return m_helpers[subCalo]->channels().end();
438 }
439 
440 //----------------------------------------------------------------------------
441 inline
442 CaloCell_Base_ID::id_range
443 CaloCell_Base_ID::cell_range (const int subCalo) const
444 {
445  return m_helpers[subCalo]->channels().range();
446 }
447 
448 //----------------------------------------------------------------------------
449 inline
450 CaloCell_Base_ID::id_iterator
451 CaloCell_Base_ID::reg_begin () const
452 {
453  return(m_region_vec.begin());
454 }
455 
456 //----------------------------------------------------------------------------
457 inline
458 CaloCell_Base_ID::id_iterator
459 CaloCell_Base_ID::reg_end () const
460 {
461  return(m_region_vec.end());
462 }
463 
464 //----------------------------------------------------------------------------
465 inline
466 CaloCell_Base_ID::id_range
467 CaloCell_Base_ID::reg_range () const
468 {
469  return id_range (reg_begin(), reg_end());
470 }
471 
472 //----------------------------------------------------------------------------
473 inline
474 CaloCell_Base_ID::id_iterator
475 CaloCell_Base_ID::reg_begin (const int subCalo) const
476 {
477  return m_helpers[subCalo]->regions().begin();
478 }
479 
480 //----------------------------------------------------------------------------
481 inline
482 CaloCell_Base_ID::id_iterator
483 CaloCell_Base_ID::reg_end (const int subCalo) const
484 {
485  return m_helpers[subCalo]->regions().end();
486 }
487 
488 //----------------------------------------------------------------------------
489 inline
490 CaloCell_Base_ID::id_range
491 CaloCell_Base_ID::reg_range (const int subCalo) const
492 {
493  return m_helpers[subCalo]->regions().range();
494 }
495 
496 //----------------------------------------------------------------------------
497 inline bool CaloCell_Base_ID::is_em(const Identifier id) const
498 {
499  return m_emHelper->is_lar_em(id);
500 }
501 
502 //----------------------------------------------------------------------------
503 inline bool CaloCell_Base_ID::is_em(const IdentifierHash caloHash) const
504 {
505  bool result=false;
506  if(caloHash < m_cell_max[LAREM]) result=true;
507  return result;
508 }
509 
510 //----------------------------------------------------------------------------
511 inline bool CaloCell_Base_ID::is_em_barrel(const Identifier id) const
512 {
513  return m_emHelper->is_em_barrel(id);
514 }
515 
516 //----------------------------------------------------------------------------
517 inline bool CaloCell_Base_ID::is_em_endcap(const Identifier id) const
518 {
519  return m_emHelper->is_em_endcap(id);
520 }
521 
522 //----------------------------------------------------------------------------
523 inline bool CaloCell_Base_ID::is_em_endcap_inner(const Identifier id) const
524 {
525  return m_emHelper->is_em_endcap_inner(id);
526 }
527 
528 //----------------------------------------------------------------------------
529 inline bool CaloCell_Base_ID::is_em_endcap_outer(const Identifier id) const
530 {
531  return m_emHelper->is_em_endcap_outer(id);
532 }
533 
534 //----------------------------------------------------------------------------
535 inline bool CaloCell_Base_ID::is_hec(const Identifier id) const
536 {
537  return m_emHelper->is_lar_hec(id);
538 }
539 
540 //----------------------------------------------------------------------------
541 inline bool CaloCell_Base_ID::is_hec(const IdentifierHash caloHash) const
542 {
543  bool result=false;
544  if(caloHash >= m_cell_min[LARHEC] &&
545  caloHash < m_cell_max[LARHEC] ) result=true;
546  return result;
547 }
548 
549 //----------------------------------------------------------------------------
550 inline bool CaloCell_Base_ID::is_fcal(const Identifier id) const
551 {
552  return m_emHelper->is_lar_fcal(id);
553 }
554 
555 //----------------------------------------------------------------------------
556 inline bool CaloCell_Base_ID::is_fcal(const IdentifierHash caloHash) const
557 {
558  bool result=false;
559  if(caloHash >= m_cell_min[LARFCAL] && caloHash < m_cell_max[LARFCAL] ) result=true;
560  return result;
561 }
562 
563 //----------------------------------------------------------------------------
564 inline bool CaloCell_Base_ID::is_minifcal(const Identifier id) const
565 {
566  return m_emHelper->is_lar_minifcal(id);
567 }
568 
569 //----------------------------------------------------------------------------
570 inline bool CaloCell_Base_ID::is_minifcal(const IdentifierHash caloHash) const
571 {
572  bool result=false;
573  if(caloHash >= m_cell_min[LARMINIFCAL] && caloHash < m_cell_max[LARMINIFCAL] ) result=true;
574  return result;
575 }
576 
577 //----------------------------------------------------------------------------
578 inline bool CaloCell_Base_ID::is_tile(const ExpandedIdentifier& id) const
579 {
580  return m_emHelper->is_tile(id);
581 }
582 
583 //----------------------------------------------------------------------------
584 inline bool CaloCell_Base_ID::is_tile(const Identifier id) const
585 {
586  return m_emHelper->is_tile(id);
587 }
588 
589 //----------------------------------------------------------------------------
590 inline bool CaloCell_Base_ID::is_tile(const IdentifierHash caloHash) const
591 {
592  bool result=false;
593  if(caloHash >= m_cell_min[TILE] && caloHash < m_cell_max[TILE] ) result=true;
594  return result;
595 }
596 
597 //----------------------------------------------------------------------------
598 inline bool CaloCell_Base_ID::is_tile_barrel(const Identifier id) const
599 {
600  return m_tileHelper->is_tile_barrel(id);
601 }
602 
603 //----------------------------------------------------------------------------
604 inline bool CaloCell_Base_ID::is_tile_extbarrel(const Identifier id) const
605 {
606  return m_tileHelper->is_tile_extbarrel(id);
607 }
608 
609 //----------------------------------------------------------------------------
610 inline bool CaloCell_Base_ID::is_tile_gap(const Identifier id) const
611 {
612  return m_tileHelper->is_tile_gap(id);
613 }
614 
615 //----------------------------------------------------------------------------
616 inline bool CaloCell_Base_ID::is_tile_gapscin(const Identifier id) const
617 {
618  return m_tileHelper->is_tile_gapscin(id);
619 }
620 
621 //----------------------------------------------------------------------------
622 inline bool CaloCell_Base_ID::is_tile_positive(const Identifier id) const
623 {
624  return m_tileHelper->is_positive(id);
625 }
626 
627 //----------------------------------------------------------------------------
628 inline bool CaloCell_Base_ID::is_tile_negative(const Identifier id) const
629 {
630  return m_tileHelper->is_negative(id);
631 }
632 
633 //----------------------------------------------------------------------------
634 inline int CaloCell_Base_ID::sub_calo (const Identifier id)const
635 {
636  if(m_emHelper->is_lar_em(id)) {
637  return LAREM;
638  }
639  else if(m_emHelper->is_lar_hec(id)) {
640  return LARHEC;
641  }
642  else if(m_emHelper->is_lar_minifcal(id)) {
643  // must do minifcal before fcal because miniFCAL IS FCAL
644  return LARMINIFCAL;
645  }
646  else if(m_emHelper->is_lar_fcal(id)) {
647  return LARFCAL;
648  }
649  else if(m_emHelper->is_tile(id)) {
650  return TILE;
651  }
652  else {
653  return(NOT_VALID);
654  }
655 }
656 
657 //----------------------------------------------------------------------------
658 inline int CaloCell_Base_ID::sub_calo (const IdentifierHash caloHash)const
659 {
660  int result = NOT_VALID;
661  if(caloHash < m_cell_max[LAREM]) {
662  result = LAREM;
663  }
664  else if(caloHash < m_cell_max[LARHEC] ) {
665  result = LARHEC;
666  }
667  else if(caloHash < m_cell_max[LARFCAL] ) {
668  result = LARFCAL;
669  }
670  else if(caloHash < m_cell_max[TILE] ) {
671  result = TILE;
672  }
673  else if(caloHash < m_cell_max[LARMINIFCAL] ) {
674  result = LARMINIFCAL;
675  }
676  return result;
677 }
678 
679 //----------------------------------------------------------------------------
680 inline int CaloCell_Base_ID::pos_neg (const Identifier id)const
681 {
682  if(m_emHelper->is_lar_em(id)) {
683  return m_emHelper->barrel_ec(id);
684  }
685  else if(m_emHelper->is_lar_hec(id)) {
686  return m_hecHelper->pos_neg(id);
687  }
688  else if(m_emHelper->is_lar_minifcal(id)) {
689  // must do minifcal before fcal because miniFCAL IS FCAL
690  return m_minifcalHelper->pos_neg(id);
691  }
692  else if(m_emHelper->is_lar_fcal(id)) {
693  return m_fcalHelper->pos_neg(id);
694  }
695  else {
696  return(NOT_VALID);
697  }
698 }
699 
700 //----------------------------------------------------------------------------
701 inline int CaloCell_Base_ID::section (const Identifier id)const
702 {
703  if(m_emHelper->is_tile(id)) {
704  return m_tileHelper->section(id);
705  }
706  else {
707  return(NOT_VALID);
708  }
709 }
710 
711 //----------------------------------------------------------------------------
712 inline int CaloCell_Base_ID::sampling (const Identifier id)const
713 {
714  if(m_emHelper->is_lar_em(id)) {
715  return m_emHelper->sampling(id);
716  }
717  else if(m_emHelper->is_lar_hec(id)) {
718  return m_hecHelper->sampling(id);
719  }
720  else if(m_emHelper->is_lar_minifcal(id)) {
721  // must do minifcal before fcal because miniFCAL IS FCAL
722  return m_minifcalHelper->depth(id);
723  }
724  else if(m_emHelper->is_lar_fcal(id)) {
725  return m_fcalHelper->module(id);
726  }
727  else {
728  return(NOT_VALID);
729  }
730 }
731 
732 //----------------------------------------------------------------------------
733 inline int CaloCell_Base_ID::side (const Identifier id)const
734 {
735  if(m_emHelper->is_tile(id)) {
736  return m_tileHelper->side(id);
737  }
738  else {
739  return(NOT_VALID);
740  }
741 }
742 
743 //----------------------------------------------------------------------------
744 inline int CaloCell_Base_ID::region (const Identifier id)const
745 {
746  if(m_emHelper->is_lar_em(id)) {
747  return m_emHelper->region(id);
748  }
749  else if(m_emHelper->is_lar_hec(id)) {
750  return m_hecHelper->region(id);
751  }
752  else {
753  return(NOT_VALID);
754  }
755 }
756 
757 //----------------------------------------------------------------------------
758 inline int CaloCell_Base_ID::module (const Identifier id)const
759 {
760  if(m_emHelper->is_tile(id)) {
761  return m_tileHelper->module(id);
762  }
763  else {
764  return(NOT_VALID);
765  }
766 }
767 
768 //----------------------------------------------------------------------------
769 inline int CaloCell_Base_ID::eta(const Identifier id)const
770 {
771  if(m_emHelper->is_lar_em(id)) {
772  return m_emHelper->eta(id);
773  }
774  else if(m_emHelper->is_lar_hec(id)) {
775  return m_hecHelper->eta(id);
776  }
777  else if(m_emHelper->is_lar_minifcal(id)) {
778  // must do minifcal before fcal because miniFCAL IS FCAL
779  return m_minifcalHelper->eta(id);
780  }
781  else if(m_emHelper->is_lar_fcal(id)) {
782  return m_fcalHelper->eta(id);
783  }
784  else {
785  return(NOT_VALID);
786  }
787 }
788 
789 //----------------------------------------------------------------------------
790 inline int CaloCell_Base_ID::tower(const Identifier id)const
791 {
792  if(m_emHelper->is_tile(id)) {
793  return m_tileHelper->tower(id);
794  }
795  else {
796  return(NOT_VALID);
797  }
798 }
799 
800 //----------------------------------------------------------------------------
801 inline int CaloCell_Base_ID::phi(const Identifier id)const
802 {
803  if(m_emHelper->is_lar_em(id)) {
804  return m_emHelper->phi(id);
805  }
806  else if(m_emHelper->is_lar_hec(id)) {
807  return m_hecHelper->phi(id);
808  }
809  else if(m_emHelper->is_lar_minifcal(id)) {
810  // must do minifcal before fcal because miniFCAL IS FCAL
811  return m_minifcalHelper->phi(id);
812  }
813  else if(m_emHelper->is_lar_fcal(id)) {
814  return m_fcalHelper->phi(id);
815  }
816  else {
817  return(NOT_VALID);
818  }
819 }
820 
821 //----------------------------------------------------------------------------
822 inline int CaloCell_Base_ID::sample(const Identifier id)const
823 {
824  if(m_emHelper->is_tile(id)) {
825  return m_tileHelper->sample(id);
826  }
827  else {
828  return(NOT_VALID);
829  }
830 }
831 
832 //----------------------------------------------------------------------------
833 inline bool CaloCell_Base_ID::is_supercell(const Identifier id)const
834 {
835  if(m_emHelper->is_lar_em(id)) {
836  return m_emHelper->is_supercell(id);
837  }
838  else if(is_hec(id)) {
839  return m_hecHelper->is_supercell(id);
840  }
841  else if(m_emHelper->is_lar_fcal(id)) {
842  return m_fcalHelper->is_supercell(id);
843  }
844  else if(is_tile(id)) {
845  return m_tileHelper->is_supercell(id);
846  }
847 
848  return false;
849 }
850 
851 //----------------------------------------------------------------------------
852 inline int CaloCell_Base_ID::eta_min(const Identifier regId) const
853 {
854  if(m_emHelper->is_lar_em(regId)) {
855  return m_emHelper->eta_min(regId);
856  }
857  else if(m_emHelper->is_lar_hec(regId)) {
858  return m_hecHelper->eta_min(regId);
859  }
860  else if(m_emHelper->is_lar_minifcal(regId)) {
861  // must do minifcal before fcal because miniFCAL IS FCAL
862  return m_minifcalHelper->eta_min(regId);
863  }
864  else if(m_emHelper->is_lar_fcal(regId)) {
865  return m_fcalHelper->eta_min(regId);
866  }
867  else if(m_emHelper->is_tile(regId)) {
868  return m_tileHelper->eta_min(regId);
869  }
870  else {
871  return(NOT_VALID);
872  }
873 }
874 
875 //----------------------------------------------------------------------------
876 inline int CaloCell_Base_ID::eta_max(const Identifier regId) const
877 {
878  if(m_emHelper->is_lar_em(regId)) {
879  return m_emHelper->eta_max(regId);
880  }
881  else if(m_emHelper->is_lar_hec(regId)) {
882  return m_hecHelper->eta_max(regId);
883  }
884  else if(m_emHelper->is_lar_minifcal(regId)) {
885  // must do minifcal before fcal because miniFCAL IS FCAL
886  return m_minifcalHelper->eta_max(regId);
887  }
888  else if(m_emHelper->is_lar_fcal(regId)) {
889  return m_fcalHelper->eta_max(regId);
890  }
891  else if(m_emHelper->is_tile(regId)) {
892  return m_tileHelper->eta_max(regId);
893  }
894  else {
895  return(NOT_VALID);
896  }
897 }
898 
899 //----------------------------------------------------------------------------
900 inline int CaloCell_Base_ID::phi_min(const Identifier regId) const
901 {
902  if(m_emHelper->is_lar_em(regId)) {
903  return m_emHelper->phi_min(regId);
904  }
905  else if(m_emHelper->is_lar_hec(regId)) {
906  return m_hecHelper->phi_min(regId);
907  }
908  else if(m_emHelper->is_lar_minifcal(regId)) {
909  // must do minifcal before fcal because miniFCAL IS FCAL
910  return m_minifcalHelper->phi_min(regId);
911  }
912  else if(m_emHelper->is_lar_fcal(regId)) {
913  return m_fcalHelper->phi_min(regId);
914  }
915  else {
916  return(NOT_VALID);
917  }
918 }
919 
920 //----------------------------------------------------------------------------
921 inline int CaloCell_Base_ID::phi_max(const Identifier regId) const
922 {
923  if(m_emHelper->is_lar_em(regId)) {
924  return m_emHelper->phi_max(regId);
925  }
926  else if(m_emHelper->is_lar_hec(regId)) {
927  return m_hecHelper->phi_max(regId);
928  }
929  else if(m_emHelper->is_lar_minifcal(regId)) {
930  // must do minifcal before fcal because miniFCAL IS FCAL
931  return m_minifcalHelper->phi_max(regId);
932  }
933  else if(m_emHelper->is_lar_fcal(regId)) {
934  return m_fcalHelper->phi_max(regId);
935  }
936  else if(m_emHelper->is_tile(regId)) {
937  return m_tileHelper->phi_max(regId);
938  }
939  else {
940  return(NOT_VALID);
941  }
942 }
943 
944 //----------------------------------------------------------------------------
945 inline float CaloCell_Base_ID::etaGranularity(const Identifier regId) const
946 {
947  int subcalo = 0;
948  IdentifierHash regHash = subcalo_region_hash (regId, subcalo);
949  if (regHash == NOT_VALID) return NOT_VALID;
950  return m_helpers[subcalo]->etaGranularity (regHash);
951 }
952 
953 //----------------------------------------------------------------------------
954 inline float CaloCell_Base_ID::phiGranularity(const Identifier regId) const
955 {
956  int subcalo = 0;
957  IdentifierHash regHash = subcalo_region_hash (regId, subcalo);
958  if (regHash == NOT_VALID) return NOT_VALID;
959  return m_helpers[subcalo]->phiGranularity (regHash);
960 }
961 
962 //----------------------------------------------------------------------------
963 inline float CaloCell_Base_ID::eta0(const Identifier regId) const
964 {
965  int subcalo = 0;
966  IdentifierHash regHash = subcalo_region_hash (regId, subcalo);
967  if (regHash == NOT_VALID) return NOT_VALID;
968  return m_helpers[subcalo]->eta0 (regHash);
969 }
970 
971 //----------------------------------------------------------------------------
972 inline float CaloCell_Base_ID::phi0(const Identifier regId) const
973 {
974  int subcalo = 0;
975  IdentifierHash regHash = subcalo_region_hash (regId, subcalo);
976  if (regHash == NOT_VALID) return NOT_VALID;
977  return m_helpers[subcalo]->phi0 (regHash);
978 }
979 
980 //---------------------------------------------------------------------------
981 inline int CaloCell_Base_ID::GetSubCaloName(const std::string& SubCaloName )const
982 {
983  if(SubCaloName=="LAREM"){
984  return(LAREM);
985  }
986  else if(SubCaloName=="LARHEC"){
987  return(LARHEC);
988  }
989  else if(SubCaloName=="LARMINIFCAL"){
990  return(LARMINIFCAL);
991  }
992  else if(SubCaloName=="LARFCAL"){
993  return(LARFCAL);
994  }
995  else if(SubCaloName=="TILE"){
996  return(TILE);
997  }
998  else{
999  return(NOT_VALID);
1000  }
1001 }
1002 
1003 
1004 //---------------------------------------------------------------------------
1005 inline
1006 CaloCell_Base_ID::SUBCALO
1007 CaloCell_Base_ID::get_subcalo (Identifier id) const
1008 {
1009  if (m_emHelper->is_lar_em(id))
1010  return LAREM;
1011  else if (m_emHelper->is_lar_hec(id))
1012  return LARHEC;
1013  else if (m_emHelper->is_lar_minifcal (id)) {
1014  // must do minifcal before fcal because miniFCAL IS FCAL
1015  return LARMINIFCAL;
1016  }
1017  else if (m_emHelper->is_lar_fcal (id))
1018  return LARFCAL;
1019  else if (m_emHelper->is_tile (id))
1020  return TILE;
1021  return NOT_VALID;
1022 }