ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArGeoModel
LArGeoRAL
src
RALHec.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// RALHec
6
// Sep 5 JFB
7
8
// Fetch parameters from a NOVA database structure.
9
10
#include "
LArGeoRAL/RALHec.h
"
11
#include "
LArGeoCode/VDetectorParameters.h
"
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
20
#include "
RDBAccessSvc/IRDBAccessSvc.h
"
21
#include "
RDBAccessSvc/IRDBRecord.h
"
22
#include "
RDBAccessSvc/IRDBRecordset.h
"
23
24
#include "
GeoModelInterfaces/IGeoModelSvc.h
"
25
#include "
GeoModelInterfaces/IGeoDbTagSvc.h
"
26
27
#include <cstdlib>
28
#include <iostream>
29
#include <stdexcept>
30
#include <string>
31
32
class
LArGeo::RALHec::Clockwork
{
33
34
public
:
35
36
Clockwork
() =
default
;
37
~Clockwork
() =
default
;
38
39
IRDBRecordset_ptr
hadronicEndcap
;
40
IRDBRecordset_ptr
hecGridValues
;
41
IRDBRecordset_ptr
hecLongitudinalBlock
;
42
};
43
44
45
LArGeo::RALHec::RALHec
():
46
m_c
(new
Clockwork
())
47
{
48
// First, fetch the Athena services.
49
ISvcLocator* svcLocator = Gaudi::svcLocator();
50
51
SmartIF<IGeoDbTagSvc> geoDbTagSvc{svcLocator->service(
"GeoDbTagSvc"
)};
52
if
(!geoDbTagSvc.isValid()) {
53
throw
std::runtime_error (
"Cannot locate GeoDBTagSvc"
);
54
}
55
56
SmartIF<IRDBAccessSvc> pAccessSvc{svcLocator->service(geoDbTagSvc->getParamSvcName())};
57
if
(!pAccessSvc.isValid()) {
58
throw
std::runtime_error (
"Cannot locate "
+ geoDbTagSvc->getParamSvcName());
59
}
60
61
std::string detectorKey;
62
std::string detectorNode;
63
64
if
(geoDbTagSvc->getSqliteReader()==
nullptr
) {
65
// The geometry DB is used
66
SmartIF<IGeoModelSvc> geoModel{svcLocator->service(
"GeoModelSvc"
)};
67
if
(!geoModel.isValid()) {
68
throw
std::runtime_error (
"Cannot locate GeoModelSvc"
);
69
}
70
71
std::string AtlasVersion = geoModel->atlasVersion();
72
std::string LArVersion = geoModel->LAr_VersionOverride();
73
74
detectorKey = LArVersion.empty() ? AtlasVersion : LArVersion;
75
detectorNode = LArVersion.empty() ?
"ATLAS"
:
"LAr"
;
76
}
77
78
79
m_c
->hadronicEndcap = pAccessSvc->getRecordsetPtr(
"HadronicEndcap"
,detectorKey, detectorNode);
80
m_c
->hecGridValues = pAccessSvc->getRecordsetPtr(
"HecGridValues"
,detectorKey, detectorNode);
81
m_c
->hecLongitudinalBlock = pAccessSvc->getRecordsetPtr(
"HecLongitudinalBlock"
,detectorKey, detectorNode);
82
83
}
84
85
86
LArGeo::RALHec::~RALHec
()
87
{
88
delete
m_c
;
89
}
90
91
92
double
LArGeo::RALHec::GetValue
(std::string_view a_name,
93
const
int
a0
,
94
const
int
/*a1*/
,
95
const
int
/*a2*/
,
96
const
int
/*a3*/
,
97
const
int
/*a4*/
)
const
98
{
99
100
std::ostringstream A0STR;
101
A0STR <<
"_"
<<
a0
;
102
const
std::string A0 = A0STR.str();
103
104
105
if
( a_name ==
"LArHECmoduleNumber"
)
return
(*
m_c
->hadronicEndcap)[0]->getInt(
"NSCT"
);
106
if
( a_name ==
"LArHECzStart"
)
return
(*
m_c
->hadronicEndcap)[0]->getDouble(
"ZSTART"
)*CLHEP::cm;
107
if
( a_name ==
"LArHECgapSize"
)
return
(*
m_c
->hadronicEndcap)[0]->getDouble(
"LARG"
)*CLHEP::cm;
108
if
( a_name ==
"LArHECbetweenWheel"
)
return
(*
m_c
->hadronicEndcap)[0]->getDouble(
"GAPWHL"
)*CLHEP::cm;
109
if
( a_name ==
"LArHECcopperPad"
)
return
(*
m_c
->hadronicEndcap)[0]->getDouble(
"COPPER"
)*CLHEP::cm;
110
if
( a_name ==
"LArHECplateWidth0"
)
return
(*
m_c
->hadronicEndcap)[0]->getDouble(
"PLATE_0"
)*CLHEP::cm;
111
if
( a_name ==
"LArHECplateWidth1"
)
return
(*
m_c
->hadronicEndcap)[0]->getDouble(
"PLATE_1"
)*CLHEP::cm;
112
if
( a_name ==
"LArHECkaptonPosition"
)
return
(*
m_c
->hadronicEndcap)[0]->getDouble(
"KPTPOS"
+A0)*CLHEP::cm;
113
if
( a_name ==
"LArHECkaptonWidth"
)
return
(*
m_c
->hadronicEndcap)[0]->getDouble(
"KPTWID"
+A0)*CLHEP::cm;
114
if
( a_name ==
"LArHECrodPosY"
)
return
(*
m_c
->hadronicEndcap)[0]->getDouble(
"RODPOSR"
+A0)*CLHEP::cm;
115
if
( a_name ==
"LArHECrodPosX"
)
return
(*
m_c
->hadronicEndcap)[0]->getDouble(
"RODPOSX"
+A0)*CLHEP::cm;
116
if
( a_name ==
"LArHECrodDim"
)
return
(*
m_c
->hadronicEndcap)[0]->getDouble(
"RODDIM"
+A0)*CLHEP::cm;
117
if
( a_name ==
"LArHECspcDim"
)
return
(*
m_c
->hadronicEndcap)[0]->getDouble(
"SPCDIM"
+A0)*CLHEP::cm;
118
119
if
( a_name ==
"LArHECsliceIndex"
)
return
(*
m_c
->hecLongitudinalBlock)[
a0
]->getDouble(
"IBLC"
);
120
if
( a_name ==
"LArHECmoduleRinner1"
)
return
(*
m_c
->hecLongitudinalBlock)[0]->getDouble(
"BLRMN"
)*CLHEP::cm;
121
if
( a_name ==
"LArHECmoduleRinner2"
)
return
(*
m_c
->hecLongitudinalBlock)[1]->getDouble(
"BLRMN"
)*CLHEP::cm;
122
if
( a_name ==
"LArHECmoduleRouter"
)
return
(*
m_c
->hecLongitudinalBlock)[0]->getDouble(
"BLRMX"
)*CLHEP::cm;
123
if
( a_name ==
"LArHECdepthZ"
)
return
(*
m_c
->hecLongitudinalBlock)[
a0
]->getDouble(
"BLDPTH"
)*CLHEP::cm;
124
if
( a_name ==
"LArHECfirstAbsorber"
)
return
(*
m_c
->hecLongitudinalBlock)[
a0
]->getDouble(
"PLATE0"
)*CLHEP::cm;
125
if
( a_name ==
"LArHECgapNumber"
)
return
(*
m_c
->hecLongitudinalBlock)[
a0
]->getDouble(
"BLMOD"
);
126
127
// We didn't find a match.
128
std::string errMessage =
"RALHec::GetValue: could not find a match for the key '"
;
129
errMessage.append(a_name);
130
std::cerr << errMessage << std::endl;
131
throw
std::runtime_error (errMessage.c_str());
132
133
// Unreached.
134
}
IGeoDbTagSvc.h
IGeoModelSvc.h
IRDBAccessSvc.h
Definition of the abstract IRDBAccessSvc interface.
IRDBRecordset_ptr
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition
IRDBAccessSvc.h:30
IRDBRecord.h
Definition of the abstract IRDBRecord interface.
IRDBRecordset.h
Definition of the abstract IRDBRecordset interface.
RALHec.h
StoreGateSvc.h
VDetectorParameters.h
LArGeo::RALHec::Clockwork
Definition
RALHec.cxx:32
LArGeo::RALHec::Clockwork::~Clockwork
~Clockwork()=default
LArGeo::RALHec::Clockwork::hecGridValues
IRDBRecordset_ptr hecGridValues
Definition
RALHec.cxx:40
LArGeo::RALHec::Clockwork::hadronicEndcap
IRDBRecordset_ptr hadronicEndcap
Definition
RALHec.cxx:39
LArGeo::RALHec::Clockwork::hecLongitudinalBlock
IRDBRecordset_ptr hecLongitudinalBlock
Definition
RALHec.cxx:41
LArGeo::RALHec::Clockwork::Clockwork
Clockwork()=default
LArGeo::RALHec::m_c
Clockwork * m_c
Definition
RALHec.h:35
LArGeo::RALHec::GetValue
virtual double GetValue(std::string_view, 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
RALHec.cxx:92
LArGeo::RALHec::RALHec
RALHec()
Definition
RALHec.cxx:45
LArGeo::RALHec::~RALHec
virtual ~RALHec()
Definition
RALHec.cxx:86
a0
double a0
Definition
globals.cxx:27
Generated on
for ATLAS Offline Software by
1.17.0