ATLAS Offline Software
RALExperimentalHall.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 // RALExperimentalHall
6 // Sep 5 JFB
7 
8 // Fetch parameters from a NOVA database structure.
9 
12 
13 // Athena Service classes
14 #include "GaudiKernel/Bootstrap.h"
15 #include "GaudiKernel/ISvcLocator.h"
16 #include "StoreGate/StoreGateSvc.h"
17 
18 #include "CLHEP/Units/PhysicalConstants.h"
19 
25 
26 #include <cstdlib>
27 #include <iostream>
28 #include <stdexcept>
29 #include <string>
30 
32 
33 public:
34 
35  Clockwork()= default;
36  ~Clockwork()= default;
37 
39 
40 };
41 
42 
44  m_c(new Clockwork())
45 {
46  // First, fetch the Athena services.
47  ISvcLocator* svcLocator = Gaudi::svcLocator();
48 
49  IGeoDbTagSvc* geoDbTagSvc{nullptr};
50  StatusCode sc = svcLocator->service("GeoDbTagSvc",geoDbTagSvc);
51  if (sc != StatusCode::SUCCESS) {
52  throw std::runtime_error ("Cannot locate GeoDBTagSvc");
53  }
54 
55  IRDBAccessSvc* pAccessSvc{nullptr};
56  sc = svcLocator->service(geoDbTagSvc->getParamSvcName(),pAccessSvc);
57  if (sc != StatusCode::SUCCESS) {
58  throw std::runtime_error ("Cannot locate " + geoDbTagSvc->getParamSvcName());
59  }
60 
61  std::string AtlasVersion;
62 
63  if(geoDbTagSvc->getSqliteReader()==nullptr) {
64  // The geometry DB is used
65  IGeoModelSvc* geoModel{nullptr};
66  sc = svcLocator->service ("GeoModelSvc",geoModel);
67  if (sc != StatusCode::SUCCESS) {
68  throw std::runtime_error ("Cannot locate GeoModelSvc");
69  }
70 
71  AtlasVersion = geoModel->atlasVersion();
72  }
73 
74  m_c->atlasMother = pAccessSvc->getRecordsetPtr("AtlasMother",AtlasVersion, "ATLAS");
75 }
76 
77 
79 {
80  delete m_c;
81 }
82 
83 
84 double LArGeo::RALExperimentalHall::GetValue(const std::string& a_name,
85  const int /*a0*/,
86  const int /*a1*/,
87  const int /*a2*/,
88  const int /*a3*/,
89  const int /*a4*/ ) const
90 {
91 
92  if ( a_name == "LArExpHallOutOfTimeCut" ) return 2.5*CLHEP::ns;
93  if ( a_name == "LArExpHallInnerRadius" ) return (*m_c->atlasMother)[1]->getDouble("RMIN")*CLHEP::cm;
94  if ( a_name == "LArExpHallOuterRadius" ) return (*m_c->atlasMother)[1]->getDouble("RMAX")*CLHEP::cm;
95  if ( a_name == "LArExpHallZmax" ) return (*m_c->atlasMother)[1]->getDouble("ZMAX")*CLHEP::cm;
96 
97  // We didn't find a match.
98  std::string errMessage = "RALExperimentalHall::GetValue: could not find a match for the key '" + a_name;
99  std::cerr << errMessage << std::endl;
100  throw std::runtime_error (errMessage.c_str());
101 
102  // Unreached
103 }
LArGeo::RALExperimentalHall::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: RALExperimentalHall.cxx:84
LArGeo::RALExperimentalHall::m_c
Clockwork * m_c
Definition: RALExperimentalHall.h:37
LArGeo::RALExperimentalHall::RALExperimentalHall
RALExperimentalHall()
Definition: RALExperimentalHall.cxx:43
IGeoModelSvc
Definition: IGeoModelSvc.h:17
CSV_InDetExporter.new
new
Definition: CSV_InDetExporter.py:145
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
LArGeo::RALExperimentalHall::Clockwork::~Clockwork
~Clockwork()=default
cm
const double cm
Definition: Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCAL_ChannelMap.cxx:25
LArGeo::RALExperimentalHall::Clockwork
Definition: RALExperimentalHall.cxx:31
EventInfoWrite.AtlasVersion
AtlasVersion
Definition: EventInfoWrite.py:17
IRDBAccessSvc.h
Definition of the abstract IRDBAccessSvc interface.
IRDBAccessSvc
IRDBAccessSvc is an abstract interface to the athena service that provides the following functionalit...
Definition: IRDBAccessSvc.h:45
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
IGeoDbTagSvc
Definition: IGeoDbTagSvc.h:26
IRDBRecordset_ptr
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition: IRDBAccessSvc.h:25
VDetectorParameters.h
LArGeo::RALExperimentalHall::~RALExperimentalHall
virtual ~RALExperimentalHall()
Definition: RALExperimentalHall.cxx:78
LArGeo::RALExperimentalHall::Clockwork::Clockwork
Clockwork()=default
LArGeo::RALExperimentalHall::Clockwork::atlasMother
IRDBRecordset_ptr atlasMother
Definition: RALExperimentalHall.cxx:38
IRDBRecord.h
Definition of the abstract IRDBRecord interface.
python.SystemOfUnits.ns
int ns
Definition: SystemOfUnits.py:130
IRDBRecordset.h
Definition of the abstract IRDBRecordset interface.
IGeoModelSvc.h
StoreGateSvc.h
IGeoDbTagSvc.h
RALExperimentalHall.h