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)
62 SmartIF<StoreGateSvc>
detStore{Gaudi::svcLocator()->service(
"DetectorStore")};
64 throw std::runtime_error(
"Error in LArDetectorFactory, cannot access DetectorStore");
68 if (StatusCode::SUCCESS !=
detStore->retrieve(materialManager, std::string(
"MATERIALS"))) {
69 throw std::runtime_error(
"Error in BarrelPresamplerConstruction, stored MaterialManager is not found.");
72 const GeoMaterial *Copper = materialManager->
getMaterial(
"std::Copper");
73 if (!Copper)
throw std::runtime_error(
"Error in BarrelPresamplerConstruction, std::Copper is not found.");
75 const GeoMaterial *Iron = materialManager->
getMaterial(
"std::Iron");
76 if (!Iron)
throw std::runtime_error(
"Error in BarrelPresamplerConstruction, std::Iron is not found.");
78 const GeoMaterial *Lead = materialManager->
getMaterial(
"std::Lead");
79 if (!Lead)
throw std::runtime_error(
"Error in BarrelPresamplerConstruction, std::Lead is not found.");
81 const GeoMaterial *
LAr = materialManager->
getMaterial(
"std::LiquidArgon");
82 if (!
LAr)
throw std::runtime_error(
"Error in BarrelPresamplerConstruction, std::LiquidArgon is not found.");
84 const GeoMaterial *Air = materialManager->
getMaterial(
"std::Air");
85 if (!Air)
throw std::runtime_error(
"Error in BarrelPresamplerConstruction, std::Air is not found.");
87 const GeoMaterial *Kapton = materialManager->
getMaterial(
"std::Kapton");
88 if (!Kapton)
throw std::runtime_error(
"Error in BarrelPresamplerConstruction, std::Kapton is not found.");
89 const GeoMaterial *Glue = materialManager->
getMaterial(
"LAr::Glue");
90 if (!Glue)
throw std::runtime_error(
"Error in BarrelPresamplerConstruction, LAr::Glue is not found.");
92 const GeoMaterial *G10 = materialManager->
getMaterial(
"LAr::G10");
93 if (!G10)
throw std::runtime_error(
"Error in BarrelPresamplerConstruction, LAr::G10 is not found.");
95 const GeoMaterial *FR4 = materialManager->
getMaterial(
"LAr::FR4");
96 if (!FR4)
throw std::runtime_error(
"Error in BarrelPresamplerConstruction, LAr::FR4 is not found.");
98 const GeoMaterial *MBMat = materialManager->
getMaterial(
"LAr::MBMat");
99 if (!MBMat)
throw std::runtime_error(
"Error in BarrelPresamplerConstruction, LAr::MBMat is not found.");
101 const GeoMaterial *AnodeMat = materialManager->
getMaterial(
"LAr::AnodeMat");
102 if (!AnodeMat)
throw std::runtime_error(
"Error in BarrelPresamplerConstruction, LAr::AnodeMat is not found.");
104 const GeoMaterial *CathodeMat = materialManager->
getMaterial(
"LAr::CathodeMat");
105 if (!CathodeMat)
throw std::runtime_error(
"Error in BarrelPresamplerConstruction, LAr::CathodeMat is not found.");
107 const GeoMaterial *ConnecMat = materialManager->
getMaterial(
"LAr::ConnecMat");
108 if (!ConnecMat)
throw std::runtime_error(
"Error in BarrelPresamplerConstruction, LAr::ConnecMat is not found.");
182 std::string
basename =
"LAr::Barrel::Presampler";
184 GeoTubs *tubs =
new GeoTubs(rMinPresamplerMother, rMaxPresamplerMother, presamplerMother_length,Phi_min, Phi_span);
185 GeoLogVol* logVol =
new GeoLogVol(
basename,tubs,
LAr);
199 for(
int ii=0; ii<8; ii++ ) mod_leng[ii]=
mod[ii][0]*cmm+2*epsil;
207 double bigLength = 277.5;
208 double prep1_height = (smallLength/2+1.)*cmm;
210 mod_heig[0]= (larheight+prep1_th+prep2_th)*cmm+4*epsil;
211 mod_heig[1]= (larheight2+prep1_th+prep2_th)*cmm+5.*epsil;
212 for(
int i=2;
i<8;
i++ ) mod_heig[
i] = mod_heig[0];
219 double mb_length = 3100.3;
220 double sector_length = mb_length*cmm +9.*epsil;
221 double sector_height = mod_heig[0]+(shell_th+rail_th)*cmm+mech_clear*
Gaudi::Units::mm+3*epsil;
223 unsigned int nsectors=32;
224 double mod_xm = prep1_height+epsil;
226 double sect_xm = mod_xm+epsil;
230 double zpres = -presamplerMother_length+sector_length/2+epsil;
232 GeoTrd *trd =
new GeoTrd(sect_xm, sect_xp, sector_length/2, sector_length/2, sector_height/2);
234 GeoLogVol *logVol =
new GeoLogVol (
basename+
"::Sector",trd,
LAr);
235 GeoPhysVol *sectorPhysVol =
new GeoPhysVol(logVol);
237 GeoGenfun::Variable
I;
239 GeoGenfun::GENFUNCTION
f = dphiSector*
I+0.5*dphiSector;
240 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);
241 GeoSerialTransformer *st =
new GeoSerialTransformer(sectorPhysVol,&
t, nbsectors);
256 mod_leng[0]=mod_leng[0]-delta01;
257 mod_leng[1]=mod_leng[1]+delta01;
258 GeoIntrusivePtr<GeoPhysVol> pvModule[8];
261 double modYPrev=0, modLenPrev=0;
262 for (
int m=0;
m<8;
m++) {
265 double modLen=mod_leng[
m];
268 double modY= (
m==0) ? -sector_length/2+modLen/2+epsil : modYPrev + modLenPrev /2 + modLen/2 +epsil;
269 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;
271 GeoTrd * trd =
new GeoTrd(mod_xm,mod_xp,modLen/2,modLen/2,mod_heig[
m]/2);
272 GeoLogVol *logVol =
new GeoLogVol(
basename+
"::Module",trd,
LAr);
273 pvModule[
m] =
new GeoPhysVol(logVol);
275 GeoTransform *xf =
new GeoTransform(GeoTrf::Translate3D(0.0, modY, modZ));
276 sectorPhysVol->add(xf);
277 sectorPhysVol->add(pvModule[
m]);
286 double prot_y = (shell_leng/2)*cmm;
288 double glY = -sector_length/2+prot_y+epsil;
292 GeoBox *box =
new GeoBox((smallLength/2+1.)*cmm, (shell_leng/2)*cmm,(shell_th/2)*cmm);
293 GeoLogVol *logVol=
new GeoLogVol(
basename+
"::ProtectionShell",box,FR4);
294 GeoIntrusivePtr<GeoPhysVol>physVol =
new GeoPhysVol(logVol);
296 double glZ = -sector_height/2+(shell_th/2)*cmm+epsil;
298 GeoTransform *xf =
new GeoTransform(GeoTrf::Translate3D(glX,glY, glZ));
299 sectorPhysVol->add(xf);
300 sectorPhysVol->add(physVol);
304 double rail_pos = 22.;
305 double rail_width = 24.;
306 double prot_th = 0.5;
307 double widthFront = 2.8;
308 double mb_width = 169.;
309 double heightIn = 1.5;
310 double heightOut = 5.;
312 double modz[8], mody[8];
313 mody[0] = -sector_length/2+mod_leng[0]/2+epsil;
314 modz[0] = -sector_height/2+shell_th*cmm+mech_clear+mod_heig[0]/2+epsil;
315 modz[1] = modz[0]+(mod_heig[0]-mod_heig[1])/2;
316 for(
int i=1;
i<8;
i++)
317 mody[
i] = mody[
i-1]+mod_leng[
i-1]/2+mod_leng[
i]/2+epsil;
319 for(
int i=2;
i<8;
i++) modz[
i]= modz[0];
321 double mbZ = modz[0]+mod_heig[0]/2+(mb_th/2)*cmm+epsil;
325 GeoBox* MB =
new GeoBox((mb_width/2)*cmm,(mb_length/2)*cmm,(mb_th/2)*cmm);
326 GeoLogVol *logVol=
new GeoLogVol(
basename+
"::MotherBoard",MB,MBMat);
327 GeoIntrusivePtr<GeoPhysVol>physVol =
new GeoPhysVol(logVol);
329 GeoTransform* xf =
new GeoTransform(GeoTrf::TranslateZ3D(mbZ));
330 sectorPhysVol->add(xf);
331 sectorPhysVol->add(physVol);
336 double prot_x = (bigLength/2+1.-rail_pos-rail_width+epsil)*cmm;
337 double prot_y = (shell_leng/2)*cmm;
338 double prot_z = (prot_th/2)*cmm;
340 GeoBox* plate =
new GeoBox(prot_x,prot_y,prot_z);
341 GeoLogVol *logVol=
new GeoLogVol(
basename+
"::ProtectionPlate",plate,FR4);
342 GeoIntrusivePtr<GeoPhysVol>physVol =
new GeoPhysVol(logVol);
344 GeoTransform* xf =
new GeoTransform(GeoTrf::Translate3D(glX,glY,mbZ+(mb_th/2+heightOut+prot_th/2)*cmm+2*epsil));
345 sectorPhysVol->add(xf);
346 sectorPhysVol->add(physVol);
351 double conn_xm = (widthFront/2)*cmm;
352 double conn_xp = (mb_width/2)*cmm;
353 double conn_ym= (heightIn/2)*cmm;
354 double conn_yp =(heightOut/2)*cmm;
355 double conn_leng = (mb_length/2)*cmm;
357 GeoTrd* connectics =
new GeoTrd(conn_xm,conn_xp,conn_ym,conn_yp,conn_leng);
358 GeoLogVol *logVol=
new GeoLogVol(
basename+
"::Connectics",connectics,ConnecMat);
359 GeoIntrusivePtr<GeoPhysVol>physVol =
new GeoPhysVol(logVol);
361 double connZ = mbZ+(mb_th/2+heightOut/2)*cmm+epsil;
362 GeoTransform* xf1 =
new GeoTransform(GeoTrf::TranslateZ3D(connZ));
365 sectorPhysVol->add(xf1);
366 sectorPhysVol->add(xf2);
367 sectorPhysVol->add(physVol);
372 GeoBox* rail =
new GeoBox((rail_width/2)*cmm,(shell_leng/2)*cmm,(rail_th/2)*cmm);
373 GeoLogVol *logVol=
new GeoLogVol(
basename+
"::Rail",rail,FR4);
374 GeoIntrusivePtr<GeoPhysVol>physVol =
new GeoPhysVol(logVol);
376 double railX = (bigLength/2+1-rail_pos-rail_width/2)*cmm+epsil;
377 double railZ = modz[0]+mod_heig[0]/2+(rail_th/2)*cmm+epsil;
379 GeoTransform* xf1 =
new GeoTransform(GeoTrf::Translate3D(railX,glY,railZ));
380 GeoTransform* xf2 =
new GeoTransform(GeoTrf::Translate3D(-railX,glY,railZ));
382 sectorPhysVol->add(xf1);
383 sectorPhysVol->add(physVol);
385 sectorPhysVol->add(xf2);
386 sectorPhysVol->add(physVol);
394 double anode_th = 0.330;
395 double cathode_th = 0.270;
400 GeoTrd* catho1 =
new GeoTrd(smallLength/2*cmm,bigLength/2*cmm,cathode_th/2*cmm,cathode_th/2*cmm,heig_elec1/2*cmm);
401 GeoLogVol* LV_catho1 =
new GeoLogVol(
basename+
"::Cathode1",catho1,CathodeMat);
402 GeoIntrusivePtr<GeoPhysVol>PV_catho1 =
new GeoPhysVol(LV_catho1);
404 GeoTrd* catho3 =
new GeoTrd(smallLength/2 *cmm,bigLength/2 *cmm,cathode_th/2 *cmm,cathode_th/2 *cmm,heig_elec3/2);
405 GeoLogVol* LV_catho3 =
new GeoLogVol(
basename+
"::Cathode3",catho3,CathodeMat);
406 GeoIntrusivePtr<GeoPhysVol>PV_catho3 =
new GeoPhysVol(LV_catho3);
408 GeoTrd* ano1 =
new GeoTrd(smallLength/2 *cmm,bigLength/2 *cmm,anode_th/2 *cmm,anode_th/2 *cmm,heig_elec1/2);
409 GeoLogVol* LV_ano1 =
new GeoLogVol(
basename+
"::Anode1",ano1,AnodeMat);
410 GeoIntrusivePtr<GeoPhysVol>PV_ano1 =
new GeoPhysVol(LV_ano1);
412 GeoTrd* ano3 =
new GeoTrd(smallLength/2 *cmm,bigLength/2 *cmm,anode_th/2 *cmm,anode_th/2 *cmm,heig_elec3/2);
413 GeoLogVol* LV_ano3 =
new GeoLogVol(
basename+
"::Anode3",ano3,AnodeMat);
414 GeoIntrusivePtr<GeoPhysVol>PV_ano3 =
new GeoPhysVol(LV_ano3);
417 double prep2_height = (bigLength/2+1.)*cmm;
418 double prep1_z = (prep1_th/2)*cmm;
419 double prep2_z = (prep2_th/2)*cmm;
420 double prep_length[8];
421 for(
int i=0;
i<8;
i++ ) prep_length[
i] = mod_leng[
i]-2.*epsil;
423 std::array<GeoIntrusivePtr<GeoPhysVol>,8> PV_Prep1{}, PV_Prep2{};
425 for(
int i=0;
i<8;
i++ )
427 GeoBox* box1 =
new GeoBox(prep1_height,prep_length[
i]/2,prep1_z);
428 GeoLogVol* logVol1 =
new GeoLogVol(
basename+
"::Prep1",box1,FR4);
429 PV_Prep1[
i] =
new GeoPhysVol(logVol1);
431 GeoBox* box2 =
new GeoBox(prep2_height,prep_length[
i]/2,prep2_z);
432 GeoLogVol* logVol2 =
new GeoLogVol(
basename+
"::Prep2",box2,FR4);
433 PV_Prep2[
i] =
new GeoPhysVol(logVol2);
437 std::array<double, 8> prep1_pos{};
438 std::array<double, 8> prep2_pos{};
439 double elec_trans = -2*prep2_z+mod_heig[0]/2-(larheight/2)*cmm-3*epsil;
440 for(
int i=0;
i<8;
i++ )
442 prep1_pos[
i] = prep1_z-mod_heig[
i]/2+epsil;
443 prep2_pos[
i] = -prep2_z+mod_heig[
i]/2-epsil;
446 double YStartA[8],YStartC[8];
448 for(
int i=0;
i<8;
i++ )
450 YStartC[
i] = -mod_leng[
i]/2+(
mod[
i][5]+cathode_th/2)*cmm;
451 YStartA[
i] = YStartC[
i]+(
mod[
i][4]/2)*cmm;
456 YStartC[1] += delta01;
457 YStartA[1] += delta01;
459 for(
int i=0;
i<8;
i++)
461 GeoTransform* xfPrep1 =
new GeoTransform(GeoTrf::TranslateZ3D(prep1_pos[
i]));
462 GeoTransform* xfPrep2 =
new GeoTransform(GeoTrf::TranslateZ3D(prep2_pos[
i]));
464 pvModule[
i]->add(xfPrep1);
465 pvModule[
i]->add(PV_Prep1[
i]);
466 pvModule[
i]->add(xfPrep2);
467 pvModule[
i]->add(PV_Prep2[
i]);
472 GeoGenfun::Variable
I;
473 GeoGenfun::GENFUNCTION cathoGF = YStartC[
i]+
I*
mod[
i][4]*cmm;
474 GeoGenfun::GENFUNCTION anoGF = YStartA[
i]+
I*
mod[
i][4]*cmm;
476 GeoXF::TRANSFUNCTION cathoTF = GeoXF::Pow(GeoTrf::TranslateY3D(1.),cathoGF)*GeoTrf::TranslateZ3D(elec_trans)*GeoTrf::RotateX3D(-
mod[
i][3]*
Gaudi::Units::deg);
477 GeoXF::TRANSFUNCTION anoTF = GeoXF::Pow(GeoTrf::TranslateY3D(1.),anoGF)*GeoTrf::TranslateZ3D(elec_trans)*GeoTrf::RotateX3D(-
mod[
i][3]*
Gaudi::Units::deg);
480 GeoSerialTransformer *cathoST,*anoST;
483 cathoST =
new GeoSerialTransformer(PV_catho1,&cathoTF,
static_cast<unsigned int>(
mod[
i][2]));
484 anoST =
new GeoSerialTransformer(PV_ano1,&anoTF,
static_cast<unsigned int>(
mod[
i][1]));
488 cathoST =
new GeoSerialTransformer(PV_catho3,&cathoTF,
static_cast<unsigned int>(
mod[
i][2]));
489 anoST =
new GeoSerialTransformer(PV_ano3,&anoTF,
static_cast<unsigned int>(
mod[
i][1]));
492 pvModule[
i]->add(cathoST);
493 pvModule[
i]->add(anoST);
505 return m_psPhysicalPos;
509 return m_psPhysicalNeg;