ATLAS Offline Software
Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //Dear emacs, this is -*-c++-*-
6 
7 #ifndef CALOGEOHELPERS_CALOSAMPLING_H
8 #define CALOGEOHELPERS_CALOSAMPLING_H
9 
14 #include <string>
15 
16 
17 class CaloSampling {
18 public:
19  // The following enum lists the various calorimeter sampling layers.
20  // Calorimeter. Use this for type safety when calling methods here.
21  //
22  enum CaloSample {
23 #define CALOSAMPLING(NAME, ISBARREL, ISENDCAP) NAME,
24 #include "CaloGeoHelpers/CaloSampling.def"
25 #undef CALOSAMPLING
26  };
27 
28 
30  static constexpr unsigned int getNumberOfSamplings()
31  {
32  return static_cast<unsigned int>(Unknown);
33  }
34 
36  static unsigned int getSamplingPattern(const CaloSample s) {
37  return (0x1U << s);
38  }
39 
41  static
42  constexpr
43  unsigned int barrelPattern();
44 
46  static
47  constexpr
48  unsigned int endcapPattern();
49 
54  static std::string getSamplingName (CaloSample theSample);
55 
56 
61  static std::string getSamplingName (unsigned int theSample);
62 
63 
70  static CaloSample getSampling (const std::string& name);
71 };
72 
73 
74 constexpr
76  return (//EM Barrel
77 #define CALOSAMPLING(NAME, ISBARREL, ISENDCAP) (((unsigned)ISBARREL)<<NAME) |
78 #include "CaloGeoHelpers/CaloSampling.def"
80  0 );
81 }
82 
83 constexpr
85  return (//EMEC:
86 #define CALOSAMPLING(NAME, ISBARREL, ISENDCAP) (((unsigned)ISENDCAP)<<NAME) |
87 #include "CaloGeoHelpers/CaloSampling.def"
89  0 );
90 }
91 
92 #endif /* CALOSAMPLING_H */
GetLCDefs::Unknown
@ Unknown
Definition: GetLCDefs.h:21
CaloSampling::getSampling
static CaloSample getSampling(const std::string &name)
Return the sampling code for a given name.
Definition: Calorimeter/CaloGeoHelpers/Root/CaloSampling.cxx:32
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
CaloSampling
provides Calorimeter Sampling enum
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:17
CaloSampling::barrelPattern
static constexpr unsigned int barrelPattern()
Get the bit-pattern for barrel samplings.
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:75
CaloSampling::getSamplingPattern
static unsigned int getSamplingPattern(const CaloSample s)
Get a unsigned with one bit set
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:36
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
CALOSAMPLING
#define CALOSAMPLING(NAME, ISBARREL, ISENDCAP)
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:23
python.Include.include
include
Definition: Include.py:319
CaloSampling::endcapPattern
static constexpr unsigned int endcapPattern()
Get the bit-pattern for endcap samplings.
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:84
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
undef
@ undef
Definition: L1CaloPprPlotManager.h:81
CaloSampling::getNumberOfSamplings
static constexpr unsigned int getNumberOfSamplings()
Get number of available samplings.
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:30
CaloSampling::getSamplingName
static std::string getSamplingName(CaloSample theSample)
Returns a string (name) for each CaloSampling.
Definition: Calorimeter/CaloGeoHelpers/Root/CaloSampling.cxx:18