Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Calorimeter/CaloGeoHelpers/Root/CaloSampling.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "CaloGeoHelpers/CaloSampling.h"
6 
7 namespace {
8 
9 const char* const sample_names[] = {
10 #define CALOSAMPLING(name, inbarrel, inendcap) #name ,
11 #include "CaloGeoHelpers/CaloSampling.def"
12 #undef CALOSAMPLING
13 };
14 
15 } // anonymous namespace
16 
17 
19 {
20  return sample_names[theSample];
21 }
22 
23 
24 std::string CaloSampling::getSamplingName (unsigned int theSample)
25 {
26  if (theSample >= getNumberOfSamplings())
27  return "";
28  return sample_names[theSample];
29 }
30 
31 
33 {
34  for (int samp = 0; samp != static_cast<int>(Unknown); ++samp) {
35  if (sample_names[samp] == name) {
36  return static_cast<CaloSample> (samp);
37  }
38  }
39  return Unknown;
40 }
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
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
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