7 #include "GeoModelKernel/GeoElement.h"
8 #include "GeoModelKernel/GeoMaterial.h"
9 #include "GeoModelKernel/GeoFullPhysVol.h"
10 #include "GeoModelKernel/GeoPhysVol.h"
11 #include "GeoModelKernel/GeoVPhysVol.h"
12 #include "GeoModelKernel/GeoLogVol.h"
13 #include "GeoModelKernel/GeoTransform.h"
14 #include "GeoModelKernel/GeoAlignableTransform.h"
15 #include "GeoModelKernel/GeoIdentifierTag.h"
16 #include "GeoModelKernel/GeoNameTag.h"
17 #include "GeoModelKernel/GeoSerialIdentifier.h"
18 #include "GeoModelKernel/GeoSerialTransformer.h"
19 #include "GeoModelKernel/GeoXF.h"
22 #include "GeoModelKernel/GeoPcon.h"
23 #include "GeoModelKernel/GeoTubs.h"
24 #include "GeoModelKernel/GeoCons.h"
25 #include "GeoModelKernel/GeoBox.h"
26 #include "GeoModelKernel/GeoTrap.h"
27 #include "GeoModelKernel/GeoTrd.h"
32 #include "CLHEP/Geometry/Transform3D.h"
33 #include "CLHEP/Vector/Rotation.h"
36 #include "GaudiKernel/PhysicalConstants.h"
37 #include "GaudiKernel/MsgStream.h"
38 #include "GaudiKernel/Bootstrap.h"
43 #include "GeoGenericFunctions/Abs.h"
44 #include "GeoGenericFunctions/Sin.h"
45 #include "GeoGenericFunctions/Cos.h"
46 #include "GeoGenericFunctions/Sqrt.h"
47 #include "GeoGenericFunctions/ATan.h"
48 #include "GeoGenericFunctions/Rectangular.h"
49 #include "GeoGenericFunctions/Mod.h"
50 #include "GeoGenericFunctions/Variable.h"
51 #include "GeoGenericFunctions/FixedConstant.h"
58 m_psPhysicalPos(nullptr),
59 m_psPhysicalNeg(nullptr),
63 ISvcLocator *svcLocator = Gaudi::svcLocator();
65 if (svcLocator->service(
"MessageSvc",
msgSvc,
true )==StatusCode::FAILURE) {
66 throw std::runtime_error(
"Error in BarrelPresamplerConstruction, cannot access MessageSvc");
68 MsgStream
log(
msgSvc,
"BarrelPresamplerConstruction");
73 log <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;
74 log <<
"+ +" << std::endl;
75 log <<
"+ Start of Barrel PS GeoModel definition +" << std::endl;
76 log <<
"+ +" << std::endl;
77 log <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;
80 if (svcLocator->service(
"DetectorStore",
detStore,
false )==StatusCode::FAILURE) {
81 throw std::runtime_error(
"Error in LArDetectorFactory, cannot access DetectorStore");
86 if (StatusCode::SUCCESS !=
detStore->retrieve(materialManager, std::string(
"MATERIALS"))) {
87 throw std::runtime_error(
"Error in BarrelPresamplerConstruction, stored MaterialManager is not found.");
90 const GeoMaterial *Copper = materialManager->
getMaterial(
"std::Copper");
91 if (!Copper)
throw std::runtime_error(
"Error in BarrelPresamplerConstruction, std::Copper is not found.");
93 const GeoMaterial *Iron = materialManager->
getMaterial(
"std::Iron");
94 if (!Iron)
throw std::runtime_error(
"Error in BarrelPresamplerConstruction, std::Iron is not found.");
96 const GeoMaterial *Lead = materialManager->
getMaterial(
"std::Lead");
97 if (!Lead)
throw std::runtime_error(
"Error in BarrelPresamplerConstruction, std::Lead is not found.");
99 const GeoMaterial *
LAr = materialManager->
getMaterial(
"std::LiquidArgon");
100 if (!
LAr)
throw std::runtime_error(
"Error in BarrelPresamplerConstruction, std::LiquidArgon is not found.");
102 const GeoMaterial *Air = materialManager->
getMaterial(
"std::Air");
103 if (!Air)
throw std::runtime_error(
"Error in BarrelPresamplerConstruction, std::Air is not found.");
105 const GeoMaterial *Kapton = materialManager->
getMaterial(
"std::Kapton");
106 if (!Kapton)
throw std::runtime_error(
"Error in BarrelPresamplerConstruction, std::Kapton is not found.");
107 const GeoMaterial *Glue = materialManager->
getMaterial(
"LAr::Glue");
108 if (!Glue)
throw std::runtime_error(
"Error in BarrelPresamplerConstruction, LAr::Glue is not found.");
110 const GeoMaterial *G10 = materialManager->
getMaterial(
"LAr::G10");
111 if (!G10)
throw std::runtime_error(
"Error in BarrelPresamplerConstruction, LAr::G10 is not found.");
113 const GeoMaterial *FR4 = materialManager->
getMaterial(
"LAr::FR4");
114 if (!FR4)
throw std::runtime_error(
"Error in BarrelPresamplerConstruction, LAr::FR4 is not found.");
116 const GeoMaterial *MBMat = materialManager->
getMaterial(
"LAr::MBMat");
117 if (!MBMat)
throw std::runtime_error(
"Error in BarrelPresamplerConstruction, LAr::MBMat is not found.");
119 const GeoMaterial *AnodeMat = materialManager->
getMaterial(
"LAr::AnodeMat");
120 if (!AnodeMat)
throw std::runtime_error(
"Error in BarrelPresamplerConstruction, LAr::AnodeMat is not found.");
122 const GeoMaterial *CathodeMat = materialManager->
getMaterial(
"LAr::CathodeMat");
123 if (!CathodeMat)
throw std::runtime_error(
"Error in BarrelPresamplerConstruction, LAr::CathodeMat is not found.");
125 const GeoMaterial *ConnecMat = materialManager->
getMaterial(
"LAr::ConnecMat");
126 if (!ConnecMat)
throw std::runtime_error(
"Error in BarrelPresamplerConstruction, LAr::ConnecMat is not found.");
200 std::string
basename =
"LAr::Barrel::Presampler";
202 GeoTubs *tubs =
new GeoTubs(rMinPresamplerMother, rMaxPresamplerMother, presamplerMother_length,Phi_min, Phi_span);
203 GeoLogVol* logVol =
new GeoLogVol(
basename,tubs,
LAr);
217 for(
int ii=0; ii<8; ii++ ) mod_leng[ii]=
mod[ii][0]*cmm+2*epsil;
225 double bigLength = 277.5;
226 double prep1_height = (smallLength/2+1.)*cmm;
228 mod_heig[0]= (larheight+prep1_th+prep2_th)*cmm+4*epsil;
229 mod_heig[1]= (larheight2+prep1_th+prep2_th)*cmm+5.*epsil;
230 for(
int i=2;
i<8;
i++ ) mod_heig[
i] = mod_heig[0];
237 double mb_length = 3100.3;
238 double sector_length = mb_length*cmm +9.*epsil;
239 double sector_height = mod_heig[0]+(shell_th+rail_th)*cmm+mech_clear*
Gaudi::Units::mm+3*epsil;
241 unsigned int nsectors=32;
242 double mod_xm = prep1_height+epsil;
244 double sect_xm = mod_xm+epsil;
248 double zpres = -presamplerMother_length+sector_length/2+epsil;
250 GeoTrd *trd =
new GeoTrd(sect_xm, sect_xp, sector_length/2, sector_length/2, sector_height/2);
252 GeoLogVol *logVol =
new GeoLogVol (
basename+
"::Sector",trd,
LAr);
253 GeoPhysVol *sectorPhysVol =
new GeoPhysVol(logVol);
255 GeoGenfun::Variable
I;
257 GeoGenfun::GENFUNCTION
f = dphiSector*
I+0.5*dphiSector;
258 GeoXF::TRANSFUNCTION
t = GeoXF::Pow(GeoTrf::RotateZ3D(1.0),
f)*GeoTrf::TranslateX3D(rpres)*GeoTrf::TranslateZ3D(zpres)*GeoTrf::RotateZ3D(90*
Gaudi::Units::deg)*GeoTrf::RotateX3D(90*
Gaudi::Units::deg);
259 GeoSerialTransformer *st =
new GeoSerialTransformer(sectorPhysVol,&
t, nbsectors);
274 mod_leng[0]=mod_leng[0]-delta01;
275 mod_leng[1]=mod_leng[1]+delta01;
276 GeoIntrusivePtr<GeoPhysVol> pvModule[8];
279 double modYPrev=0, modLenPrev=0;
280 for (
int m=0;
m<8;
m++) {
283 double modLen=mod_leng[
m];
286 double modY= (
m==0) ? -sector_length/2+modLen/2+epsil : modYPrev + modLenPrev /2 + modLen/2 +epsil;
287 double modZ= (
m==1) ? -sector_height/2+shell_th*cmm+mech_clear+mod_heig[0]/2+epsil+(mod_heig[0]-mod_heig[1])/2 : -sector_height/2+shell_th*cmm+mech_clear+mod_heig[0]/2+epsil;
289 GeoTrd * trd =
new GeoTrd(mod_xm,mod_xp,modLen/2,modLen/2,mod_heig[
m]/2);
290 GeoLogVol *logVol =
new GeoLogVol(
basename+
"::Module",trd,
LAr);
291 pvModule[
m] =
new GeoPhysVol(logVol);
293 GeoTransform *xf =
new GeoTransform(GeoTrf::Translate3D(0.0, modY, modZ));
294 sectorPhysVol->add(xf);
295 sectorPhysVol->add(pvModule[
m]);
304 double prot_y = (shell_leng/2)*cmm;
306 double glY = -sector_length/2+prot_y+epsil;
310 GeoBox *box =
new GeoBox((smallLength/2+1.)*cmm, (shell_leng/2)*cmm,(shell_th/2)*cmm);
311 GeoLogVol *logVol=
new GeoLogVol(
basename+
"::ProtectionShell",box,FR4);
312 GeoIntrusivePtr<GeoPhysVol>physVol =
new GeoPhysVol(logVol);
314 double glZ = -sector_height/2+(shell_th/2)*cmm+epsil;
316 GeoTransform *xf =
new GeoTransform(GeoTrf::Translate3D(glX,glY, glZ));
317 sectorPhysVol->add(xf);
318 sectorPhysVol->add(physVol);
322 double rail_pos = 22.;
323 double rail_width = 24.;
324 double prot_th = 0.5;
325 double widthFront = 2.8;
326 double mb_width = 169.;
327 double heightIn = 1.5;
328 double heightOut = 5.;
330 double modz[8], mody[8];
331 mody[0] = -sector_length/2+mod_leng[0]/2+epsil;
332 modz[0] = -sector_height/2+shell_th*cmm+mech_clear+mod_heig[0]/2+epsil;
333 modz[1] = modz[0]+(mod_heig[0]-mod_heig[1])/2;
334 for(
int i=1;
i<8;
i++)
335 mody[
i] = mody[
i-1]+mod_leng[
i-1]/2+mod_leng[
i]/2+epsil;
337 for(
int i=2;
i<8;
i++) modz[
i]= modz[0];
339 double mbZ = modz[0]+mod_heig[0]/2+(mb_th/2)*cmm+epsil;
343 GeoBox* MB =
new GeoBox((mb_width/2)*cmm,(mb_length/2)*cmm,(mb_th/2)*cmm);
344 GeoLogVol *logVol=
new GeoLogVol(
basename+
"::MotherBoard",MB,MBMat);
345 GeoIntrusivePtr<GeoPhysVol>physVol =
new GeoPhysVol(logVol);
347 GeoTransform* xf =
new GeoTransform(GeoTrf::TranslateZ3D(mbZ));
348 sectorPhysVol->add(xf);
349 sectorPhysVol->add(physVol);
354 double prot_x = (bigLength/2+1.-rail_pos-rail_width+epsil)*cmm;
355 double prot_y = (shell_leng/2)*cmm;
356 double prot_z = (prot_th/2)*cmm;
358 GeoBox* plate =
new GeoBox(prot_x,prot_y,prot_z);
359 GeoLogVol *logVol=
new GeoLogVol(
basename+
"::ProtectionPlate",plate,FR4);
360 GeoIntrusivePtr<GeoPhysVol>physVol =
new GeoPhysVol(logVol);
362 GeoTransform* xf =
new GeoTransform(GeoTrf::Translate3D(glX,glY,mbZ+(mb_th/2+heightOut+prot_th/2)*cmm+2*epsil));
363 sectorPhysVol->add(xf);
364 sectorPhysVol->add(physVol);
369 double conn_xm = (widthFront/2)*cmm;
370 double conn_xp = (mb_width/2)*cmm;
371 double conn_ym= (heightIn/2)*cmm;
372 double conn_yp =(heightOut/2)*cmm;
373 double conn_leng = (mb_length/2)*cmm;
375 GeoTrd* connectics =
new GeoTrd(conn_xm,conn_xp,conn_ym,conn_yp,conn_leng);
376 GeoLogVol *logVol=
new GeoLogVol(
basename+
"::Connectics",connectics,ConnecMat);
377 GeoIntrusivePtr<GeoPhysVol>physVol =
new GeoPhysVol(logVol);
379 double connZ = mbZ+(mb_th/2+heightOut/2)*cmm+epsil;
380 GeoTransform* xf1 =
new GeoTransform(GeoTrf::TranslateZ3D(connZ));
383 sectorPhysVol->add(xf1);
384 sectorPhysVol->add(xf2);
385 sectorPhysVol->add(physVol);
390 GeoBox* rail =
new GeoBox((rail_width/2)*cmm,(shell_leng/2)*cmm,(rail_th/2)*cmm);
391 GeoLogVol *logVol=
new GeoLogVol(
basename+
"::Rail",rail,FR4);
392 GeoIntrusivePtr<GeoPhysVol>physVol =
new GeoPhysVol(logVol);
394 double railX = (bigLength/2+1-rail_pos-rail_width/2)*cmm+epsil;
395 double railZ = modz[0]+mod_heig[0]/2+(rail_th/2)*cmm+epsil;
397 GeoTransform* xf1 =
new GeoTransform(GeoTrf::Translate3D(railX,glY,railZ));
398 GeoTransform* xf2 =
new GeoTransform(GeoTrf::Translate3D(-railX,glY,railZ));
400 sectorPhysVol->add(xf1);
401 sectorPhysVol->add(physVol);
403 sectorPhysVol->add(xf2);
404 sectorPhysVol->add(physVol);
412 double anode_th = 0.330;
413 double cathode_th = 0.270;
418 GeoTrd* catho1 =
new GeoTrd(smallLength/2*cmm,bigLength/2*cmm,cathode_th/2*cmm,cathode_th/2*cmm,heig_elec1/2*cmm);
419 GeoLogVol* LV_catho1 =
new GeoLogVol(
basename+
"::Cathode1",catho1,CathodeMat);
420 GeoIntrusivePtr<GeoPhysVol>PV_catho1 =
new GeoPhysVol(LV_catho1);
422 GeoTrd* catho3 =
new GeoTrd(smallLength/2 *cmm,bigLength/2 *cmm,cathode_th/2 *cmm,cathode_th/2 *cmm,heig_elec3/2);
423 GeoLogVol* LV_catho3 =
new GeoLogVol(
basename+
"::Cathode3",catho3,CathodeMat);
424 GeoIntrusivePtr<GeoPhysVol>PV_catho3 =
new GeoPhysVol(LV_catho3);
426 GeoTrd* ano1 =
new GeoTrd(smallLength/2 *cmm,bigLength/2 *cmm,anode_th/2 *cmm,anode_th/2 *cmm,heig_elec1/2);
427 GeoLogVol* LV_ano1 =
new GeoLogVol(
basename+
"::Anode1",ano1,AnodeMat);
428 GeoIntrusivePtr<GeoPhysVol>PV_ano1 =
new GeoPhysVol(LV_ano1);
430 GeoTrd* ano3 =
new GeoTrd(smallLength/2 *cmm,bigLength/2 *cmm,anode_th/2 *cmm,anode_th/2 *cmm,heig_elec3/2);
431 GeoLogVol* LV_ano3 =
new GeoLogVol(
basename+
"::Anode3",ano3,AnodeMat);
432 GeoIntrusivePtr<GeoPhysVol>PV_ano3 =
new GeoPhysVol(LV_ano3);
435 double prep2_height = (bigLength/2+1.)*cmm;
436 double prep1_z = (prep1_th/2)*cmm;
437 double prep2_z = (prep2_th/2)*cmm;
438 double prep_length[8];
439 for(
int i=0;
i<8;
i++ ) prep_length[
i] = mod_leng[
i]-2.*epsil;
441 std::array<GeoIntrusivePtr<GeoPhysVol>,8> PV_Prep1{}, PV_Prep2{};
443 for(
int i=0;
i<8;
i++ )
445 GeoBox* box1 =
new GeoBox(prep1_height,prep_length[
i]/2,prep1_z);
446 GeoLogVol* logVol1 =
new GeoLogVol(
basename+
"::Prep1",box1,FR4);
447 PV_Prep1[
i] =
new GeoPhysVol(logVol1);
449 GeoBox* box2 =
new GeoBox(prep2_height,prep_length[
i]/2,prep2_z);
450 GeoLogVol* logVol2 =
new GeoLogVol(
basename+
"::Prep2",box2,FR4);
451 PV_Prep2[
i] =
new GeoPhysVol(logVol2);
455 std::array<double, 8> prep1_pos{};
456 std::array<double, 8> prep2_pos{};
457 double elec_trans = -2*prep2_z+mod_heig[0]/2-(larheight/2)*cmm-3*epsil;
458 for(
int i=0;
i<8;
i++ )
460 prep1_pos[
i] = prep1_z-mod_heig[
i]/2+epsil;
461 prep2_pos[
i] = -prep2_z+mod_heig[
i]/2-epsil;
464 double YStartA[8],YStartC[8];
466 for(
int i=0;
i<8;
i++ )
468 YStartC[
i] = -mod_leng[
i]/2+(
mod[
i][5]+cathode_th/2)*cmm;
469 YStartA[
i] = YStartC[
i]+(
mod[
i][4]/2)*cmm;
474 YStartC[1] += delta01;
475 YStartA[1] += delta01;
477 for(
int i=0;
i<8;
i++)
479 GeoTransform* xfPrep1 =
new GeoTransform(GeoTrf::TranslateZ3D(prep1_pos[
i]));
480 GeoTransform* xfPrep2 =
new GeoTransform(GeoTrf::TranslateZ3D(prep2_pos[
i]));
482 pvModule[
i]->add(xfPrep1);
483 pvModule[
i]->add(PV_Prep1[
i]);
484 pvModule[
i]->add(xfPrep2);
485 pvModule[
i]->add(PV_Prep2[
i]);
490 GeoGenfun::Variable
I;
491 GeoGenfun::GENFUNCTION cathoGF = YStartC[
i]+
I*
mod[
i][4]*cmm;
492 GeoGenfun::GENFUNCTION anoGF = YStartA[
i]+
I*
mod[
i][4]*cmm;
494 GeoXF::TRANSFUNCTION cathoTF = GeoXF::Pow(GeoTrf::TranslateY3D(1.),cathoGF)*GeoTrf::TranslateZ3D(elec_trans)*GeoTrf::RotateX3D(-
mod[
i][3]*
Gaudi::Units::deg);
495 GeoXF::TRANSFUNCTION anoTF = GeoXF::Pow(GeoTrf::TranslateY3D(1.),anoGF)*GeoTrf::TranslateZ3D(elec_trans)*GeoTrf::RotateX3D(-
mod[
i][3]*
Gaudi::Units::deg);
498 GeoSerialTransformer *cathoST,*anoST;
501 cathoST =
new GeoSerialTransformer(PV_catho1,&cathoTF,
static_cast<unsigned int>(
mod[
i][2]));
502 anoST =
new GeoSerialTransformer(PV_ano1,&anoTF,
static_cast<unsigned int>(
mod[
i][1]));
506 cathoST =
new GeoSerialTransformer(PV_catho3,&cathoTF,
static_cast<unsigned int>(
mod[
i][2]));
507 anoST =
new GeoSerialTransformer(PV_ano3,&anoTF,
static_cast<unsigned int>(
mod[
i][1]));
510 pvModule[
i]->add(cathoST);
511 pvModule[
i]->add(anoST);
523 return m_psPhysicalPos;
527 return m_psPhysicalNeg;