ATLAS Offline Software
Loading...
Searching...
No Matches
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
7namespace {
8
9const 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
24std::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}
@ Unknown
Definition TruthClasses.h:9
static CaloSample getSampling(const std::string &name)
Return the sampling code for a given name.
static std::string getSamplingName(CaloSample theSample)
Returns a string (name) for each CaloSampling.
static constexpr unsigned int getNumberOfSamplings()
Get number of available samplings.