130{
131 ISvcLocator *svcLocator = Gaudi::svcLocator();
132
133 ATH_MSG_DEBUG(
"++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
134 << "+ +\n"
135 << "+ Start of Barrel EM GeoModel definition +\n"
136 << "+ +\n"
137 << "++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
138 << " \n"
140 << " \n"
141 << " ");
142
145 }
146
147 bool doDetailedAbsorberStraight = false;
148 bool doDetailedAbsorberFold = false;
149
150 SmartIF<IGeoModelSvc> geoModel{svcLocator->service ("GeoModelSvc")};
151 if(!geoModel.isValid())
152 throw std::runtime_error("Error in BarrelConstruction, cannot access GeoModelSvc");
153 SmartIF<IRDBAccessSvc> rdbAccess{svcLocator->service ("RDBAccessSvc")};
154 if(!rdbAccess.isValid())
155 throw std::runtime_error("Error in BarrelConstruction, cannot access RDBAccessSvc");
156
157 DecodeVersionKey larVersionKey(geoModel, "LAr");
158
159 ATH_MSG_INFO(
"Getting primary numbers for " << larVersionKey.node() <<
", " << larVersionKey.tag());
160
161 IRDBRecordset_ptr switchSet = rdbAccess->getRecordsetPtr(
"LArSwitches", larVersionKey.tag(), larVersionKey.node());
162 if ((*switchSet).size() !=0) {
163 const IRDBRecord *switches = (*switchSet)[0];
165 if (switches->
getInt(
"DETAILED_ABSORBER") !=0) {
167 doDetailedAbsorberStraight = true;
168 doDetailedAbsorberFold = true;
169 } else {
171 }
172 } else {
174 }
175 } else {
177 }
178
179 ATH_MSG_INFO(
" Makes detailed absorber sandwich ? " << doDetailedAbsorberStraight <<
" " << doDetailedAbsorberFold);
181
182 GeoGenfun::Cos Cos;
183 GeoGenfun::Sin Sin;
184 GeoGenfun::Sqrt Sqrt;
185 GeoGenfun::ATan ATan;
186
187 double twopi64 = Gaudi::Units::pi/32.;
188 double twopi32 = 2.*twopi64;
189
190
191 SmartIF<StoreGateSvc>
detStore{svcLocator->service(
"DetectorStore")};
193 throw std::runtime_error("Error in LArDetectorFactory, cannot access DetectorStore");
194 }
195
196
197 StoredMaterialManager* materialManager = nullptr;
198 if (StatusCode::SUCCESS !=
detStore->retrieve(materialManager, std::string(
"MATERIALS"))) {
199 throw std::runtime_error("Error in BarrelConstruction, stored MaterialManager is not found.");
200 }
201
202 const GeoMaterial *Iron = materialManager->
getMaterial(
"std::Iron");
203 if (!Iron) throw std::runtime_error("Error in BarrelConstruction, std::Iron is not found.");
204
205 const GeoMaterial *LAr = materialManager->
getMaterial(
"std::LiquidArgon");
206 if (!LAr) throw std::runtime_error("Error in BarrelConstruction, std::LiquidArgon is not found.");
207
208 const GeoMaterial *Lead = materialManager->
getMaterial(
"std::Lead");
209 if (!Lead) throw std::runtime_error("Error in BarrelConstruction, std::Lead is not found.");
210
211 const GeoMaterial *G10_bar = materialManager->
getMaterial(
"LAr::G10_bar");
212 if (!G10_bar) throw std::runtime_error("Error in BarrelConstruction, LAr::G10_bar is not found.");
213
214 const GeoMaterial *Moth_elect = materialManager->
getMaterial(
"LAr::MBoards");
215 if (!Moth_elect) throw std::runtime_error("Error in BarrelConstruction, LAr::MBoards is not found.");
216
217 const GeoMaterial *Cable_elect = materialManager->
getMaterial(
"LAr::Cables");
218 if (!Cable_elect) throw std::runtime_error("Error in BarrelConstruction, LAr::Cables is not found.");
219
220 const GeoMaterial *Thin_abs = materialManager->
getMaterial(
"LAr::Thinabs");
221 if (!Thin_abs) throw std::runtime_error("Error in BarrelConstruction, LAr::Thinabs is not found.");
222
223 const GeoMaterial *Thick_abs = materialManager->
getMaterial(
"LAr::Thickabs");
224 if (!Thick_abs) throw std::runtime_error("Error in BarrelConstruction, LAr::Thickabs is not found.");
225
226 const GeoMaterial *Kapton_Cu = materialManager->
getMaterial(
"LAr::KaptonC");
227 if (!Kapton_Cu) throw std::runtime_error("Error in BarrelConstruction, LAr::KaptonC is not found.");
228
229 const GeoMaterial *Sumb = materialManager->
getMaterial(
"LAr::SBoard");
230 if (!Sumb) throw std::runtime_error("Error in BarrelConstruction, LAr::SBoard is not found.");
231
232 const GeoMaterial *Glue = materialManager->
getMaterial(
"LAr::Glue");
233 if (!Glue) throw std::runtime_error("Error in BarrelConstruction, LAr::Glue is not found.");
234
235 const GeoElement *Pb = materialManager->
getElement(
"Lead");
236 if (!Pb) throw std::runtime_error("Error in BarrelConstruction, element lead not found ");
237
238 const GeoElement *Fe = materialManager->
getElement(
"Iron");
239 if (!Fe) throw std::runtime_error("Error in BarrelConstruction, element Fe not found ");
240
241
242 double contract =
m_parameters->GetValue(
"LArEMBAbsorberContraction");
243
244 double density_lead = Lead->getDensity()/(contract*contract*contract);
246 myLead->add(Pb,1.0);
247 myLead->lock();
248
249 double density_iron = Iron->getDensity()/(contract*contract*contract);
251 myIron->add(Fe,1.0);
252 myIron->lock();
253
254
255
256#ifdef DEBUGGEO
257 std::cout << "*** BarrelConstruction: List of Materials, density,X0,Lambda " << std::endl;
258 std::cout << " Iron " << Iron->getDensity() << " "
259 << Iron->getRadLength() << " "
260 << Iron->getIntLength() << std::endl;
261 std::cout << " LAR " << LAr->getDensity() << " "
262 << LAr->getRadLength() << " "
263 << LAr->getIntLength() << std::endl;
264 std::cout << " G10_bar " << G10_bar->getDensity() << " "
265 << G10_bar->getRadLength() << " "
266 << G10_bar->getIntLength() << std::endl,
267 std::cout << " Moth_elect " << Moth_elect->getDensity() << " "
268 << Moth_elect->getRadLength() << " "
269 << Moth_elect->getIntLength() << std::endl;
270 std::cout << " Cable " << Cable_elect->getDensity() << " "
271 << Cable_elect->getRadLength() << " "
272 << Cable_elect->getIntLength() << std::endl;
273 std::cout << " Sumb " << Sumb->getDensity() << " "
274 << Sumb->getRadLength() << " "
275 << Sumb->getIntLength() << std::endl;
276 std::cout << " Thin_abs " << Thin_abs->getDensity() << " "
277 << Thin_abs->getRadLength() << " "
278 << Thin_abs->getIntLength() << std::endl;
279 std::cout << " Thick_abs " << Thick_abs->getDensity() << " "
280 << Thick_abs->getRadLength() << " "
281 << Thick_abs->getIntLength() << std::endl;
282 std::cout << " Kapton_Cu " << Kapton_Cu->getDensity() << " "
283 << Kapton_Cu->getRadLength() << " "
284 << Kapton_Cu->getIntLength() << std::endl;
285#endif
286 std::string baseName = "LAr::EMB::";
287
288
289
290
291
292
293 double Moth_Z_min =
m_parameters->GetValue(
"LArEMBMotherZmin");
294 double Moth_Z_max =
m_parameters->GetValue(
"LArEMBMotherZmax");
295
296
297
298 double Moth_inner_radius =
m_parameters->GetValue(
"LArEMBMotherRmin");
299 double Moth_outer_radius =
m_parameters->GetValue(
"LArEMBMotherRmax");
300
301 double Moth_Phi_Min = 0.;
302 double Moth_Phi_Max =
m_parameters->GetValue(
"LArEMBphiMaxBarrel")*Gaudi::Units::deg;
303
304#ifdef DEBUGGEO
305 std::cout << " *** Mother volume (Ecam) parameters " << std::endl;
306 std::cout << " Rmin/Rmax " << Moth_inner_radius << " " << Moth_outer_radius << std::endl;
307 std::cout << " Zmin/Zmax " << Moth_Z_min << " " << Moth_Z_max << std::endl;
308 std::cout << " phi1,Dphi (Gaudi::Units::deg)" << Moth_Phi_Min/Gaudi::Units::deg << " " << Moth_Phi_Max/Gaudi::Units::deg << std::endl;
309#endif
310
311
313
314
315 double Bar_Z_min = Moth_Z_min;
316 double Bar_Z_max = Moth_Z_max;
317
318
319
320 double Rhocen1 =
m_parameters->GetValue(
"LArEMBRadiusAtCurvature",0);
321
322
324#ifdef DEBUGGEO
325 std::cout << " Bar_Eta_cut " << Bar_Eta_cut << std::endl;
326#endif
327
328 double Bar_Z_cut, Bar_Rcmx ;
329
332
334
335 double Zp0 = 0.;
336
337
338 double Zhalf = (Bar_Z_max-Bar_Z_min)/2.;
339
340 double Zhalfc = (Bar_Z_cut-Bar_Z_min)/2.;
341
342
343
344
345
346
347
348 double Rhocen[15], Phicen[15], Delta[15], deltay[15], deltax[15], TetaTrans[15];
349 for (int idat=0; idat<15; idat++)
350 {
351 Rhocen[idat] =
353 Phicen[idat] =
355 Delta[idat] =
357 if(idat == 14) Delta[idat] = (90.0) * Gaudi::Units::deg;
358
359
360
361
363 deltay[idat] =
365 deltax[idat] =
367 }
368 else {
369 deltay[idat]=0.;
370 deltax[idat]=0.;
371 }
372
373
375 TetaTrans[idat] = 2.*
atan(
exp(-etaTrans));
376
377 ATH_MSG_DEBUG(
"idat " << idat <<
" Rhocen/Phice/Delta/deltay/deltax/etatrans "
378 << Rhocen[idat] << " " << Phicen[idat]*(1./Gaudi::Units::deg) << " "
379 << Delta[idat]*(1./Gaudi::Units::deg) << " " << deltay[idat] << " " << deltax[idat]
380 << " " << etaTrans);
381 }
382
383
384 int checkParity=0;
385 if (Phicen[0]<0.) checkParity=1;
386
387
389 int Nabsorber = (Ncell==64) ? Ncell + 1 : Ncell;
390 int Nelectrode = Ncell;
391
392
393
397 ATH_MSG_WARNING(
"================LAr BarrelConstruction===========================\n"
398 << "===YOU ARE RUNNING WITH A LIMITED SLICE OF BARREL ACCORDEON ===\n"
399 << "===THIS OPTION IS FOR VISUALIZATION OR OTHER TESTING, ONLY!! ===\n"
400 << "===AND IF THIS IS NOT YOUR INTENTION PLEASE BE SURE TO SET ===\n"
401 << "===THE FLAG GeoModelSvc.LArDetectorTool.BarrelCellVisLimit=-1 ===\n"
402 << "===Remember there are no defaults in Athena. Thank you. ===\n"
403 << "=================================================================");
404 }
405
406
407
408 double z1 =
m_parameters->GetValue(
"LArEMBG10FrontDeltaZ")+ Moth_Z_min;
409
410 const double r1 = Moth_inner_radius
413
415 const double inv_r2_r1 = 1. / (
r2-
r1);
416
417
418 double zmax1_Stac = z1 + (Rhocen[0]-
r1)*(Moth_Z_max-z1)*inv_r2_r1;
419
420
421
422
423
424
425
426
427
428
429
430
431 {
432 double Moth_Phi_Min2 = (Ncell == 64) ? -1.555*Gaudi::Units::deg : 0.;
433 double Moth_Phi_Max2 = (Ncell == 64) ? 25.61*Gaudi::Units::deg : 2*
M_PI;
434
435 double safety_rhocen1 = 0.040*Gaudi::Units::mm;
436 double Zplan[] = {Bar_Z_min-Zp0,Bar_Z_cut-Zp0,Bar_Z_max-Zp0};
437 double Riacc[] = {Moth_inner_radius,Moth_inner_radius, Rhocen1-safety_rhocen1};
438 double Roacc[] = {Moth_outer_radius,Moth_outer_radius,Moth_outer_radius};
439
440#ifdef DEBUGGEO
441 std::cout << " *** Parameters for ECAM Pcon volume " << std::endl;
442 std::cout << " Zplan " << Zplan[0] << " " << Zplan[1] << " " << Zplan[2] << std::endl;
443 std::cout << " Rin " << Riacc[0] << " " << Riacc[1] << " " << Riacc[2] << std::endl;
444 std::cout << " Rout " << Roacc[0] << " " << Roacc[1] << " " << Roacc[2] << std::endl;
445 std::cout << " PhiMin,Dphi " << Moth_Phi_Min2/Gaudi::Units::deg << " " << Moth_Phi_Max2/Gaudi::Units::deg << std::endl;
446#endif
447 int ecamArraySize = sizeof(Zplan) / sizeof(double);
448 std::string
name = baseName +
"ECAM";
449 GeoPcon* pCon = new GeoPcon(Moth_Phi_Min2,
450 Moth_Phi_Max2);
451
452 for (
int i=0;
i< ecamArraySize;
i++)
453 {
454 pCon->addPlane(Zplan[i],Riacc[i],Roacc[i]);
455 }
456 const GeoLogVol* logVol = new GeoLogVol(name,pCon,LAr);
459
460
461
462
463 {
466 if(!
status.isSuccess())
throw std::runtime_error (
"Cannot store EMB_POS");
467 }
468 {
471 if(!
status.isSuccess())
throw std::runtime_error (
"Cannot store EMB_NEG");
472 }
473 }
474
475
477
478
479
480
481#ifdef BUILD_FRONT_ELECTRONICS
482
483
484
485
486
487 GeoIntrusivePtr<GeoPhysVol>Elnicsf_phys=nullptr;
488 double Xel1f;
489 {
490
491
492 Xel1f =
m_parameters->GetValue(
"LArEMBInnerElectronics");
493 double DeltaZ = Zhalfc;
494 double Zpos = Zhalfc+Bar_Z_min;
495 double Rmini = Moth_inner_radius + 0.010*Gaudi::Units::mm;
496 double Rmaxi = Rmini+Xel1f - 0.010*Gaudi::Units::mm;
497 std::string
name = baseName +
"TELF";
498#ifdef DEBUGGEO
499 std::cout << " *** parameters for TELF tubs " << std::endl;
500 std::cout << " DeltaZ " << DeltaZ << std::endl;
501 std::cout << " Rmin/Rmax " << Rmini << " " << Rmaxi << std::endl,
502 std::cout << " PhiMin,Dphi " << Moth_Phi_Min/Gaudi::Units::deg << " " << Moth_Phi_Max/Gaudi::Units::deg << std::endl;
503 std::cout << " Zpos in ECAM " << Zpos << std::endl;
504#endif
505 GeoTubs* tubs = new GeoTubs(Rmini,
506 Rmaxi,
507 DeltaZ,
508 Moth_Phi_Min,
509 Moth_Phi_Max);
510 const GeoLogVol* logVol = new GeoLogVol(name,tubs,LAr);
511 Elnicsf_phys = new GeoPhysVol(logVol);
516 }
517
518
519
520
521
522
523 GeoIntrusivePtr<GeoPhysVol>Sumb_phys=nullptr;
524 {
525 double ThickSum = 10.*Gaudi::Units::mm;
526 double Rmini = Moth_inner_radius+Xel1f-ThickSum;
527 double Rmaxi = Moth_inner_radius+Xel1f -0.020*Gaudi::Units::mm;
528 double DeltaZ = Zhalfc;
529 double Zpos=0.;
530 std::string
name = baseName +
"SUMB";
531#ifdef DEBUGGEO
532 std::cout << " *** parameters for SUMB tubs " << std::endl;
533 std::cout << " DeltaZ " << DeltaZ << std::endl;
534 std::cout << " Rmin/Rmax " << Rmini << " " << Rmaxi << std::endl,
535 std::cout << " PhiMin,Dphi " << Moth_Phi_Min/Gaudi::Units::deg << " " << Moth_Phi_Max/Gaudi::Units::deg << std::endl;
536 std::cout << " Zpos in TELF " << Zpos << std::endl;
537#endif
538
539 GeoTubs * tubs = new GeoTubs(Rmini,Rmaxi,DeltaZ,Moth_Phi_Min,Moth_Phi_Max);
540 const GeoLogVol* logVol = new GeoLogVol(name,tubs,Sumb);
541 Sumb_phys = new GeoPhysVol(logVol);
542 Elnicsf_phys->add(new GeoTransform(GeoTrf::TranslateZ3D(Zpos)));
543 Elnicsf_phys->add(Sumb_phys);
544 }
545
546
547
548 {
549 double ClearancePS =
m_parameters->GetValue(
"LArEMBMoBoclearfrPS");
550 double RhoPosB = Moth_inner_radius + ClearancePS;
551 double bdx = .5*(
m_parameters->GetValue(
"LArEMBMoBoTchickness"));
552 double bdy = .5*(
m_parameters->GetValue(
"LArEMBMoBoHeight"));
553 double bdz = Zhalfc - 0.007*Gaudi::Units::mm;
554
555
556
557 {
558 double PhiOrig = 0.;
560 double PhiPos0 = twopi64 + PhiOrig;
561
562 std::string
name = baseName +
"MOAC";
563#ifdef DEBUGGEO
564 std::cout << " *** parameters for MotherBoard (box)" << std::endl;
565 std::cout << " dx,dy,dz " << bdx << " " << bdy << " " << bdz << std::endl;
566 std::cout << " Radius pos " << RhoPosB << std::endl;
567 std::cout << " Phi0,Dphi " << PhiPos0/Gaudi::Units::deg << " " << twopi32/Gaudi::Units::deg << std::endl;
568#endif
569 GeoBox * box = new GeoBox(bdx,bdy,bdz);
570 const GeoLogVol * logVol = new GeoLogVol(name,box,Moth_elect);
571 GeoPhysVol * pV = new GeoPhysVol(logVol);
572 GeoSerialIdentifier * iD = new GeoSerialIdentifier(0);
573 GeoGenfun::Variable
c;
574 GeoGenfun::GENFUNCTION PhiPos = PhiPos0 + twopi32*
c;
575 GeoXF::TRANSFUNCTION TX =
576 GeoXF::Pow(GeoTrf::TranslateX3D(1.0),RhoPosB*Cos(PhiPos))*
577 GeoXF::Pow(GeoTrf::TranslateY3D(1.0),RhoPosB*Sin(PhiPos))*
578 GeoXF::Pow(GeoTrf::RotateZ3D(1.0),PhiPos);
579 GeoSerialTransformer *
st =
new GeoSerialTransformer(pV, &TX, NoOFboard);
580 Elnicsf_phys->add(iD);
581 Elnicsf_phys->add(st);
582
583 }
584
585
586
587
588
589
590
591
592
593
594 {
595
596 double Dzc = Zhalfc - 0.007*Gaudi::Units::mm;
597 double Dx1 = .5*(
m_parameters->GetValue(
"LArEMBCablethickat0"));
598 double Dx2 = .5*Bar_Eta_cut*(
m_parameters->GetValue(
"LArEMBthickincrfac"));
599
600 double Dy1 = .5*(
m_parameters->GetValue(
"LArEMBCableEtaheight"));
601 double Dy2 = Dy1;
602
604 double RhoPosC = Moth_inner_radius + ClearancePS;
605
606 std::string
name = baseName +
"CAAC";
607#ifdef DEBUGGEO
608 std::cout << " *** Parameters for Cable (Trap) " << std::endl;
609 std::cout << " Dzc " << Dzc << std::endl;
610 std::cout << " Dx1,Dx2 (half thickness at eta=0 and etamax " << Dx1 << " " << Dx2 << std::endl;
611 std::cout << " Dy1,Dy2 " << Dy1 << " " << Dy2 << std::endl;
612 std::cout << " Radial Position " << RhoPosC << std::endl;
613#endif
614
615 GeoTrap* trap = new GeoTrap(Dzc,0.,0.,Dy1,Dx1,Dx1,0.,
616 Dy2,Dx2,Dx2,0.);
617 const GeoLogVol* logVol = new GeoLogVol(name,trap,Cable_elect);
618
619 GeoPhysVol * pV = new GeoPhysVol(logVol);
620 GeoSerialIdentifier * iD = new GeoSerialIdentifier(0);
621 double PhiPos0 = (twopi64 - asin(bdy/RhoPosB))/2.;
622#ifdef DEBUGGEO
623 std::cout << " PhiPos0 " << PhiPos0 << std::endl;
624#endif
625 GeoGenfun::Variable
I;
626
627
628 GeoGenfun::Rectangular KDelta;
629 KDelta.baseline().setValue(0.0);
630 KDelta.height().setValue(1.0);
631 KDelta.x0().setValue(-0.5);
632 KDelta.x1().setValue(0.5);
633
634
635 GeoGenfun::Mod Mod1(1.0),Mod2(2.0),Mod4(4.0);
636 GeoGenfun::GENFUNCTION
Int =
I - Mod1;
637 GeoGenfun::GENFUNCTION Ccopy =
Int(
I + 0.5);
638 GeoGenfun::GENFUNCTION PhiOrig = 22.5*Gaudi::Units::deg*
Int(Ccopy/4);
639 GeoGenfun::GENFUNCTION PhiPos1 = PhiPos0 + PhiOrig;
640 GeoGenfun::GENFUNCTION PhiPos2 = twopi32 - PhiPos0 + PhiOrig;
641 GeoGenfun::GENFUNCTION PhiPos00 =
642 (KDelta(Mod4(Ccopy)-2) + KDelta(Mod4(Ccopy)-3))*PhiPos2 +
643 (1.0-KDelta(Mod4(Ccopy)-2)-KDelta(Mod4(Ccopy)-3))*PhiPos1;
644 GeoGenfun::GENFUNCTION PhiPos = PhiPos00 + Mod2(Ccopy)*twopi32;
645 GeoXF::TRANSFUNCTION TX =
646 GeoXF::Pow(GeoTrf::TranslateX3D(1.0),RhoPosC*Cos(PhiPos))*
647 GeoXF::Pow(GeoTrf::TranslateY3D(1.0),RhoPosC*Sin(PhiPos))*
648 GeoXF::Pow(GeoTrf::RotateZ3D(1.0),PhiPos);
649 GeoSerialTransformer *
st =
new GeoSerialTransformer(pV, &TX, NoOFcable);
650#ifdef DEBUGGEO
651 for (int ii=0;ii<NoOFcable;ii++) {
652 std::cout << "copy, phi " << ii << " " << PhiPos(ii)/Gaudi::Units::deg << std::endl;
653 }
654#endif
655 Elnicsf_phys->add(iD);
656 Elnicsf_phys->add(st);
657
658 }
659
660 }
661#endif
662
663
664
665
666 double clearance = 1.3*Gaudi::Units::mm;
667
668#ifdef BUILD_HIGHETA_ELECTRONICS
669
670
671
672
673
674
675
676
677 {
678
679
680 double ze1= zmax1_Stac+clearance;
681 double ze2 = Bar_Z_max;
682 double safety = 0.05*Gaudi::Units::mm;
683 double DeltaZ = 0.5*(ze2-ze1)-safety;
684 double Zpos = ze1+DeltaZ+0.5*safety;
685 double Rmini1 = Rhocen[0] - .030*Gaudi::Units::mm;
686 double Rmaxi1 = Rhocen[0] - .020*Gaudi::Units::mm;
687 double Rmini2 = Rhocen[0] - .030*Gaudi::Units::mm;
688 double Rmaxi2 = Bar_Rcmx - clearance - .070*Gaudi::Units::mm;
689 std::string
name = baseName +
"TELB";
690#ifdef DEBUGGEO
691 std::cout << " *** Parameters for high eta electronics (Cons) " <<std::endl;
692 std::cout << " Rmini1,Rmini2,Rmaxi1,Rmaxi2 " << Rmini1 << " " << Rmini2 << " "
693 << Rmaxi1 << " " << Rmaxi2 << std::endl,
694 std::cout << " DeltaZ " << DeltaZ << std::endl;
695 std::cout << " Phi_Min,Dphi " << Moth_Phi_Min/Gaudi::Units::deg << " " << Moth_Phi_Max/Gaudi::Units::deg << std::endl;
696 std::cout << " Zpos " << Zpos << std::endl;
697#endif
698 GeoCons* cons = new GeoCons(Rmini1,Rmini2,Rmaxi1,Rmaxi2,
699 DeltaZ,Moth_Phi_Min,Moth_Phi_Max);
700 const GeoLogVol* logVol = new GeoLogVol(name,cons,Cable_elect);
701 GeoIntrusivePtr<GeoPhysVol> physVol = new GeoPhysVol(logVol);
706
707 }
708
709
710#endif
711
712
713
714
715
716
717#ifdef BUILD_FRONT_G10
718
719
720
721 {
722 double Xel1f =
m_parameters->GetValue(
"LArEMBInnerElectronics");
723 double Xg10f =
m_parameters->GetValue(
"LArEMBG10SupportBarsIn");
724 double DeltaZ = 0.5*
m_parameters->GetValue(
"LArEMBG10FrontDeltaZ");
725 double Zpos = DeltaZ+Bar_Z_min;
726 double Rmini = Moth_inner_radius + Xel1f;
727 double Rmaxi = Rmini+Xg10f;
728 std::string
name = baseName +
"GTENF";
729#ifdef DEBUGGEO
730 std::cout << " *** parameters for front G10 ring (tubs) " << std::endl;
731 std::cout << " Rmini,Rmaxi " << Rmini << " " << Rmaxi << std::endl;
732 std::cout << " DeltaZ " << DeltaZ << std::endl;
733 std::cout << " phimin,dphi " << Moth_Phi_Min/Gaudi::Units::deg << " " << Moth_Phi_Max/Gaudi::Units::deg << std::endl;
734 std::cout << " Zpos " << Zpos << std::endl;
735#endif
736 GeoTubs* tubs = new GeoTubs(Rmini,Rmaxi,DeltaZ,Moth_Phi_Min,Moth_Phi_Max);
737 const GeoLogVol* logVol = new GeoLogVol(name,tubs,G10_bar);
738 GeoIntrusivePtr<GeoPhysVol> physVol = new GeoPhysVol(logVol);
743
745 larVersionKey.tag(),
746 larVersionKey.node());
747 if (extraCones->
size() > 0 ) {
749 const std::string& conName = cone->getString("CONE");
750 if (conName=="ExtraInBar") {
751 double extra_dz = 0.5*( cone->getDouble("DZ") );
752 double extra_rmin1 = cone->getDouble("RMIN1");
753 double extra_rmin2 = cone->getDouble("RMIN2");
754 double extra_rmax1 = cone->getDouble("RMAX1");
755 double extra_rmax2 = cone->getDouble("RMAX2");
756 double extra_phi0 = cone->getDouble("PHI0");
757 double extra_dphi = cone->getDouble("DPHI");
758 double extra_zpos = cone->getDouble("ZPOS");
759
760 std::string
name = baseName +
"ExtraMat1";
761 GeoCons* cons = new GeoCons(extra_rmin1,extra_rmin2,extra_rmax1,extra_rmax2,
762 extra_dz,extra_phi0,extra_dphi);
763 const GeoLogVol* logVol = new GeoLogVol(name,cons,Lead);
764 GeoIntrusivePtr<GeoPhysVol> physVol2 = new GeoPhysVol(logVol);
765 physVol->add(new GeoTransform(GeoTrf::TranslateZ3D(extra_zpos)));
766 physVol->add(physVol2);
767 }
768 }
769 }
770
771 }
772
773#endif
774
775#ifdef BUILD_BACK_G10
776
777
778 {
779 double DeltaZ = Zhalf;
780 double Zpos = Zhalf+Bar_Z_min;
781 double Xtal =
m_parameters->GetValue(
"LArEMBLArGapTail")+ 0.1*Gaudi::Units::mm;
782 double Rmini = Rhocen[Nbrt]+Xtal;
783
784
785 double Rmaxi = Moth_outer_radius-0.01*Gaudi::Units::mm;
786
787 std::string
name = baseName +
"GTENB";
788#ifdef DEBUGGEO
789 std::cout << " *** parameters for back G10 ring (tubs) " << std::endl;
790 std::cout << " Rmini,Rmaxi " << Rmini << " " << Rmaxi << std::endl;
791 std::cout << " DeltaZ " << DeltaZ << std::endl;
792 std::cout << " phimin,dphi " << Moth_Phi_Min/Gaudi::Units::deg << " " << Moth_Phi_Max/Gaudi::Units::deg << std::endl;
793 std::cout << " Zpos " << Zpos << std::endl;
794#endif
795
796 GeoTubs* tubs = new GeoTubs(Rmini,Rmaxi,DeltaZ,Moth_Phi_Min,Moth_Phi_Max);
797 const GeoLogVol* logVol = new GeoLogVol(name,tubs,G10_bar);
798 GeoIntrusivePtr<GeoPhysVol> physVol = new GeoPhysVol(logVol);
803 }
804
805#endif
806
807
808 GeoIntrusivePtr<GeoPhysVol>stacPhysical=nullptr;
809
810
811
812
813
814 {
815
816 double Moth_Phi_Min2 = (Ncell == 64) ? -1.055*Gaudi::Units::deg : 0.;
817 double Moth_Phi_Max2 = (Ncell == 64) ? 24.61*Gaudi::Units::deg : 2*
M_PI;
818
819 double Zplan1[] = {Bar_Z_min,zmax1_Stac+clearance,Bar_Z_max};
820 double Riacc1[] = {Rhocen[0],Rhocen[0], Bar_Rcmx-clearance};
821 double Roacc1[] = {Rhocen[Nbrt],Rhocen[Nbrt],Rhocen[Nbrt]};
822
823 std::string
name = baseName +
"STAC";
824#ifdef DEBUGGEO
825 std::cout << " *** Parameters for STAC Pcon volume " << std::endl;
826 std::cout << " Zplan " << Zplan1[0] << " " << Zplan1[1] << " " << Zplan1[2] << std::endl;
827 std::cout << " Rin " << Riacc1[0] << " " << Riacc1[1] << " " << Riacc1[2] << std::endl;
828 std::cout << " Rout " << Roacc1[0] << " " << Roacc1[1] << " " << Roacc1[2] << std::endl;
829 std::cout << " PhiMin,Dphi " << Moth_Phi_Min2/Gaudi::Units::deg << " " << Moth_Phi_Max2/Gaudi::Units::deg << std::endl;
830 std::cout << " Zpos " << -Zp0 << std::endl;
831#endif
832 GeoPcon* pCone = new GeoPcon(Moth_Phi_Min2,Moth_Phi_Max2);
833 for (
int i=0;
i<3;
i++) pCone->addPlane(Zplan1[i],Riacc1[i],Roacc1[i]);
834 const GeoLogVol* logVol = new GeoLogVol(name,pCone,LAr);
835 stacPhysical = new GeoPhysVol(logVol);
840 }
841
842
843#ifdef BUILD_ACCORDION_PLATES
844 {
845
846
847 double Xtip_pb =
m_parameters->GetValue(
"LArEMBLeadTipThickFront");
848 double Xtip_pc =
m_parameters->GetValue(
"LArEMBLeadTipThickEnd");
849 double Xtip_gt =
m_parameters->GetValue(
"LArEMBG10TipThickFront");
850 double Xtip_gs =
m_parameters->GetValue(
"LArEMBG10TipThickEnd");
851 double Thgl =
m_parameters->GetValue(
"LArEMBThickAbsGlue");
852 double Thfe =
m_parameters->GetValue(
"LArEMBThickAbsIron");
853 double Thpb =
m_parameters->GetValue(
"LArEMBThickAbsLead");
854 double Thpb_thin =
m_parameters->GetValue(
"LArEMBThinAbsLead");
855 double Thcu =
m_parameters->GetValue(
"LArEMBThickElecCopper");
856 double Thfg =
m_parameters->GetValue(
"LArEMBThickElecKapton");
857 double Psi =
m_parameters->GetValue(
"LArEMBPhiGapAperture");
858 double Contract =
m_parameters->GetValue(
"LArEMBAbsorberContraction");
859
860 double Thce = (Thpb+Thgl+Thfe)*Contract;
861 double Thel = Thcu+Thfg;
862
864
865 double Zmin = Bar_Z_min;
866 double Zmax = Bar_Z_max;
867
868
869
870 double Zcp1[15]={};
871 double Zcp2[15]={};
872 double Along[14]={};
873
874
875
876
877
878
879
880 double Zcp1l[14]={},Zcp1h[14]={},Zcp2l[14]={},Zcp2h[14]={};
881 double Rhol[14]={},Rhoh[14]={};
882
883 double safety_along = 0.007*Gaudi::Units::mm;
884
885
886
887
888 double Cenx[15]={0}, Ceny[15]={0} ;
889 for (int jf=0; jf<(Nbrt+1); jf++)
890 {
891 Cenx[jf] = Rhocen[jf]*
cos(Phicen[jf]);
892 Ceny[jf] = Rhocen[jf]*
sin(Phicen[jf]);
893 Zcp1[jf] = Rhocen[jf]/
tan(TetaTrans[jf]);
894 if (Rhocen[jf] < r2)
895 Zcp2[jf] = z1 + (Rhocen[jf]-
r1)*inv_r2_r1*(Moth_Z_max-z1);
896 else
897 Zcp2[jf]=Moth_Z_max;
898
899#ifdef DEBUGGEO
900 std::cout << " jf " << jf
901 << "Cenx/Ceny " << Cenx[jf] << " " << Ceny[jf] << " "
902 << "Zcp1/Zcp2 " << Zcp1[jf] << " " << Zcp2[jf] << std::endl;
903#endif
904
905 }
906
907
908 double Rint =
m_parameters->GetValue(
"LArEMBNeutFiberRadius");
909 for (int jl=0; jl<Nbrt; jl++)
910 {
911 double Adisc2 = (Cenx[jl+1]-Cenx[jl])*(Cenx[jl+1]-Cenx[jl])+
912 (Ceny[jl+1]-Ceny[jl])*(Ceny[jl+1]-Ceny[jl]);
913 double Along2 = Adisc2 - 4.*Rint*Rint;
914 Along[jl] = sqrt(Along2);
915#ifdef DEBUGGEO
916 std::cout << "jl " << jl
917 << "straight length " << Along[jl] << std::endl;
918#endif
919 double ddelta =
M_PI/2.-Delta[jl];
920
921 if (checkParity==0) {
922 if (jl%2==1) ddelta=-1.*ddelta;
923 } else {
924 if (jl%2==0) ddelta=-1.*ddelta;
925 }
926 double xlong=Along[jl]-2.*safety_along;
927 double x2=0.5*(Cenx[jl+1]+Cenx[jl])+0.5*xlong*
cos(ddelta);
928 double y2=0.5*(Ceny[jl+1]+Ceny[jl])+0.5*xlong*
sin(ddelta);
929 double x1=0.5*(Cenx[jl+1]+Cenx[jl])-0.5*xlong*
cos(ddelta);
930 double y1=0.5*(Ceny[jl+1]+Ceny[jl])-0.5*xlong*
sin(ddelta);
931 Rhol[jl] = sqrt(x1*x1+y1*y1);
932 Rhoh[jl] = sqrt(x2*x2+y2*y2);
933 Zcp1l[jl] = Rhol[jl]/
tan(TetaTrans[jl]);
934 Zcp1h[jl] = Rhoh[jl]/
tan(TetaTrans[jl+1]);
935 if (Rhol[jl] < r2)
936 Zcp2l[jl] = z1 + (Rhol[jl]-
r1)*inv_r2_r1*(Moth_Z_max-z1);
937 else
938 Zcp2l[jl]=Moth_Z_max;
939 if (Rhoh[jl] < r2)
940 Zcp2h[jl] = z1 + (Rhoh[jl]-
r1)*inv_r2_r1*(Moth_Z_max-z1);
941 else
942 Zcp2h[jl]=Moth_Z_max;
943#ifdef DEBUGGEO
944 std::cout <<
"x1,y1,x2,y2 " <<
x1 <<
" " <<
y1 <<
" " <<
x2 <<
" "
946 std::cout << " lower/upper radius " << Rhol[jl] << " " << Rhoh[jl]
947 << " Z for eta0.8 " << Zcp1l[jl] << " " << Zcp1h[jl]
948 << " Z for etamax " << Zcp2l[jl] << " " << Zcp2h[jl] << std::endl;
949#endif
950 }
951
952
953
954 double Gama0 =
m_parameters->GetValue(
"LArEMBAbsPhiFirst");
955
956 GeoGenfun::Variable icopy;
957 GeoGenfun::GENFUNCTION Game = Gama0 + Psi/2 +
Alfa*icopy;
958 GeoGenfun::GENFUNCTION Gama = Gama0 +
Alfa*icopy;
959
960
961
962
963 enum FB {FRONT, BACK, TERM};
964
965 for (int fb=FRONT; fb!=TERM; fb++)
966 {
967
968 int irl = fb==FRONT ? 0 : Nbrt;
969
970 double Xtips = Xtip_pb + Xtip_gt;
971 double Xtipt = Xtip_pc + Xtip_gs;
972
973
974 {
975 double radius = fb==FRONT ? Cenx[0] - Xtip_pb/2 : Cenx[Nbrt] + Xtipt/2;
976 double Xhalfb = fb==FRONT ? Xtip_pb/2 -0.002*Gaudi::Units::mm : Xtipt/2 - .004*Gaudi::Units::mm;
977 double Zhalfb = fb==FRONT ? (Bar_Z_cut-Zmin)/2. : (
Zmax-Zmin)/2.;
978 double dz01 = (std::min(Zcp1[irl],Zmax)-Zmin)/2.;
979
980 std::string
name = baseName +
"FrontBack::Absorber";
981 GeoBox *box = new GeoBox(Xhalfb,Thce/2,Zhalfb);
982 GeoBox *box2 = new GeoBox(Xhalfb,Thce/2,dz01);
983 const GeoLogVol *logVol = new GeoLogVol(name,box,Thin_abs);
984 const GeoLogVol *logVol2 = new GeoLogVol(name,box2,Thick_abs);
985 GeoIntrusivePtr<GeoPhysVol> physVol = new GeoPhysVol(logVol);
986 GeoIntrusivePtr<GeoPhysVol> physVol2 = new GeoPhysVol(logVol2);
987 physVol->add(new GeoTransform(GeoTrf::Translate3D(0.,0.,dz01-Zhalfb)));
988 physVol->add(physVol2);
989 GeoGenfun::GENFUNCTION Xcd =
radius*Cos(Gama);
990 GeoGenfun::GENFUNCTION Ycd =
radius*Sin(Gama);
991 GeoGenfun::GENFUNCTION Zcd = GeoGenfun::FixedConstant(Zmin+Zhalfb);
992
993
994 GeoXF::TRANSFUNCTION TX =
995 GeoXF::Pow(GeoTrf::TranslateX3D(1.0),Xcd) *
996 GeoXF::Pow(GeoTrf::TranslateY3D(1.0),Ycd) *
997 GeoXF::Pow(GeoTrf::TranslateZ3D(1.0),Zcd) *
998 GeoXF::Pow(GeoTrf::RotateZ3D(1.0),Gama);
999 GeoSerialTransformer *
st =
new GeoSerialTransformer(physVol, &TX, Nabsorber);
1002#ifdef DEBUGGEO
1003 if (fb==FRONT) std::cout << " *** Front tip Absorber " << std::endl;
1004 else std::cout << " *** Back tip Absorber " << std::endl;
1005 std::cout << " Thin Abs Box " << Xhalfb << " " << Thce/2. << " " << Zhalfb << std::endl;
1006 std::cout << " Thick Abs Box " << Xhalfb << " " << Thce/2. << " " << dz01 << std::endl;
1007 std::cout << " Z position thick in thin " << dz01-Zhalfb << std::endl;
1008 std::cout <<
" Radial position " <<
radius << std::endl;
1009 std::cout << " Phi0 (Gaudi::Units::deg) " << Gama(0)/Gaudi::Units::deg << std::endl;
1010 std::cout << " Z position in ECAM " << Zmin+Zhalfb << std::endl;
1011#endif
1012 }
1013
1014 if (fb==FRONT)
1015 {
1016 double Xhalfbg = Xtip_gt/2-0.002*Gaudi::Units::mm;
1017 double radiusg = Cenx[0]-Xtip_pb/2. - Xtips/2 ;
1018 double Zhalfbg = (Bar_Z_cut-Zmin)/2. ;
1019 std::string
name = baseName +
"FrontBack::G10";
1020#ifdef DEBUGGEO
1021 std::cout << " *** Front tip G10 " << std::endl;
1022 std::cout << " Box parameters " << Xhalfbg << " " << Thce/2. << " " << Zhalfbg << std::endl;
1023#endif
1024 GeoBox *box = new GeoBox(Xhalfbg,Thce/2,Zhalfbg);
1025 const GeoLogVol *logVol = new GeoLogVol(name,box,G10_bar);
1026 GeoPhysVol *physVol = new GeoPhysVol(logVol);
1027
1028#ifdef BUILD_FRONT_STEEL
1029
1030
1031 name = baseName +
"FrontBack::Steel";
1032 double Tgfe =
m_parameters->GetValue(
"LArEMBThinAbsIron");
1033#ifdef DEBUGGEO
1034 std::cout << " Iron Box parameters " << Xhalfbg
1035 << " " << Tgfe/4. << " " << Zhalfbg << std::endl;
1036#endif
1037 GeoBox *box2 = new GeoBox(Xhalfbg,Tgfe/4.,Zhalfbg);
1038 const GeoLogVol *logVol2 = new GeoLogVol(name,box2,Iron);
1039 GeoIntrusivePtr<GeoPhysVol>physVol2 = new GeoPhysVol(logVol2);
1040#ifdef DEBUGGEO
1041 std::cout << " Position Iron in G10 at y = +- " << 0.5*(+Thce-Tgfe/2.) << std::endl;
1042#endif
1043 physVol->add(new GeoTransform(GeoTrf::Translate3D(0.,0.5*(-Thce+Tgfe/2.),0.)));
1044 physVol->add(physVol2);
1045 physVol->add(new GeoTransform(GeoTrf::Translate3D(0.,0.5*(+Thce-Tgfe/2.),0.)));
1046 physVol->add(physVol2);
1047#endif
1048
1049
1050 GeoGenfun::GENFUNCTION Xcd = radiusg*Cos(Gama);
1051 GeoGenfun::GENFUNCTION Ycd = radiusg*Sin(Gama);
1052 GeoGenfun::GENFUNCTION Zcd = GeoGenfun::FixedConstant(Zhalfbg+Zmin);
1053 GeoXF::TRANSFUNCTION TX =
1054 GeoXF::Pow(GeoTrf::TranslateX3D(1.0),Xcd) *
1055 GeoXF::Pow(GeoTrf::TranslateY3D(1.0),Ycd) *
1056 GeoXF::Pow(GeoTrf::TranslateZ3D(1.0),Zcd) *
1057 GeoXF::Pow(GeoTrf::RotateZ3D(1.0),Gama);
1058 GeoSerialTransformer *
st =
new GeoSerialTransformer(physVol, &TX, Nabsorber);
1061#ifdef DEBUGGEO
1062 std::cout << " Radial position G10 tip " << radiusg << std::endl;
1063 std::cout << " Phi0 (Gaudi::Units::deg)" << Gama(0)/Gaudi::Units::deg << std::endl;
1064 std::cout << " Zposition in ECAM " << Zmin+Zhalfbg << std::endl;
1065#endif
1066
1067 }
1068
1069 {
1070 double Xhalfbe = fb==FRONT ? Xtips/2 -0.002*Gaudi::Units::mm : Xtipt/2 - .004*Gaudi::Units::mm;
1071 double Zhalfbe = fb==FRONT ? (Bar_Z_cut-Zmin)/2. : (
Zmax - Zmin)/2;
1072 double radiuse = fb==FRONT ? Cenx[0] - Xtips/2 : Cenx[Nbrt] + Xtipt/2;
1073 std::string
name = baseName +
"FrontBack::Electrode";
1074 GeoBox *box = new GeoBox(Xhalfbe,Thel/2,Zhalfbe);
1075 const GeoLogVol *logVol = new GeoLogVol(name,box,Kapton_Cu);
1076 GeoIntrusivePtr<GeoPhysVol> physVol = new GeoPhysVol(logVol);
1077 GeoGenfun::GENFUNCTION Xcd = radiuse*Cos(Game);
1078 GeoGenfun::GENFUNCTION Ycd = radiuse*Sin(Game);
1079 GeoGenfun::GENFUNCTION Zcd = GeoGenfun::FixedConstant(Zmin+Zhalfbe);
1080
1081 GeoXF::TRANSFUNCTION TX =
1082 GeoXF::Pow(GeoTrf::TranslateX3D(1.0),Xcd) *
1083 GeoXF::Pow(GeoTrf::TranslateY3D(1.0),Ycd) *
1084 GeoXF::Pow(GeoTrf::TranslateZ3D(1.0),Zcd) *
1085 GeoXF::Pow(GeoTrf::RotateZ3D(1.0),Game);
1086
1087 GeoSerialTransformer *
st =
new GeoSerialTransformer(physVol, &TX, Nelectrode);
1090
1091#ifdef DEBUGGEO
1092 if (fb==FRONT) std::cout << " *** Front tip electrode " << std::endl;
1093 else std::cout << " *** Back tip electrode " << std::endl;
1094 std::cout << " Box " << Xhalfbe << " " << Thel/2. << " " << Zhalfbe << std::endl;
1095 std::cout << " Radial position " << radiuse << std::endl;
1096 std::cout << " Phi0 (Gaudi::Units::deg)" << Game(0)/Gaudi::Units::deg << std::endl;
1097 std::cout << " Z position in ECAM " << Zmin+Zhalfbe << std::endl;
1098#endif
1099
1100
1101 }
1102 }
1103
1104
1105 GeoStraightAccSection *gStraightElectrodes=nullptr;
1106 GeoStraightAccSection *gStraightAbsorbers =nullptr;
1107
1108
1109
1110
1111
1112
1113 double safety_zlen=0.050*Gaudi::Units::mm;
1114
1115 for(int irl=0; irl<Nbrt; irl++)
1116 {
1117#ifdef DEBUGGEO
1118 std::cout << " ----- irl = " << irl << std::endl;
1119#endif
1120 int iparit;
1121
1122 if (checkParity==0) {
1123 iparit= (1-2*(irl%2));
1124 } else {
1125 iparit=(2*(irl%2)-1);
1126 }
1127
1128
1129 double Zcon1 = Zcp2[irl];
1130 double Zcon2 = Zcp2[irl+1];
1131
1132
1133
1134 if (irl>0 && Rhoh[irl-1] < Bar_Rcmx) Zcon1=Zcp2h[irl-1];
1135 if (Rhoh[irl] < Bar_Rcmx) Zcon2=Zcp2h[irl];
1136
1137 double dz0 = (std::min(Zcon1,Zmax)-Zmin)/2.;
1138 double dza = (std::min(Zcon2,Zmax)-Zmin)/2.;
1139 double dz01 = (std::min(Zcp1[irl],Zmax)-Zmin)/2.;
1140 double dza1 = (std::min(Zcp1[irl+1],Zmax)-Zmin)/2.;
1141
1142
1143
1144
1145 int ndivi=1;
1146 if (Rhocen[irl] < Bar_Rcmx && Rhocen[irl+1] > Bar_Rcmx) {
1147#ifdef DEBUGGEO
1148 std::cout << " Divide section in two pieces at r= " << Bar_Rcmx << std::endl;
1149#endif
1150 ndivi=2;
1151 }
1152
1153 for (int idivi=0;idivi<ndivi;idivi++) {
1154
1155
1156 double bl1,tl1;
1158 if (ndivi==1) {
1159 bl1 = (std::min(Zcp2l[irl],Zmax)-Zmin)/2.;
1160 tl1 = (std::min(Zcp2h[irl],Zmax)-Zmin)/2.;
1162 }
1163 else {
1164 if (idivi==0) {
1165 bl1 = (std::min(Zcp2l[irl],Zmax)-Zmin)/2.;
1166 tl1 = (
Zmax-Zmin)/2.;
1167 frac=(Bar_Rcmx-Rhol[irl])/(Rhoh[irl]-Rhol[irl]);
1168 }
1169 else {
1170 bl1 = (
Zmax-Zmin)/2.;
1171 tl1 = (
Zmax-Zmin)/2.;
1172 frac=(Rhoh[irl]-Bar_Rcmx)/(Rhoh[irl]-Rhol[irl]);
1173 }
1174#ifdef DEBUGGEO
1175 std::cout <<
" Division " << idivi <<
" fraction of straight section " <<
frac << std::endl;
1176#endif
1177 }
1178
1179 tl1=tl1-safety_zlen;
1180 bl1=bl1-safety_zlen;
1181
1182
1183 {
1184
1185
1186 double Dz = Thce/2.;
1187
1188
1189 GeoGenfun::GENFUNCTION x1a =
LArGeo::Fx(irl+0., Gama, Cenx, Ceny)
1192 GeoGenfun::GENFUNCTION x2a =
LArGeo::Fx(irl+1., Gama, Cenx, Ceny)
1195 GeoGenfun::GENFUNCTION y1a =
LArGeo::Fy(irl+0., Gama, Cenx, Ceny)
1198 GeoGenfun::GENFUNCTION y2a =
LArGeo::Fy(irl+1., Gama, Cenx, Ceny)
1201 GeoGenfun::GENFUNCTION
dx = x2a - x1a;
1202 GeoGenfun::GENFUNCTION
dy = y2a - y1a;
1203
1204
1205
1206 GeoGenfun::GENFUNCTION Da = Sqrt ( dx*dx + dy*dy );
1207 GeoGenfun::GENFUNCTION da = Sqrt ( (Da - 2.*Rint)*(Da + 2.*Rint) );
1208
1209
1210 GeoGenfun::GENFUNCTION cosalfa = (da*
dx -iparit*2.*Rint*
dy)/Da/Da;
1211 GeoGenfun::GENFUNCTION sinalfa = (da*
dy +iparit*2.*Rint*
dx)/Da/Da;
1212 GeoGenfun::GENFUNCTION newalpha =
LArGeo::ATan2(sinalfa,cosalfa);
1213
1214 GeoGenfun::GENFUNCTION
h1 = da/2. *
frac - .007*Gaudi::Units::mm;
1215
1216 double Zx0 = (tl1+bl1)/2.;
1217
1218
1219
1220 double Xb1,Xt1;
1221 if (ndivi==1) {
1222 Xb1 = (Zcp1l[irl]-Zmin)/2.;
1223 Xt1 = (Zcp1h[irl]-Zmin)/2.;
1224 } else {
1225 double xfrac=(Bar_Rcmx-Rhol[irl])/(Rhoh[irl]-Rhol[irl]);
1226 if (idivi==0) {
1227 Xb1 = (Zcp1l[irl]-Zmin)/2.;
1228 Xt1 = (xfrac*Zcp1h[irl]+(1.-xfrac)*Zcp1l[irl]-Zmin)/2.;
1229 }
1230 else {
1231 Xb1 = (xfrac*Zcp1h[irl]+(1.-xfrac)*Zcp1l[irl]-Zmin)/2.;
1232 Xt1 = (Zcp1h[irl]-Zmin)/2.;
1233 }
1234 }
1235
1236 double Xtrans = (Xb1+Xt1)/2.-Zx0 + .007*Gaudi::Units::mm;
1237
1238
1239 double Xt2 = tl1-Xt1;
1240 double Xb2 = bl1-Xb1;
1241
1242
1243 double Xtrans2 = Zx0 - (Xb2+Xt2)/2.;
1244 Xt2 = Xt2 -0.007*Gaudi::Units::mm;
1245 Xb2 = Xb2 -0.007*Gaudi::Units::mm;
1246
1247
1248 GeoGenfun::GENFUNCTION
alpha = ATan(0.5*(bl1-tl1)/h1);
1249 GeoGenfun::GENFUNCTION alpha_t = ATan(0.5*(Xb1-Xt1)/h1);
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261 GeoGenfun::GENFUNCTION alpha_2 = ATan((2.*bl1-Xb2-(2.*tl1-Xt2))/(2.*h1));
1262
1263
1264
1265
1266
1267 GeoGenfun::GENFUNCTION alfrot = -
M_PI/2. - newalpha;
1268
1269 GeoGenfun::GENFUNCTION Xcd = (x1a + x2a)/2. + (2.*idivi-1.)*(1.-
frac)*da/2.*cosalfa;
1270 GeoGenfun::GENFUNCTION Ycd = (y1a + y2a)/2. + (2.*idivi-1.)*(1.-
frac)*da/2.*sinalfa;
1271 GeoGenfun::GENFUNCTION Zcd = GeoGenfun::FixedConstant(Zmin+(tl1+bl1)/2.+safety_zlen);
1272
1273 GeoXF::TRANSFUNCTION TX =
1274 GeoXF::Pow(GeoTrf::TranslateX3D(1.0),Xcd) *
1275 GeoXF::Pow(GeoTrf::TranslateY3D(1.0),Ycd) *
1276 GeoXF::Pow(GeoTrf::TranslateZ3D(1.0),Zcd) *
1277 GeoXF::Pow(GeoTrf::RotateZ3D(1.0),-alfrot)*
1278 GeoTrf::RotateY3D(-90*Gaudi::Units::deg);
1279
1280
1281
1283 {
1284
1285
1286 std::string thinName = baseName + "ThinAbs::Straight";
1287 std::string thickName = baseName + "ThickAbs::Straight";
1288
1289#ifdef DEBUGGEO
1290 std::cout << " *** thinAbs trap parameters " << std::endl;
1291 std::cout << " Thickness " << Dz << std::endl;
1292 std::cout <<
" h1 (rad leng) " <<
h1(
instance) << std::endl;
1293 std::cout << " tl1,bl1 " << tl1 << " " << bl1 << std::endl;
1295 std::cout << " *** thickAbs trap parameters " << std::endl;
1296 std::cout << " Thickness " << Dz << std::endl;
1297 std::cout <<
" h1 (rad leng) " <<
h1(
instance) << std::endl;
1298 std::cout << " tl1,bl1 " << Xt1 << " " << Xb1 << std::endl;
1299 std::cout <<
" alpha " << alpha_t(
instance) << std::endl;
1300
1301 std::cout <<
" Position absorber x,y,z " << Xcd(
instance) <<
" " << Ycd(
instance)
1302 <<
" " << Zcd(
instance) << std::endl;
1303 std::cout <<
" Rotation along Z " << -alfrot(
instance)/
deg << std::endl;
1304 std::cout << " Rotation along Y " << -90 << std::endl;
1305
1306#endif
1307
1308
1309 GeoIntrusivePtr<GeoPhysVol> thinPhys = nullptr;
1312 if (!doDetailedAbsorberStraight) {
1313
1314 const GeoLogVol* thinLog = new GeoLogVol(thinName,thinTrap,Thin_abs);
1315 thinPhys = new GeoPhysVol(thinLog);
1316
1319 const GeoLogVol* thickLog = new GeoLogVol(thickName,thickTrap,Thick_abs);
1320 GeoIntrusivePtr<GeoPhysVol> thickPhys = new GeoPhysVol(thickLog);
1321
1322 thinPhys->add(new GeoTransform(GeoTrf::TranslateX3D(Xtrans)));
1323 thinPhys->add(thickPhys);
1324
1325#ifdef DEBUGGEO
1326 std::cout << " Position thick Abs in Thin at " << Xtrans << std::endl;
1327#endif
1328 }
1329
1330 if (doDetailedAbsorberStraight) {
1331
1332
1333#ifdef DEBUGGEO
1334 std::cout <<
" dz overall absorber volume " << Dz <<
" radial length " <<
h1(
instance) <<
1335 " lenghts " << tl1 <<
" " << bl1 <<
" Angle y axis " <<
alpha(
instance) << std::endl;
1336#endif
1337 const GeoLogVol* thinLog = new GeoLogVol(thinName,thinTrap,myIron);
1338 thinPhys = new GeoPhysVol(thinLog);
1339
1340
1341
1342 double dz_glue = Dz - 0.5*Thfe*Contract;
1343#ifdef DEBUGGEO
1344 std::cout << " dz glue volume in which lead will be put " << dz_glue << std::endl;
1345#endif
1348 std::string thickGlueName = baseName + "ThickAbsGlue::Straight";
1349 const GeoLogVol* thickTrapGlueLog = new GeoLogVol(thickGlueName,thickTrapGlue, Glue);
1350 GeoIntrusivePtr<GeoPhysVol> thickTrapGluePhys = new GeoPhysVol(thickTrapGlueLog);
1351 thinPhys->add(new GeoTransform(GeoTrf::Translate3D(0.,0.,0.)));
1352 thinPhys->add(thickTrapGluePhys);
1353
1354
1355 double dz_lead_thick=0.5*Thpb*Contract;
1356#ifdef DEBUGGEO
1357 std::cout <<
" dz thick lead " << dz_lead_thick <<
" lenghts " << Xt1 <<
" " << Xb1 <<
" Angle y axis " << alpha_t(
instance) << std::endl;
1358 std::cout << " position in overall absorber at X trans " << Xtrans << std::endl;
1359#endif
1360 GeoTrap* thickTrapLead =
new GeoTrap(dz_lead_thick,0.,0.,
h1(
instance),Xt1,Xb1,alpha_t(
instance),
1362 std::string thickLeadName= baseName+"ThickAbsLead::Straight";
1363 const GeoLogVol* thickTrapLeadLog = new GeoLogVol(thickLeadName,thickTrapLead, myLead);
1364 GeoIntrusivePtr<GeoPhysVol> thickTrapLeadPhys = new GeoPhysVol(thickTrapLeadLog);
1365 thickTrapGluePhys->add(new GeoTransform(GeoTrf::TranslateX3D(Xtrans)));
1366 thickTrapGluePhys->add(thickTrapLeadPhys);
1367
1368 double dz_lead_thin = 0.5*Thpb_thin*Contract;
1369#ifdef DEBUGGEO
1370 std::cout <<
" dz thin lead " << dz_lead_thin <<
" lenghts " << Xt2 <<
" " << Xb2 <<
" Angle y axis " << alpha_2(
instance) << std::endl;
1371 std::cout << " position in overall absorber at X trans " << Xtrans2 << std::endl;
1372#endif
1373 GeoTrap* thinTrapLead =
new GeoTrap(dz_lead_thin,0.,0.,
h1(
instance),Xt2,Xb2,alpha_2(
instance),
1375 std::string thinLeadName = baseName+"ThinAbsLead::Straight";
1376 const GeoLogVol* thinTrapLeadLog = new GeoLogVol(thinLeadName,thinTrapLead, myLead);
1377 GeoIntrusivePtr<GeoPhysVol> thinTrapLeadPhys = new GeoPhysVol(thinTrapLeadLog);
1378 thickTrapGluePhys->add(new GeoTransform(GeoTrf::TranslateX3D(Xtrans2)));
1379 thickTrapGluePhys->add(thinTrapLeadPhys);
1380
1381
1382 }
1383
1384
1385
1386
1387
1388
1390 if (!gStraightAbsorbers) gStraightAbsorbers = new GeoStraightAccSection();
1396
1397 stacPhysical->add(
new GeoTransform(TX(
instance)));
1398 int icopytot=1000000*idivi+10000*irl+
instance;
1399 stacPhysical->add(new GeoIdentifierTag(icopytot));
1400 stacPhysical->add(thinPhys);
1401 }
1402 else {
1403 if (!gStraightAbsorbers) gStraightAbsorbers = new GeoStraightAccSection();
1405 gStraightAbsorbers->
setHalfLength(irl,thinTrap->getDydzn());
1406 GeoSerialTransformer *
st =
new GeoSerialTransformer(thinPhys, &TX, Nabsorber);
1407 stacPhysical->add(new GeoSerialIdentifier(irl*10000+idivi*1000000));
1408 stacPhysical->add(st);
1409 break;
1410 }
1411 }
1412
1413
1414 if (idivi==0) {
1415
1416 double phi0_safety=0.;
1417 if (irl==0) phi0_safety=0.003;
1418
1419
1420
1421
1422 int irl1=irl;
1423 int irl2 = (irl==Nbrt-1) ? irl+1 : irl;
1424
1425 for (int jrl=irl1; jrl<=irl2; jrl++) {
1426
1427
1428 int iirl=jrl-1;
1429 if (iirl<0) iirl=1;
1430 GeoGenfun::GENFUNCTION x0a =
LArGeo::Fx(iirl, Gama, Cenx, Ceny)
1433 GeoGenfun::GENFUNCTION y0a =
LArGeo::Fy(iirl, Gama, Cenx, Ceny)
1436 GeoGenfun::GENFUNCTION dx0 = x1a - x0a;
1437 GeoGenfun::GENFUNCTION dy0 = y1a - y0a;
1438
1439 GeoGenfun::GENFUNCTION Da0 = Sqrt ( dx0*dx0 + dy0*dy0 );
1440 GeoGenfun::GENFUNCTION da0 = Sqrt ( (Da0 - 2.*Rint)*(Da0 + 2.*Rint) );
1441
1442 GeoGenfun::GENFUNCTION cosalfa0 = (da0*dx0 +iparit*2.*Rint*dy0)/Da0/Da0;
1443 GeoGenfun::GENFUNCTION sinalfa0 = (da0*dy0 -iparit*2.*Rint*dx0)/Da0/Da0;
1444 GeoGenfun::GENFUNCTION alpha_prev =
LArGeo::ATan2(sinalfa0,cosalfa0);
1445
1446#ifdef DEBUGGEO
1447 if (jrl>0 && jrl<Nbrt) {
1448 std::cout << "x1,y1,x0,y0 " << x1a(0) << " " << y1a(0) << " "
1449 << x0a(0) << " " << y0a(0) << std::endl;
1450 std::cout << " newalpha, alpha_prev " << newalpha(0) << " "
1451 << alpha_prev(0) << std::endl;
1452 }
1453#endif
1454 GeoGenfun::Mod Mod2Pi(2*
M_PI);
1455
1456 GeoGenfun::GENFUNCTION phi0_dfold_0 =
1457 GeoGenfun::FixedConstant(
M_PI/2.+phi0_safety);
1458 GeoGenfun::GENFUNCTION dphi_dfold_0 = Mod2Pi(newalpha-phi0_safety - Gama);
1459 GeoGenfun::GENFUNCTION phi0_dfold_1 = Mod2Pi(
M_PI/2.+ alpha_prev - Gama);
1460 GeoGenfun::GENFUNCTION dphi_dfold_1 = Mod2Pi(newalpha-alpha_prev);
1461 GeoGenfun::GENFUNCTION phi0_dfold_2 = Mod2Pi(
M_PI/2.+ newalpha - Gama);
1462 GeoGenfun::GENFUNCTION dphi_dfold_2 = Mod2Pi(- newalpha + Gama);
1463
1464 GeoGenfun::GENFUNCTION phi0_ufold_0 =
1465 Mod2Pi(
M_PI/2.+newalpha-Gama);
1466 GeoGenfun::GENFUNCTION dphi_ufold_0 = Mod2Pi(-newalpha+Gama-phi0_safety);
1467 GeoGenfun::GENFUNCTION phi0_ufold_1 = Mod2Pi(
M_PI/2. + newalpha - Gama);
1468 GeoGenfun::GENFUNCTION dphi_ufold_1 = Mod2Pi(alpha_prev - newalpha);
1469 GeoGenfun::GENFUNCTION phi0_ufold_2 = GeoGenfun::FixedConstant(
M_PI/2.);
1470 GeoGenfun::GENFUNCTION dphi_ufold_2 = Mod2Pi(newalpha-Gama);
1471
1472 const GeoGenfun::AbsFunction* phi0_fold=nullptr;
1473 const GeoGenfun::AbsFunction* dphi_fold=nullptr;
1474 const GeoXF::Function* TXfold=nullptr;
1475
1476 std::string thinName;
1477 std::string thickName;
1478 if (jrl%2==checkParity) {
1479 thinName = baseName + "ThinAbs::CornerDownFold";
1480 thickName = baseName + "ThickAbs::CornerDownFold";
1481 } else {
1482 thinName = baseName + "ThinAbs::CornerUpFold";
1483 thickName = baseName + "ThickAbs::CornerUpFold";
1484 }
1485
1486
1487 double Rcmin=Rint-Thce/2.;
1488 double Rcmax=Rint+Thce/2.;
1489
1490
1491 double ddz0 = dz0-safety_zlen;
1492 double ddz01 = dz01-safety_zlen;
1493 if (jrl==Nbrt){
1494 ddz0=dza-safety_zlen;
1495 ddz01=dza1-safety_zlen;
1496 }
1497
1498
1499 GeoGenfun::GENFUNCTION zpos = GeoGenfun::FixedConstant(Zmin+dz0);
1500 double phirot=0;
1501 if (jrl%2==checkParity) phirot = -
M_PI;
1502 GeoXF::TRANSFUNCTION TXfold1=
1503 GeoXF::Pow(GeoTrf::TranslateX3D(1.0),x1a) *
1504 GeoXF::Pow(GeoTrf::TranslateY3D(1.0),y1a) *
1505 GeoXF::Pow(GeoTrf::TranslateZ3D(1.0),zpos) *
1506 GeoXF::Pow(GeoTrf::RotateZ3D(1.0),Gama+phirot);
1507 GeoXF::TRANSFUNCTION TXfold2 =
1508 GeoXF::Pow(GeoTrf::TranslateX3D(1.0),x2a) *
1509 GeoXF::Pow(GeoTrf::TranslateY3D(1.0),y2a) *
1510 GeoXF::Pow(GeoTrf::TranslateZ3D(1.0),zpos) *
1511 GeoXF::Pow(GeoTrf::RotateZ3D(1.0),Gama+phirot);
1512
1513
1514 if (jrl==0 && checkParity==0) {
1515 phi0_fold = &(phi0_dfold_0);
1516 dphi_fold = &(dphi_dfold_0);
1517 TXfold = &(TXfold1);
1518 }
1519
1520 if (jrl%2==checkParity && jrl >0 && jrl<Nbrt) {
1521 phi0_fold = &(phi0_dfold_1);
1522 dphi_fold = &(dphi_dfold_1);
1523 TXfold = &(TXfold1);
1524 }
1525
1526 if (jrl%2 ==checkParity && jrl == Nbrt) {
1527 phi0_fold = &(phi0_dfold_2);
1528 dphi_fold = &(dphi_dfold_2);
1529 TXfold = &(TXfold2);
1530 }
1531
1532 if (jrl==0 && checkParity==1) {
1533 phi0_fold = &(phi0_ufold_0);
1534 dphi_fold = &(dphi_ufold_0);
1535 TXfold = &(TXfold1);
1536 }
1537
1538 if (jrl%2 ==(1-checkParity) && jrl>0 && jrl < Nbrt) {
1539 phi0_fold = &(phi0_ufold_1);
1540 dphi_fold = &(dphi_ufold_1);
1541 TXfold = &(TXfold1);
1542 }
1543
1544 if (jrl%2==(1-checkParity) && jrl==Nbrt) {
1545 phi0_fold = &(phi0_ufold_2);
1546 dphi_fold = &(dphi_ufold_2);
1547 TXfold = &(TXfold2);
1548 }
1549
1550 if (!phi0_fold || !dphi_fold || !TXfold) {
1551 ATH_MSG_INFO(
" LArGeoBarrel::BarrelConstruction fold not defined...");
1552 }
1553 else
1555 {
1556
1557 GeoIntrusivePtr<GeoPhysVol> thinPhys = nullptr;
1558
1559 if (!doDetailedAbsorberFold) {
1560 GeoTubs* thinTubs = new GeoTubs(Rcmin,Rcmax,ddz0,
1562 GeoTubs* thickTubs = new GeoTubs(Rcmin,Rcmax,ddz01,
1564#ifdef DEBUGGEO
1565 std::cout << " Thin Abs Corner (tubs) " << std::endl;
1566 std::cout << " Rmin,Rmax,dZ,phi0,Dphi[rad] " << Rcmin << " " << Rcmax << " "
1567 << ddz0 <<
" " << (*phi0_fold)(
instance) <<
" "
1568 <<(*dphi_fold)(
instance) << std::endl;
1569 std::cout << " Thick Abs Corner (tubs) " << std::endl;
1570 std::cout << " Rmin,Rmax,dZ,phi0,Dphi[rad] " << Rcmin << " " << Rcmax << " "
1571 << ddz01 <<
" " << (*phi0_fold)(
instance) <<
" "
1572 << (*dphi_fold)(
instance) << std::endl;
1573#endif
1574 const GeoLogVol* thinLog = new GeoLogVol(thinName,thinTubs,Thin_abs);
1575 const GeoLogVol* thickLog = new GeoLogVol(thickName,thickTubs,Thick_abs);
1576
1577 thinPhys = new GeoPhysVol(thinLog);
1578 GeoIntrusivePtr<GeoPhysVol> thickPhys = new GeoPhysVol(thickLog);
1579
1580 thinPhys->add(new GeoTransform(GeoTrf::TranslateZ3D(ddz01-ddz0)));
1581 thinPhys->add(thickPhys);
1582#ifdef DEBUGGEO
1583 std::cout << " Position Thick fold in Thin Z = " << ddz01-ddz0 << std::endl;
1584#endif
1585
1586 }
1587
1588 if (doDetailedAbsorberFold) {
1589
1590
1591 GeoTubs* thinTubs = new GeoTubs(Rcmin,Rcmax,ddz0,
1593 const GeoLogVol* thinLog = new GeoLogVol(thinName,thinTubs,myIron);
1594 thinPhys = new GeoPhysVol(thinLog);
1595
1596#ifdef DEBUGGEO
1597 std::cout << " overall fold volume rmin,rmax,dz " << Rcmin << " " << Rcmax << " " << ddz0 << std::endl;
1598#endif
1599
1600
1601 GeoTubs* glueTubs = new GeoTubs(Rcmin+0.5*Thfe*Contract,Rcmax-0.5*Thfe*Contract,ddz0,
1603 std::string foldGlueName = baseName+"Glue::Fold";
1604 const GeoLogVol* glueTubsLog = new GeoLogVol(foldGlueName,glueTubs,Glue);
1605 GeoIntrusivePtr<GeoPhysVol> glueTubsPhys = new GeoPhysVol(glueTubsLog);
1606 thinPhys->add(new GeoTransform(GeoTrf::TranslateZ3D(0.)));
1607 thinPhys->add(glueTubsPhys);
1608#ifdef DEBUGGEO
1609 std::cout << " glue fold volume " << Rcmin+0.5*Thfe*Contract << " " << Rcmax-0.5*Thfe*Contract << " " << ddz0 << std::endl;
1610#endif
1611
1612
1613
1614
1615 GeoTubs* thickLeadTubs = new GeoTubs(Rint-0.5*Thpb*Contract,Rint+0.5*Thpb*Contract,ddz01,
1617 std::string foldThickLeadName = baseName+"ThickLead::Fold";
1618 const GeoLogVol* thickLeadLog = new GeoLogVol(foldThickLeadName,thickLeadTubs,myLead);
1619 GeoIntrusivePtr<GeoPhysVol> thickLeadPhys = new GeoPhysVol(thickLeadLog);
1620 glueTubsPhys->add(new GeoTransform(GeoTrf::TranslateZ3D(ddz01-ddz0)));
1621 glueTubsPhys->add(thickLeadPhys);
1622#ifdef DEBUGGEO
1623 std::cout << " thick lead volume " << Rint-Thpb*Contract << " " << Rint+Thpb*Contract << " " << ddz01 << std::endl;
1624 std::cout << " put in glue fold volume with z translation " << ddz01-ddz0 << std::endl;
1625#endif
1626
1627
1628 GeoTubs* thinLeadTubs = new GeoTubs(Rint-0.5*Thpb_thin*Contract,Rint+0.5*Thpb_thin*Contract,ddz0-ddz01,
1630 std::string foldThinLeadName = baseName+"ThinLead::Fold";
1631 const GeoLogVol* thinLeadLog = new GeoLogVol(foldThinLeadName,thinLeadTubs,myLead);
1632 GeoIntrusivePtr<GeoPhysVol> thinLeadPhys = new GeoPhysVol(thinLeadLog);
1633 glueTubsPhys->add(new GeoTransform(GeoTrf::TranslateZ3D(ddz01)));
1634 glueTubsPhys->add(thinLeadPhys);
1635
1636#ifdef DEBUGGEO
1637 std::cout << " thin lead volume " << Rint-Thpb_thin*Contract << " " << Rint+Thpb_thin*Contract << " " << ddz01 << std::endl;
1638 std::cout << " put in glue fold volume with z translation " << ddz01 << std::endl;
1639#endif
1640
1641
1642
1643 }
1644
1645#ifdef DEBUGGEO
1646 if (jrl !=Nbrt) {
1647 std::cout <<
" Position absorber fold x,y,z,rotation/z " << x1a(
instance) <<
1650 } else {
1651 std::cout <<
" Position absorber fold x,y,z,rotation/z " << x2a(
instance) <<
1654 }
1655#endif
1657 stacPhysical->add(
new GeoTransform((*TXfold)(
instance)));
1659 stacPhysical->add(new GeoIdentifierTag(icopytot));
1660 stacPhysical->add(thinPhys);
1661 }
1662 else {
1663 GeoSerialTransformer *
st =
new GeoSerialTransformer(thinPhys, TXfold, Nabsorber);
1664 stacPhysical->add(new GeoSerialIdentifier(jrl*10000));
1665 stacPhysical->add(st);
1666 break;
1667 }
1668
1669 }
1670 }
1671
1672 }
1673 }
1674
1675
1676 {
1677
1678
1679 double Dze = Thel/2.;
1680
1681
1682 GeoGenfun::GENFUNCTION x1e =
LArGeo::Fx(irl+0., Game, Cenx, Ceny)
1685 GeoGenfun::GENFUNCTION x2e =
LArGeo::Fx(irl+1., Game, Cenx, Ceny)
1688 GeoGenfun::GENFUNCTION y1e =
LArGeo::Fy(irl+0., Game, Cenx, Ceny)
1691 GeoGenfun::GENFUNCTION y2e =
LArGeo::Fy(irl+1., Game, Cenx, Ceny)
1694 GeoGenfun::GENFUNCTION dxe = x2e - x1e;
1695 GeoGenfun::GENFUNCTION dye = y2e - y1e;
1696
1697 GeoGenfun::GENFUNCTION De = Sqrt ( dxe*dxe + dye*dye );
1698 GeoGenfun::GENFUNCTION de = Sqrt ( (De - 2.*Rint)*(De + 2.*Rint) );
1699
1700
1701 GeoGenfun::GENFUNCTION cosalfae = (de*dxe -iparit*2.*Rint*dye)/De/De;
1702 GeoGenfun::GENFUNCTION sinalfae = (de*dye +iparit*2.*Rint*dxe)/De/De;
1703 GeoGenfun::GENFUNCTION newalphe =
LArGeo::ATan2(sinalfae,cosalfae);
1704
1705
1706
1707
1708
1709 GeoGenfun::GENFUNCTION alfrote = -
M_PI/2. - newalphe;
1710
1711 GeoGenfun::GENFUNCTION Xcde = (x1e + x2e)/2.+ (2.*idivi-1.)*(1.-
frac)*de/2.*cosalfae;
1712 GeoGenfun::GENFUNCTION Ycde = (y1e + y2e)/2.+ (2.*idivi-1.)*(1.-
frac)*de/2.*sinalfae;
1713 GeoGenfun::GENFUNCTION Zcde = GeoGenfun::FixedConstant(Zmin+(tl1+bl1)/2.+safety_zlen);
1714
1715
1716 GeoGenfun::GENFUNCTION h1e = de/2.*
frac - .007*Gaudi::Units::mm;
1717 GeoGenfun::GENFUNCTION alpha_e = ATan(0.5*(bl1-tl1)/h1e);
1718
1719
1720 GeoXF::TRANSFUNCTION TXE =
1721 GeoXF::Pow(GeoTrf::TranslateX3D(1.0),Xcde) *
1722 GeoXF::Pow(GeoTrf::TranslateY3D(1.0),Ycde) *
1723 GeoXF::Pow(GeoTrf::TranslateZ3D(1.0),Zcde) *
1724 GeoXF::Pow(GeoTrf::RotateZ3D(1.0),-alfrote)*
1725 GeoTrf::RotateY3D(-90*Gaudi::Units::deg);
1726
1727
1729 {
1730 std::string
name = baseName +
"Electrode::Straight";
1731#ifdef DEBUGGEO
1732 std::cout << " *** Electrode trap parameters " << std::endl;
1733 std::cout << " Thickness " << Dze << std::endl;
1734 std::cout <<
" h1 (rad leng) " << h1e(
instance) << std::endl;
1735 std::cout << " tl1,tb1 " << tl1 << " " << bl1 << std::endl;
1736 std::cout <<
" alpha " << alpha_e(
instance) << std::endl;
1737 std::cout <<
" Position electrode x,y,z " << Xcde(
instance) <<
" " << Ycde(
instance)
1738 <<
" " << Zcde(
instance) << std::endl;
1739 std::cout <<
" Rotation along Z " << -alfrote(
instance)/
deg << std::endl;
1740 std::cout << " Rotation along Y " << -90 << std::endl;
1741
1742#endif
1743
1744 GeoTrap* trap =
new GeoTrap(Dze,0.,0.,h1e(
instance),tl1,bl1,alpha_e(
instance),
1746 const GeoLogVol* logVol = new GeoLogVol(name,trap,Kapton_Cu);
1747 GeoIntrusivePtr<GeoPhysVol> physVol = new GeoPhysVol(logVol);
1748
1749
1750
1751
1752
1754 if (!gStraightElectrodes) gStraightElectrodes = new GeoStraightAccSection();
1760
1761 stacPhysical->add(
new GeoTransform(TXE(
instance)));
1762 int icopytot=1000000*idivi+10000*irl+
instance;
1763 stacPhysical->add(new GeoIdentifierTag(icopytot));
1764 stacPhysical->add(physVol);
1765 }
1766 else {
1767 if (!gStraightElectrodes) gStraightElectrodes = new GeoStraightAccSection();
1770 GeoSerialTransformer *
st =
new GeoSerialTransformer(physVol, &TXE, Nelectrode);
1771 stacPhysical->add(new GeoSerialIdentifier(irl*10000+idivi*1000000));
1772 stacPhysical->add(st);
1773 break;
1774 }
1775 }
1776
1777
1778
1779 if (idivi==0) {
1780
1781 double phi0_safety=0.;
1782 if (irl==0) phi0_safety=0.003;
1783
1784
1785
1786
1787 int irl1=irl;
1788 int irl2 = (irl==Nbrt-1) ? irl+1 : irl;
1789
1790 for (int jrl=irl1; jrl<=irl2; jrl++) {
1791
1792
1793 int iirl=jrl-1;
1794 if (iirl<0) iirl=1;
1795 GeoGenfun::GENFUNCTION x0e =
LArGeo::Fx(iirl, Game, Cenx, Ceny)
1798 GeoGenfun::GENFUNCTION y0e =
LArGeo::Fy(iirl, Game, Cenx, Ceny)
1801 GeoGenfun::GENFUNCTION dx0 = x1e - x0e;
1802 GeoGenfun::GENFUNCTION dy0 = y1e - y0e;
1803
1804 GeoGenfun::GENFUNCTION Da0 = Sqrt ( dx0*dx0 + dy0*dy0 );
1805 GeoGenfun::GENFUNCTION da0 = Sqrt ( (Da0 - 2.*Rint)*(Da0 + 2.*Rint) );
1806
1807 GeoGenfun::GENFUNCTION cosalfa0 = (da0*dx0 +iparit*2.*Rint*dy0)/Da0/Da0;
1808 GeoGenfun::GENFUNCTION sinalfa0 = (da0*dy0 -iparit*2.*Rint*dx0)/Da0/Da0;
1809 GeoGenfun::GENFUNCTION alphe_prev =
LArGeo::ATan2(sinalfa0,cosalfa0);
1810
1811#ifdef DEBUGGEO
1812 if (jrl>0 && jrl<Nbrt) {
1813 std::cout << " newalphae, alphae_prev " << newalphe(0) << " "
1814 << alphe_prev(0) << std::endl;
1815 }
1816#endif
1817
1818
1819 GeoGenfun::Mod Mod2Pi(2*
M_PI);
1820 GeoGenfun::GENFUNCTION phi0_dfold_0 =
1821 GeoGenfun::FixedConstant(
M_PI/2.+phi0_safety);
1822 GeoGenfun::GENFUNCTION dphi_dfold_0 = Mod2Pi(newalphe-phi0_safety-Game);
1823 GeoGenfun::GENFUNCTION phi0_dfold_1 = Mod2Pi(
M_PI/2.+ alphe_prev - Game);
1824 GeoGenfun::GENFUNCTION dphi_dfold_1 = Mod2Pi(newalphe-alphe_prev);
1825 GeoGenfun::GENFUNCTION phi0_dfold_2 = Mod2Pi(
M_PI/2.+ newalphe - Game);
1826 GeoGenfun::GENFUNCTION dphi_dfold_2 = Mod2Pi(- newalphe + Game);
1827
1828 GeoGenfun::GENFUNCTION phi0_ufold_0 =
1829 Mod2Pi(
M_PI/2.+newalphe-Game);
1830 GeoGenfun::GENFUNCTION dphi_ufold_0 = Mod2Pi(-newalphe+Game-phi0_safety);
1831 GeoGenfun::GENFUNCTION phi0_ufold_1 = Mod2Pi(
M_PI/2. + newalphe - Game);
1832 GeoGenfun::GENFUNCTION dphi_ufold_1 = Mod2Pi(alphe_prev - newalphe);
1833 GeoGenfun::GENFUNCTION phi0_ufold_2 = GeoGenfun::FixedConstant(
M_PI/2.);
1834 GeoGenfun::GENFUNCTION dphi_ufold_2 = Mod2Pi(newalphe - Game);
1835
1836 const GeoGenfun::AbsFunction* phi0_fold=nullptr;
1837 const GeoGenfun::AbsFunction* dphi_fold=nullptr;
1838 const GeoXF::Function* TXfold=nullptr;
1839
1840 std::string eName;
1841 if (jrl%2==checkParity) {
1842 eName = baseName + "Electrode::CornerDownFold";
1843 } else {
1844 eName = baseName + "Electrode::CornerUpFold";
1845 }
1846
1847
1848 double Rcmine=Rint-Thel/2.;
1849 double Rcmaxe=Rint+Thel/2.;
1850
1851
1852 double ddz0 = dz0-safety_zlen;
1853 if (jrl==Nbrt) {
1854 ddz0 = dza - safety_zlen;
1855 }
1856
1857 GeoGenfun::GENFUNCTION zpos = GeoGenfun::FixedConstant(Zmin+dz0);
1858 double phirot = 0;
1859 if (jrl%2==checkParity) phirot = -
M_PI;
1860 GeoXF::TRANSFUNCTION TXfold1=
1861 GeoXF::Pow(GeoTrf::TranslateX3D(1.0),x1e) *
1862 GeoXF::Pow(GeoTrf::TranslateY3D(1.0),y1e) *
1863 GeoXF::Pow(GeoTrf::TranslateZ3D(1.0),zpos) *
1864 GeoXF::Pow(GeoTrf::RotateZ3D(1.0),Game+phirot);
1865 GeoXF::TRANSFUNCTION TXfold2 =
1866 GeoXF::Pow(GeoTrf::TranslateX3D(1.0),x2e) *
1867 GeoXF::Pow(GeoTrf::TranslateY3D(1.0),y2e) *
1868 GeoXF::Pow(GeoTrf::TranslateZ3D(1.0),zpos) *
1869 GeoXF::Pow(GeoTrf::RotateZ3D(1.0),Game+phirot);
1870
1871
1872 if (jrl==0 && checkParity==0) {
1873 phi0_fold = &(phi0_dfold_0);
1874 dphi_fold = &(dphi_dfold_0);
1875 TXfold = &(TXfold1);
1876 }
1877
1878 if (jrl%2==checkParity && jrl >0 && jrl<Nbrt) {
1879 phi0_fold = &(phi0_dfold_1);
1880 dphi_fold = &(dphi_dfold_1);
1881 TXfold = &(TXfold1);
1882 }
1883
1884 if (jrl%2 ==checkParity && jrl == Nbrt) {
1885 phi0_fold = &(phi0_dfold_2);
1886 dphi_fold = &(dphi_dfold_2);
1887 TXfold = &(TXfold2);
1888 }
1889
1890 if (jrl==0 && checkParity==1 ) {
1891 phi0_fold = &(phi0_ufold_0);
1892 dphi_fold = &(dphi_ufold_0);
1893 TXfold = &(TXfold1);
1894
1895 }
1896
1897 if (jrl%2 ==(1-checkParity) && jrl>0 && jrl < Nbrt) {
1898 phi0_fold = &(phi0_ufold_1);
1899 dphi_fold = &(dphi_ufold_1);
1900 TXfold = &(TXfold1);
1901 }
1902
1903 if (jrl%2==(1-checkParity) && jrl==Nbrt) {
1904 phi0_fold = &(phi0_ufold_2);
1905 dphi_fold = &(dphi_ufold_2);
1906 TXfold = &(TXfold2);
1907 }
1908
1909 if (!phi0_fold || !dphi_fold || !TXfold) {
1910 ATH_MSG_INFO(
" LArGeoBarrel::BarrelConstruction fold not defined...");
1911 }
1912 else
1914 {
1915
1916 GeoTubs* foldeTubs = new GeoTubs(Rcmine,Rcmaxe,ddz0,
1918#ifdef DEBUGGEO
1919 std::cout << " Electrode Corner (tubs) " << std::endl;
1920 std::cout << " Rmin,Rmax,dZ,phi0,Dphi[rad] " << Rcmine << " " << Rcmaxe << " "
1921 << ddz0 <<
" " << (*phi0_fold)(
instance) <<
" "
1922 <<(*dphi_fold)(
instance) << std::endl;
1923#endif
1924 const GeoLogVol* foldeLog = new GeoLogVol(eName,foldeTubs,Kapton_Cu);
1925
1926 GeoIntrusivePtr<GeoPhysVol> foldePhys = new GeoPhysVol(foldeLog);
1927
1928#ifdef DEBUGGEO
1929 if (jrl!=Nbrt) {
1930 std::cout <<
" Position electrode fold x,y,z,rotation/z " << x1e(
instance) <<
1933 } else {
1934 std::cout <<
" Position electrode fold x,y,z,rotation/z " << x2e(
instance) <<
1937 }
1938#endif
1940 stacPhysical->add(
new GeoTransform((*TXfold)(
instance)));
1942 stacPhysical->add(new GeoIdentifierTag(icopytot));
1943 stacPhysical->add(foldePhys);
1944 }
1945 else {
1946 GeoSerialTransformer *
st =
new GeoSerialTransformer(foldePhys, TXfold, Nelectrode);
1947 stacPhysical->add(new GeoSerialIdentifier(jrl*10000));
1948 stacPhysical->add(st);
1949 break;
1950 }
1951
1952 }
1953 }
1954
1955 }
1956 }
1957 }
1958 }
1959 {
1961 if(!
status.isSuccess())
throw std::runtime_error (
"Cannot store STRAIGHTELECTRODES structure");
1962 }
1963 {
1965 if(!
status.isSuccess())
throw std::runtime_error (
"Cannot store STRAIGHTABSORBERS structure");
1966 }
1967 }
1968
1969#endif
1970
1971 ATH_MSG_DEBUG(
"++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
1972 << "+ +\n"
1973 << "+ END of Barrel EM GeoModel definition +\n"
1974 << "+ +\n"
1975 << "++++++++++++++++++++++++++++++++++++++++++++++++++++");
1976}
#define ATH_MSG_WARNING(x)
GeoIntrusivePtr< T > GeoRef
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
std::unique_ptr< IRDBRecord > IRDBRecord_ptr
bool msgLvl(const MSG::Level lvl) const
Test the output level.
const double & YCent(int stackid, int cellid) const
void setHalfLength(int stackid, double halfLength)
const double & Cosu(int stackid, int cellid) const
const double & HalfLength(int stackid, int cellid) const
void setTransform(int stackid, GeoXF::TRANSFUNCTION TXE)
const double & Sinu(int stackid, int cellid) const
const double & XCent(int stackid, int cellid) const
virtual bool isFieldNull(const std::string &fieldName) const =0
Check if the field value is NULL.
virtual int getInt(const std::string &fieldName) const =0
Get int field value.
virtual unsigned int size() const =0
virtual const GeoElement * getElement(const std::string &name)=0
virtual const GeoMaterial * getMaterial(const std::string &name)=0
::StatusCode StatusCode
StatusCode definition for legacy code.
GeoGenfun::FunctionNoop Fy(double r, GeoGenfun::GENFUNCTION G, const double Cenx[], const double Ceny[])
GeoGenfun::FunctionNoop ATan2(GeoGenfun::GENFUNCTION y, GeoGenfun::GENFUNCTION x)
GeoGenfun::FunctionNoop Fx(double r, GeoGenfun::GENFUNCTION G, const double Cenx[], const double Ceny[])
GeoGenfun::FunctionNoop Del1(GeoGenfun::GENFUNCTION G)
GeoGenfun::FunctionNoop Del2(GeoGenfun::GENFUNCTION G)