14 #include "GaudiKernel/Bootstrap.h"
15 #include "GaudiKernel/ISvcLocator.h"
18 #include "CLHEP/Units/PhysicalConstants.h"
56 ISvcLocator* svcLocator = Gaudi::svcLocator();
58 SmartIF<IGeoDbTagSvc> geoDbTagSvc{svcLocator->service(
"GeoDbTagSvc")};
59 if(!geoDbTagSvc.isValid()) {
60 throw std::runtime_error (
"Cannot locate GeoDBTagSvc");
63 SmartIF<IRDBAccessSvc> pAccessSvc{svcLocator->service(geoDbTagSvc->getParamSvcName())};
64 if(!pAccessSvc.isValid()) {
65 throw std::runtime_error (
"Cannot locate " + geoDbTagSvc->getParamSvcName());
68 std::string detectorKey;
69 std::string detectorNode;
71 if(geoDbTagSvc->getSqliteReader()==
nullptr) {
73 SmartIF<IGeoModelSvc> geoModel{svcLocator->service(
"GeoModelSvc")};
74 if(!geoModel.isValid()) {
75 throw std::runtime_error (
"Cannot locate GeoModelSvc");
79 std::string LArVersion = geoModel->LAr_VersionOverride();
81 detectorKey = LArVersion.empty() ?
AtlasVersion : LArVersion;
82 detectorNode = LArVersion.empty() ?
"ATLAS" :
"LAr";
85 if ( LArVersion.empty()) {
86 LArVersion=pAccessSvc->getChildTag(
"LAr",
AtlasVersion,
"ATLAS");
91 if (LArVersion ==
"LAr-00" || LArVersion ==
"LAr-01" ||
92 LArVersion ==
"LAr-Rome-Initial-00" ||
93 LArVersion ==
"LAr-H6-00" ||
94 LArVersion ==
"LAr-Commissioning-00" ||
95 LArVersion ==
"LAr-G3-00") {
97 log << MSG::INFO <<
" in RALEmb: old database tag used, some values are hard coded" <<
endmsg;
98 log << MSG::INFO <<
" Non projectivity of lead transition will not be simulated " <<
endmsg;
101 if (LArVersion ==
"LAr-00" || LArVersion ==
"LAr-01" || LArVersion ==
"LAr-02" ||
102 LArVersion ==
"LAr-Rome-Initial-00" ||
103 LArVersion ==
"LAr-H8-00" ||
104 LArVersion ==
"LAr-H6-00" ||
105 LArVersion ==
"LAr-Commissioning-00" ||
106 LArVersion ==
"LAr-G3-00") {
108 log << MSG::INFO <<
" in RALEmb: only old sagging values available" <<
endmsg;
111 if (LArVersion ==
"LAr-00" || LArVersion ==
"LAr-01" || LArVersion ==
"LAr-02" ||
112 LArVersion ==
"LAr-03" || LArVersion ==
"LAr-04" ||
113 LArVersion ==
"LAr-Rome-Initial-00" ||
114 LArVersion ==
"LAr-H8-00" ||
115 LArVersion ==
"LAr-H6-00" ||
116 LArVersion ==
"LAr-Commissioning-00" ||
117 LArVersion ==
"LAr-Commissioning-01" ||
118 LArVersion ==
"LAr-G3-00" ||
119 LArVersion ==
"LAr-02-Align-00" ||
120 LArVersion ==
"LAr-02-Align-01" ||
121 LArVersion ==
"LAr-H6-2002-00" ||
122 LArVersion ==
"LAr-H6-2003-00" ||
123 LArVersion ==
"LAr-TBEC-00" ) {
129 m_c->
barrelGeometry = pAccessSvc->getRecordsetPtr(
"BarrelGeometry",detectorKey, detectorNode);
130 m_c->
barrelSagging = pAccessSvc->getRecordsetPtr(
"BarrelSagging",detectorKey, detectorNode);
132 m_c->
barrelMotherboards = pAccessSvc->getRecordsetPtr(
"BarrelMotherboards",detectorKey, detectorNode);
133 m_c->
barrelLongDiv = pAccessSvc->getRecordsetPtr(
"BarrelLongDiv",detectorKey, detectorNode);
134 m_c->
presamplerGeometry = pAccessSvc->getRecordsetPtr(
"PresamplerGeometry",detectorKey, detectorNode);
155 std::ostringstream A0STR;
157 const std::string A0 = A0STR.str();
159 if ( a_name ==
"LArEMBnoOFPhysPhiCell" )
return (*m_c->barrelGeometry)[0]->getInt(
"NCELMX");
161 if ( a_name ==
"LArEMBAbsPhiFirst" )
return (*m_c->barrelGeometry)[0]->getDouble(
"PHIFIRST");
162 if ( a_name ==
"LArEMBPhiGapWidth" )
return (*m_c->barrelGeometry)[0]->getDouble(
"PHIGAP")*
CLHEP::cm;
163 if ( a_name ==
"LArEMBPhiGapAperture" )
return (*m_c->barrelGeometry)[0]->getDouble(
"ALFA")*
CLHEP::deg;
164 if ( a_name ==
"LArEMBMotherRmin" )
return (*m_c->barrelGeometry)[0]->getDouble(
"RMIN")*
CLHEP::cm;
165 if ( a_name ==
"LArEMBMotherRmax" )
return (*m_c->barrelGeometry)[0]->getDouble(
"RMAX")*
CLHEP::cm;
166 if ( a_name ==
"LArEMBFiducialRmax" )
return (*m_c->barrelGeometry)[0]->getDouble(
"ROUT_AC")*
CLHEP::cm;
167 if ( a_name ==
"LArEMBMotherZmin" )
return (*m_c->barrelGeometry)[0]->getDouble(
"ZMIN")*
CLHEP::cm;
168 if ( a_name ==
"LArEMBMotherZmax" )
return (*m_c->barrelGeometry)[0]->getDouble(
"ZMAX")*
CLHEP::cm;
169 if ( a_name ==
"LArEMBnoOFAccZigs" )
return (*m_c->barrelGeometry)[0]->getInt(
"NBRT");
170 if ( a_name ==
"LArEMBnoOFAccSamps" )
return (*m_c->barrelGeometry)[0]->getInt(
"NSTAMX");
171 if ( a_name ==
"LArEMBInnerElectronics" )
return (*m_c->barrelGeometry)[0]->getDouble(
"XEL1")*
CLHEP::cm;
172 if ( a_name ==
"LArEMBLArGapTail" )
return (*m_c->barrelGeometry)[0]->getDouble(
"XTAL")*
CLHEP::cm;
173 if ( a_name ==
"LArEMBG10SupportBarsIn" )
return (*m_c->barrelGeometry)[0]->getDouble(
"XG10")*
CLHEP::cm;
174 if ( a_name ==
"LArEMBG10SupportBarsOut" )
return (*m_c->barrelGeometry)[0]->getDouble(
"XGSB")*
CLHEP::cm;
175 if ( a_name ==
"LArEMBZmin" )
return (*m_c->barrelGeometry)[0]->getDouble(
"ZMIN")*
CLHEP::cm;
176 if ( a_name ==
"LArEMBZmax" )
return (*m_c->barrelGeometry)[0]->getDouble(
"ZMAX")*
CLHEP::cm;
177 if ( a_name ==
"LArEMBAccTrackMin" )
return (*m_c->barrelGeometry)[0]->getDouble(
"RHOMIN")*
CLHEP::cm;
178 if ( a_name ==
"LArEMBRadiusInnerAccordion" )
return (*m_c->barrelGeometry)[0]->getDouble(
"RIN_AC")*
CLHEP::cm;
179 if ( a_name ==
"LArEMBRadiusOuterAccordion" )
return (*m_c->barrelGeometry)[0]->getDouble(
"ROUT_AC")*
CLHEP::cm;
180 if ( a_name ==
"LArEMBMaxEtaAcceptance" )
return (*m_c->barrelGeometry)[0]->getDouble(
"ETACUT");
181 if ( a_name ==
"LArEMBThickEtaAcceptance" )
return (*m_c->barrelGeometry)[0]->getDouble(
"ETACU1");
182 if ( a_name ==
"LArEMBRadiusAtCurvature" )
return (*m_c->barrelGeometry)[0]->getDouble(
"RHOCEN"+A0)*
CLHEP::cm;
183 if ( a_name ==
"LArEMBPhiAtCurvature" )
return (*m_c->barrelGeometry)[0]->getDouble(
"PHICEN"+A0)*
CLHEP::deg;
184 if ( a_name ==
"LArEMBDeltaZigAngle" )
return (*m_c->barrelGeometry)[0]->getDouble(
"DELTA"+A0)*
CLHEP::deg;
185 if ( a_name ==
"LArEMBNeutFiberRadius" )
return (*m_c->barrelGeometry)[0]->getDouble(
"RINT")*
CLHEP::cm;
186 if ( a_name ==
"LArEMBLeadTipThickFront" )
return (*m_c->barrelGeometry)[0]->getDouble(
"XTIP_PB")*
CLHEP::cm;
187 if ( a_name ==
"LArEMBLeadTipThickEnd" )
return (*m_c->barrelGeometry)[0]->getDouble(
"XTIP_PC")*
CLHEP::cm;
188 if ( a_name ==
"LArEMBG10TipThickFront" )
return (*m_c->barrelGeometry)[0]->getDouble(
"XTIP_GT")*
CLHEP::cm;
189 if ( a_name ==
"LArEMBG10TipThickEnd" )
return (*m_c->barrelGeometry)[0]->getDouble(
"XTIP_GS")*
CLHEP::cm;
190 if ( a_name ==
"LArEMBThinAbsGlue" )
return (*m_c->barrelGeometry)[0]->getDouble(
"TGGL")*
CLHEP::cm;
191 if ( a_name ==
"LArEMBThinAbsIron" )
return (*m_c->barrelGeometry)[0]->getDouble(
"TGFE")*
CLHEP::cm;
192 if ( a_name ==
"LArEMBThinAbsLead" )
return (*m_c->barrelGeometry)[0]->getDouble(
"TGPB")*
CLHEP::cm;
193 if ( a_name ==
"LArEMBThickAbsGlue" )
return (*m_c->barrelGeometry)[0]->getDouble(
"THGL")*
CLHEP::cm;
194 if ( a_name ==
"LArEMBThickAbsIron" )
return (*m_c->barrelGeometry)[0]->getDouble(
"THFE")*
CLHEP::cm;
195 if ( a_name ==
"LArEMBThickAbsLead" )
return (*m_c->barrelGeometry)[0]->getDouble(
"THPB")*
CLHEP::cm;
196 if ( a_name ==
"LArEMBThickElecCopper" )
return (*m_c->barrelGeometry)[0]->getDouble(
"THCU")*
CLHEP::cm;
197 if ( a_name ==
"LArEMBThickElecKapton" )
return (*m_c->barrelGeometry)[0]->getDouble(
"THFG")*
CLHEP::cm;
198 if ( a_name ==
"LArEMBRminHighZ" ) {
199 if (!m_oldDB)
return (*m_c->barrelGeometry)[0]->getDouble(
"RMINHIGHZ")*
CLHEP::cm;
202 if ( a_name ==
"LArEMBDeltaRS12" ) {
203 if (!m_oldDB)
return (*m_c->barrelGeometry)[0]->getDouble(
"DELTARS12")*
CLHEP::cm;
206 if ( a_name ==
"LArEMBphiMaxBarrel" ) {
207 if (!m_oldDB)
return (*m_c->barrelGeometry)[0]->getDouble(
"PHIMAXBARREL");
210 if ( a_name ==
"LArEMBG10FrontDeltaZ" ) {
211 if (!m_oldDB)
return (*m_c->barrelGeometry)[0]->getDouble(
"G10FRONTDELTAZ")*
CLHEP::cm;
221 if ( a_name ==
"LArEMBSaggingAmplitude" ) {
222 return (*m_c->barrelSagging)[0]->getDouble(
"SAG"+A0)*
CLHEP::cm;
224 if ( a_name ==
"LArEMBSaggingAmplitude2" ) {
225 if (!m_oldSagging)
return (*m_c->barrelSagging)[0]->getDouble(
"SAG"+A0+
"_X")*
CLHEP::cm;
235 if ( a_name ==
"LArEMBmasspercentCu" )
return (*m_c->barrelAccordionCables)[0]->getDouble(
"PERCU");
236 if ( a_name ==
"LArEMBmasspercentKap" )
return (*m_c->barrelAccordionCables)[0]->getDouble(
"PERKAP");
237 if ( a_name ==
"LArEMBCablethickat0" )
return (*m_c->barrelAccordionCables)[0]->getDouble(
"THICKIN")*
CLHEP::cm;
238 if ( a_name ==
"LArEMBthickincrfac" )
return (*m_c->barrelAccordionCables)[0]->getDouble(
"THICKFAC")*
CLHEP::cm;
239 if ( a_name ==
"LArEMBCableEtaheight" )
return (*m_c->barrelAccordionCables)[0]->getDouble(
"HEIGHT")*
CLHEP::cm;
240 if ( a_name ==
"LArEMBnoOFcableBundle" )
return (*m_c->barrelAccordionCables)[0]->getInt(
"ACCORCAB");
241 if ( a_name ==
"LArEMBCablclearfrPS" )
return (*m_c->barrelAccordionCables)[0]->getDouble(
"CLEARANCE")*
CLHEP::cm;
245 if ( a_name ==
"LArEMBEpoxyVolumicMass" )
return (*m_c->barrelMotherboards)[0]->getDouble(
"DG10")*(
CLHEP::g/
CLHEP::cm3);
246 if ( a_name ==
"LArEMBCuThickness" )
return (*m_c->barrelMotherboards)[0]->getDouble(
"THICU")*
CLHEP::cm;
247 if ( a_name ==
"LArEMBG10Thickness" )
return (*m_c->barrelMotherboards)[0]->getDouble(
"THIG10")*
CLHEP::cm;
248 if ( a_name ==
"LArEMBMoBoTchickness" )
return (*m_c->barrelMotherboards)[0]->getDouble(
"THIMB")*
CLHEP::cm;
249 if ( a_name ==
"LArEMBMoBoHeight" )
return (*m_c->barrelMotherboards)[0]->getDouble(
"HEIGHTMB")*
CLHEP::cm;
250 if ( a_name ==
"LArEMBnoOFmothboard" )
return (*m_c->barrelMotherboards)[0]->getInt(
"MOTHBOAR");
251 if ( a_name ==
"LArEMBMoBoclearfrPS" )
return (*m_c->barrelMotherboards)[0]->getDouble(
"CLEARANCE")*
CLHEP::cm;
256 if ( a_name ==
"LArEMBfiducialMothZmax" )
return (*m_c->barrelLongDiv)[0]->getDouble(
"ZMAXACT")*
CLHEP::cm;
257 if ( a_name ==
"LArEMBfiducialMothZmin" ) {
258 if (!m_oldDB)
return (*m_c->barrelLongDiv)[0]->getDouble(
"ZMINACT")*
CLHEP::cm;
265 if ( a_name ==
"LArEMBarrelRmin" )
return (*m_c->presamplerGeometry)[0]->getDouble(
"RMIN")*
CLHEP::cm;
268 if ( a_name ==
"LArEMBEtaTrans" ) {
269 if (!m_oldDB)
return (*m_c->barrelEtaTrans)[
a0]->getDouble(
"ETATRANS");
274 if (!m_oldContract) {
275 if (a_name ==
"LArEMBAbsorberContraction")
return (*m_c->coldContraction)[0]->getDouble(
"ABSORBERCONTRACTION");
278 if (a_name ==
"LArEMBAbsorberContraction")
return 0.997;
283 std::string errMessage =
"RALEmb::GetValue: could not find a match for the key '" + a_name;
285 throw std::runtime_error(errMessage);