ATLAS Offline Software
RAL.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "LArGeoRAL/RAL.h"
7 
9 #include "LArGeoRAL/RALEmb.h"
10 #include "LArGeoRAL/RALEmec.h"
11 #include "LArGeoRAL/RALHec.h"
12 
13 #include <cstdlib>
14 #include <iostream>
15 #include <stdexcept>
16 #include <string>
17 
18 namespace LArGeo {
19 
21  : m_ExpHall(new RALExperimentalHall())
22  , m_Emec(new RALEmec())
23  , m_Emb(new RALEmb())
24  , m_Hec(new RALHec())
25  {
26  }
27 
28 
29  RAL::~RAL()
30  = default;
31 
32  double RAL::GetValue(const std::string& a_name,
33  const int a0,
34  const int a1,
35  const int a2,
36  const int a3,
37  const int a4 ) const
38  {
39 
40  // Call the appropriate GetValue() based on the contents of the
41  // string in a_name.
42 
43  // Note: "npos" is defined in the <string> header. If it's the
44  // result of a find() method, then the sub-string was not found.
45 
46  if ( a_name.find("ExpHall") != std::string::npos )
47  return m_ExpHall->GetValue(a_name,a0,a1,a2,a3,a4);
48 
49  if ( a_name.find("EMEC") != std::string::npos )
50  return m_Emec->GetValue(a_name,a0,a1,a2,a3,a4);
51 
52  if ( a_name.find("EMB") != std::string::npos )
53  return m_Emb->GetValue(a_name,a0,a1,a2,a3,a4);
54 
55  if ( a_name.find("HEC") != std::string::npos )
56  return m_Hec->GetValue(a_name,a0,a1,a2,a3,a4);
57 
58 
59  // We didn't find a match. Throw an exception
60  std::string errMessage = "RAL::GetValue: could not find a match for the key '" + a_name;
61  std::cerr << errMessage << std::endl;
62  throw std::runtime_error(errMessage.c_str());
63 
64  // Unreached.
65  }
66 
67 } // namespace LArGeo
LArGeo::RAL::RAL
RAL()
Definition: RAL.cxx:20
LArGeo
Definition: LArDetectorFactory.h:25
LArGeo::RALEmec
Definition: RALEmec.h:20
CSV_InDetExporter.new
new
Definition: CSV_InDetExporter.py:145
LArGeo::RALExperimentalHall
Definition: RALExperimentalHall.h:20
RALEmec.h
LArGeo::RAL::~RAL
virtual ~RAL()
LArGeo::RAL::m_Hec
boost::scoped_ptr< RALHec > m_Hec
Definition: RAL.h:49
RAL.h
RALHec.h
LArGeo::RALHec
Definition: RALHec.h:20
LArGeo::RAL::m_ExpHall
boost::scoped_ptr< RALExperimentalHall > m_ExpHall
Definition: RAL.h:46
LArGeo::RALEmb
Definition: RALEmb.h:20
a0
double a0
Definition: globals.cxx:27
RALEmb.h
VDetectorParameters.h
LArGeo::RAL::GetValue
virtual double GetValue(const std::string &, const int i0=INT_MIN, const int i1=INT_MIN, const int i2=INT_MIN, const int i3=INT_MIN, const int i4=INT_MIN) const override
Definition: RAL.cxx:32
LArGeo::RAL::m_Emb
boost::scoped_ptr< RALEmb > m_Emb
Definition: RAL.h:48
LArGeo::RAL::m_Emec
boost::scoped_ptr< RALEmec > m_Emec
Definition: RAL.h:47
RALExperimentalHall.h