CMS 3D CMS Logo

Typedefs | Functions
DDEcalBarrelNewAlgo.cc File Reference
#include "DD4hep/DetFactoryHelper.h"
#include "DD4hep/Printout.h"
#include "DataFormats/Math/interface/CMSUnits.h"
#include "DetectorDescription/DDCMS/interface/DDPlugins.h"
#include "DetectorDescription/DDCMS/interface/BenchmarkGrd.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "Geometry/CaloGeometry/interface/EcalTrapezoidParameters.h"
#include "Math/AxisAngle.h"
#include "CLHEP/Geometry/Point3D.h"
#include "CLHEP/Geometry/Vector3D.h"
#include "CLHEP/Geometry/Transform3D.h"

Go to the source code of this file.

Typedefs

using EcalTrap = EcalTrapezoidParameters
 
using Pt3D = HepGeom::Point3D< double >
 
using Ro3D = HepGeom::Rotate3D
 
using Rota = CLHEP::HepRotation
 
using RoX3D = HepGeom::RotateX3D
 
using RoZ3D = HepGeom::RotateZ3D
 
using Tf3D = HepGeom::Transform3D
 
using Tl3D = HepGeom::Translate3D
 
using Vec3 = CLHEP::Hep3Vector
 
using VecDouble = vector< double >
 
using VecStr = vector< string >
 

Functions

static long algorithm (dd4hep::Detector &, cms::DDParsingContext &ctxt, xml_h e, dd4hep::SensitiveDetector &)
 
 DD4HEP_OPEN_PLUGIN (dd4hep, ddcms_det_element_DDCMS_ecal_DDEcalBarrelNewAlgo)
 

Typedef Documentation

Definition at line 20 of file DDEcalBarrelNewAlgo.cc.

using Pt3D = HepGeom::Point3D<double>

Definition at line 22 of file DDEcalBarrelNewAlgo.cc.

using Ro3D = HepGeom::Rotate3D

Definition at line 25 of file DDEcalBarrelNewAlgo.cc.

using Rota = CLHEP::HepRotation

Definition at line 24 of file DDEcalBarrelNewAlgo.cc.

using RoX3D = HepGeom::RotateX3D

Definition at line 28 of file DDEcalBarrelNewAlgo.cc.

using RoZ3D = HepGeom::RotateZ3D

Definition at line 29 of file DDEcalBarrelNewAlgo.cc.

using Tf3D = HepGeom::Transform3D

Definition at line 27 of file DDEcalBarrelNewAlgo.cc.

using Tl3D = HepGeom::Translate3D

Definition at line 26 of file DDEcalBarrelNewAlgo.cc.

using Vec3 = CLHEP::Hep3Vector

Definition at line 23 of file DDEcalBarrelNewAlgo.cc.

using VecDouble = vector<double>

Definition at line 18 of file DDEcalBarrelNewAlgo.cc.

using VecStr = vector<string>

Definition at line 19 of file DDEcalBarrelNewAlgo.cc.

Function Documentation

static long algorithm ( dd4hep::Detector &  ,
cms::DDParsingContext ctxt,
xml_h  e,
dd4hep::SensitiveDetector &   
)
static

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!! Begin Back Cover Plate !!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!! End Back Cover Plate !!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!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!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!! End Pincers !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 474 of file DDEcalBarrelNewAlgo.cc.

References EcalTrapezoidParameters::a(), EcalTrapezoidParameters::A(), cms::DDNamespace::addVolume(), cms::DDNamespace::addVolumeNS(), writedatasetfile::args, EcalTrapezoidParameters::b(), testProducerWithPsetDescEmpty_cfi::b3, zMuMuMuonUserData::beta, EcalTrapezoidParameters::bl1(), reco::HaloData::both, HLT_2018_cff::cap, angle_units::operators::convertRadToDeg(), funct::cos(), counter, dd4hep::createPlacement(), data, cms::DDAlgoArguments::dble(), dumpMFGeometry_cfg::delta, EcalTrapezoidParameters::dz(), CustomPhysics_cfi::gamma, getRunAppsInfo::grid, EcalTrapezoidParameters::h(), EcalTrapezoidParameters::H(), EcalTrapezoidParameters::h1(), cms::DDAlgoArguments::integer(), LEDCalibrationChannels::iphi, dqmiolumiharvest::j, EcalTrapezoidParameters::L(), LogDebug, M_PI, M_PI_2, cms::DDNamespace::material(), metDiagnosticParameterSet_cfi::nMax, cms::DDAlgoArguments::parentName(), cms::DDNamespace::prepend(), diffTwoXMLs::r1, CosmicsPD_Skims::radius, idealTransformation::rotation, cms::DDNamespace::rotation(), funct::sin(), findQualityFiles::size, mathSSE::sqrt(), cms::DDAlgoArguments::str(), AlCaHLTBitMon_QueryRunRegistry::string, theta(), cms::DDAlgoArguments::value(), cms::DDAlgoArguments::vecDble(), cms::DDAlgoArguments::vecStr(), EcalTrapezoidParameters::vertexList(), cms::DDNamespace::volume(), geometryCSVtoXML::xx, geometryCSVtoXML::yy, and geometryCSVtoXML::zz.

