ATLAS Offline Software
Loading...
Searching...
No Matches
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
13
14#include <string>
15
16
18public:
19 // The following enum lists the various calorimeter sampling layers.
20 // Calorimeter. Use this for type safety when calling methods here.
21 //
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
74constexpr
76 return (//EM Barrel
77#define CALOSAMPLING(NAME, ISBARREL, ISENDCAP) (((unsigned)ISBARREL)<<NAME) |
78#include "CaloGeoHelpers/CaloSampling.def"
79#undef CALOSAMPLING
80 0 );
81}
82
83constexpr
85 return (//EMEC:
86#define CALOSAMPLING(NAME, ISBARREL, ISENDCAP) (((unsigned)ISENDCAP)<<NAME) |
87#include "CaloGeoHelpers/CaloSampling.def"
88#undef CALOSAMPLING
89 0 );
90}
91
92#endif /* CALOSAMPLING_H */
CaloCell_ID::CaloSample CaloSample
@ Unknown
Definition TruthClasses.h:9
static CaloSample getSampling(const std::string &name)
Return the sampling code for a given name.
static constexpr unsigned int barrelPattern()
Get the bit-pattern for barrel samplings.
static std::string getSamplingName(CaloSample theSample)
Returns a string (name) for each CaloSampling.
static constexpr unsigned int endcapPattern()
Get the bit-pattern for endcap samplings.
static constexpr unsigned int getNumberOfSamplings()
Get number of available samplings.
static unsigned int getSamplingPattern(const CaloSample s)
Get a unsigned with one bit set.