19 #include "GeoModelKernel/GeoElement.h"
20 #include "GeoModelKernel/GeoMaterial.h"
21 #include "GeoModelKernel/GeoFullPhysVol.h"
22 #include "GeoModelKernel/GeoPhysVol.h"
23 #include "GeoModelKernel/GeoVPhysVol.h"
24 #include "GeoModelKernel/GeoLogVol.h"
25 #include "GeoModelKernel/GeoPcon.h"
26 #include "GeoModelKernel/GeoTubs.h"
27 #include "GeoModelKernel/GeoNameTag.h"
28 #include "GeoModelKernel/GeoTransform.h"
29 #include "GeoModelKernel/GeoAlignableTransform.h"
30 #include "GeoModelKernel/GeoIdentifierTag.h"
31 #include "GeoModelKernel/GeoSerialTransformer.h"
32 #include "GeoModelKernel/GeoSerialIdentifier.h"
33 #include "GeoModelKernel/GeoXF.h"
34 #include "GeoModelKernel/GeoDefinitions.h"
35 #include "GeoGenericFunctions/Variable.h"
38 #include "GaudiKernel/MsgStream.h"
39 #include "GaudiKernel/Bootstrap.h"
40 #include "GaudiKernel/SystemOfUnits.h"
56 using GeoTrf::RotateZ3D;
57 using GeoTrf::Translate3D;
58 using GeoTrf::TranslateZ3D;
80 ISvcLocator *svcLocator = Gaudi::svcLocator();
86 SmartIF<StoreGateSvc>
detStore{svcLocator->service(
"DetectorStore")};
88 throw std::runtime_error(
"Error in HECModuleConstruction(ClampBar), cannot access DetectorStore");
94 if (StatusCode::SUCCESS !=
detStore->retrieve(materialManager, std::string(
"MATERIALS"))) {
95 throw std::runtime_error(
"Error in HECModuleConstruction(ClampBar), cannot access Material Manager");
97 const GeoMaterial *
LAr = materialManager->
getMaterial(
"std::LiquidArgon");
98 if (!
LAr)
throw std::runtime_error(
"Error in HECModuleConstruction(ClampBar), std::LiquidArgon is not found.");
99 const GeoMaterial *Iron = materialManager->
getMaterial(
"std::Iron");
100 if (!Iron)
throw std::runtime_error(
"Error in HECModuleConstruction(ClampBar), std::Iron is not found.");
103 SmartIF<IRDBAccessSvc> pAccessSvc{svcLocator->service(
"RDBAccessSvc")};
104 if(!pAccessSvc.isValid()) {
105 throw std::runtime_error (
"Cannot locate RDBAccessSvc!!");
108 SmartIF<IGeoModelSvc> geoModel{svcLocator->service(
"GeoModelSvc")};
109 if(!geoModel.isValid()) {
110 throw std::runtime_error (
"Cannot locate GeoModelSvc!!");
114 std::string LArVersion = geoModel->LAr_VersionOverride();
116 std::string detectorKey = LArVersion.empty() ?
AtlasVersion : LArVersion;
117 std::string detectorNode = LArVersion.empty() ?
"ATLAS" :
"LAr";
119 IRDBRecordset_ptr hecLongitudinalBlock = pAccessSvc->getRecordsetPtr(
"HecLongitudinalBlock",detectorKey, detectorNode);
120 IRDBRecordset_ptr hadronicEndcap = pAccessSvc->getRecordsetPtr(
"HadronicEndcap",detectorKey, detectorNode);
136 double shrinkCold = 1.0;
138 int moduleNumber = (*hadronicEndcap)[0]->getInt(
"NSCT");
139 double moduleRouter = shrinkCold * (*hecLongitudinalBlock)[0]->getDouble(
"BLRMX")*
cm;
140 double modulePhistart = 264.375*
deg;
141 double rOuter = shrinkCold * (*hecLongitudinalBlock)[0]->getDouble(
"BLRMX")*
cm;
142 double moduleDeltaPhi = 2*
M_PI/moduleNumber;
143 m_moduleNumber = moduleNumber;
144 m_moduleRouter = moduleRouter;
145 m_modulePhistart= modulePhistart;
147 m_moduleDeltaPhi= moduleDeltaPhi ;
149 std::string clampName =
"LAr::HEC::Clamp";
150 std::string larName =
"LAr::HEC::Clamp::LiquidArgon";
151 double g4allow = 0.01 *
mm;
152 double extThick = shrinkCold * 37.*
mm;
153 double extLength = shrinkCold * 84.*
mm;
154 double clampWidth = shrinkCold * 147.0 *
mm;
155 double clampThick = shrinkCold * 50.*
mm;
156 double notchLevel = shrinkCold * 25.*
mm;
157 double notchHeight = shrinkCold * 15.*
mm;
159 double notchWidth = shrinkCold * 20.*
mm;
160 double slotWidth = shrinkCold * 20.*
mm;
161 double clampLength = shrinkCold * 815.*
mm;
162 double clampAngle = 2.* asin(clampWidth/(2.*(moduleRouter+clampThick/2.)));
163 double slotAngle = 2.* asin(notchWidth/(2.*(moduleRouter+clampThick/2.)));
165 std::vector<double> notchLocation;
171 notchLocation.push_back(shrinkCold * 200.*
mm);
172 notchLocation.push_back(shrinkCold * 468.*
mm);
173 notchLocation.push_back(shrinkCold * 736.*
mm);
179 notchLocation.push_back(shrinkCold * 201.*
mm);
180 notchLocation.push_back(shrinkCold * 469.*
mm);
181 notchLocation.push_back(shrinkCold * 737.*
mm);
182 clampWidth = shrinkCold * 148.5 *
mm;
183 clampThick = shrinkCold * 98.*
mm;
184 clampLength = shrinkCold * 815.*
mm;
191 notchLocation.push_back(shrinkCold * 363.0*
mm);
192 notchLocation.push_back(shrinkCold * 831.0*
mm);
193 clampLength = shrinkCold * 960.*
mm;
198 notchLocation.push_back(shrinkCold * 364.*
mm);
199 notchLocation.push_back(shrinkCold * 832.*
mm);
200 clampWidth = shrinkCold * 148.5 *
mm;
201 clampThick = shrinkCold * 98.*
mm;
202 clampLength = shrinkCold * 960.*
mm;
203 extLength = shrinkCold * 132.*
mm;
205 notchWidth = shrinkCold * 16.*
mm;
206 notchHeight = shrinkCold * 16.*
mm;
207 notchLevel = shrinkCold * 0.*
mm;
215 std::array<GeoIntrusivePtr<GeoTubs>, 3> clampExt;
216 std::array<GeoIntrusivePtr<GeoLogVol>, 3> logExt;
217 std::array<GeoIntrusivePtr<GeoPhysVol>, 3> physExt;
219 GeoIntrusivePtr<GeoTubs> Notch{
new GeoTubs(moduleRouter+notchLevel+g4allow, moduleRouter+notchLevel+notchHeight-g4allow,
221 modulePhistart-(clampAngle/2.) , clampAngle)};
222 GeoIntrusivePtr<GeoLogVol> logNotch {
new GeoLogVol(larName, Notch,
LAr)};
223 GeoIntrusivePtr<GeoPhysVol> physiNotch{
new GeoPhysVol(logNotch)};
225 GeoIntrusivePtr<GeoTubs> Slot {
new GeoTubs(moduleRouter+g4allow, moduleRouter+notchLevel-g4allow, slotWidth/2. ,
226 modulePhistart-(slotAngle/2.) , slotAngle)};
227 GeoIntrusivePtr<GeoLogVol> logSlot{
new GeoLogVol(larName, Slot,
LAr)};
228 GeoIntrusivePtr<GeoPhysVol> physiSlot{
new GeoPhysVol(logSlot)};
232 GeoIntrusivePtr<GeoTubs> clampBar{};
233 GeoIntrusivePtr<GeoLogVol> logClamp{};
234 GeoIntrusivePtr<GeoPhysVol> physClamp{};
237 clampBar =
new GeoTubs(moduleRouter, moduleRouter+clampThick, clampLength/2. ,
238 modulePhistart-(clampAngle/2.) , clampAngle);
239 logClamp =
new GeoLogVol(clampName, clampBar, Iron);
240 physClamp=
new GeoPhysVol(logClamp);
246 clampBar =
new GeoTubs(moduleRouter, moduleRouter+clampThick, clampLength/2. ,
247 modulePhistart-(clampAngle/2.) , clampAngle);
248 logClamp =
new GeoLogVol(larName, clampBar,
LAr);
249 physClamp=
new GeoPhysVol(logClamp);
252 clampExt[0] =
new GeoTubs(moduleRouter+g4allow, moduleRouter+clampThick-extThick,
253 clampLength/2. , modulePhistart-(clampAngle/2.), clampAngle);
254 clampExt[1] =
new GeoTubs(moduleRouter+clampThick-extThick+g4allow, moduleRouter+clampThick-g4allow,
255 clampLength/2. , modulePhistart, clampAngle/2.);
256 clampExt[2] =
new GeoTubs(moduleRouter+clampThick-extThick+g4allow, moduleRouter+clampThick-g4allow,
257 extLength/2. , modulePhistart, clampAngle/2.);
262 for (
int iext=0; iext<3; iext++){
264 logExt[iext] =
new GeoLogVol(clampName, clampExt[iext], Iron);
265 physExt[iext]=
new GeoPhysVol(logExt[iext]);
269 for (
unsigned int i = 0;
i < notchLocation.size();
i++ )
271 physExt[0]->add(
new GeoIdentifierTag(
i) );
272 physExt[0]->add(
new GeoTransform(Translate3D(0,0,-clampLength/2.+notchLocation[
i])) );
273 physExt[0]->add( physiNotch );
275 physExt[0]->add(
new GeoIdentifierTag(
i) );
276 physExt[0]->add(
new GeoTransform(Translate3D(0,0,-clampLength/2.+notchLocation[
i])) );
277 physExt[0]->add( physiSlot );
283 if (iext==1 && !left) physClamp->add(
new GeoTransform(RotateZ3D(-clampAngle/2.)));
284 else if(iext==2 && left) physClamp->add(
new GeoTransform(TranslateZ3D((clampLength-extLength)/2.)
285 *RotateZ3D(-clampAngle/2.)));
286 else if(iext==2) physClamp->add(
new GeoTransform(TranslateZ3D((clampLength-extLength)/2.)
289 if (left) physClamp->add(
new GeoIdentifierTag(16) );
290 else physClamp->add(
new GeoIdentifierTag(32) );
293 physClamp->add(physExt[iext]);
301 for (
unsigned int i = 0;
i < notchLocation.size();
i++ )
304 physClamp->add(
new GeoIdentifierTag(
i) );
305 physClamp->add(
new GeoTransform(Translate3D(0,0,-clampLength/2.+notchLocation[
i])) );
306 physClamp->add( physiNotch );
312 for (
unsigned int i = 0;
i < notchLocation.size();
i++ )
315 physClamp->add(
new GeoIdentifierTag(
i) );
316 physClamp->add(
new GeoTransform(Translate3D(0,0,-clampLength/2.+notchLocation[
i])) );
317 physClamp->add( physiSlot );
335 double shrinkCold = 1.0 ;
337 std::string clampName =
"LAr::HEC::Clamp";
338 std::string larName =
"LAr::HEC::Clamp::LiquidArgon";
340 double clampLength = shrinkCold * 815.*
mm;
341 double railLength = shrinkCold * 815.*
mm;
342 double railOffset = shrinkCold * 0.*
mm;
344 clampLength = shrinkCold * 960.*
mm;
345 railLength = shrinkCold * 960.*
mm;
346 railOffset = shrinkCold * 0.*
mm;
349 GeoIntrusivePtr<GeoVPhysVol> clampingBar = GetClampingBar(
false,
false);
350 GeoIntrusivePtr<GeoVPhysVol> clampingRailR = GetClampingBar(
true,
false);
351 GeoIntrusivePtr<GeoVPhysVol> clampingRailL = GetClampingBar(
true,
true);
358 GeoIntrusivePtr<GeoTransform>
xt{
new GeoTransform(TranslateZ3D(clampLength/2.))};
359 physiHECWheel->add(
xt);
361 GeoIntrusivePtr<GeoSerialIdentifier> sIC{
new GeoSerialIdentifier(0)};
362 GeoGenfun::Variable IndexC;
366 GeoGenfun::GENFUNCTION ModuleRotationAngleC = -m_modulePhistart+m_moduleDeltaPhi + m_moduleDeltaPhi*IndexC;
367 GeoXF::TRANSFUNCTION tC = GeoXF::Pow(RotateZ3D(1.0),ModuleRotationAngleC);
368 GeoIntrusivePtr<GeoSerialTransformer> sTC{
new GeoSerialTransformer (clampingBar,&tC,((m_moduleNumber/2)-1))};
369 physiHECWheel->add(sIC);
370 physiHECWheel->add(sTC);
374 GeoGenfun::GENFUNCTION ModuleRotationAngleC = -m_modulePhistart-m_moduleDeltaPhi+180*
deg - m_moduleDeltaPhi*IndexC;
375 GeoXF::TRANSFUNCTION tC = GeoXF::Pow(RotateZ3D(1.0),ModuleRotationAngleC);
376 GeoIntrusivePtr<GeoSerialTransformer> sTC{
new GeoSerialTransformer (clampingBar,&tC,((m_moduleNumber/2)-1))};
377 physiHECWheel->add(sIC);
378 physiHECWheel->add(sTC);
382 physiHECWheel->add(
new GeoTransform(TranslateZ3D(railLength/2.-railOffset)*RotateZ3D(-m_modulePhistart-(180.*
deg))));
388 GeoSerialIdentifier *sIR =
new GeoSerialIdentifier(31);
389 physiHECWheel->add(sIR);
391 physiHECWheel->add(clampingRailL);
394 physiHECWheel->add(
xt);
395 GeoGenfun::Variable IndexC2;
399 GeoGenfun::GENFUNCTION ModuleRotationAngleC2 = -m_modulePhistart+m_moduleDeltaPhi-(180.*
deg) + m_moduleDeltaPhi*IndexC2;
400 GeoXF::TRANSFUNCTION tC2 = GeoXF::Pow(RotateZ3D(1.0),ModuleRotationAngleC2);
401 GeoIntrusivePtr<GeoSerialTransformer> sTC2{
new GeoSerialTransformer (clampingBar,&tC2,((m_moduleNumber/2)-1))};
402 physiHECWheel->add(sTC2);
406 GeoGenfun::GENFUNCTION ModuleRotationAngleC2 = -m_modulePhistart-m_moduleDeltaPhi - m_moduleDeltaPhi*IndexC2;
407 GeoXF::TRANSFUNCTION tC2 = GeoXF::Pow(RotateZ3D(1.0),ModuleRotationAngleC2);
408 GeoIntrusivePtr<GeoSerialTransformer> sTC2{
new GeoSerialTransformer (clampingBar,&tC2,((m_moduleNumber/2)-1))};
409 physiHECWheel->add(sTC2);
412 physiHECWheel->add(
new GeoTransform(TranslateZ3D(railLength/2.)*RotateZ3D(-m_modulePhistart)));
415 GeoSerialIdentifier *sIR =
new GeoSerialIdentifier(15);
416 physiHECWheel->add(sIR);
418 physiHECWheel->add(clampingRailR);