477  {
478  BenchmarkGrd counter("DDEcalBarrelNewAlgo");
479  cms::DDNamespace ns(ctxt, e, true);
480  cms::DDAlgoArguments args(ctxt, e);
481 
482  // TRICK!
483  string myns{mynamespace(args.parentName()).data(), mynamespace(args.parentName()).size()};
484 
485  // Barrel volume
486  // barrel parent volume
487  Barrel bar;
488  bar.name = args.str("BarName"); // Barrel volume name
489  bar.mat = args.str("BarMat"); // Barrel material name
490  bar.vecZPts = args.vecDble("BarZPts"); // Barrel list of z pts
491  bar.vecRMin = args.vecDble("BarRMin"); // Barrel list of rMin pts
492  bar.vecRMax = args.vecDble("BarRMax"); // Barrel list of rMax pts
493  bar.vecTran = args.vecDble("BarTran"); // Barrel translation
494  bar.vecRota = args.vecDble("BarRota"); // Barrel rotation
495  bar.vecRota2 = args.vecDble("BarRota2"); // 2nd Barrel rotation
496  bar.vecRota3 = args.vecDble("BarRota3"); // 3rd Barrel rotation
497  bar.phiLo = args.dble("BarPhiLo"); // Barrel phi lo
498  bar.phiHi = args.dble("BarPhiHi"); // Barrel phi hi
499  bar.here = args.dble("BarHere"); // Barrel presence flag
500 
501  // Supermodule volume
502  Supermodule spm;
503  spm.name = args.str("SpmName"); // Supermodule volume name
504  spm.mat = args.str("SpmMat"); // Supermodule material name
505  spm.vecZPts = args.vecDble("SpmZPts"); // Supermodule list of z pts
506  spm.vecRMin = args.vecDble("SpmRMin"); // Supermodule list of rMin pts
507  spm.vecRMax = args.vecDble("SpmRMax"); // Supermodule list of rMax pts
508  spm.vecTran = args.vecDble("SpmTran"); // Supermodule translation
509  spm.vecRota = args.vecDble("SpmRota"); // Supermodule rotation
510  spm.vecBTran = args.vecDble("SpmBTran"); // Base Supermodule translation
511  spm.vecBRota = args.vecDble("SpmBRota"); // Base Supermodule rotation
512  spm.nPerHalf = args.integer("SpmNPerHalf"); // # Supermodules per half detector
513  spm.lowPhi = args.dble("SpmLowPhi"); // Low phi value of base supermodule
514  spm.delPhi = args.dble("SpmDelPhi"); // Delta phi value of base supermodule
515  spm.phiOff = args.dble("SpmPhiOff"); // Phi offset value supermodule
516  spm.vecHere = args.vecDble("SpmHere"); // Bit saying if a supermodule is present or not
517  spm.cutName = args.str("SpmCutName"); // Name of cut box
518  spm.cutThick = args.dble("SpmCutThick"); // Box thickness
519  spm.cutShow = args.value<int>("SpmCutShow"); // Non-zero means show the box on display (testing only)
520  spm.vecCutTM = args.vecDble("SpmCutTM"); // Translation for minus phi cut box
521  spm.vecCutTP = args.vecDble("SpmCutTP"); // Translation for plus phi cut box
522  spm.cutRM = args.dble("SpmCutRM"); // Rotation for minus phi cut box
523  spm.cutRP = args.dble("SpmCutRP"); // Rotation for plus phi cut box
524  spm.expThick = args.dble("SpmExpThick"); // Thickness (x) of supermodule expansion box
525  spm.expWide = args.dble("SpmExpWide"); // Width (y) of supermodule expansion box
526  spm.expYOff = args.dble("SpmExpYOff"); // Offset (y) of supermodule expansion box
527  spm.sideName = args.str("SpmSideName"); // Supermodule Side Plate volume name
528  spm.sideMat = args.str("SpmSideMat"); // Supermodule Side Plate material name
529  spm.sideHigh = args.dble("SpmSideHigh"); // Side plate height
530  spm.sideThick = args.dble("SpmSideThick"); // Side plate thickness
531  spm.sideYOffM = args.dble("SpmSideYOffM"); // Side plate Y offset on minus phi side
532  spm.sideYOffP = args.dble("SpmSideYOffP"); // Side plate Y offset on plus phi side
533 
534  Crystal cry;
535  cry.nomCryDimAF = args.dble("NomCryDimAF");
536  cry.nomCryDimLZ = args.dble("NomCryDimLZ");
537  cry.vecNomCryDimBF = args.vecDble("NomCryDimBF");
538  cry.vecNomCryDimCF = args.vecDble("NomCryDimCF");
539  cry.vecNomCryDimAR = args.vecDble("NomCryDimAR");
540  cry.vecNomCryDimBR = args.vecDble("NomCryDimBR");
541  cry.vecNomCryDimCR = args.vecDble("NomCryDimCR");
542 
543  cry.underAF = args.dble("UnderAF");
544  cry.underLZ = args.dble("UnderLZ");
545  cry.underBF = args.dble("UnderBF");
546  cry.underCF = args.dble("UnderCF");
547  cry.underAR = args.dble("UnderAR");
548  cry.underBR = args.dble("UnderBR");
549  cry.underCR = args.dble("UnderCR");
550 
551  Alveolus alv;
552  alv.wallThAlv = args.dble("WallThAlv");
553  alv.wrapThAlv = args.dble("WrapThAlv");
554  alv.clrThAlv = args.dble("ClrThAlv");
555  alv.vecGapAlvEta = args.vecDble("GapAlvEta");
556 
557  alv.wallFrAlv = args.dble("WallFrAlv");
558  alv.wrapFrAlv = args.dble("WrapFrAlv");
559  alv.clrFrAlv = args.dble("ClrFrAlv");
560 
561  alv.wallReAlv = args.dble("WallReAlv");
562  alv.wrapReAlv = args.dble("WrapReAlv");
563  alv.clrReAlv = args.dble("ClrReAlv");
564 
565  alv.nCryTypes = args.integer("NCryTypes");
566  alv.nCryPerAlvEta = args.integer("NCryPerAlvEta");
567 
568  cry.name = args.str("CryName");
569  cry.clrName = args.str("ClrName");
570  cry.wrapName = args.str("WrapName");
571  cry.wallName = args.str("WallName");
572 
573  cry.mat = args.str("CryMat");
574  cry.clrMat = args.str("ClrMat");
575  cry.wrapMat = args.str("WrapMat");
576  cry.wallMat = args.str("WallMat");
577 
578  Capsule cap;
579  cap.name = args.str("CapName");
580  cap.here = args.dble("CapHere");
581  cap.mat = args.str("CapMat");
582  cap.xSize = args.dble("CapXSize");
583  cap.ySize = args.dble("CapYSize");
584  cap.thick = args.dble("CapThick");
585 
586  Ceramic cer;
587  cer.name = args.str("CerName");
588  cer.mat = args.str("CerMat");
589  cer.xSize = args.dble("CerXSize");
590  cer.ySize = args.dble("CerYSize");
591  cer.thick = args.dble("CerThick");
592 
593  BulkSilicon bSi;
594  bSi.name = args.str("BSiName");
595  bSi.mat = args.str("BSiMat");
596  bSi.xSize = args.dble("BSiXSize");
597  bSi.ySize = args.dble("BSiYSize");
598  bSi.thick = args.dble("BSiThick");
599 
600  APD apd;
601  apd.name = args.str("APDName");
602  apd.mat = args.str("APDMat");
603  apd.side = args.dble("APDSide");
604  apd.thick = args.dble("APDThick");
605  apd.z = args.dble("APDZ");
606  apd.x1 = args.dble("APDX1");
607  apd.x2 = args.dble("APDX2");
608 
609  apd.atjName = args.str("ATJName");
610  apd.atjMat = args.str("ATJMat");
611  apd.atjThick = args.dble("ATJThick");
612 
613  apd.sglName = args.str("SGLName");
614  apd.sglMat = args.str("SGLMat");
615  apd.sglThick = args.dble("SGLThick");
616 
617  apd.aglName = args.str("AGLName");
618  apd.aglMat = args.str("AGLMat");
619  apd.aglThick = args.dble("AGLThick");
620 
621  apd.andName = args.str("ANDName");
622  apd.andMat = args.str("ANDMat");
623  apd.andThick = args.dble("ANDThick");
624 
625  Web web;
626  web.here = args.dble("WebHere");
627  web.plName = args.str("WebPlName");
628  web.clrName = args.str("WebClrName");
629  web.plMat = args.str("WebPlMat");
630  web.clrMat = args.str("WebClrMat");
631  web.vecWebPlTh = args.vecDble("WebPlTh");
632  web.vecWebClrTh = args.vecDble("WebClrTh");
633  web.vecWebLength = args.vecDble("WebLength");
634 
635  InnerLayerVolume ily;
636  ily.here = args.dble("IlyHere");
637  ily.name = args.str("IlyName");
638  ily.phiLow = args.dble("IlyPhiLow");
639  ily.delPhi = args.dble("IlyDelPhi");
640  ily.vecIlyMat = args.vecStr("IlyMat");
641  ily.vecIlyThick = args.vecDble("IlyThick");
642 
643  ily.pipeName = args.str("IlyPipeName");
644  ily.pipeHere = args.dble("IlyPipeHere");
645  ily.pipeMat = args.str("IlyPipeMat");
646  ily.pipeOD = args.dble("IlyPipeOD");
647  ily.pipeID = args.dble("IlyPipeID");
648  ily.vecIlyPipeLength = args.vecDble("IlyPipeLength");
649  ily.vecIlyPipeType = args.vecDble("IlyPipeType");
650  ily.vecIlyPipePhi = args.vecDble("IlyPipePhi");
651  ily.vecIlyPipeZ = args.vecDble("IlyPipeZ");
652 
653  ily.pTMName = args.str("IlyPTMName");
654  ily.pTMHere = args.dble("IlyPTMHere");
655  ily.pTMMat = args.str("IlyPTMMat");
656  ily.pTMWidthHalf = 0.5 * args.dble("IlyPTMWidth");
657  ily.pTMLengthHalf = 0.5 * args.dble("IlyPTMLength");
658  ily.pTMHeightHalf = 0.5 * args.dble("IlyPTMHeight");
659  ily.vecIlyPTMZ = args.vecDble("IlyPTMZ");
660  ily.vecIlyPTMPhi = args.vecDble("IlyPTMPhi");
661 
662  ily.fanOutName = args.str("IlyFanOutName");
663  ily.fanOutHere = args.dble("IlyFanOutHere");
664  ily.fanOutMat = args.str("IlyFanOutMat");
665  ily.fanOutWidth = args.dble("IlyFanOutWidth");
666  ily.fanOutLength = args.dble("IlyFanOutLength");
667  ily.fanOutHeightHalf = 0.5 * args.dble("IlyFanOutHeight");
668  ily.vecIlyFanOutZ = args.vecDble("IlyFanOutZ");
669  ily.vecIlyFanOutPhi = args.vecDble("IlyFanOutPhi");
670  ily.diffName = args.str("IlyDiffName");
671  ily.diffMat = args.str("IlyDiffMat");
672  ily.diffOff = args.dble("IlyDiffOff");
673  ily.diffLength = args.dble("IlyDiffLength");
674  ily.bndlName = args.str("IlyBndlName");
675  ily.bndlMat = args.str("IlyBndlMat");
676  ily.bndlOff = args.dble("IlyBndlOff");
677  ily.bndlLength = args.dble("IlyBndlLength");
678  ily.fEMName = args.str("IlyFEMName");
679  ily.fEMMat = args.str("IlyFEMMat");
680  ily.fEMWidth = args.dble("IlyFEMWidth");
681  ily.fEMLength = args.dble("IlyFEMLength");
682  ily.fEMHeight = args.dble("IlyFEMHeight");
683  ily.vecIlyFEMZ = args.vecDble("IlyFEMZ");
684  ily.vecIlyFEMPhi = args.vecDble("IlyFEMPhi");
685 
686  AlveolarWedge alvWedge;
687  alvWedge.hawRName = args.str("HawRName");
688  alvWedge.fawName = args.str("FawName");
689  alvWedge.fawHere = args.dble("FawHere");
690  alvWedge.hawRHBIG = args.dble("HawRHBIG");
691  alvWedge.hawRhsml = args.dble("HawRhsml");
692  alvWedge.hawRCutY = args.dble("HawRCutY");
693  alvWedge.hawRCutZ = args.dble("HawRCutZ");
694  alvWedge.hawRCutDelY = args.dble("HawRCutDelY");
695  alvWedge.hawYOffCry = args.dble("HawYOffCry");
696 
697  alvWedge.nFawPerSupm = args.integer("NFawPerSupm");
698  alvWedge.fawPhiOff = args.dble("FawPhiOff");
699  alvWedge.fawDelPhi = args.dble("FawDelPhi");
700  alvWedge.fawPhiRot = args.dble("FawPhiRot");
701  alvWedge.fawRadOff = args.dble("FawRadOff");
702 
703  Grid grid;
704  grid.here = args.dble("GridHere");
705  grid.name = args.str("GridName");
706  grid.mat = args.str("GridMat");
707  grid.thick = args.dble("GridThick");
708 
709  Back back;
710  back.here = args.dble("BackHere");
711  back.xOff = args.dble("BackXOff");
712  back.yOff = args.dble("BackYOff");
713  back.sideName = args.str("BackSideName");
714  back.sideHere = args.dble("BackSideHere");
715  back.sideLength = args.dble("BackSideLength");
716  back.sideHeight = args.dble("BackSideHeight");
717  back.sideWidth = args.dble("BackSideWidth");
718  back.sideYOff1 = args.dble("BackSideYOff1");
719  back.sideYOff2 = args.dble("BackSideYOff2");
720  back.sideAngle = args.dble("BackSideAngle");
721  back.sideMat = args.str("BackSideMat");
722  back.plateName = args.str("BackPlateName");
723  back.plateHere = args.dble("BackPlateHere");
724  back.plateLength = args.dble("BackPlateLength");
725  back.plateThick = args.dble("BackPlateThick");
726  back.plateWidth = args.dble("BackPlateWidth");
727  back.plateMat = args.str("BackPlateMat");
728  back.plate2Name = args.str("BackPlate2Name");
729  back.plate2Thick = args.dble("BackPlate2Thick");
730  back.plate2Mat = args.str("BackPlate2Mat");
731 
732  Grille grille;
733  grille.name = args.str("GrilleName");
734  grille.here = args.dble("GrilleHere");
735  grille.thick = args.dble("GrilleThick");
736  grille.width = args.dble("GrilleWidth");
737  grille.zSpace = args.dble("GrilleZSpace");
738  grille.mat = args.str("GrilleMat");
739  grille.vecHeight = args.vecDble("GrilleHeight");
740  grille.vecZOff = args.vecDble("GrilleZOff");
741 
742  grille.edgeSlotName = args.str("GrEdgeSlotName");
743  grille.edgeSlotMat = args.str("GrEdgeSlotMat");
744  grille.edgeSlotHere = args.dble("GrEdgeSlotHere");
745  grille.edgeSlotHeight = args.dble("GrEdgeSlotHeight");
746  grille.edgeSlotWidth = args.dble("GrEdgeSlotWidth");
747  grille.midSlotName = args.str("GrMidSlotName");
748  grille.midSlotMat = args.str("GrMidSlotMat");
749  grille.midSlotHere = args.dble("GrMidSlotHere");
750  grille.midSlotWidth = args.dble("GrMidSlotWidth");
751  grille.midSlotXOff = args.dble("GrMidSlotXOff");
752  grille.vecMidSlotHeight = args.vecDble("GrMidSlotHeight");
753 
754  BackPipe backPipe;
755  backPipe.here = args.dble("BackPipeHere");
756  backPipe.name = args.str("BackPipeName");
757  backPipe.vecDiam = args.vecDble("BackPipeDiam");
758  backPipe.vecThick = args.vecDble("BackPipeThick");
759  backPipe.mat = args.str("BackPipeMat");
760  backPipe.waterMat = args.str("BackPipeWaterMat");
761 
762  BackCooling backCool;
763  backCool.here = args.dble("BackCoolHere");
764  backCool.vecName = args.vecStr("BackCoolName");
765  backCool.barHere = args.dble("BackCoolBarHere");
766  backCool.barWidth = args.dble("BackCoolBarWidth");
767  backCool.barHeight = args.dble("BackCoolBarHeight");
768  backCool.mat = args.str("BackCoolMat");
769  backCool.barName = args.str("BackCoolBarName");
770  backCool.barThick = args.dble("BackCoolBarThick");
771  backCool.barMat = args.str("BackCoolBarMat");
772  backCool.barSSName = args.str("BackCoolBarSSName");
773  backCool.barSSThick = args.dble("BackCoolBarSSThick");
774  backCool.barSSMat = args.str("BackCoolBarSSMat");
775  backCool.barWaName = args.str("BackCoolBarWaName");
776  backCool.barWaThick = args.dble("BackCoolBarWaThick");
777  backCool.barWaMat = args.str("BackCoolBarWaMat");
778  backCool.vFEHere = args.dble("BackCoolVFEHere");
779  backCool.vFEName = args.str("BackCoolVFEName");
780  backCool.vFEMat = args.str("BackCoolVFEMat");
781  backCool.backVFEName = args.str("BackVFEName");
782  backCool.backVFEMat = args.str("BackVFEMat");
783  backCool.vecBackVFELyrThick = args.vecDble("BackVFELyrThick");
784  backCool.vecBackVFELyrName = args.vecStr("BackVFELyrName");
785  backCool.vecBackVFELyrMat = args.vecStr("BackVFELyrMat");
786  backCool.vecBackCoolNSec = args.vecDble("BackCoolNSec");
787  backCool.vecBackCoolSecSep = args.vecDble("BackCoolSecSep");
788  backCool.vecBackCoolNPerSec = args.vecDble("BackCoolNPerSec");
789 
790  BackMisc backMisc;
791  backMisc.here = args.dble("BackMiscHere");
792  backMisc.vecThick = args.vecDble("BackMiscThick");
793  backMisc.vecName = args.vecStr("BackMiscName");
794  backMisc.vecMat = args.vecStr("BackMiscMat");
795  backMisc.backCBStdSep = args.dble("BackCBStdSep");
796 
797  PatchPanel patchPanel;
798  patchPanel.here = args.dble("PatchPanelHere");
799  patchPanel.vecThick = args.vecDble("PatchPanelThick");
800  patchPanel.vecNames = args.vecStr("PatchPanelNames");
801  patchPanel.vecMat = args.vecStr("PatchPanelMat");
802  patchPanel.name = args.str("PatchPanelName");
803 
804  BackCoolTank backCoolTank;
805  backCoolTank.here = args.dble("BackCoolTankHere");
806  backCoolTank.name = args.str("BackCoolTankName");
807  backCoolTank.width = args.dble("BackCoolTankWidth");
808  backCoolTank.thick = args.dble("BackCoolTankThick");
809  backCoolTank.mat = args.str("BackCoolTankMat");
810  backCoolTank.waName = args.str("BackCoolTankWaName");
811  backCoolTank.waWidth = args.dble("BackCoolTankWaWidth");
812  backCoolTank.waMat = args.str("BackCoolTankWaMat");
813  backCoolTank.backBracketName = args.str("BackBracketName");
814  backCoolTank.backBracketHeight = args.dble("BackBracketHeight");
815  backCoolTank.backBracketMat = args.str("BackBracketMat");
816 
817  DryAirTube dryAirTube;
818  dryAirTube.here = args.dble("DryAirTubeHere");
819  dryAirTube.name = args.str("DryAirTubeName");
820  dryAirTube.mbCoolTubeNum = args.integer("MBCoolTubeNum");
821  dryAirTube.innDiam = args.dble("DryAirTubeInnDiam");
822  dryAirTube.outDiam = args.dble("DryAirTubeOutDiam");
823  dryAirTube.mat = args.str("DryAirTubeMat");
824 
825  MBCoolTube mbCoolTube;
826  mbCoolTube.here = args.dble("MBCoolTubeHere");
827  mbCoolTube.name = args.str("MBCoolTubeName");
828  mbCoolTube.innDiam = args.dble("MBCoolTubeInnDiam");
829  mbCoolTube.outDiam = args.dble("MBCoolTubeOutDiam");
830  mbCoolTube.mat = args.str("MBCoolTubeMat");
831 
832  MBManif mbManif;
833  mbManif.here = args.dble("MBManifHere");
834  mbManif.name = args.str("MBManifName");
835  mbManif.innDiam = args.dble("MBManifInnDiam");
836  mbManif.outDiam = args.dble("MBManifOutDiam");
837  mbManif.mat = args.str("MBManifMat");
838 
839  MBLyr mbLyr;
840  mbLyr.here = args.dble("MBLyrHere");
841  mbLyr.vecMBLyrThick = args.vecDble("MBLyrThick");
842  mbLyr.vecMBLyrName = args.vecStr("MBLyrName");
843  mbLyr.vecMBLyrMat = args.vecStr("MBLyrMat");
844 
845  Pincer pincer;
846  pincer.rodHere = args.dble("PincerRodHere");
847  pincer.rodName = args.str("PincerRodName");
848  pincer.rodMat = args.str("PincerRodMat");
849  pincer.vecRodAzimuth = args.vecDble("PincerRodAzimuth");
850  pincer.envName = args.str("PincerEnvName");
851  pincer.envMat = args.str("PincerEnvMat");
852  pincer.envWidth = args.dble("PincerEnvWidth");
853  pincer.envHeight = args.dble("PincerEnvHeight");
854  pincer.envLength = args.dble("PincerEnvLength");
855  pincer.vecEnvZOff = args.vecDble("PincerEnvZOff");
856  pincer.blkName = args.str("PincerBlkName");
857  pincer.blkMat = args.str("PincerBlkMat");
858  pincer.blkLength = args.dble("PincerBlkLength");
859  pincer.shim1Name = args.str("PincerShim1Name");
860  pincer.shimHeight = args.dble("PincerShimHeight");
861  pincer.shim2Name = args.str("PincerShim2Name");
862  pincer.shimMat = args.str("PincerShimMat");
863  pincer.shim1Width = args.dble("PincerShim1Width");
864  pincer.shim2Width = args.dble("PincerShim2Width");
865  pincer.cutName = args.str("PincerCutName");
866  pincer.cutMat = args.str("PincerCutMat");
867  pincer.cutWidth = args.dble("PincerCutWidth");
868  pincer.cutHeight = args.dble("PincerCutHeight");
869 
870  Volume parentVolume = ns.volume(args.parentName());
871  if (bar.here != 0) {
872  const unsigned int copyOne(1);
873  const unsigned int copyTwo(2);
874  // Barrel parent volume----------------------------------------------------------
875  Solid barSolid = Polycone(bar.phiLo, (bar.phiHi - bar.phiLo), bar.vecRMin, bar.vecRMax, bar.vecZPts);
876  Position tran(bar.vecTran[0], bar.vecTran[1], bar.vecTran[2]);
877  Rotation3D rotation = myrot(ns,
878  bar.name + "Rot",
879  Rota(Vec3(bar.vecRota3[0], bar.vecRota3[1], bar.vecRota3[2]), bar.vecRota3[3]) *
880  Rota(Vec3(bar.vecRota2[0], bar.vecRota2[1], bar.vecRota2[2]), bar.vecRota2[3]) *
881  Rota(Vec3(bar.vecRota[0], bar.vecRota[1], bar.vecRota[2]), bar.vecRota[3]));
882  Volume barVolume = Volume(bar.name, barSolid, ns.material(bar.mat));
883  parentVolume.placeVolume(barVolume, copyOne, Transform3D(rotation, tran));
884  // End Barrel parent volume----------------------------------------------------------
885 
886  // Supermodule parent------------------------------------------------------------
887 
888  const string spmcut1ddname((0 != spm.cutShow) ? spm.name : (spm.name + "CUT1"));
889  Solid ddspm = Polycone(spm.lowPhi, spm.delPhi, spm.vecRMin, spm.vecRMax, spm.vecZPts);
890 
891  const unsigned int indx(0.5 * spm.vecRMax.size());
892 
893  // Deal with the cut boxes first
894  array<double, 3> cutBoxParms{{1.05 * (spm.vecRMax[indx] - spm.vecRMin[indx]) * 0.5,
895  0.5 * spm.cutThick,
896  fabs(spm.vecZPts.back() - spm.vecZPts.front()) * 0.5 + 1_mm}};
897  Solid spmCutBox = Box(spm.cutName, cutBoxParms[0], cutBoxParms[1], cutBoxParms[2]);
898  Volume spmCutLog = Volume(spm.cutName, spmCutBox, ns.material(spm.mat));
899 
900  // Supermodule side platess
901  array<double, 3> sideParms{{0.5 * spm.sideHigh, 0.5 * spm.sideThick, 0.5 * fabs(spm.vecZPts[1] - spm.vecZPts[0])}};
902  Solid sideSolid = Box(sideParms[0], sideParms[1], sideParms[2]);
903  Volume sideLog = Volume(spm.sideName, sideSolid, ns.material(spm.sideMat));
904 
905  Solid temp1;
906  Solid temp2;
907  Position sideddtra1;
908  Position sideddtra2;
909  Transform3D alltrot1;
910  Transform3D alltrot2;
911  for (unsigned int icopy(1); icopy <= 2; ++icopy) {
912  const std::vector<double>& tvec(1 == icopy ? spm.vecCutTM : spm.vecCutTP);
913  double rang(1 == icopy ? spm.cutRM : spm.cutRP);
914 
915  const Position tr(tvec[0], tvec[1], tvec[2]);
916  RotationZ ro(rang);
917  const double ang(1 == icopy ? spm.lowPhi : spm.lowPhi + spm.delPhi);
918  RotationZ ro1(ang);
919  const Position tr1(
920  0.5 * (spm.vecRMax[indx] + spm.vecRMin[indx]), 0, 0.5 * (spm.vecZPts.front() + spm.vecZPts.back()));
921  Transform3D alltrot(Transform3D(Transform3D(ro1 * tr1) * tr) * ro);
922  if (1 == icopy) {
923  alltrot1 = alltrot;
924  temp1 = SubtractionSolid(spm.name + "_T1", ddspm, spmCutBox, alltrot);
925  } else {
926  alltrot2 = alltrot;
927  temp2 = SubtractionSolid(spm.name, temp1, spmCutBox, alltrot);
928  }
929  const Tl3D trSide(tvec[0],
930  tvec[1] + (1 == icopy ? 1. : -1.) * (cutBoxParms[1] + sideParms[1]) +
931  (1 == icopy ? spm.sideYOffM : spm.sideYOffP),
932  tvec[2]);
933  const RoZ3D roSide(rang);
934  const Tf3D sideRot(RoZ3D(1 == icopy ? spm.lowPhi : spm.lowPhi + spm.delPhi) *
935  Tl3D(spm.vecRMin.front() + sideParms[0], 0, spm.vecZPts.front() + sideParms[2]) * trSide *
936  roSide);
937 
938  Rotation3D sideddrot(myrot(ns, spm.sideName + std::to_string(icopy), sideRot.getRotation()));
939  const Position sideddtra(sideRot.getTranslation());
940  1 == icopy ? sideddtra1 = sideddtra : sideddtra2 = sideddtra;
941  }
942  Volume spmLog = Volume(spm.name, ((0 != spm.cutShow) ? ddspm : temp2), ns.material(spm.mat));
943  if (0 != spm.cutShow) {
944  spmLog.placeVolume(spmCutLog, 1, alltrot1);
945  spmLog.placeVolume(spmCutLog, 1, alltrot2);
946  }
947  spmLog.placeVolume(sideLog, 1, Transform3D(ns.rotation(ns.prepend(spm.sideName + std::to_string(1))), sideddtra1));
948  spmLog.placeVolume(sideLog, 2, Transform3D(ns.rotation(ns.prepend(spm.sideName + std::to_string(2))), sideddtra2));
949 
950  const double dphi(360._deg / (1. * spm.nPerHalf));
951  for (unsigned int iphi(0); iphi < 2 * spm.nPerHalf; ++iphi) {
952  const double phi(iphi * dphi + spm.phiOff);
953 
954  // this base rotation includes the base translation & rotation
955  // plus flipping for the negative z hemisphere, plus
956  // the phi rotation for this module
957  const Tf3D rotaBase(RoZ3D(phi) * (iphi < spm.nPerHalf ? Ro3D() : RoX3D(180._deg)) *
958  Ro3D(spm.vecBRota[3], Vec3(spm.vecBRota[0], spm.vecBRota[1], spm.vecBRota[2])) *
959  Tl3D(Vec3(spm.vecBTran[0], spm.vecBTran[1], spm.vecBTran[2])));
960 
961  // here the individual rotations & translations of the supermodule
962  // are implemented on top of the overall "base" rotation & translation
963 
964  const unsigned int offr(4 * iphi);
965  const unsigned int offt(3 * iphi);
966 
967  const Ro3D r1(spm.vecRota[offr + 3], Vec3(spm.vecRota[offr + 0], spm.vecRota[offr + 1], spm.vecRota[offr + 2]));
968 
969  const Tf3D rotaExtra(r1 * Tl3D(Vec3(spm.vecTran[offt + 0], spm.vecTran[offt + 1], spm.vecTran[offt + 2])));
970 
971  const Tf3D both(rotaExtra * rotaBase);
972 
973  const Rotation3D rota(myrot(ns, spm.name + std::to_string(convertRadToDeg(phi)), both.getRotation()));
974 
975  if (spm.vecHere[iphi] != 0) {
976  // convert from CLHEP to Position & etc.
977  Position myTran(both.getTranslation().x(), both.getTranslation().y(), both.getTranslation().z());
978  barVolume.placeVolume(spmLog, iphi + 1, Transform3D(rota, myTran));
979  }
980  }
981  // End Supermodule parent------------------------------------------------------------
982 
983  // Begin Inner Layer volumes---------------------------------------------------------
984  const double ilyLength(spm.vecZPts[1] - spm.vecZPts[0]);
985  double ilyRMin(spm.vecRMin[0]);
986  double ilyThick(0);
987  for (unsigned int ilyx(0); ilyx != ily.vecIlyThick.size(); ++ilyx) {
988  ilyThick += ily.vecIlyThick[ilyx];
989  }
990  Solid ilySolid = Tube(ily.name,
991  ilyRMin, // rmin
992  ilyRMin + ilyThick, // rmax
993  0.5 * ilyLength, // dz
994  ily.phiLow, // startPhi
995  ily.phiLow + ily.delPhi); // startPhi + deltaPhi
996  Volume ilyLog = Volume(ily.name, ilySolid, ns.material(spm.mat));
997  spmLog.placeVolume(ilyLog, copyOne, Position(0, 0, 0.5 * ilyLength));
998  Volume ilyPipeLog[200];
999  if (0 != ily.pipeHere) {
1000  for (unsigned int iPipeType(0); iPipeType != ily.vecIlyPipeLength.size(); ++iPipeType) {
1001  string pName(ily.pipeName + "_" + std::to_string(iPipeType + 1));
1002 
1003  Solid ilyPipeSolid = Tube(pName,
1004  0, // rmin
1005  0.5 * ily.pipeOD, // rmax
1006  0.5 * ily.vecIlyPipeLength[iPipeType], // dz
1007  0_deg, // startPhi
1008  360_deg); // startPhi + deltaPhi
1009  ilyPipeLog[iPipeType] = Volume(pName, ilyPipeSolid, ns.material(ily.pipeMat));
1010 
1011  string pWaName(ily.pipeName + "Wa_" + std::to_string(iPipeType + 1));
1012  Solid ilyPipeWaSolid = Tube(pWaName,
1013  0, // rmin
1014  0.5 * ily.pipeID, // rmax
1015  0.5 * ily.vecIlyPipeLength[iPipeType], // dz
1016  0_deg, // startPhi
1017  360_deg); // startPhi + deltaPhi
1018  Volume ilyPipeWaLog = Volume(pWaName, ilyPipeWaSolid, ns.material(backPipe.waterMat));
1019  ilyPipeLog[iPipeType].placeVolume(ilyPipeWaLog, copyOne);
1020  }
1021  }
1022 
1023  Solid ilyPTMSolid = Box(ily.pTMHeightHalf, ily.pTMWidthHalf, ily.pTMLengthHalf);
1024  Volume ilyPTMLog = Volume(ily.pTMName, ilyPTMSolid, ns.material(ily.pTMMat));
1025 
1026  Solid ilyFanOutSolid = Box(ily.fanOutHeightHalf, ily.fanOutWidth / 2., ily.fanOutLength / 2.);
1027  Volume ilyFanOutLog = Volume(ily.fanOutName, ilyFanOutSolid, ns.material(ily.fanOutMat));
1028 
1029  Solid ilyFEMSolid = Box(ily.fEMHeight / 2., ily.fEMWidth / 2., ily.fEMLength / 2.);
1030  Volume ilyFEMLog = Volume(ily.fEMName, ilyFEMSolid, ns.material(ily.fEMMat));
1031 
1032  Solid ilyDiffSolid = Box(ily.fanOutHeightHalf, ily.fanOutWidth / 2., ily.diffLength / 2.);
1033  Volume ilyDiffLog = Volume(ily.diffName, ilyDiffSolid, ns.material(ily.diffMat));
1034 
1035  Solid ilyBndlSolid = Box(ily.fanOutHeightHalf, ily.fanOutWidth / 2., ily.bndlLength / 2.);
1036  Volume ilyBndlLog = Volume(ily.bndlName, ilyBndlSolid, ns.material(ily.bndlMat));
1037 
1038  ilyFanOutLog.placeVolume(
1039  ilyDiffLog, copyOne, Position(0_mm, 0_mm, -ily.fanOutLength / 2 + ily.diffLength / 2 + ily.diffOff));
1040  ilyFanOutLog.placeVolume(
1041  ilyBndlLog, copyOne, Position(0_mm, 0_mm, -ily.fanOutLength / 2 + ily.bndlLength / 2 + ily.bndlOff));
1042  Volume xilyLog;
1043  for (unsigned int iily(0); iily != ily.vecIlyThick.size(); ++iily) {
1044  const double ilyRMax(ilyRMin + ily.vecIlyThick[iily]);
1045  string xilyName(ily.name + std::to_string(iily));
1046  Solid xilySolid = Tube(xilyName, ilyRMin, ilyRMax, 0.5 * ilyLength, ily.phiLow, ily.phiLow + ily.delPhi);
1047  xilyLog = ns.addVolume(Volume(xilyName, xilySolid, ns.material(ily.vecIlyMat[iily])));
1048  if (0 != ily.here) {
1049  ilyLog.placeVolume(xilyLog, copyOne);
1050 
1051  unsigned int copyNum[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
1052 
1053  if (10_mm < ily.vecIlyThick[iily] && ily.vecIlyThick.size() != (iily + 1) && 0 != ily.pipeHere) {
1054  if (0 != ily.pTMHere) {
1055  unsigned int ptmCopy(0);
1056  for (unsigned int ilyPTM(0); ilyPTM != ily.vecIlyPTMZ.size(); ++ilyPTM) {
1057  const double radius(ilyRMax - 1_mm - ily.pTMHeightHalf);
1058  const double phi(ily.vecIlyPTMPhi[ilyPTM]);
1059  const double yy(radius * sin(phi));
1060  const double xx(radius * cos(phi));
1061  ++ptmCopy;
1062  xilyLog.placeVolume(
1063  ilyPTMLog,
1064  ptmCopy,
1065  Transform3D(RotationZ(phi), Position(xx, yy, ily.vecIlyPTMZ[ilyPTM] - ilyLength / 2)));
1066  }
1067  }
1068  if (0 != ily.fanOutHere) {
1069  unsigned int fanOutCopy(0);
1070  for (unsigned int ilyFO(0); ilyFO != ily.vecIlyFanOutZ.size(); ++ilyFO) {
1071  const double radius(ilyRMax - 1_mm - ily.fanOutHeightHalf);
1072  const double phi(ily.vecIlyFanOutPhi[ilyFO]);
1073  const double yy(radius * sin(phi));
1074  const double xx(radius * cos(phi));
1075  ++fanOutCopy;
1076  xilyLog.placeVolume(ilyFanOutLog,
1077  fanOutCopy,
1078  Transform3D(RotationZ(phi) * RotationY(180_deg),
1079  Position(xx, yy, ily.vecIlyFanOutZ[ilyFO] - ilyLength / 2)));
1080  }
1081  unsigned int femCopy(0);
1082  for (unsigned int ilyFEM(0); ilyFEM != ily.vecIlyFEMZ.size(); ++ilyFEM) {
1083  const double radius(ilyRMax - 1_mm - ily.fEMHeight / 2.);
1084  const double phi(ily.vecIlyFEMPhi[ilyFEM]);
1085  const double yy(radius * sin(phi));
1086  const double xx(radius * cos(phi));
1087  ++femCopy;
1088  xilyLog.placeVolume(
1089  ilyFEMLog,
1090  femCopy,
1091  Transform3D(RotationZ(phi), Position(xx, yy, ily.vecIlyFEMZ[ilyFEM] - ilyLength / 2)));
1092  }
1093  }
1094  for (unsigned int iPipe(0); iPipe != ily.vecIlyPipePhi.size(); ++iPipe) {
1095  const unsigned int type(static_cast<unsigned int>(round(ily.vecIlyPipeType[iPipe])));
1096  const double zz(-ilyLength / 2 + ily.vecIlyPipeZ[iPipe] + (9 > type ? ily.vecIlyPipeLength[type] / 2. : 0));
1097 
1098  for (unsigned int ly(0); ly != 2; ++ly) {
1099  const double radius(0 == ly ? ilyRMin + ily.pipeOD / 2. + 1_mm : ilyRMax - ily.pipeOD / 2. - 1_mm);
1100  const double phi(ily.vecIlyPipePhi[iPipe]);
1101  const double yy(radius * sin(phi));
1102  const double xx(radius * cos(phi));
1103  ++copyNum[type];
1104  if (9 > type) {
1105  xilyLog.placeVolume(ilyPipeLog[type], copyNum[type], Position(xx, yy, zz));
1106  } else {
1107  xilyLog.placeVolume(
1108  ilyPipeLog[type],
1109  copyNum[type],
1110  Transform3D(Rotation3D(ROOT::Math::AxisAngle(ROOT::Math::AxisAngle::XYZVector(xx, yy, 0), 90_deg)),
1111  Position(xx, yy, zz)));
1112  }
1113  }
1114  }
1115  }
1116  }
1117  ilyRMin = ilyRMax;
1118  }
1119  // End Inner Layer volumes---------------------------------------------------------
1120 
1121  string clyrName("ECLYR");
1122  std::vector<double> cri;
1123  std::vector<double> cro;
1124  std::vector<double> czz;
1125  czz.emplace_back(spm.vecZPts[1]);
1126  cri.emplace_back(spm.vecRMin[0]);
1127  cro.emplace_back(spm.vecRMin[0] + 25_mm);
1128  czz.emplace_back(spm.vecZPts[2]);
1129  cri.emplace_back(spm.vecRMin[2]);
1130  cro.emplace_back(spm.vecRMin[2] + 10_mm);
1131  Solid clyrSolid = Polycone(clyrName, -9.5_deg, 19_deg, cri, cro, czz);
1132  Volume clyrLog = Volume(clyrName, clyrSolid, ns.material(ily.vecIlyMat[4]));
1133  spmLog.placeVolume(clyrLog, copyOne);
1134 
1135  // Begin Alveolar Wedge parent ------------------------------------------------------
1136  //----------------
1137 
1138  // the next few lines accumulate dimensions appropriate to crystal type 1
1139  // which we use to set some of the features of the half-alveolar wedge (hawR).
1140 
1141  const double BNom1(cry.vecNomCryDimCR[0]);
1142  const double bNom1(cry.vecNomCryDimCF[0]);
1143  const double sWall1(alv.wallThAlv);
1144  const double fWall1(alv.wallFrAlv);
1145  const double sWrap1(alv.wrapThAlv);
1146  const double fWrap1(alv.wrapFrAlv);
1147  const double sClr1(alv.clrThAlv);
1148  const double fClr1(alv.clrFrAlv);
1149  const double LNom1(cry.nomCryDimLZ);
1150  const double beta1(atan((BNom1 - bNom1) / LNom1));
1151  const double sinbeta1(sin(beta1));
1152 
1153  const double tana_hawR((BNom1 - bNom1) / LNom1);
1154 
1155  const double H_hawR(alvWedge.hawRHBIG);
1156  const double h_hawR(alvWedge.hawRhsml);
1157  const double a_hawR(bNom1 + sClr1 + 2 * sWrap1 + 2 * sWall1 - sinbeta1 * (fClr1 + fWrap1 + fWall1));
1158  const double B_hawR(a_hawR + H_hawR * tana_hawR);
1159  const double b_hawR(a_hawR + h_hawR * tana_hawR);
1160  const double L_hawR(spm.vecZPts[2]);
1161 
1162  const EcalTrap trapHAWR(a_hawR / 2., //double aHalfLengthXNegZLoY , // bl1, A/2
1163  a_hawR / 2., //double aHalfLengthXPosZLoY , // bl2, a/2
1164  b_hawR / 2., //double aHalfLengthXPosZHiY , // tl2, b/2
1165  H_hawR / 2., //double aHalfLengthYNegZ , // h1, H/2
1166  h_hawR / 2., //double aHalfLengthYPosZ , // h2, h/2
1167  L_hawR / 2., //double aHalfLengthZ , // dz, L/2
1168  90_deg, //double aAngleAD , // alfa1
1169  0, //double aCoord15X , // x15
1170  0 //double aCoord15Y // y15
1171  );
1172 
1173  string hawRName1(alvWedge.hawRName + "1");
1174  Solid hawRSolid1 = mytrap(hawRName1, trapHAWR);
1175 
1176  const double al1_fawR(atan((B_hawR - a_hawR) / H_hawR) + M_PI_2);
1177 
1178  // here is trap for Full Alveolar Wedge
1179  const EcalTrap trapFAW(a_hawR, //double aHalfLengthXNegZLoY , // bl1, A/2
1180  a_hawR, //double aHalfLengthXPosZLoY , // bl2, a/2
1181  b_hawR, //double aHalfLengthXPosZHiY , // tl2, b/2
1182  H_hawR / 2., //double aHalfLengthYNegZ , // h1, H/2
1183  h_hawR / 2., //double aHalfLengthYPosZ , // h2, h/2
1184  L_hawR / 2., //double aHalfLengthZ , // dz, L/2
1185  al1_fawR, //double aAngleAD , // alfa1
1186  0, //double aCoord15X , // x15
1187  0 //double aCoord15Y // y15
1188  );
1189 
1190  const string fawName1(alvWedge.fawName + "1");
1191  Solid fawSolid1 = mytrap(fawName1, trapFAW);
1192 
1193  const EcalTrap::VertexList vHAW(trapHAWR.vertexList());
1194  const EcalTrap::VertexList vFAW(trapFAW.vertexList());
1195 
1196  const double hawBoxClr(1_mm);
1197 
1198  // HAW cut box to cut off back end of wedge
1199  const string hawCutName(alvWedge.hawRName + "CUTBOX");
1200  array<double, 3> hawBoxParms{{0.5 * b_hawR + hawBoxClr, 0.5 * alvWedge.hawRCutY, 0.5 * alvWedge.hawRCutZ}};
1201  Solid hawCutBox = Box(hawCutName, hawBoxParms[0], hawBoxParms[1], hawBoxParms[2]);
1202 
1203  const Pt3D b1(hawBoxParms[0], hawBoxParms[1], hawBoxParms[2]);
1204  const Pt3D b2(-hawBoxParms[0], hawBoxParms[1], hawBoxParms[2]);
1205  const Pt3D b3(-hawBoxParms[0], hawBoxParms[1], -hawBoxParms[2]);
1206 
1207  const double zDel(
1208  sqrt(4 * hawBoxParms[2] * hawBoxParms[2] - (h_hawR - alvWedge.hawRCutDelY) * (h_hawR - alvWedge.hawRCutDelY)));
1209 
1210  const Tf3D hawCutForm(b1,
1211  b2,
1212  b3,
1213  vHAW[2] + Pt3D(hawBoxClr, -alvWedge.hawRCutDelY, 0),
1214  vHAW[1] + Pt3D(-hawBoxClr, -alvWedge.hawRCutDelY, 0),
1215  Pt3D(vHAW[0].x() - hawBoxClr, vHAW[0].y(), vHAW[0].z() - zDel));
1216 
1217  Solid hawRSolid = SubtractionSolid(hawRSolid1,
1218  hawCutBox,
1219  Transform3D(myrot(ns, hawCutName + "R", hawCutForm.getRotation()),
1220  Position(hawCutForm.getTranslation().x(),
1221  hawCutForm.getTranslation().y(),
1222  hawCutForm.getTranslation().z())));
1223  Volume hawRLog = Volume(alvWedge.hawRName, hawRSolid, ns.material(spm.mat));
1224 
1225  // FAW cut box to cut off back end of wedge
1226  const string fawCutName(alvWedge.fawName + "CUTBOX");
1227  const array<double, 3> fawBoxParms{{2 * hawBoxParms[0], hawBoxParms[1], hawBoxParms[2]}};
1228  Solid fawCutBox = Box(fawCutName, fawBoxParms[0], fawBoxParms[1], fawBoxParms[2]);
1229 
1230  const Pt3D bb1(fawBoxParms[0], fawBoxParms[1], fawBoxParms[2]);
1231  const Pt3D bb2(-fawBoxParms[0], fawBoxParms[1], fawBoxParms[2]);
1232  const Pt3D bb3(-fawBoxParms[0], fawBoxParms[1], -fawBoxParms[2]);
1233 
1234  const Tf3D fawCutForm(bb1,
1235  bb2,
1236  bb3,
1237  vFAW[2] + Pt3D(2 * hawBoxClr, -5_mm, 0),
1238  vFAW[1] + Pt3D(-2 * hawBoxClr, -5_mm, 0),
1239  Pt3D(vFAW[1].x() - 2 * hawBoxClr, vFAW[1].y() - trapFAW.h(), vFAW[1].z() - zDel));
1240  // FIXME: EFAW extruded by: EFAW/EHAWR_2 ovlp=0.209316 cm
1241  Solid fawSolid = SubtractionSolid(fawSolid1,
1242  fawCutBox,
1243  Transform3D(myrot(ns, fawCutName + "R", fawCutForm.getRotation()),
1244  Position(fawCutForm.getTranslation().x(),
1245  fawCutForm.getTranslation().y(),
1246  fawCutForm.getTranslation().z())));
1247  Volume fawLog = Volume(alvWedge.fawName, fawSolid, ns.material(spm.mat));
1248 
1249  const Tf3D hawRform(vHAW[3],
1250  vHAW[0],
1251  vHAW[1], // HAW inside FAW
1252  vFAW[3],
1253  0.5 * (vFAW[0] + vFAW[3]),
1254  0.5 * (vFAW[1] + vFAW[2]));
1255 
1256  fawLog.placeVolume(
1257  hawRLog,
1258  copyOne,
1259  Transform3D(
1260  myrot(ns, alvWedge.hawRName + "R", hawRform.getRotation()),
1261  Position(hawRform.getTranslation().x(), hawRform.getTranslation().y(), hawRform.getTranslation().z())));
1262 
1263  // FIXME: extrusion when using placeVolume,
1264  // use TGeoCombiTrans instead
1265  fawLog->AddNode( //.placeVolume(
1266  hawRLog,
1267  copyTwo,
1269  Rotation3D(1., 0., 0., 0., 1., 0., 0., 0., -1.) * RotationY(-M_PI), // rotate about Y after refl thru Z
1270  Position(-hawRform.getTranslation().x(), -hawRform.getTranslation().y(), -hawRform.getTranslation().z())));
1271 
1272  for (unsigned int iPhi(1); iPhi <= alvWedge.nFawPerSupm; ++iPhi) {
1273  const double rPhi(alvWedge.fawPhiOff + (iPhi - 0.5) * alvWedge.fawDelPhi);
1274 
1275  const Tf3D fawform(RoZ3D(rPhi) * Tl3D(alvWedge.fawRadOff + (trapFAW.H() + trapFAW.h()) / 4, 0, trapFAW.L() / 2) *
1276  RoZ3D(-90_deg + alvWedge.fawPhiRot));
1277  if (alvWedge.fawHere)
1278  spmLog.placeVolume(
1279  fawLog,
1280  iPhi,
1281  Transform3D(
1282  myrot(ns, alvWedge.fawName + "_Rot" + std::to_string(iPhi), fawform.getRotation()),
1283  Position(fawform.getTranslation().x(), fawform.getTranslation().y(), fawform.getTranslation().z())));
1284  }
1285 
1286  // End Alveolar Wedge parent ------------------------------------------------------
1287 
1288  // Begin Grid + Tablet insertion
1289 
1290  const double h_Grid(grid.thick);
1291 
1292  const EcalTrap trapGrid((B_hawR - h_Grid * (B_hawR - a_hawR) / H_hawR) / 2, // bl1, A/2
1293  (b_hawR - h_Grid * (B_hawR - a_hawR) / H_hawR) / 2, // bl2, a/2
1294  b_hawR / 2., // tl2, b/2
1295  h_Grid / 2., // h1, H/2
1296  h_Grid / 2., // h2, h/2
1297  (L_hawR - 8_cm) / 2., // dz, L/2
1298  90_deg, // alfa1
1299  0, // x15
1300  H_hawR - h_hawR // y15
1301  );
1302 
1303  Solid gridSolid = mytrap(grid.name, trapGrid);
1304  Volume gridLog = Volume(grid.name, gridSolid, ns.material(grid.mat));
1305 
1306  const EcalTrap::VertexList vGrid(trapGrid.vertexList());
1307 
1308  const Tf3D gridForm(vGrid[4],
1309  vGrid[5],
1310  vGrid[6], // Grid inside HAW
1311  vHAW[5] - Pt3D(0, h_Grid, 0),
1312  vHAW[5],
1313  vHAW[6]);
1314 
1315  if (0 != grid.here)
1316  hawRLog.placeVolume(
1317  gridLog,
1318  copyOne,
1319  Transform3D(
1320  myrot(ns, grid.name + "R", gridForm.getRotation()),
1321  Position(gridForm.getTranslation().x(), gridForm.getTranslation().y(), gridForm.getTranslation().z())));
1322  // End Grid + Tablet insertion
1323 
1324  // begin filling Wedge with crystal plus supports --------------------------
1325 
1326  const double aNom(cry.nomCryDimAF);
1327  const double LNom(cry.nomCryDimLZ);
1328 
1329  const double AUnd(cry.underAR);
1330  const double aUnd(cry.underAF);
1331  const double bUnd(cry.underCF);
1332  const double HUnd(cry.underBR);
1333  const double hUnd(cry.underBF);
1334  const double LUnd(cry.underLZ);
1335 
1336  const double sWall(alv.wallThAlv);
1337  const double sWrap(alv.wrapThAlv);
1338  const double sClr(alv.clrThAlv);
1339 
1340  const double fWall(alv.wallFrAlv);
1341  const double fWrap(alv.wrapFrAlv);
1342  const double fClr(alv.clrFrAlv);
1343 
1344  const double rWall(alv.wallReAlv);
1345  const double rWrap(alv.wrapReAlv);
1346  const double rClr(alv.clrReAlv);
1347 
1348  // theta is angle in yz plane between z axis & leading edge of crystal
1349  double theta(90_deg);
1350  double zee(0_mm);
1351  double side(0_mm);
1352  double zeta(0_deg); // increment in theta for last crystal
1353 
1354  for (unsigned int cryType(1); cryType <= alv.nCryTypes; ++cryType) {
1355  const string sType("_" + std::string(10 > cryType ? "0" : "") + std::to_string(cryType));
1356 
1357  LogDebug("EcalGeom") << "Crytype=" << cryType;
1358  const double ANom(cry.vecNomCryDimAR[cryType - 1]);
1359  const double BNom(cry.vecNomCryDimCR[cryType - 1]);
1360  const double bNom(cry.vecNomCryDimCF[cryType - 1]);
1361  const double HNom(cry.vecNomCryDimBR[cryType - 1]);
1362  const double hNom(cry.vecNomCryDimBF[cryType - 1]);
1363 
1364  const double alfCry(90_deg + atan((bNom - bUnd - aNom + aUnd) / (hNom - hUnd)));
1365 
1366  const EcalTrap trapCry((ANom - AUnd) / 2., //double aHalfLengthXNegZLoY , // bl1, A/2
1367  (aNom - aUnd) / 2., //double aHalfLengthXPosZLoY , // bl2, a/2
1368  (bNom - bUnd) / 2., //double aHalfLengthXPosZHiY , // tl2, b/2
1369  (HNom - HUnd) / 2., //double aHalfLengthYNegZ , // h1, H/2
1370  (hNom - hUnd) / 2., //double aHalfLengthYPosZ , // h2, h/2
1371  (LNom - LUnd) / 2., //double aHalfLengthZ , // dz, L/2
1372  alfCry, //double aAngleAD , // alfa1
1373  aNom - aUnd - ANom + AUnd, //double aCoord15X , // x15
1374  hNom - hUnd - HNom + HUnd //double aCoord15Y // y15
1375  );
1376 
1377  const string cryDDName(cry.name + sType);
1378  Solid crySolid = mytrap(cry.name, trapCry);
1379  Volume cryLog = Volume(cryDDName, crySolid, ns.material(cry.mat));
1380 
1381  //++++++++++++++++++++++++++++++++++ APD ++++++++++++++++++++++++++++++++++
1382  const unsigned int copyCap(1);
1383  const string capDDName(cap.name + sType);
1384  Solid capSolid = Box(cap.xSize / 2., cap.ySize / 2., cap.thick / 2.);
1385  Volume capLog = Volume(capDDName, capSolid, ns.material(cap.mat));
1386 
1387  const string sglDDName(apd.sglName + sType);
1388  Solid sglSolid = Box(cap.xSize / 2., cap.ySize / 2., apd.sglThick / 2.);
1389  Volume sglLog = Volume(sglDDName, sglSolid, ns.material(apd.sglMat));
1390  const unsigned int copySGL(1);
1391 
1392  const string cerDDName(cer.name + sType);
1393  Solid cerSolid = Box(cer.xSize / 2., cer.ySize / 2., cer.thick / 2.);
1394  Volume cerLog = Volume(cerDDName, cerSolid, ns.material(cer.mat));
1395  unsigned int copyCER(0);
1396 
1397  const string bsiDDName(bSi.name + sType);
1398  Solid bsiSolid = Box(bSi.xSize / 2., bSi.ySize / 2., bSi.thick / 2.);
1399  Volume bsiLog = Volume(bsiDDName, bsiSolid, ns.material(bSi.mat));
1400  const unsigned int copyBSi(1);
1401 
1402  const string atjDDName(apd.atjName + sType);
1403  Solid atjSolid = Box(atjDDName, apd.side / 2., apd.side / 2., apd.atjThick / 2.);
1404  Volume atjLog = Volume(atjDDName, atjSolid, ns.material(apd.atjMat));
1405  const unsigned int copyATJ(1);
1406 
1407  const string aglDDName(apd.aglName + sType);
1408  Solid aglSolid = Box(bSi.xSize / 2., bSi.ySize / 2., apd.aglThick / 2.);
1409  Volume aglLog = Volume(aglDDName, aglSolid, ns.material(apd.aglMat));
1410  const unsigned int copyAGL(1);
1411 
1412  const string andDDName(apd.andName + sType);
1413  Solid andSolid = Box(apd.side / 2., apd.side / 2., apd.andThick / 2.);
1414  Volume andLog = Volume(andDDName, andSolid, ns.material(apd.andMat));
1415  const unsigned int copyAND(1);
1416 
1417  const string apdDDName(apd.name + sType);
1418  Solid apdSolid = Box(apdDDName, apd.side / 2., apd.side / 2., apd.thick / 2.);
1419  Volume apdLog = Volume(apdDDName, apdSolid, ns.material(apd.mat));
1420  const unsigned int copyAPD(1);
1421 
1422  //++++++++++++++++++++++++++++++++++ END APD ++++++++++++++++++++++++++++++++++
1423 
1424  const double delta(atan((HNom - hNom) / LNom));
1425  const double sindelta(sin(delta));
1426 
1427  const double gamma(atan((ANom - aNom) / LNom));
1428  const double singamma(sin(gamma));
1429 
1430  const double beta(atan((BNom - bNom) / LNom));
1431  const double sinbeta(sin(beta));
1432 
1433  // Now clearance trap
1434  const double alfClr(90_deg + atan((bNom - aNom) / (hNom + sClr)));
1435 
1436  const EcalTrap trapClr((ANom + sClr + rClr * singamma) / 2., //double aHalfLengthXNegZLoY , // bl1, A/2
1437  (aNom + sClr - fClr * singamma) / 2., //double aHalfLengthXPosZLoY , // bl2, a/2
1438  (bNom + sClr - fClr * sinbeta) / 2., //double aHalfLengthXPosZHiY , // tl2, b/2
1439  (HNom + sClr + rClr * sindelta) / 2., //double aHalfLengthYNegZ , // h1, H/2
1440  (hNom + sClr - fClr * sindelta) / 2., //double aHalfLengthYPosZ , // h2, h/2
1441  (LNom + fClr + rClr) / 2., // dz, L/2
1442  alfClr, //double aAngleAD , // alfa1
1443  aNom - ANom, //double aCoord15X , // x15
1444  hNom - HNom //double aCoord15Y // y15
1445  );
1446 
1447  const string clrDDName(cry.clrName + sType);
1448  Solid clrSolid = mytrap(clrDDName, trapClr);
1449  Volume clrLog = Volume(clrDDName, clrSolid, ns.material(cry.clrMat));
1450 
1451  // Now wrap trap
1452  const double alfWrap(90_deg + atan((bNom - aNom) / (hNom + sClr + 2 * sWrap)));
1453 
1454  const EcalTrap trapWrap((trapClr.A() + 2 * sWrap + rWrap * singamma) / 2, // bl1, A/2
1455  (trapClr.a() + 2 * sWrap - fWrap * singamma) / 2, // bl2, a/2
1456  (trapClr.b() + 2 * sWrap - fWrap * sinbeta) / 2, // tl2, b/2
1457  (trapClr.H() + 2 * sWrap + rWrap * sindelta) / 2, // h1, H/2
1458  (trapClr.h() + 2 * sWrap - fWrap * sindelta) / 2, // h2, h/2
1459  (trapClr.L() + fWrap + rWrap) / 2., // dz, L/2
1460  alfWrap, //double aAngleAD , // alfa1
1461  aNom - ANom - (cryType > 9 ? 0 : 0.020_mm),
1462  hNom - HNom //double aCoord15Y // y15
1463  );
1464 
1465  const string wrapDDName(cry.wrapName + sType);
1466  Solid wrapSolid = mytrap(wrapDDName, trapWrap);
1467  Volume wrapLog = Volume(wrapDDName, wrapSolid, ns.material(cry.wrapMat));
1468 
1469  // Now wall trap
1470 
1471  const double alfWall(90_deg + atan((bNom - aNom) / (hNom + sClr + 2 * sWrap + 2 * sWall)));
1472 
1473  const EcalTrap trapWall((trapWrap.A() + 2 * sWall + rWall * singamma) / 2, // A/2
1474  (trapWrap.a() + 2 * sWall - fWall * singamma) / 2, // a/2
1475  (trapWrap.b() + 2 * sWall - fWall * sinbeta) / 2, // b/2
1476  (trapWrap.H() + 2 * sWall + rWall * sindelta) / 2, // H/2
1477  (trapWrap.h() + 2 * sWall - fWall * sindelta) / 2, // h/2
1478  (trapWrap.L() + fWall + rWall) / 2., // L/2
1479  alfWall, // alfa1
1480  aNom - ANom - (cryType < 10 ? 0.150_mm : 0.100_mm),
1481  hNom - HNom // y15
1482  );
1483 
1484  const string wallDDName(cry.wallName + sType);
1485  Solid wallSolid = mytrap(wallDDName, trapWall);
1486  Volume wallLog = Volume(wallDDName, wallSolid, ns.material(cry.wallMat));
1487 
1488  // Now for placement of cry within clr
1489  const Vec3 cryToClr(0, 0, (rClr - fClr) / 2);
1490  clrLog.placeVolume(cryLog, copyOne, Position(0_mm, 0_mm, (rClr - fClr) / 2));
1491 
1492  if (0 != cap.here) {
1493  bsiLog.placeVolume(aglLog, copyAGL, Position(0_mm, 0_mm, -apd.aglThick / 2. + bSi.thick / 2.));
1494  bsiLog.placeVolume(andLog, copyAND, Position(0_mm, 0_mm, -apd.andThick / 2. - apd.aglThick + bSi.thick / 2.));
1495  bsiLog.placeVolume(
1496  apdLog, copyAPD, Position(0_mm, 0_mm, -apd.thick / 2. - apd.andThick - apd.aglThick + bSi.thick / 2.));
1497  bsiLog.placeVolume(
1498  atjLog,
1499  copyATJ,
1500  Position(0_mm, 0_mm, -apd.atjThick / 2. - apd.thick - apd.andThick - apd.aglThick + bSi.thick / 2.));
1501  cerLog.placeVolume(bsiLog, copyBSi, Position(0_mm, 0_mm, -bSi.thick / 2. + cer.thick / 2.));
1502  capLog.placeVolume(sglLog, copySGL, Position(0_mm, 0_mm, -apd.sglThick / 2. + cap.thick / 2.));
1503 
1504  for (unsigned int ijkl(0); ijkl != 2; ++ijkl) {
1505  capLog.placeVolume(cerLog,
1506  ++copyCER,
1507  Position(trapCry.bl1() - (0 == ijkl ? apd.x1 : apd.x2),
1508  trapCry.h1() - apd.z,
1509  -apd.sglThick - cer.thick / 2. + cap.thick / 2.));
1510  }
1511  clrLog.placeVolume(capLog, copyCap, Position(0_mm, 0_mm, -trapCry.dz() - cap.thick / 2. + (rClr - fClr) / 2.));
1512  }
1513 
1514  const Vec3 clrToWrap(0, 0, (rWrap - fWrap) / 2);
1515  wrapLog.placeVolume(clrLog, copyOne, Position(0_mm, 0_mm, (rWrap - fWrap) / 2)); //SAME as cryToWrap
1516 
1517  // Now for placement of clr within wall
1518  const Vec3 wrapToWall1(0_mm, 0_mm, (rWall - fWall) / 2);
1519  const Vec3 wrapToWall(Vec3((cryType > 9 ? 0_mm : 0.005_mm), 0_mm, 0_mm) + wrapToWall1);
1520  wallLog.placeVolume(
1521  wrapLog,
1522  copyOne,
1523  Position(Vec3((cryType > 9 ? 0_mm : 0.005_mm), 0_mm, 0_mm) + wrapToWall1)); //SAME as wrapToWall
1524 
1525  const EcalTrap::VertexList vWall(trapWall.vertexList());
1526  const EcalTrap::VertexList vCry(trapCry.vertexList());
1527 
1528  const double sidePrime((trapWall.a() - trapCry.a()) / 2);
1529  const double frontPrime(fWall + fWrap + fClr + LUnd / 2);
1530 
1531  // define web plates with clearance ===========================================
1532 
1533  if (1 == cryType) // first web plate: inside clearance volume
1534  {
1535  zee += alv.vecGapAlvEta[0];
1536  }
1537 
1538  for (unsigned int etaAlv(1); etaAlv <= alv.nCryPerAlvEta; ++etaAlv) {
1539  LogDebug("EcalGeom") << "theta=" << convertRadToDeg(theta) << ", sidePrime=" << sidePrime
1540  << ", frontPrime=" << frontPrime << ", zeta=" << zeta << ", delta=" << delta
1541  << ", zee=" << zee;
1542 
1543  zee += 0.075_mm + (side * cos(zeta) + trapWall.h() - sidePrime) / sin(theta);
1544 
1545  // make transform for placing enclosed crystal
1546 
1547  const Pt3D trap2(vCry[2] + cryToClr + clrToWrap + wrapToWall);
1548 
1549  const Pt3D trap3(trap2 + Pt3D(0, -trapCry.h(), 0));
1550  const Pt3D trap1(trap3 + Pt3D(-trapCry.a(), 0, 0));
1551 
1552  const Pt3D wedge3(vHAW[4] + Pt3D(sidePrime, alvWedge.hawYOffCry, zee));
1553  const Pt3D wedge2(wedge3 + Pt3D(0, trapCry.h() * cos(theta), -trapCry.h() * sin(theta)));
1554  const Pt3D wedge1(wedge3 + Pt3D(trapCry.a(), 0, 0));
1555 
1556  const Tf3D tForm1(trap1, trap2, trap3, wedge1, wedge2, wedge3);
1557 
1558  const double xx(0.050_mm);
1559 
1560  const Tf3D tForm(HepGeom::Translate3D(xx, 0, 0) * tForm1);
1561  hawRLog.placeVolume(
1562  wallLog,
1563  etaAlv,
1564  Transform3D(myrot(ns, wallDDName + "_" + std::to_string(etaAlv), tForm.getRotation()),
1565  Position(tForm.getTranslation().x(), tForm.getTranslation().y(), tForm.getTranslation().z())));
1566  theta -= delta;
1567  side = sidePrime;
1568  zeta = delta;
1569  }
1570  if (5 == cryType || 9 == cryType || 13 == cryType || 17 == cryType) { // web plates
1571  zee += 0.5 * alv.vecGapAlvEta[cryType] / sin(theta);
1572  zee += 0.5 * alv.vecGapAlvEta[cryType] / sin(theta);
1573  } else {
1574  if (17 != cryType)
1575  zee += alv.vecGapAlvEta[cryType] / sin(theta);
1576  }
1577  }
1578  // END filling Wedge with crystal plus supports --------------------------
1579 
1580  //------------------------------------------------------------------------
1581  //------------------------------------------------------------------------
1582  //------------------------------------------------------------------------
1583  //------------------------------------------------------------------------
1584  //**************** Material at outer radius of supermodule ***************
1585  //------------------------------------------------------------------------
1586  //------------------------------------------------------------------------
1587  //------------------------------------------------------------------------
1588  //------------------------------------------------------------------------
1589 
1590  if (0 != back.here) {
1596 
1597  const Position outtra(back.xOff + back.sideHeight / 2, back.yOff, back.sideLength / 2);
1598 
1599  const double realBPthick(back.plateThick + back.plate2Thick);
1600  array<double, 3> backPlateParms{{back.plateWidth / 2., realBPthick / 2., back.plateLength / 2.}};
1601  Solid backPlateSolid = Box(backPlateParms[0], backPlateParms[1], backPlateParms[2]);
1602  Volume backPlateLog = Volume(back.plateName, backPlateSolid, ns.material(back.plateMat));
1603 
1604  const Position backPlateTra(
1605  back.sideHeight / 2 + backPlateParms[1], 0_mm, backPlateParms[2] - back.sideLength / 2);
1606 
1607  Solid backPlate2Solid = Box(back.plateWidth / 2., back.plate2Thick / 2., back.plateLength / 2.);
1608  Volume backPlate2Log = Volume(back.plate2Name, backPlate2Solid, ns.material(back.plate2Mat));
1609 
1610  const Position backPlate2Tra(0_mm, -backPlateParms[1] + back.plate2Thick / 2., 0_mm);
1611  if (0 != back.plateHere) {
1612  backPlateLog.placeVolume(backPlate2Log, copyOne, Transform3D(backPlate2Tra));
1613  spmLog.placeVolume(
1614  backPlateLog,
1615  copyOne,
1616  Transform3D(myrot(ns, back.plateName + "Rot5", CLHEP::HepRotationZ(270_deg)), outtra + backPlateTra));
1617  }
1623 
1629 
1630  const EcalTrap trapBS(back.sideWidth / 2., //double aHalfLengthXNegZLoY , // bl1, A/2
1631  back.sideWidth / 2., //double aHalfLengthXPosZLoY , // bl2, a/2
1632  back.sideWidth / 4., //double aHalfLengthXPosZHiY , // tl2, b/2
1633  back.sideHeight / 2., //double aHalfLengthYNegZ , // h1, H/2
1634  back.sideHeight / 2., //double aHalfLengthYPosZ , // h2, h/2
1635  back.sideLength / 2., //double aHalfLengthZ , // dz, L/2
1636  back.sideAngle, //double aAngleAD , // alfa1
1637  0, //double aCoord15X , // x15
1638  0 //double aCoord15Y // y15
1639  );
1640 
1641  Solid backSideSolid = mytrap(back.sideName, trapBS);
1642  Volume backSideLog = Volume(back.sideName, backSideSolid, ns.material(back.sideMat));
1643 
1644  const Position backSideTra1(0_mm, back.plateWidth / 2 + back.sideYOff1, 1_mm);
1645  if (0 != back.sideHere) {
1646  spmLog.placeVolume(
1647  backSideLog,
1648  copyOne,
1649  Transform3D(myrot(ns, back.sideName + "Rot8", CLHEP::HepRotationX(180_deg) * CLHEP::HepRotationZ(90_deg)),
1650  outtra + backSideTra1));
1651  const Position backSideTra2(0_mm, -back.plateWidth / 2 + back.sideYOff2, 1_mm);
1652  spmLog.placeVolume(
1653  backSideLog,
1654  copyTwo,
1655  Transform3D(myrot(ns, back.sideName + "Rot9", CLHEP::HepRotationZ(90_deg)), outtra + backSideTra2));
1656  }
1662 
1663  //=====================
1664  const double backCoolWidth(backCool.barWidth + 2. * backCoolTank.width);
1665 
1671 
1672  const double manifCut(2_mm);
1673 
1674  Solid mBManifSolid = Tube(0, mbManif.outDiam / 2, backCoolWidth / 2. - manifCut, 0_deg, 360_deg);
1675  Volume mBManifLog = Volume(mbManif.name, mBManifSolid, ns.material(mbManif.mat));
1676 
1677  const string mBManifWaName(mbManif.name + "Wa");
1678  Solid mBManifWaSolid = Tube(0, mbManif.innDiam / 2, backCoolWidth / 2. - manifCut, 0_deg, 360_deg);
1679  Volume mBManifWaLog(mBManifWaName, mBManifWaSolid, ns.material(backPipe.waterMat));
1680  mBManifLog.placeVolume(mBManifWaLog, copyOne);
1681 
1687  //=====================
1688 
1694  const double deltaY(-5_mm);
1695 
1696  Solid grEdgeSlotSolid = Box(grille.edgeSlotHeight / 2., grille.edgeSlotWidth / 2., grille.thick / 2.);
1697  Volume grEdgeSlotLog = Volume(grille.edgeSlotName, grEdgeSlotSolid, ns.material(grille.edgeSlotMat));
1698 
1699  unsigned int edgeSlotCopy(0);
1700  unsigned int midSlotCopy(0);
1701 
1702  Volume grMidSlotLog[4];
1703 
1704  for (unsigned int iGr(0); iGr != grille.vecHeight.size(); ++iGr) {
1705  string gName(grille.name + std::to_string(iGr));
1706  Solid grilleSolid = Box(gName, grille.vecHeight[iGr] / 2., backCoolWidth / 2., grille.thick / 2.);
1707  Volume grilleLog = Volume(gName, grilleSolid, ns.material(grille.mat));
1708 
1709  const Position grilleTra(-realBPthick / 2 - grille.vecHeight[iGr] / 2,
1710  deltaY,
1711  grille.vecZOff[iGr] + grille.thick / 2 - back.sideLength / 2);
1712  const Position gTra(outtra + backPlateTra + grilleTra);
1713 
1714  if (0 != grille.midSlotHere && 0 != iGr) {
1715  if (0 == (iGr - 1) % 2) {
1716  string mName(grille.midSlotName + std::to_string(iGr / 2));
1717  Solid grMidSlotSolid =
1718  Box(mName, grille.vecMidSlotHeight[(iGr - 1) / 2] / 2., grille.midSlotWidth / 2., grille.thick / 2.);
1719  grMidSlotLog[(iGr - 1) / 2] = Volume(mName, grMidSlotSolid, ns.material(grille.midSlotMat));
1720  }
1721  grilleLog.placeVolume(
1722  grMidSlotLog[(iGr - 1) / 2],
1723  ++midSlotCopy,
1724  Transform3D(Position(
1725  grille.vecHeight[iGr] / 2. - grille.vecMidSlotHeight[(iGr - 1) / 2] / 2., +grille.midSlotXOff, 0)));
1726  grilleLog.placeVolume(
1727  grMidSlotLog[(iGr - 1) / 2],
1728  ++midSlotCopy,
1729  Transform3D(Position(
1730  grille.vecHeight[iGr] / 2. - grille.vecMidSlotHeight[(iGr - 1) / 2] / 2., -grille.midSlotXOff, 0)));
1731  }
1732 
1733  if (0 != grille.edgeSlotHere && 0 != iGr) {
1734  grilleLog.placeVolume(grEdgeSlotLog,
1735  ++edgeSlotCopy,
1736  Transform3D(Position(grille.vecHeight[iGr] / 2. - grille.edgeSlotHeight / 2.,
1737  backCoolWidth / 2 - grille.edgeSlotWidth / 2.,
1738  0)));
1739  grilleLog.placeVolume(grEdgeSlotLog,
1740  ++edgeSlotCopy,
1741  Transform3D(Position(grille.vecHeight[iGr] / 2. - grille.edgeSlotHeight / 2.,
1742  -backCoolWidth / 2 + grille.edgeSlotWidth / 2.,
1743  0)));
1744  }
1745  if (0 != grille.here)
1746  spmLog.placeVolume(grilleLog, iGr, Transform3D(gTra));
1747 
1748  if ((0 != iGr % 2) && (0 != mbManif.here)) {
1749  spmLog.placeVolume(mBManifLog,
1750  iGr,
1751  Transform3D(myrot(ns, mbManif.name + "R1", CLHEP::HepRotationX(90_deg)),
1752  gTra - Position(-mbManif.outDiam / 2. + grille.vecHeight[iGr] / 2.,
1753  manifCut,
1754  grille.thick / 2. + 3 * mbManif.outDiam / 2.)));
1755  spmLog.placeVolume(mBManifLog,
1756  iGr - 1,
1757  Transform3D(myrot(ns, mbManif.name + "R2", CLHEP::HepRotationX(90_deg)),
1758  gTra - Position(-3 * mbManif.outDiam / 2. + grille.vecHeight[iGr] / 2.,
1759  manifCut,
1760  grille.thick / 2 + 3 * mbManif.outDiam / 2.)));
1761  }
1762  }
1763 
1769 
1775 
1776  Solid backCoolBarSolid = Box(backCool.barHeight / 2., backCool.barWidth / 2., backCool.barThick / 2.);
1777  Volume backCoolBarLog = Volume(backCool.barName, backCoolBarSolid, ns.material(backCool.barMat));
1778 
1779  Solid backCoolBarSSSolid = Box(backCool.barHeight / 2., backCool.barWidth / 2., backCool.barSSThick / 2.);
1780  Volume backCoolBarSSLog = Volume(backCool.barSSName, backCoolBarSSSolid, ns.material(backCool.barSSMat));
1781  const Position backCoolBarSSTra(0, 0, 0);
1782  backCoolBarLog.placeVolume(backCoolBarSSLog, copyOne, Transform3D(backCoolBarSSTra));
1783 
1784  Solid backCoolBarWaSolid = Box(backCool.barHeight / 2., backCool.barWidth / 2., backCool.barWaThick / 2.);
1785  Volume backCoolBarWaLog = Volume(backCool.barWaName, backCoolBarWaSolid, ns.material(backCool.barWaMat));
1786  const Position backCoolBarWaTra(0, 0, 0);
1787  backCoolBarSSLog.placeVolume(backCoolBarWaLog, copyOne, Transform3D(backCoolBarWaTra));
1788 
1794 
1800 
1801  double thickVFE(0);
1802  for (unsigned int iLyr(0); iLyr != backCool.vecBackVFELyrThick.size(); ++iLyr) {
1803  thickVFE += backCool.vecBackVFELyrThick[iLyr];
1804  }
1805  Solid backVFESolid = Box(backCool.barHeight / 2., backCool.barWidth / 2., thickVFE / 2.);
1806  Volume backVFELog = ns.addVolumeNS(Volume(myns + backCool.vFEName, backVFESolid, ns.material(backCool.vFEMat)));
1807  Position offTra(0, 0, -thickVFE / 2);
1808  for (unsigned int iLyr(0); iLyr != backCool.vecBackVFELyrThick.size(); ++iLyr) {
1809  Solid backVFELyrSolid =
1810  Box(backCool.barHeight / 2., backCool.barWidth / 2., backCool.vecBackVFELyrThick[iLyr] / 2.);
1811  Volume backVFELyrLog =
1812  Volume(backCool.vecBackVFELyrName[iLyr], backVFELyrSolid, ns.material(backCool.vecBackVFELyrMat[iLyr]));
1813  const Position backVFELyrTra(0, 0, backCool.vecBackVFELyrThick[iLyr] / 2);
1814  backVFELog.placeVolume(backVFELyrLog, copyOne, Transform3D(backVFELyrTra + offTra));
1815  offTra += 2 * backVFELyrTra;
1816  }
1817 
1823 
1829 
1830  const double halfZCoolVFE(thickVFE + backCool.barThick / 2.);
1831  Solid backCoolVFESolid = Box(backCool.barHeight / 2., backCool.barWidth / 2., halfZCoolVFE);
1832  Volume backCoolVFELog = Volume(backCool.backVFEName, backCoolVFESolid, ns.material(backCool.backVFEMat));
1833  if (0 != backCool.barHere)
1834  backCoolVFELog.placeVolume(backCoolBarLog, copyOne, Transform3D());
1835  if (0 != backCool.vFEHere)
1836  backCoolVFELog.placeVolume(
1837  backVFELog, copyOne, Transform3D(Position(0, 0, backCool.barThick / 2. + thickVFE / 2.)));
1838  backCoolVFELog.placeVolume(backVFELog,
1839  copyTwo,
1840  Transform3D(myrot(ns, backCool.backVFEName + "Flip", CLHEP::HepRotationX(180_deg)),
1841  Position(0, 0, -backCool.barThick / 2. - thickVFE / 2.)));
1842 
1848 
1854  unsigned int iCVFECopy(1);
1855  unsigned int iSep(0);
1856  unsigned int iNSec(0);
1857  const unsigned int nMisc(backMisc.vecThick.size() / 4);
1858  for (unsigned int iMod(0); iMod != 4; ++iMod) {
1859  const double pipeLength(grille.vecZOff[2 * iMod + 1] - grille.vecZOff[2 * iMod] - grille.thick - 3_mm);
1860  const double pipeZPos(grille.vecZOff[2 * iMod + 1] - pipeLength / 2 - 1.5_mm);
1861 
1862  // accumulate total height of parent volume
1863  double backCoolHeight(backCool.barHeight + mbCoolTube.outDiam);
1864  for (unsigned int iMisc(0); iMisc != nMisc; ++iMisc) {
1865  backCoolHeight += backMisc.vecThick[iMod * nMisc + iMisc];
1866  }
1867  double bottomThick(mbCoolTube.outDiam);
1868  for (unsigned int iMB(0); iMB != mbLyr.vecMBLyrThick.size(); ++iMB) {
1869  backCoolHeight += mbLyr.vecMBLyrThick[iMB];
1870  bottomThick += mbLyr.vecMBLyrThick[iMB];
1871  }
1872 
1873  string backCName(backCool.vecName[iMod]);
1874  const double halfZBCool((pipeLength - 2 * mbManif.outDiam - grille.zSpace) / 2);
1875  Solid backCoolSolid = Box(backCoolHeight / 2., backCoolWidth / 2., halfZBCool);
1876  Volume backCoolLog = Volume(backCName, backCoolSolid, ns.material(spm.mat));
1877 
1878  const Position bCoolTra(
1879  -realBPthick / 2 + backCoolHeight / 2 - grille.vecHeight[2 * iMod],
1880  deltaY,
1881  grille.vecZOff[2 * iMod] + grille.thick + grille.zSpace + halfZBCool - back.sideLength / 2);
1882  if (0 != backCool.here)
1883  spmLog.placeVolume(backCoolLog, iMod + 1, outtra + backPlateTra + bCoolTra);
1884 
1885  //===
1886  const double backCoolTankHeight(backCool.barHeight); // - backBracketHeight() ) ;
1887  const double halfZTank(halfZBCool - 5_cm);
1888 
1889  string bTankName(backCoolTank.name + std::to_string(iMod + 1));
1890  Solid backCoolTankSolid = Box(backCoolTankHeight / 2., backCoolTank.width / 2., halfZTank);
1891  Volume backCoolTankLog = Volume(bTankName, backCoolTankSolid, ns.material(backCoolTank.mat));
1892  if (0 != backCoolTank.here)
1893  backCoolLog.placeVolume(backCoolTankLog,
1894  copyOne,
1895  Transform3D(Rotation3D(),
1896  Position(-backCoolHeight / 2 + backCoolTankHeight / 2. + bottomThick,
1897  backCool.barWidth / 2. + backCoolTank.width / 2.,
1898  0)));
1899 
1900  string bTankWaName(backCoolTank.waName + std::to_string(iMod + 1));
1901  Solid backCoolTankWaSolid = Box(backCoolTankHeight / 2. - backCoolTank.thick / 2.,
1902  backCoolTank.waWidth / 2.,
1903  halfZTank - backCoolTank.thick / 2.);
1904  Volume backCoolTankWaLog = Volume(bTankWaName, backCoolTankWaSolid, ns.material(backCoolTank.waMat));
1905  backCoolTankLog.placeVolume(backCoolTankWaLog, copyOne, Transform3D(Rotation3D(), Position(0, 0, 0)));
1906 
1907  string bBracketName(backCoolTank.backBracketName + std::to_string(iMod + 1));
1908  Solid backBracketSolid = Box(backCoolTank.backBracketHeight / 2., backCoolTank.width / 2., halfZTank);
1909  Volume backBracketLog = Volume(bBracketName, backBracketSolid, ns.material(backCoolTank.backBracketMat));
1910  if (0 != backCoolTank.here)
1911  backCoolLog.placeVolume(backBracketLog,
1912  copyOne,
1913  Transform3D(Rotation3D(),
1914  Position(backCool.barHeight - backCoolHeight / 2. -
1915  backCoolTank.backBracketHeight / 2. + bottomThick,
1916  -backCool.barWidth / 2. - backCoolTank.width / 2.,
1917  0)));
1918  //===
1919 
1920  Position bSumTra(backCool.barHeight - backCoolHeight / 2. + bottomThick, 0, 0);
1921  for (unsigned int j(0); j != nMisc; ++j) { // loop over miscellaneous layers
1922  const string bName(backMisc.vecName[iMod * nMisc + j]);
1923  Solid bSolid =
1924  Box(backMisc.vecThick[iMod * nMisc + j] / 2, backCool.barWidth / 2. + backCoolTank.width, halfZBCool);
1925 
1926  Volume bLog = Volume(bName, bSolid, ns.material(backMisc.vecMat[iMod * nMisc + j]));
1927 
1928  const Position bTra(backMisc.vecThick[iMod * nMisc + j] / 2, 0_mm, 0_mm);
1929 
1930  if (0 != backMisc.here)
1931  backCoolLog.placeVolume(bLog, copyOne, Transform3D(Rotation3D(), bSumTra + bTra));
1932 
1933  bSumTra += 2 * bTra;
1934  }
1935 
1936  const double bHalfWidth(backCool.barWidth / 2. + backCoolTank.width);
1937 
1938  if (0 != mbLyr.here) {
1939  Position mTra(-backCoolHeight / 2. + mbCoolTube.outDiam, 0, 0);
1940  for (unsigned int j(0); j != mbLyr.vecMBLyrThick.size(); ++j) // loop over MB layers
1941  {
1942  const string mName(mbLyr.vecMBLyrName[j] + "_" + std::to_string(iMod + 1));
1943  Solid mSolid = Box(mbLyr.vecMBLyrThick[j] / 2, bHalfWidth, halfZBCool);
1944  Volume mLog = Volume(mName, mSolid, ns.material(mbLyr.vecMBLyrMat[j]));
1945 
1946  mTra += Position(mbLyr.vecMBLyrThick[j] / 2.0, 0_mm, 0_mm);
1947  backCoolLog.placeVolume(mLog, copyOne, Transform3D(Rotation3D(), mTra));
1948  mTra += Position(mbLyr.vecMBLyrThick[j] / 2.0, 0_mm, 0_mm);
1949  }
1950  }
1951 
1952  if (0 != mbCoolTube.here) {
1953  const string mBName(mbCoolTube.name + "_" + std::to_string(iMod + 1));
1954 
1955  Solid mBCoolTubeSolid = Tube(0, mbCoolTube.outDiam / 2, halfZBCool, 0_deg, 360_deg);
1956  Volume mBLog = Volume(mBName, mBCoolTubeSolid, ns.material(mbCoolTube.mat));
1957 
1958  const string mBWaName(mbCoolTube.name + "Wa_" + std::to_string(iMod + 1));
1959  Solid mBCoolTubeWaSolid = Tube(mBWaName, 0, mbCoolTube.innDiam / 2, halfZBCool, 0_deg, 360_deg);
1960  Volume mBWaLog = Volume(mBWaName, mBCoolTubeWaSolid, ns.material(backPipe.waterMat));
1961  mBLog.placeVolume(mBWaLog, copyOne);
1962 
1963  for (unsigned int j(0); j != dryAirTube.mbCoolTubeNum; ++j) // loop over all MB cooling circuits
1964  {
1965  backCoolLog.placeVolume(mBLog,
1966  2 * j + 1,
1967  Transform3D(Rotation3D(),
1968  Position(-backCoolHeight / 2.0 + mbCoolTube.outDiam / 2.,
1969  -bHalfWidth + (j + 1) * bHalfWidth / 5,
1970  0)));
1971  }
1972  }
1973 
1979  if (0 != backPipe.here && 0 != iMod) {
1980  string bPipeName(backPipe.name + "_" + std::to_string(iMod + 1));
1981  string bInnerName(backPipe.name + "_H2O_" + std::to_string(iMod + 1));
1982 
1983  Solid backPipeSolid = Tube(bPipeName, 0_mm, backPipe.vecDiam[iMod] / 2, pipeLength / 2, 0_deg, 360_deg);
1984  Solid backInnerSolid = Tube(
1985  bInnerName, 0_mm, backPipe.vecDiam[iMod] / 2 - backPipe.vecThick[iMod], pipeLength / 2, 0_deg, 360_deg);
1986 
1987  Volume backPipeLog = Volume(bPipeName, backPipeSolid, ns.material(backPipe.mat));
1988  Volume backInnerLog = Volume(bInnerName, backInnerSolid, ns.material(backPipe.waterMat));
1989 
1990  const Position bPipeTra1(back.xOff + back.sideHeight - 0.7 * backPipe.vecDiam[iMod],
1991  back.yOff + back.plateWidth / 2 - back.sideWidth - 0.7 * backPipe.vecDiam[iMod],
1992  pipeZPos);
1993 
1994  spmLog.placeVolume(backPipeLog, copyOne, Transform3D(Rotation3D(), bPipeTra1));
1995 
1996  const Position bPipeTra2(
1997  bPipeTra1.x(), back.yOff - back.plateWidth / 2 + back.sideWidth + backPipe.vecDiam[iMod], bPipeTra1.z());
1998 
1999  spmLog.placeVolume(backPipeLog, copyTwo, Transform3D(Rotation3D(), bPipeTra2));
2000  backPipeLog.placeVolume(backInnerLog, copyOne, Transform3D(Rotation3D(), Position()));
2001  }
2007 
2008  //=================================================
2009 
2010  if (0 != dryAirTube.here) {
2011  string dryAirTubName(dryAirTube.name + std::to_string(iMod + 1));
2012 
2013  Solid dryAirTubeSolid =
2014  Tube(dryAirTubName, dryAirTube.innDiam / 2, dryAirTube.outDiam / 2, pipeLength / 2, 0_deg, 360_deg);
2015  Volume dryAirTubeLog = Volume(dryAirTubName, dryAirTubeSolid, ns.material(dryAirTube.mat));
2016 
2017  const Position dryAirTubeTra1(back.xOff + back.sideHeight - 0.7 * dryAirTube.outDiam - backPipe.vecDiam[iMod],
2018  back.yOff + back.plateWidth / 2 - back.sideWidth - 1.2 * dryAirTube.outDiam,
2019  pipeZPos);
2020 
2021  spmLog.placeVolume(dryAirTubeLog, copyOne, Transform3D(Rotation3D(), dryAirTubeTra1));
2022 
2023  const Position dryAirTubeTra2(dryAirTubeTra1.x(),
2024  back.yOff - back.plateWidth / 2 + back.sideWidth + 0.7 * dryAirTube.outDiam,
2025  dryAirTubeTra1.z());
2026 
2027  spmLog.placeVolume(dryAirTubeLog, copyTwo, Transform3D(Rotation3D(), dryAirTubeTra2));
2028  }
2029  //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2030 
2031  // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2032  // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2033  // !!!!!!!!!!!!!! Begin Placement of Cooling + VFE Cards !!!!!!
2034  // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2035  // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2036 
2037  Position cTra(backCool.barHeight / 2. - backCoolHeight / 2. + bottomThick, 0, -halfZTank + halfZCoolVFE);
2038  const unsigned int numSec(static_cast<unsigned int>(backCool.vecBackCoolNSec[iMod]));
2039  for (unsigned int jSec(0); jSec != numSec; ++jSec) {
2040  const unsigned int nMax(static_cast<unsigned int>(backCool.vecBackCoolNPerSec[iNSec++]));
2041  for (unsigned int iBar(0); iBar != nMax; ++iBar) {
2042  backCoolLog.placeVolume(backCoolVFELog, iCVFECopy++, cTra);
2043  cTra += Position(0, 0, backMisc.backCBStdSep);
2044  }
2045  cTra -= Position(0, 0, backMisc.backCBStdSep); // backspace to previous
2046  if (jSec != numSec - 1)
2047  cTra += Position(0, 0, backCool.vecBackCoolSecSep[iSep++]); // now take atypical step
2048  }
2054  }
2055 
2061 
2067 
2068  double patchHeight(0);
2069  for (unsigned int iPatch(0); iPatch != patchPanel.vecThick.size(); ++iPatch) {
2070  patchHeight += patchPanel.vecThick[iPatch];
2071  }
2072 
2073  array<double, 3> patchParms{
2074  {patchHeight / 2., backCool.barWidth / 2., (spm.vecZPts.back() - grille.vecZOff.back() - grille.thick) / 2}};
2075  Solid patchSolid = Box(patchParms[0], patchParms[1], patchParms[2]);
2076  Volume patchLog = Volume(patchPanel.name, patchSolid, ns.material(spm.mat));
2077 
2078  const Position patchTra(back.xOff + 4_mm, 0_mm, grille.vecZOff.back() + grille.thick + patchParms[2]);
2079  if (0 != patchPanel.here)
2080  spmLog.placeVolume(patchLog, copyOne, patchTra);
2081 
2082  Position pTra(-patchParms[0], 0, 0);
2083 
2084  for (unsigned int j(0); j != patchPanel.vecNames.size(); ++j) {
2085  const string pName(patchPanel.vecNames[j]);
2086 
2087  Solid pSolid = Box(patchPanel.vecThick[j] / 2., patchParms[1], patchParms[2]);
2088  Volume pLog = Volume(pName, pSolid, ns.material(patchPanel.vecMat[j]));
2089 
2090  pTra += Position(patchPanel.vecThick[j] / 2, 0_mm, 0_mm);
2091  patchLog.placeVolume(pLog, copyOne, pTra);
2092 
2093  pTra += Position(patchPanel.vecThick[j] / 2, 0_mm, 0_mm);
2094  }
2100 
2106 
2107  if (0 != pincer.rodHere) {
2108  // Make hierarchy of rods, envelopes, blocks, shims, and cutouts
2109 
2110  Solid rodSolid = Box(pincer.rodName, pincer.envWidth / 2., pincer.envHeight / 2., ilyLength / 2);
2111  Volume rodLog = Volume(pincer.rodName, rodSolid, ns.material(pincer.rodMat));
2112 
2113  array<double, 3> envParms{{pincer.envWidth / 2., pincer.envHeight / 2., pincer.envLength / 2}};
2114  Solid envSolid = Box(pincer.envName, envParms[0], envParms[1], envParms[2]);
2115  Volume envLog = Volume(pincer.envName, envSolid, ns.material(pincer.envMat));
2116 
2117  array<double, 3> blkParms{{pincer.envWidth / 2., pincer.envHeight / 2., pincer.blkLength / 2}};
2118  Solid blkSolid = Box(pincer.blkName, blkParms[0], blkParms[1], blkParms[2]);
2119  Volume blkLog = Volume(pincer.blkName, blkSolid, ns.material(pincer.blkMat));
2120 
2121  envLog.placeVolume(blkLog, copyOne, Position(0_mm, 0_mm, pincer.envLength / 2 - pincer.blkLength / 2));
2122 
2123  array<double, 3> cutParms{{pincer.cutWidth / 2., pincer.cutHeight / 2., pincer.blkLength / 2}};
2124  Solid cutSolid = Box(pincer.cutName, cutParms[0], cutParms[1], cutParms[2]);
2125  Volume cutLog = Volume(pincer.cutName, cutSolid, ns.material(pincer.cutMat));
2126  blkLog.placeVolume(
2127  cutLog,
2128  copyOne,
2129  Position(
2130  +blkParms[0] - cutParms[0] - pincer.shim1Width + pincer.shim2Width, -blkParms[1] + cutParms[1], 0_mm));
2131  array<double, 3> shim2Parms{{pincer.shim2Width / 2., pincer.shimHeight / 2., pincer.blkLength / 2}};
2132  Solid shim2Solid = Box(pincer.shim2Name, shim2Parms[0], shim2Parms[1], shim2Parms[2]);
2133  Volume shim2Log = Volume(pincer.shim2Name, shim2Solid, ns.material(pincer.shimMat));
2134  cutLog.placeVolume(
2135  shim2Log, copyOne, Position(+cutParms[0] - shim2Parms[0], -cutParms[1] + shim2Parms[1], 0_mm));
2136 
2137  array<double, 3> shim1Parms{
2138  {pincer.shim1Width / 2., pincer.shimHeight / 2., (pincer.envLength - pincer.blkLength) / 2}};
2139  Solid shim1Solid = Box(pincer.shim1Name, shim1Parms[0], shim1Parms[1], shim1Parms[2]);
2140  Volume shim1Log = Volume(pincer.shim1Name, shim1Solid, ns.material(pincer.shimMat));
2141  envLog.placeVolume(
2142  shim1Log,
2143  copyOne,
2144  Position(+envParms[0] - shim1Parms[0], -envParms[1] + shim1Parms[1], -envParms[2] + shim1Parms[2]));
2145 
2146  for (unsigned int iEnv(0); iEnv != pincer.vecEnvZOff.size(); ++iEnv) {
2147  rodLog.placeVolume(envLog,
2148  1 + iEnv,
2149  Position(0_mm, 0_mm, -ilyLength / 2. + pincer.vecEnvZOff[iEnv] - pincer.envLength / 2.));
2150  }
2151 
2152  // Place the rods
2153  const double radius(ilyRMin - pincer.envHeight / 2 - 1_mm);
2154  const string xilyName(ily.name + std::to_string(ily.vecIlyMat.size() - 1));
2155 
2156  for (unsigned int iRod(0); iRod != pincer.vecRodAzimuth.size(); ++iRod) {
2157  const Position rodTra(
2158  radius * cos(pincer.vecRodAzimuth[iRod]), radius * sin(pincer.vecRodAzimuth[iRod]), 0_mm);
2159  xilyLog.placeVolume(rodLog,
2160  1 + iRod,
2161  Transform3D(myrot(ns,
2162  pincer.rodName + std::to_string(iRod),
2163  CLHEP::HepRotationZ(90_deg + pincer.vecRodAzimuth[iRod])),
2164  rodTra));
2165  }
2166  }
2172  }
2173  }
2174 
2175  return 1;
2176 }
#define LogDebug(id)
size
Write out results.
type
Definition: HCALResponse.h:21
HepGeom::Point3D< double > Pt3D
HepGeom::Translate3D Tl3D
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
Definition: __init__.py:1
HepGeom::Transform3D Tf3D
#define M_PI_2
HepGeom::RotateZ3D RoZ3D
TGeoCombiTrans * createPlacement(const Rotation3D &iRot, const Position &iTrans)
HepGeom::RotateX3D RoX3D
float float float z
T sqrt(T t)
Definition: SSEVec.h:19
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
dd4hep::Volume Volume
#define M_PI
CaloCellGeometry::Pt3D Pt3D
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
static std::atomic< unsigned int > counter
math::XYZVector XYZVector
Definition: RawParticle.h:26
CLHEP::HepRotation Rota
HepGeom::Rotate3D Ro3D
CaloCellGeometry::Pt3DVec VertexList
CLHEP::Hep3Vector Vec3
DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_ecal_DDEcalBarrelNewAlgo   
)

Definition at line 2178 of file DDEcalBarrelNewAlgo.cc.