CMS 3D CMS Logo

Typedefs | Functions
DDEcalBarrelNewAlgo.cc File Reference
#include "DD4hep/DetFactoryHelper.h"
#include "DD4hep/Printout.h"
#include "DataFormats/Math/interface/angle_units.h"
#include "DetectorDescription/DDCMS/interface/DDPlugins.h"
#include "DetectorDescription/DDCMS/interface/BenchmarkGrd.h"
#include "DetectorDescription/DDCMS/interface/DDutils.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_OPEN_PLUGIN (dd4hep, ddcms_det_element_DDCMS_ecal_DDEcalBarrelNewAlgo)
 

Typedef Documentation

◆ EcalTrap

Definition at line 23 of file DDEcalBarrelNewAlgo.cc.

◆ Pt3D

using Pt3D = HepGeom::Point3D<double>

Definition at line 25 of file DDEcalBarrelNewAlgo.cc.

◆ Ro3D

using Ro3D = HepGeom::Rotate3D

Definition at line 28 of file DDEcalBarrelNewAlgo.cc.

◆ Rota

using Rota = CLHEP::HepRotation

Definition at line 27 of file DDEcalBarrelNewAlgo.cc.

◆ RoX3D

using RoX3D = HepGeom::RotateX3D

Definition at line 31 of file DDEcalBarrelNewAlgo.cc.

◆ RoZ3D

using RoZ3D = HepGeom::RotateZ3D

Definition at line 32 of file DDEcalBarrelNewAlgo.cc.

◆ Tf3D

using Tf3D = HepGeom::Transform3D

Definition at line 30 of file DDEcalBarrelNewAlgo.cc.

◆ Tl3D

using Tl3D = HepGeom::Translate3D

Definition at line 29 of file DDEcalBarrelNewAlgo.cc.

◆ Vec3

using Vec3 = CLHEP::Hep3Vector

Definition at line 26 of file DDEcalBarrelNewAlgo.cc.

◆ VecDouble

using VecDouble = vector<double>

Definition at line 21 of file DDEcalBarrelNewAlgo.cc.

◆ VecStr

using VecStr = vector<string>

Definition at line 22 of file DDEcalBarrelNewAlgo.cc.

Function Documentation

◆ algorithm()

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

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





















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




















!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!! Begin Back Side Plates !!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!



















!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!! End Back Side Plates !!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


















!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!! Begin Mother Board Cooling Manifold Setup !!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

















!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!! End Mother Board Cooling Manifold Setup !!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
















!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!! Begin Loop over Grilles & MB Cooling Manifold !!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!















!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!! End Loop over Grilles & MB Cooling Manifold !!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!














!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!! Begin Cooling Bar Setup !!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!













!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!! End Cooling Bar Setup !!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!












!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!! Begin VFE Card Setup !!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!











!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!! End VFE Card Setup !!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!










!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!! Begin Cooling Bar + VFE Setup !!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!









!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!! End Cooling Bar + VFE Setup !!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!








!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!! Begin Placement of Readout & Cooling by Module !!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!







!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!! Begin Back Water Pipes !!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!






!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!! End Back Water Pipes !!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!





!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!! End Placement of Cooling + VFE Cards !!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!




!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!! End Placement of Readout & Cooling by Module !!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!



!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!! Begin Patch Panel !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!! End Patch Panel !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!! Begin Pincers !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!! End Pincers !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 473 of file DDEcalBarrelNewAlgo.cc.

References EcalTrapezoidParameters::a(), EcalTrapezoidParameters::A(), cms::DDNamespace::addAssembly(), cms::DDNamespace::addVolume(), writedatasetfile::args, cms::DDNamespace::assembly(), EcalTrapezoidParameters::b(), b1, b2, testProducerWithPsetDescEmpty_cfi::b3, HLT_2022v12_cff::beta, EcalTrapezoidParameters::bl1(), reco::HaloData::both, HLT_2022v12_cff::cap, cms::convert2mm(), angle_units::operators::convertRadToDeg(), TCMET_cfi::corner, funct::cos(), counter, data, dumpMFGeometry_cfg::delta, EcalTrapezoidParameters::dz(), MillePedeFileConverter_cfg::e, CustomPhysics_cfi::gamma, getRunAppsInfo::grid, EcalTrapezoidParameters::h(), EcalTrapezoidParameters::H(), EcalTrapezoidParameters::h1(), LEDCalibrationChannels::iphi, dqmiolumiharvest::j, dqmdumpme::k, EcalTrapezoidParameters::L(), M_PI, M_PI_2, cms::DDNamespace::material(), Skims_PA_cff::name, metDiagnosticParameterSet_cfi::nMax, PixelTestBeamValidation_cfi::Position, cms::DDNamespace::prepend(), diffTwoXMLs::r1, CosmicsPD_Skims::radius, idealTransformation::rotation, cms::DDNamespace::rotation(), funct::sin(), findQualityFiles::size, mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, theta(), cond::impl::to_string(), HcalDetIdTransform::transform(), EcalTrapezoidParameters::vertexList(), cms::DDNamespace::volume(), x, geometryCSVtoXML::xx, geometryCSVtoXML::yy, and geometryCSVtoXML::zz.

473  {
474  BenchmarkGrd counter("DDEcalBarrelNewAlgo");
475  cms::DDNamespace ns(ctxt, e, true);
476  cms::DDAlgoArguments args(ctxt, e);
477 
478  // TRICK!
479  string myns{mynamespace(args.parentName()).data(), mynamespace(args.parentName()).size()};
480 
481  // Barrel volume
482  // barrel parent volume
483  Barrel bar;
484  bar.name = myns + args.str("BarName"); // Barrel volume name
485  bar.mat = args.str("BarMat"); // Barrel material name
486  bar.vecZPts = args.vecDble("BarZPts"); // Barrel list of z pts
487  bar.vecRMin = args.vecDble("BarRMin"); // Barrel list of rMin pts
488  bar.vecRMax = args.vecDble("BarRMax"); // Barrel list of rMax pts
489  bar.vecTran = args.vecDble("BarTran"); // Barrel translation
490  bar.vecRota = args.vecDble("BarRota"); // Barrel rotation
491  bar.vecRota2 = args.vecDble("BarRota2"); // 2nd Barrel rotation
492  bar.vecRota3 = args.vecDble("BarRota3"); // 3rd Barrel rotation
493  bar.phiLo = args.dble("BarPhiLo"); // Barrel phi lo
494  bar.phiHi = args.dble("BarPhiHi"); // Barrel phi hi
495  bar.here = args.dble("BarHere"); // Barrel presence flag
496 
497  // Supermodule volume
498  Supermodule spm;
499  spm.name = ns.prepend(args.str("SpmName")); // Supermodule volume name
500  spm.mat = args.str("SpmMat"); // Supermodule material name
501  spm.vecZPts = args.vecDble("SpmZPts"); // Supermodule list of z pts
502  spm.vecRMin = args.vecDble("SpmRMin"); // Supermodule list of rMin pts
503  spm.vecRMax = args.vecDble("SpmRMax"); // Supermodule list of rMax pts
504  spm.vecTran = args.vecDble("SpmTran"); // Supermodule translation
505  spm.vecRota = args.vecDble("SpmRota"); // Supermodule rotation
506  spm.vecBTran = args.vecDble("SpmBTran"); // Base Supermodule translation
507  spm.vecBRota = args.vecDble("SpmBRota"); // Base Supermodule rotation
508  spm.nPerHalf = args.integer("SpmNPerHalf"); // # Supermodules per half detector
509  spm.lowPhi = args.dble("SpmLowPhi"); // Low phi value of base supermodule
510  spm.delPhi = args.dble("SpmDelPhi"); // Delta phi value of base supermodule
511  spm.phiOff = args.dble("SpmPhiOff"); // Phi offset value supermodule
512  spm.vecHere = args.vecDble("SpmHere"); // Bit saying if a supermodule is present or not
513  spm.cutName = ns.prepend(args.str("SpmCutName")); // Name of cut box
514  spm.cutThick = args.dble("SpmCutThick"); // Box thickness
515  spm.cutShow = args.value<int>("SpmCutShow"); // Non-zero means show the box on display (testing only)
516  spm.vecCutTM = args.vecDble("SpmCutTM"); // Translation for minus phi cut box
517  spm.vecCutTP = args.vecDble("SpmCutTP"); // Translation for plus phi cut box
518  spm.cutRM = args.dble("SpmCutRM"); // Rotation for minus phi cut box
519  spm.cutRP = args.dble("SpmCutRP"); // Rotation for plus phi cut box
520  spm.expThick = args.dble("SpmExpThick"); // Thickness (x) of supermodule expansion box
521  spm.expWide = args.dble("SpmExpWide"); // Width (y) of supermodule expansion box
522  spm.expYOff = args.dble("SpmExpYOff"); // Offset (y) of supermodule expansion box
523  spm.sideName = myns + args.str("SpmSideName"); // Supermodule Side Plate volume name
524  spm.sideMat = args.str("SpmSideMat"); // Supermodule Side Plate material name
525  spm.sideHigh = args.dble("SpmSideHigh"); // Side plate height
526  spm.sideThick = args.dble("SpmSideThick"); // Side plate thickness
527  spm.sideYOffM = args.dble("SpmSideYOffM"); // Side plate Y offset on minus phi side
528  spm.sideYOffP = args.dble("SpmSideYOffP"); // Side plate Y offset on plus phi side
529 
530  Crystal cry;
531  cry.nomCryDimAF = args.dble("NomCryDimAF");
532  cry.nomCryDimLZ = args.dble("NomCryDimLZ");
533  cry.vecNomCryDimBF = args.vecDble("NomCryDimBF");
534  cry.vecNomCryDimCF = args.vecDble("NomCryDimCF");
535  cry.vecNomCryDimAR = args.vecDble("NomCryDimAR");
536  cry.vecNomCryDimBR = args.vecDble("NomCryDimBR");
537  cry.vecNomCryDimCR = args.vecDble("NomCryDimCR");
538 
539  cry.underAF = args.dble("UnderAF");
540  cry.underLZ = args.dble("UnderLZ");
541  cry.underBF = args.dble("UnderBF");
542  cry.underCF = args.dble("UnderCF");
543  cry.underAR = args.dble("UnderAR");
544  cry.underBR = args.dble("UnderBR");
545  cry.underCR = args.dble("UnderCR");
546 
547  Alveolus alv;
548  alv.wallThAlv = args.dble("WallThAlv");
549  alv.wrapThAlv = args.dble("WrapThAlv");
550  alv.clrThAlv = args.dble("ClrThAlv");
551  alv.vecGapAlvEta = args.vecDble("GapAlvEta");
552 
553  alv.wallFrAlv = args.dble("WallFrAlv");
554  alv.wrapFrAlv = args.dble("WrapFrAlv");
555  alv.clrFrAlv = args.dble("ClrFrAlv");
556 
557  alv.wallReAlv = args.dble("WallReAlv");
558  alv.wrapReAlv = args.dble("WrapReAlv");
559  alv.clrReAlv = args.dble("ClrReAlv");
560 
561  alv.nCryTypes = args.integer("NCryTypes");
562  alv.nCryPerAlvEta = args.integer("NCryPerAlvEta");
563 
564  cry.name = ns.prepend(args.str("CryName"));
565  cry.clrName = ns.prepend(args.str("ClrName"));
566  cry.wrapName = ns.prepend(args.str("WrapName"));
567  cry.wallName = ns.prepend(args.str("WallName"));
568 
569  cry.mat = args.str("CryMat");
570  cry.clrMat = args.str("ClrMat");
571  cry.wrapMat = args.str("WrapMat");
572  cry.wallMat = args.str("WallMat");
573 
574  Capsule cap;
575  cap.name = ns.prepend(args.str("CapName"));
576  cap.here = args.dble("CapHere");
577  cap.mat = args.str("CapMat");
578  cap.xSizeHalf = 0.5 * args.dble("CapXSize");
579  cap.ySizeHalf = 0.5 * args.dble("CapYSize");
580  cap.thickHalf = 0.5 * args.dble("CapThick");
581 
582  Ceramic cer;
583  cer.name = ns.prepend(args.str("CerName"));
584  cer.mat = args.str("CerMat");
585  cer.xSizeHalf = 0.5 * args.dble("CerXSize");
586  cer.ySizeHalf = 0.5 * args.dble("CerYSize");
587  cer.thickHalf = 0.5 * args.dble("CerThick");
588 
589  BulkSilicon bSi;
590  bSi.name = ns.prepend(args.str("BSiName"));
591  bSi.mat = args.str("BSiMat");
592  bSi.xSizeHalf = 0.5 * args.dble("BSiXSize");
593  bSi.ySizeHalf = 0.5 * args.dble("BSiYSize");
594  bSi.thickHalf = 0.5 * args.dble("BSiThick");
595 
596  APD apd;
597  apd.name = ns.prepend(args.str("APDName"));
598  apd.mat = args.str("APDMat");
599  apd.side = args.dble("APDSide");
600  apd.thick = args.dble("APDThick");
601  apd.z = args.dble("APDZ");
602  apd.x1 = args.dble("APDX1");
603  apd.x2 = args.dble("APDX2");
604 
605  apd.atjName = ns.prepend(args.str("ATJName"));
606  apd.atjMat = args.str("ATJMat");
607  apd.atjThickHalf = 0.5 * args.dble("ATJThick");
608 
609  apd.sglName = ns.prepend(args.str("SGLName"));
610  apd.sglMat = args.str("SGLMat");
611  apd.sglThick = args.dble("SGLThick");
612 
613  apd.aglName = ns.prepend(args.str("AGLName"));
614  apd.aglMat = args.str("AGLMat");
615  apd.aglThick = args.dble("AGLThick");
616 
617  apd.andName = ns.prepend(args.str("ANDName"));
618  apd.andMat = args.str("ANDMat");
619  apd.andThick = args.dble("ANDThick");
620 
621  Web web;
622  web.here = args.dble("WebHere");
623  web.plName = ns.prepend(args.str("WebPlName"));
624  web.clrName = ns.prepend(args.str("WebClrName"));
625  web.plMat = args.str("WebPlMat");
626  web.clrMat = args.str("WebClrMat");
627  web.vecWebPlTh = args.vecDble("WebPlTh");
628  web.vecWebClrTh = args.vecDble("WebClrTh");
629  web.vecWebLength = args.vecDble("WebLength");
630 
631  InnerLayerVolume ily;
632  ily.here = args.dble("IlyHere");
633  ily.name = myns + args.str("IlyName");
634  ily.phiLow = args.dble("IlyPhiLow");
635  ily.delPhi = args.dble("IlyDelPhi");
636  ily.vecIlyMat = args.vecStr("IlyMat");
637  ily.vecIlyThick = args.vecDble("IlyThick");
638 
639  ily.pipeName = myns + args.str("IlyPipeName");
640  ily.pipeHere = args.dble("IlyPipeHere");
641  ily.pipeMat = args.str("IlyPipeMat");
642  ily.pipeODHalf = 0.5 * args.dble("IlyPipeOD");
643  ily.pipeID = args.dble("IlyPipeID");
644  ily.vecIlyPipeLengthHalf = args.vecDble("IlyPipeLength");
645  std::transform(ily.vecIlyPipeLengthHalf.begin(),
646  ily.vecIlyPipeLengthHalf.end(),
647  ily.vecIlyPipeLengthHalf.begin(),
648  [](double length) -> double { return 0.5 * length; });
649 
650  ily.vecIlyPipeType = args.vecDble("IlyPipeType");
651  ily.vecIlyPipePhi = args.vecDble("IlyPipePhi");
652  ily.vecIlyPipeZ = args.vecDble("IlyPipeZ");
653 
654  ily.pTMName = myns + args.str("IlyPTMName");
655  ily.pTMHere = args.dble("IlyPTMHere");
656  ily.pTMMat = args.str("IlyPTMMat");
657  ily.pTMWidthHalf = 0.5 * args.dble("IlyPTMWidth");
658  ily.pTMLengthHalf = 0.5 * args.dble("IlyPTMLength");
659  ily.pTMHeightHalf = 0.5 * args.dble("IlyPTMHeight");
660  ily.vecIlyPTMZ = args.vecDble("IlyPTMZ");
661  ily.vecIlyPTMPhi = args.vecDble("IlyPTMPhi");
662 
663  ily.fanOutName = myns + args.str("IlyFanOutName");
664  ily.fanOutHere = args.dble("IlyFanOutHere");
665  ily.fanOutMat = args.str("IlyFanOutMat");
666  ily.fanOutWidthHalf = 0.5 * args.dble("IlyFanOutWidth");
667  ily.fanOutLengthHalf = 0.5 * args.dble("IlyFanOutLength");
668  ily.fanOutHeightHalf = 0.5 * args.dble("IlyFanOutHeight");
669  ily.vecIlyFanOutZ = args.vecDble("IlyFanOutZ");
670  ily.vecIlyFanOutPhi = args.vecDble("IlyFanOutPhi");
671  ily.diffName = myns + args.str("IlyDiffName");
672  ily.diffMat = args.str("IlyDiffMat");
673  ily.diffOff = args.dble("IlyDiffOff");
674  ily.diffLengthHalf = 0.5 * args.dble("IlyDiffLength");
675  ily.bndlName = myns + args.str("IlyBndlName");
676  ily.bndlMat = args.str("IlyBndlMat");
677  ily.bndlOff = args.dble("IlyBndlOff");
678  ily.bndlLengthHalf = 0.5 * args.dble("IlyBndlLength");
679  ily.fEMName = myns + args.str("IlyFEMName");
680  ily.fEMMat = args.str("IlyFEMMat");
681  ily.fEMWidthHalf = 0.5 * args.dble("IlyFEMWidth");
682  ily.fEMLengthHalf = 0.5 * args.dble("IlyFEMLength");
683  ily.fEMHeightHalf = 0.5 * args.dble("IlyFEMHeight");
684  ily.vecIlyFEMZ = args.vecDble("IlyFEMZ");
685  ily.vecIlyFEMPhi = args.vecDble("IlyFEMPhi");
686 
687  AlveolarWedge alvWedge;
688  alvWedge.hawRName = myns + args.str("HawRName");
689  alvWedge.fawName = myns + args.str("FawName");
690  alvWedge.fawHere = args.dble("FawHere");
691  alvWedge.hawRHBIG = args.dble("HawRHBIG");
692  alvWedge.hawRhsml = args.dble("HawRhsml");
693  alvWedge.hawRCutY = args.dble("HawRCutY");
694  alvWedge.hawRCutZ = args.dble("HawRCutZ");
695  alvWedge.hawRCutDelY = args.dble("HawRCutDelY");
696  alvWedge.hawYOffCry = args.dble("HawYOffCry");
697 
698  alvWedge.nFawPerSupm = args.integer("NFawPerSupm");
699  alvWedge.fawPhiOff = args.dble("FawPhiOff");
700  alvWedge.fawDelPhi = args.dble("FawDelPhi");
701  alvWedge.fawPhiRot = args.dble("FawPhiRot");
702  alvWedge.fawRadOff = args.dble("FawRadOff");
703 
704  Grid grid;
705  grid.here = args.dble("GridHere");
706  grid.name = myns + args.str("GridName");
707  grid.mat = args.str("GridMat");
708  grid.thick = args.dble("GridThick");
709 
710  Back back;
711  back.here = args.dble("BackHere");
712  back.xOff = args.dble("BackXOff");
713  back.yOff = args.dble("BackYOff");
714  back.sideName = myns + args.str("BackSideName");
715  back.sideHere = args.dble("BackSideHere");
716  back.sideLength = args.dble("BackSideLength");
717  back.sideHeight = args.dble("BackSideHeight");
718  back.sideWidth = args.dble("BackSideWidth");
719  back.sideYOff1 = args.dble("BackSideYOff1");
720  back.sideYOff2 = args.dble("BackSideYOff2");
721  back.sideAngle = args.dble("BackSideAngle");
722  back.sideMat = args.str("BackSideMat");
723  back.plateName = myns + args.str("BackPlateName");
724  back.plateHere = args.dble("BackPlateHere");
725  back.plateLength = args.dble("BackPlateLength");
726  back.plateThick = args.dble("BackPlateThick");
727  back.plateWidth = args.dble("BackPlateWidth");
728  back.plateMat = args.str("BackPlateMat");
729  back.plate2Name = myns + args.str("BackPlate2Name");
730  back.plate2Thick = args.dble("BackPlate2Thick");
731  back.plate2Mat = args.str("BackPlate2Mat");
732 
733  Grille grille;
734  grille.name = myns + args.str("GrilleName");
735  grille.here = args.dble("GrilleHere");
736  grille.thick = args.dble("GrilleThick");
737  grille.width = args.dble("GrilleWidth");
738  grille.zSpace = args.dble("GrilleZSpace");
739  grille.mat = args.str("GrilleMat");
740  grille.vecHeight = args.vecDble("GrilleHeight");
741  grille.vecZOff = args.vecDble("GrilleZOff");
742 
743  grille.edgeSlotName = myns + args.str("GrEdgeSlotName");
744  grille.edgeSlotMat = args.str("GrEdgeSlotMat");
745  grille.edgeSlotHere = args.dble("GrEdgeSlotHere");
746  grille.edgeSlotHeight = args.dble("GrEdgeSlotHeight");
747  grille.edgeSlotWidth = args.dble("GrEdgeSlotWidth");
748  grille.midSlotName = myns + args.str("GrMidSlotName");
749  grille.midSlotMat = args.str("GrMidSlotMat");
750  grille.midSlotHere = args.dble("GrMidSlotHere");
751  grille.midSlotWidth = args.dble("GrMidSlotWidth");
752  grille.midSlotXOff = args.dble("GrMidSlotXOff");
753  grille.vecMidSlotHeight = args.vecDble("GrMidSlotHeight");
754 
755  BackPipe backPipe;
756  backPipe.here = args.dble("BackPipeHere");
757  backPipe.name = myns + args.str("BackPipeName");
758  backPipe.vecDiam = args.vecDble("BackPipeDiam");
759  backPipe.vecThick = args.vecDble("BackPipeThick");
760  backPipe.mat = args.str("BackPipeMat");
761  backPipe.waterMat = args.str("BackPipeWaterMat");
762 
763  BackCooling backCool;
764  backCool.here = args.dble("BackCoolHere");
765  backCool.vecName = args.vecStr("BackCoolName");
766  std::transform(backCool.vecName.begin(),
767  backCool.vecName.end(),
768  backCool.vecName.begin(),
769  [&myns](std::string name) -> std::string { return (myns + name); });
770  backCool.barHere = args.dble("BackCoolBarHere");
771  backCool.barWidth = args.dble("BackCoolBarWidth");
772  backCool.barHeight = args.dble("BackCoolBarHeight");
773  backCool.mat = args.str("BackCoolMat");
774  backCool.barName = myns + args.str("BackCoolBarName");
775  backCool.barThick = args.dble("BackCoolBarThick");
776  backCool.barMat = args.str("BackCoolBarMat");
777  backCool.barSSName = myns + args.str("BackCoolBarSSName");
778  backCool.barSSThick = args.dble("BackCoolBarSSThick");
779  backCool.barSSMat = args.str("BackCoolBarSSMat");
780  backCool.barWaName = myns + args.str("BackCoolBarWaName");
781  backCool.barWaThick = args.dble("BackCoolBarWaThick");
782  backCool.barWaMat = args.str("BackCoolBarWaMat");
783  backCool.vFEHere = args.dble("BackCoolVFEHere");
784  backCool.vFEName = myns + args.str("BackCoolVFEName");
785  backCool.vFEMat = args.str("BackCoolVFEMat");
786  backCool.backVFEName = args.str("BackVFEName");
787  backCool.backVFEMat = args.str("BackVFEMat");
788  backCool.vecBackVFELyrThick = args.vecDble("BackVFELyrThick");
789  backCool.vecBackVFELyrName = args.vecStr("BackVFELyrName");
790  std::transform(backCool.vecBackVFELyrName.begin(),
791  backCool.vecBackVFELyrName.end(),
792  backCool.vecBackVFELyrName.begin(),
793  [&myns](std::string name) -> std::string { return (myns + name); });
794  backCool.vecBackVFELyrMat = args.vecStr("BackVFELyrMat");
795  backCool.vecBackCoolNSec = args.vecDble("BackCoolNSec");
796  backCool.vecBackCoolSecSep = args.vecDble("BackCoolSecSep");
797  backCool.vecBackCoolNPerSec = args.vecDble("BackCoolNPerSec");
798 
799  BackMisc backMisc;
800  backMisc.here = args.dble("BackMiscHere");
801  backMisc.vecThick = args.vecDble("BackMiscThick");
802  backMisc.vecName = args.vecStr("BackMiscName");
803  std::transform(backMisc.vecName.begin(),
804  backMisc.vecName.end(),
805  backMisc.vecName.begin(),
806  [&myns](std::string name) -> std::string { return (myns + name); });
807  backMisc.vecMat = args.vecStr("BackMiscMat");
808  backMisc.backCBStdSep = args.dble("BackCBStdSep");
809 
810  PatchPanel patchPanel;
811  patchPanel.here = args.dble("PatchPanelHere");
812  patchPanel.vecThick = args.vecDble("PatchPanelThick");
813  patchPanel.vecNames = args.vecStr("PatchPanelNames");
814  std::transform(patchPanel.vecNames.begin(),
815  patchPanel.vecNames.end(),
816  patchPanel.vecNames.begin(),
817  [&myns](std::string name) -> std::string { return (myns + name); });
818 
819  patchPanel.vecMat = args.vecStr("PatchPanelMat");
820  patchPanel.name = myns + args.str("PatchPanelName");
821 
822  BackCoolTank backCoolTank;
823  backCoolTank.here = args.dble("BackCoolTankHere");
824  backCoolTank.name = myns + args.str("BackCoolTankName");
825  backCoolTank.width = args.dble("BackCoolTankWidth");
826  backCoolTank.thick = args.dble("BackCoolTankThick");
827  backCoolTank.mat = args.str("BackCoolTankMat");
828  backCoolTank.waName = myns + args.str("BackCoolTankWaName");
829  backCoolTank.waWidth = args.dble("BackCoolTankWaWidth");
830  backCoolTank.waMat = args.str("BackCoolTankWaMat");
831  backCoolTank.backBracketName = myns + args.str("BackBracketName");
832  backCoolTank.backBracketHeight = args.dble("BackBracketHeight");
833  backCoolTank.backBracketMat = args.str("BackBracketMat");
834 
835  DryAirTube dryAirTube;
836  dryAirTube.here = args.dble("DryAirTubeHere");
837  dryAirTube.name = args.str("DryAirTubeName");
838  dryAirTube.mbCoolTubeNum = args.integer("MBCoolTubeNum");
839  dryAirTube.innDiam = args.dble("DryAirTubeInnDiam");
840  dryAirTube.outDiam = args.dble("DryAirTubeOutDiam");
841  dryAirTube.mat = args.str("DryAirTubeMat");
842 
843  MBCoolTube mbCoolTube;
844  mbCoolTube.here = args.dble("MBCoolTubeHere");
845  mbCoolTube.name = myns + args.str("MBCoolTubeName");
846  mbCoolTube.innDiam = args.dble("MBCoolTubeInnDiam");
847  mbCoolTube.outDiam = args.dble("MBCoolTubeOutDiam");
848  mbCoolTube.mat = args.str("MBCoolTubeMat");
849 
850  MBManif mbManif;
851  mbManif.here = args.dble("MBManifHere");
852  mbManif.name = myns + args.str("MBManifName");
853  mbManif.innDiam = args.dble("MBManifInnDiam");
854  mbManif.outDiam = args.dble("MBManifOutDiam");
855  mbManif.mat = args.str("MBManifMat");
856 
857  MBLyr mbLyr;
858  mbLyr.here = args.dble("MBLyrHere");
859  mbLyr.vecMBLyrThick = args.vecDble("MBLyrThick");
860  mbLyr.vecMBLyrName = args.vecStr("MBLyrName");
861  std::transform(mbLyr.vecMBLyrName.begin(),
862  mbLyr.vecMBLyrName.end(),
863  mbLyr.vecMBLyrName.begin(),
864  [&myns](std::string name) -> std::string { return (myns + name); });
865  mbLyr.vecMBLyrMat = args.vecStr("MBLyrMat");
866 
867  Pincer pincer;
868  pincer.rodHere = args.dble("PincerRodHere");
869  pincer.rodName = myns + args.str("PincerRodName");
870  pincer.rodMat = args.str("PincerRodMat");
871  pincer.vecRodAzimuth = args.vecDble("PincerRodAzimuth");
872  pincer.envName = myns + args.str("PincerEnvName");
873  pincer.envMat = args.str("PincerEnvMat");
874  pincer.envWidthHalf = 0.5 * args.dble("PincerEnvWidth");
875  pincer.envHeightHalf = 0.5 * args.dble("PincerEnvHeight");
876  pincer.envLengthHalf = 0.5 * args.dble("PincerEnvLength");
877  pincer.vecEnvZOff = args.vecDble("PincerEnvZOff");
878  pincer.blkName = myns + args.str("PincerBlkName");
879  pincer.blkMat = args.str("PincerBlkMat");
880  pincer.blkLengthHalf = 0.5 * args.dble("PincerBlkLength");
881  pincer.shim1Name = myns + args.str("PincerShim1Name");
882  pincer.shimHeight = args.dble("PincerShimHeight");
883  pincer.shim2Name = myns + args.str("PincerShim2Name");
884  pincer.shimMat = args.str("PincerShimMat");
885  pincer.shim1Width = args.dble("PincerShim1Width");
886  pincer.shim2Width = args.dble("PincerShim2Width");
887  pincer.cutName = myns + args.str("PincerCutName");
888  pincer.cutMat = args.str("PincerCutMat");
889  pincer.cutWidth = args.dble("PincerCutWidth");
890  pincer.cutHeight = args.dble("PincerCutHeight");
891 
892  Volume parentVolume = ns.volume(args.parentName());
893  if (bar.here != 0) {
894  const unsigned int copyOne(1);
895  const unsigned int copyTwo(2);
896  // Barrel parent volume----------------------------------------------------------
897  Solid barSolid = Polycone(bar.name, bar.phiLo, (bar.phiHi - bar.phiLo), bar.vecRMin, bar.vecRMax, bar.vecZPts);
898 #ifdef EDM_ML_DEBUG
899  edm::LogVerbatim("EBGeom") << bar.name << " PolyCone from " << convertRadToDeg(bar.phiLo) << " to "
900  << convertRadToDeg(bar.phiHi) << " with " << bar.vecZPts.size() << " points";
901  for (unsigned int k = 0; k < bar.vecZPts.size(); ++k)
902  edm::LogVerbatim("EBGeom") << "[" << k << "] " << cms::convert2mm(bar.vecZPts[k]) << ":"
903  << cms::convert2mm(bar.vecRMin[k]) << ":" << cms::convert2mm(bar.vecRMax[k]);
904 #endif
905  Position tran(bar.vecTran[0], bar.vecTran[1], bar.vecTran[2]);
906  Rotation3D rotation = myrot(ns,
907  bar.name + "Rot",
908  Rota(Vec3(bar.vecRota3[0], bar.vecRota3[1], bar.vecRota3[2]), bar.vecRota3[3]) *
909  Rota(Vec3(bar.vecRota2[0], bar.vecRota2[1], bar.vecRota2[2]), bar.vecRota2[3]) *
910  Rota(Vec3(bar.vecRota[0], bar.vecRota[1], bar.vecRota[2]), bar.vecRota[3]));
911  Volume barVolume = Volume(bar.name, barSolid, ns.material(bar.mat));
912  parentVolume.placeVolume(barVolume, copyOne, Transform3D(rotation, tran));
913 #ifdef EDM_ML_DEBUG
914  edm::LogVerbatim("EBGeomX") << barVolume.name() << ":" << copyOne << " positioned in " << parentVolume.name()
915  << " at (" << cms::convert2mm(tran.x()) << "," << cms::convert2mm(tran.y()) << ","
916  << cms::convert2mm(tran.z()) << ") with rotation";
917 #endif
918  // End Barrel parent volume----------------------------------------------------------
919 
920  // Supermodule parent------------------------------------------------------------
921 
922  const string spmcut1ddname((0 != spm.cutShow) ? spm.name : (spm.name + "CUT1"));
923 
924 #ifdef EDM_ML_DEBUG
925  edm::LogVerbatim("EBGeom") << spmcut1ddname << " PolyCone from " << convertRadToDeg(spm.lowPhi) << " to "
926  << convertRadToDeg(spm.lowPhi + spm.delPhi) << " with " << spm.vecZPts.size()
927  << " points";
928  for (unsigned int k = 0; k < spm.vecZPts.size(); ++k)
929  edm::LogVerbatim("EBGeom") << "[" << k << "] " << cms::convert2mm(spm.vecZPts[k]) << ":"
930  << cms::convert2mm(spm.vecRMin[k]) << ":" << cms::convert2mm(spm.vecRMax[k]);
931 #endif
932 
933  const unsigned int indx(0.5 * spm.vecRMax.size());
934 
935  // Deal with the cut boxes first
936  array<double, 3> cutBoxParms{{1.05 * (spm.vecRMax[indx] - spm.vecRMin[indx]) * 0.5,
937  0.5 * spm.cutThick,
938  fabs(spm.vecZPts.back() - spm.vecZPts.front()) * 0.5 + 1.0 * dd4hep::mm}};
939 
940  // Supermodule side platess
941  array<double, 3> sideParms{{0.5 * spm.sideHigh, 0.5 * spm.sideThick, 0.5 * fabs(spm.vecZPts[1] - spm.vecZPts[0])}};
942  Solid sideSolid = Box(spm.sideName, sideParms[0], sideParms[1], sideParms[2]);
943 #ifdef EDM_ML_DEBUG
944  edm::LogVerbatim("EBGeom") << spm.sideName << " Box " << cms::convert2mm(sideParms[0]) << ":"
945  << cms::convert2mm(sideParms[1]) << ":" << cms::convert2mm(sideParms[2]);
946 #endif
947  Volume sideLog = Volume(spm.sideName, sideSolid, ns.material(spm.sideMat));
948 
949  Position sideddtra1;
950  Position sideddtra2;
951  for (unsigned int icopy(1); icopy <= 2; ++icopy) {
952  const std::vector<double>& tvec(1 == icopy ? spm.vecCutTM : spm.vecCutTP);
953  double rang(1 == icopy ? spm.cutRM : spm.cutRP);
954 
955  const Position tr(tvec[0], tvec[1], tvec[2]);
956  RotationZ ro(rang);
957  const double ang(1 == icopy ? spm.lowPhi : spm.lowPhi + spm.delPhi);
958  RotationZ ro1(ang);
959  const Position tr1(
960  0.5 * (spm.vecRMax[indx] + spm.vecRMin[indx]), 0, 0.5 * (spm.vecZPts.front() + spm.vecZPts.back()));
961 
962  const Tl3D trSide(tvec[0],
963  tvec[1] + (1 == icopy ? 1. : -1.) * (cutBoxParms[1] + sideParms[1]) +
964  (1 == icopy ? spm.sideYOffM : spm.sideYOffP),
965  tvec[2]);
966  const RoZ3D roSide(rang);
967  const Tf3D sideRot(RoZ3D(1 == icopy ? spm.lowPhi : spm.lowPhi + spm.delPhi) *
968  Tl3D(spm.vecRMin.front() + sideParms[0], 0, spm.vecZPts.front() + sideParms[2]) * trSide *
969  roSide);
970 
971  Rotation3D sideddrot(myrot(ns, spm.sideName + std::to_string(icopy), sideRot.getRotation()));
972  const Position sideddtra(sideRot.getTranslation());
973  1 == icopy ? sideddtra1 = sideddtra : sideddtra2 = sideddtra;
974  }
975 
976  ns.addAssembly(spm.name);
977  ns.assembly(spm.name).placeVolume(
978  sideLog, 1, Transform3D(ns.rotation(spm.sideName + std::to_string(1)), sideddtra1));
979 #ifdef EDM_ML_DEBUG
980  edm::LogVerbatim("EBGeomX") << sideLog.name() << ":1 positioned in " << spm.name << " at ("
981  << cms::convert2mm(sideddtra1.x()) << "," << cms::convert2mm(sideddtra1.y()) << ","
982  << cms::convert2mm(sideddtra1.z()) << ") with rotation";
983 #endif
984  ns.assembly(spm.name).placeVolume(
985  sideLog, 2, Transform3D(ns.rotation(spm.sideName + std::to_string(2)), sideddtra2));
986 #ifdef EDM_ML_DEBUG
987  edm::LogVerbatim("EBGeomX") << sideLog.name() << ":2 positioned in " << ns.assembly(spm.name).name() << " at ("
988  << cms::convert2mm(sideddtra2.x()) << "," << cms::convert2mm(sideddtra2.y()) << ","
989  << cms::convert2mm(sideddtra2.z()) << ") with rotation";
990 #endif
991 
992  const double dphi(360._deg / (1. * spm.nPerHalf));
993  for (unsigned int iphi(0); iphi < 2 * spm.nPerHalf; ++iphi) {
994  const double phi(iphi * dphi + spm.phiOff);
995 
996  // this base rotation includes the base translation & rotation
997  // plus flipping for the negative z hemisphere, plus
998  // the phi rotation for this module
999  const Tf3D rotaBase(RoZ3D(phi) * (iphi < spm.nPerHalf ? Ro3D() : RoX3D(180._deg)) *
1000  Ro3D(spm.vecBRota[3], Vec3(spm.vecBRota[0], spm.vecBRota[1], spm.vecBRota[2])) *
1001  Tl3D(Vec3(spm.vecBTran[0], spm.vecBTran[1], spm.vecBTran[2])));
1002 
1003  // here the individual rotations & translations of the supermodule
1004  // are implemented on top of the overall "base" rotation & translation
1005 
1006  const unsigned int offr(4 * iphi);
1007  const unsigned int offt(3 * iphi);
1008 
1009  const Ro3D r1(spm.vecRota[offr + 3], Vec3(spm.vecRota[offr + 0], spm.vecRota[offr + 1], spm.vecRota[offr + 2]));
1010 
1011  const Tf3D rotaExtra(r1 * Tl3D(Vec3(spm.vecTran[offt + 0], spm.vecTran[offt + 1], spm.vecTran[offt + 2])));
1012 
1013  const Tf3D both(rotaExtra * rotaBase);
1014 
1015  const Rotation3D rota(myrot(ns, spm.name + std::to_string(convertRadToDeg(phi)), both.getRotation()));
1016 
1017  if (spm.vecHere[iphi] != 0) {
1018  // convert from CLHEP to Position & etc.
1019  Position myTran(both.getTranslation().x(), both.getTranslation().y(), both.getTranslation().z());
1020  barVolume.placeVolume(ns.assembly(spm.name), iphi + 1, Transform3D(rota, myTran));
1021 #ifdef EDM_ML_DEBUG
1022  edm::LogVerbatim("EBGeomX") << ns.assembly(spm.name).name() << ":" << (iphi + 1) << " positioned in "
1023  << barVolume.name() << " at (" << cms::convert2mm(myTran.x()) << ","
1024  << cms::convert2mm(myTran.y()) << "," << cms::convert2mm(myTran.z())
1025  << ") with rotation";
1026 #endif
1027  }
1028  }
1029  // End Supermodule parent------------------------------------------------------------
1030 
1031  // Begin Inner Layer volumes---------------------------------------------------------
1032  const double ilyLengthHalf(0.5 * (spm.vecZPts[1] - spm.vecZPts[0]));
1033  double ilyRMin(spm.vecRMin[0]);
1034  double ilyThick(0);
1035  for (unsigned int ilyx(0); ilyx != ily.vecIlyThick.size(); ++ilyx) {
1036  ilyThick += ily.vecIlyThick[ilyx];
1037  }
1038  Solid ilySolid = Tube(ily.name,
1039  ilyRMin, // rmin
1040  ilyRMin + ilyThick, // rmax
1041  ilyLengthHalf, // dz
1042  ily.phiLow, // startPhi
1043  ily.phiLow + ily.delPhi); // startPhi + deltaPhi
1044 #ifdef EDM_ML_DEBUG
1045  edm::LogVerbatim("EBGeom") << ily.name << " Tubs " << cms::convert2mm(ilyLengthHalf) << ":"
1046  << cms::convert2mm(ilyRMin) << ":" << cms::convert2mm(ilyRMin + ilyThick) << ":"
1047  << convertRadToDeg(ily.phiLow) << ":" << convertRadToDeg(ily.delPhi);
1048 #endif
1049  Volume ilyLog = Volume(ily.name, ilySolid, ns.material(spm.mat));
1050  ns.assembly(spm.name).placeVolume(ilyLog, copyOne, Position(0, 0, ilyLengthHalf));
1051 #ifdef EDM_ML_DEBUG
1052  edm::LogVerbatim("EBGeomX") << ilyLog.name() << ":" << copyOne << " positioned in " << ns.assembly(spm.name).name()
1053  << " at (0,0," << cms::convert2mm(ilyLengthHalf) << ") with no rotation";
1054 #endif
1055  Volume ilyPipeLog[200];
1056  if (0 != ily.pipeHere) {
1057  for (unsigned int iPipeType(0); iPipeType != ily.vecIlyPipeLengthHalf.size(); ++iPipeType) {
1058  string pName(ily.pipeName + "_" + std::to_string(iPipeType + 1));
1059 
1060  Solid ilyPipeSolid = Tube(pName,
1061  0, // rmin
1062  ily.pipeODHalf, // rmax
1063  ily.vecIlyPipeLengthHalf[iPipeType], // dz
1064  0._deg, // startPhi
1065  360._deg); // startPhi + deltaPhi
1066 #ifdef EDM_ML_DEBUG
1067  edm::LogVerbatim("EBGeom") << pName << " Tubs " << cms::convert2mm(ily.vecIlyPipeLengthHalf[iPipeType])
1068  << ":0:" << cms::convert2mm(ily.pipeODHalf) << ":0:360";
1069 #endif
1070  ilyPipeLog[iPipeType] = Volume(pName, ilyPipeSolid, ns.material(ily.pipeMat));
1071 
1072  string pWaName(ily.pipeName + "Wa_" + std::to_string(iPipeType + 1));
1073  Solid ilyPipeWaSolid = Tube(pWaName,
1074  0, // rmin
1075  0.5 * ily.pipeID, // rmax
1076  ily.vecIlyPipeLengthHalf[iPipeType], // dz
1077  0._deg, // startPhi
1078  360._deg); // startPhi + deltaPhi
1079 #ifdef EDM_ML_DEBUG
1080  edm::LogVerbatim("EBGeom") << pWaName << " Tubs " << cms::convert2mm(ily.vecIlyPipeLengthHalf[iPipeType])
1081  << ":0:" << cms::convert2mm(0.5 * ily.pipeID) << ":0:360";
1082 #endif
1083  Volume ilyPipeWaLog = Volume(pWaName, ilyPipeWaSolid, ns.material(backPipe.waterMat));
1084  ilyPipeLog[iPipeType].placeVolume(ilyPipeWaLog, copyOne);
1085 #ifdef EDM_ML_DEBUG
1086  edm::LogVerbatim("EBGeomX") << ilyPipeWaLog.name() << ":" << copyOne << " positioned in "
1087  << ilyPipeLog[iPipeType].name() << " at (0,0,0) with no rotation";
1088 #endif
1089  }
1090  }
1091 
1092  Solid ilyPTMSolid = Box(ily.pTMName, ily.pTMHeightHalf, ily.pTMWidthHalf, ily.pTMLengthHalf);
1093 #ifdef EDM_ML_DEBUG
1094  edm::LogVerbatim("EBGeom") << ily.pTMName << " Box " << cms::convert2mm(ily.pTMHeightHalf) << ":"
1095  << cms::convert2mm(ily.pTMWidthHalf) << ":" << cms::convert2mm(ily.pTMLengthHalf);
1096 #endif
1097  Volume ilyPTMLog = Volume(ily.pTMName, ilyPTMSolid, ns.material(ily.pTMMat));
1098 
1099  Solid ilyFanOutSolid = Box(ily.fanOutName, ily.fanOutHeightHalf, ily.fanOutWidthHalf, ily.fanOutLengthHalf);
1100 #ifdef EDM_ML_DEBUG
1101  edm::LogVerbatim("EBGeom") << ily.fanOutName << " Box " << cms::convert2mm(ily.fanOutHeightHalf) << ":"
1102  << cms::convert2mm(ily.fanOutWidthHalf) << ":" << cms::convert2mm(ily.fanOutLengthHalf);
1103 #endif
1104  Volume ilyFanOutLog = Volume(ily.fanOutName, ilyFanOutSolid, ns.material(ily.fanOutMat));
1105 
1106  Solid ilyFEMSolid = Box(ily.fEMName, ily.fEMHeightHalf, ily.fEMWidthHalf, ily.fEMLengthHalf);
1107 #ifdef EDM_ML_DEBUG
1108  edm::LogVerbatim("EBGeom") << ily.fEMName << " Box " << cms::convert2mm(ily.fEMHeightHalf) << ":"
1109  << cms::convert2mm(ily.fEMWidthHalf) << ":" << cms::convert2mm(ily.fEMLengthHalf);
1110 #endif
1111  Volume ilyFEMLog = Volume(ily.fEMName, ilyFEMSolid, ns.material(ily.fEMMat));
1112 
1113  Solid ilyDiffSolid = Box(ily.diffName, ily.fanOutHeightHalf, ily.fanOutWidthHalf, ily.diffLengthHalf);
1114 #ifdef EDM_ML_DEBUG
1115  edm::LogVerbatim("EBGeom") << ily.diffName << " Box " << cms::convert2mm(ily.fanOutHeightHalf) << ":"
1116  << cms::convert2mm(ily.fanOutWidthHalf) << ":" << cms::convert2mm(ily.diffLengthHalf);
1117 #endif
1118  Volume ilyDiffLog = Volume(ily.diffName, ilyDiffSolid, ns.material(ily.diffMat));
1119 
1120  Solid ilyBndlSolid = Box(ily.bndlName, ily.fanOutHeightHalf, ily.fanOutWidthHalf, ily.bndlLengthHalf);
1121 #ifdef EDM_ML_DEBUG
1122  edm::LogVerbatim("EBGeom") << ily.bndlName << " Box " << cms::convert2mm(ily.fanOutHeightHalf) << ":"
1123  << cms::convert2mm(ily.fanOutWidthHalf) << ":" << cms::convert2mm(ily.bndlLengthHalf);
1124 #endif
1125  Volume ilyBndlLog = Volume(ily.bndlName, ilyBndlSolid, ns.material(ily.bndlMat));
1126 
1127  ilyFanOutLog.placeVolume(
1128  ilyDiffLog, copyOne, Position(0, 0, -ily.fanOutLengthHalf + ily.diffLengthHalf + ily.diffOff));
1129 #ifdef EDM_ML_DEBUG
1130  edm::LogVerbatim("EBGeomX") << ilyDiffLog.name() << ":" << copyOne << " positioned in " << ilyFanOutLog.name()
1131  << " at (0,0,"
1132  << cms::convert2mm(-ily.fanOutLengthHalf + ily.diffLengthHalf + ily.diffOff)
1133  << ") with no rotation";
1134 #endif
1135  ilyFanOutLog.placeVolume(
1136  ilyBndlLog, copyOne, Position(0, 0, -ily.fanOutLengthHalf + ily.bndlLengthHalf + ily.bndlOff));
1137 #ifdef EDM_ML_DEBUG
1138  edm::LogVerbatim("EBGeomX") << ilyBndlLog.name() << ":" << copyOne << " positioned in " << ilyFanOutLog.name()
1139  << " at (0,0,"
1140  << cms::convert2mm(-ily.fanOutLengthHalf + ily.bndlLengthHalf + ily.bndlOff)
1141  << ") with no rotation";
1142 #endif
1143 
1144  Volume xilyLog;
1145  for (unsigned int iily(0); iily != ily.vecIlyThick.size(); ++iily) {
1146  const double ilyRMax(ilyRMin + ily.vecIlyThick[iily]);
1147  string xilyName(ily.name + std::to_string(iily));
1148  Solid xilySolid = Tube(xilyName, ilyRMin, ilyRMax, ilyLengthHalf, ily.phiLow, ily.phiLow + ily.delPhi);
1149 #ifdef EDM_ML_DEBUG
1150  edm::LogVerbatim("EBGeom") << xilyName << " Tubs " << cms::convert2mm(ilyLengthHalf) << ":"
1151  << cms::convert2mm(ilyRMin) << ":" << cms::convert2mm(ilyRMax) << ":"
1152  << convertRadToDeg(ily.phiLow) << ":" << convertRadToDeg(ily.delPhi);
1153 #endif
1154  xilyLog = ns.addVolume(Volume(xilyName, xilySolid, ns.material(ily.vecIlyMat[iily])));
1155  if (0 != ily.here) {
1156  ilyLog.placeVolume(xilyLog, copyOne);
1157 #ifdef EDM_ML_DEBUG
1158  edm::LogVerbatim("EBGeomX") << xilyLog.name() << ":" << copyOne << " positioned in " << ilyLog.name()
1159  << " at (0,0,0) with no rotation";
1160 #endif
1161  unsigned int copyNum[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
1162 
1163  if (10 * dd4hep::mm < ily.vecIlyThick[iily] && ily.vecIlyThick.size() != (iily + 1) && 0 != ily.pipeHere) {
1164  if (0 != ily.pTMHere) {
1165  unsigned int ptmCopy(0);
1166  for (unsigned int ilyPTM(0); ilyPTM != ily.vecIlyPTMZ.size(); ++ilyPTM) {
1167  const double radius(ilyRMax - 1 * dd4hep::mm - ily.pTMHeightHalf);
1168  const double phi(ily.vecIlyPTMPhi[ilyPTM]);
1169  const double yy(radius * sin(phi));
1170  const double xx(radius * cos(phi));
1171  ++ptmCopy;
1172  xilyLog.placeVolume(
1173  ilyPTMLog,
1174  ptmCopy,
1175  Transform3D(RotationZ(phi), Position(xx, yy, ily.vecIlyPTMZ[ilyPTM] - ilyLengthHalf)));
1176 #ifdef EDM_ML_DEBUG
1177  edm::LogVerbatim("EBGeomX")
1178  << ilyPTMLog.name() << ":" << ptmCopy << " positioned in " << xilyLog.name() << " at ("
1179  << cms::convert2mm(xx) << "," << cms::convert2mm(yy) << ","
1180  << cms::convert2mm(ily.vecIlyPTMZ[ilyPTM] - ilyLengthHalf) << ") with rotation";
1181 #endif
1182  }
1183  }
1184  if (0 != ily.fanOutHere) {
1185  unsigned int fanOutCopy(0);
1186  for (unsigned int ilyFO(0); ilyFO != ily.vecIlyFanOutZ.size(); ++ilyFO) {
1187  const double radius(ilyRMax - 1 * dd4hep::mm - ily.fanOutHeightHalf);
1188  const double phi(ily.vecIlyFanOutPhi[ilyFO]);
1189  const double yy(radius * sin(phi));
1190  const double xx(radius * cos(phi));
1191  ++fanOutCopy;
1192  xilyLog.placeVolume(ilyFanOutLog,
1193  fanOutCopy,
1194  Transform3D(RotationZ(phi) * RotationY(180._deg),
1195  Position(xx, yy, ily.vecIlyFanOutZ[ilyFO] - ilyLengthHalf)));
1196 #ifdef EDM_ML_DEBUG
1197  edm::LogVerbatim("EBGeomX")
1198  << ilyFanOutLog.name() << ":" << fanOutCopy << " positioned in " << xilyLog.name() << " at ("
1199  << cms::convert2mm(xx) << "," << cms::convert2mm(yy) << ","
1200  << cms::convert2mm(ily.vecIlyFanOutZ[ilyFO] - ilyLengthHalf) << ") with rotation";
1201 #endif
1202  }
1203  unsigned int femCopy(0);
1204  for (unsigned int ilyFEM(0); ilyFEM != ily.vecIlyFEMZ.size(); ++ilyFEM) {
1205  const double radius(ilyRMax - 1 * dd4hep::mm - ily.fEMHeightHalf);
1206  const double phi(ily.vecIlyFEMPhi[ilyFEM]);
1207  const double yy(radius * sin(phi));
1208  const double xx(radius * cos(phi));
1209  ++femCopy;
1210  xilyLog.placeVolume(
1211  ilyFEMLog,
1212  femCopy,
1213  Transform3D(RotationZ(phi), Position(xx, yy, ily.vecIlyFEMZ[ilyFEM] - ilyLengthHalf)));
1214 #ifdef EDM_ML_DEBUG
1215  edm::LogVerbatim("EBGeomX")
1216  << ilyFEMLog.name() << ":" << femCopy << " positioned in " << xilyLog.name() << " at ("
1217  << cms::convert2mm(xx) << "," << cms::convert2mm(yy) << ","
1218  << cms::convert2mm(ily.vecIlyFEMZ[ilyFEM] - ilyLengthHalf) << ") with rotation";
1219 #endif
1220  }
1221  }
1222  for (unsigned int iPipe(0); iPipe != ily.vecIlyPipePhi.size(); ++iPipe) {
1223  const unsigned int type(static_cast<unsigned int>(round(ily.vecIlyPipeType[iPipe])));
1224  const double zz(-ilyLengthHalf + ily.vecIlyPipeZ[iPipe] + (9 > type ? ily.vecIlyPipeLengthHalf[type] : 0));
1225 
1226  for (unsigned int ly(0); ly != 2; ++ly) {
1227  const double radius(0 == ly ? ilyRMin + ily.pipeODHalf + 1 * dd4hep::mm
1228  : ilyRMax - ily.pipeODHalf - 1 * dd4hep::mm);
1229  const double phi(ily.vecIlyPipePhi[iPipe]);
1230  const double yy(radius * sin(phi));
1231  const double xx(radius * cos(phi));
1232  ++copyNum[type];
1233  if (9 > type) {
1234  xilyLog.placeVolume(ilyPipeLog[type], copyNum[type], Position(xx, yy, zz));
1235 #ifdef EDM_ML_DEBUG
1236  edm::LogVerbatim("EBGeomX")
1237  << ilyPipeLog[type].name() << ":" << copyNum[type] << " positioned in " << xilyLog.name() << " at ("
1238  << cms::convert2mm(xx) << "," << cms::convert2mm(yy) << "," << cms::convert2mm(zz)
1239  << ") with no rotation";
1240 #endif
1241  } else {
1242  xilyLog.placeVolume(
1243  ilyPipeLog[type],
1244  copyNum[type],
1245  Transform3D(Rotation3D(ROOT::Math::AxisAngle(ROOT::Math::AxisAngle::XYZVector(xx, yy, 0), 90._deg)),
1246  Position(xx, yy, zz)));
1247 #ifdef EDM_ML_DEBUG
1248  edm::LogVerbatim("EBGeomX") << ilyPipeLog[type].name() << ":" << copyNum[type] << " positioned in "
1249  << xilyLog.name() << " at (" << cms::convert2mm(xx) << ","
1250  << cms::convert2mm(yy) << "," << cms::convert2mm(zz) << ") with rotation";
1251 #endif
1252  }
1253  }
1254  }
1255  }
1256  }
1257  ilyRMin = ilyRMax;
1258  }
1259  // End Inner Layer volumes---------------------------------------------------------
1260 
1261  string clyrName(ns.prepend("ECLYR"));
1262  std::vector<double> cri;
1263  std::vector<double> cro;
1264  std::vector<double> czz;
1265  czz.emplace_back(spm.vecZPts[1]);
1266  cri.emplace_back(spm.vecRMin[0]);
1267  cro.emplace_back(spm.vecRMin[0] + 25 * dd4hep::mm);
1268  czz.emplace_back(spm.vecZPts[2]);
1269  cri.emplace_back(spm.vecRMin[2]);
1270  cro.emplace_back(spm.vecRMin[2] + 10 * dd4hep::mm);
1271  Solid clyrSolid = Polycone(clyrName, -9.5_deg, 19_deg, cri, cro, czz);
1272 #ifdef EDM_ML_DEBUG
1273  edm::LogVerbatim("EBGeom") << clyrName << " PolyCone from -9.5 to 9.5 with " << czz.size() << " points";
1274  for (unsigned int k = 0; k < czz.size(); ++k)
1275  edm::LogVerbatim("EBGeom") << "[" << k << "] " << cms::convert2mm(czz[k]) << ":" << cms::convert2mm(cri[k]) << ":"
1276  << cms::convert2mm(cro[k]);
1277 #endif
1278  Volume clyrLog = Volume(clyrName, clyrSolid, ns.material(ily.vecIlyMat[4]));
1279  ns.assembly(spm.name).placeVolume(clyrLog, copyOne);
1280 #ifdef EDM_ML_DEBUG
1281  edm::LogVerbatim("EBGeomX") << clyrLog.name() << ":" << copyOne << " positioned in " << ns.assembly(spm.name).name()
1282  << " at (0,0,0) with no rotation";
1283 #endif
1284  // Begin Alveolar Wedge parent ------------------------------------------------------
1285  //----------------
1286 
1287  // the next few lines accumulate dimensions appropriate to crystal type 1
1288  // which we use to set some of the features of the half-alveolar wedge (hawR).
1289 
1290  const double BNom1(cry.vecNomCryDimCR[0]);
1291  const double bNom1(cry.vecNomCryDimCF[0]);
1292  const double sWall1(alv.wallThAlv);
1293  const double fWall1(alv.wallFrAlv);
1294  const double sWrap1(alv.wrapThAlv);
1295  const double fWrap1(alv.wrapFrAlv);
1296  const double sClr1(alv.clrThAlv);
1297  const double fClr1(alv.clrFrAlv);
1298  const double LNom1(cry.nomCryDimLZ);
1299  const double beta1(atan((BNom1 - bNom1) / LNom1));
1300  const double sinbeta1(sin(beta1));
1301 
1302  const double tana_hawR((BNom1 - bNom1) / LNom1);
1303 
1304  const double H_hawR(alvWedge.hawRHBIG);
1305  const double h_hawR(alvWedge.hawRhsml);
1306  const double a_hawR(bNom1 + sClr1 + 2 * sWrap1 + 2 * sWall1 - sinbeta1 * (fClr1 + fWrap1 + fWall1));
1307  const double B_hawR(a_hawR + H_hawR * tana_hawR);
1308  const double b_hawR(a_hawR + h_hawR * tana_hawR);
1309  const double L_hawR(spm.vecZPts[2]);
1310 
1311  const EcalTrap trapHAWR(0.5 * a_hawR, //double aHalfLengthXNegZLoY , // bl1, A/2
1312  0.5 * a_hawR, //double aHalfLengthXPosZLoY , // bl2, a/2
1313  0.5 * b_hawR, //double aHalfLengthXPosZHiY , // tl2, b/2
1314  0.5 * H_hawR, //double aHalfLengthYNegZ , // h1, H/2
1315  0.5 * h_hawR, //double aHalfLengthYPosZ , // h2, h/2
1316  0.5 * L_hawR, //double aHalfLengthZ , // dz, L/2
1317  90._deg, //double aAngleAD , // alfa1
1318  0, //double aCoord15X , // x15
1319  0 //double aCoord15Y // y15
1320  );
1321 
1322  string hawRName1(alvWedge.hawRName + "1");
1323 
1324  const double al1_fawR(atan((B_hawR - a_hawR) / H_hawR) + M_PI_2);
1325 
1326  // here is trap for Full Alveolar Wedge
1327  const EcalTrap trapFAW(a_hawR, //double aHalfLengthXNegZLoY , // bl1, A/2
1328  a_hawR, //double aHalfLengthXPosZLoY , // bl2, a/2
1329  b_hawR, //double aHalfLengthXPosZHiY , // tl2, b/2
1330  0.5 * H_hawR, //double aHalfLengthYNegZ , // h1, H/2
1331  0.5 * h_hawR, //double aHalfLengthYPosZ , // h2, h/2
1332  0.5 * L_hawR, //double aHalfLengthZ , // dz, L/2
1333  al1_fawR, //double aAngleAD , // alfa1
1334  0, //double aCoord15X , // x15
1335  0 //double aCoord15Y // y15
1336  );
1337 
1338  const string fawName1(alvWedge.fawName + "1");
1339  Solid fawSolid1 = mytrap(fawName1, trapFAW);
1340 
1341  const EcalTrap::VertexList vHAW(trapHAWR.vertexList());
1342  const EcalTrap::VertexList vFAW(trapFAW.vertexList());
1343 
1344  const double hawBoxClr(1 * dd4hep::mm);
1345 
1346  // HAW cut box to cut off back end of wedge
1347  const string hawCutName(alvWedge.hawRName + "CUTBOX");
1348  array<double, 3> hawBoxParms{{0.5 * b_hawR + hawBoxClr, 0.5 * alvWedge.hawRCutY, 0.5 * alvWedge.hawRCutZ}};
1349 
1350 #ifdef EDM_ML_DEBUG
1351  edm::LogVerbatim("EBGeom") << hawCutName << " Box " << cms::convert2mm(hawBoxParms[0]) << ":"
1352  << cms::convert2mm(hawBoxParms[1]) << ":" << cms::convert2mm(hawBoxParms[2]);
1353 #endif
1354 
1355  const Pt3D b1(hawBoxParms[0], hawBoxParms[1], hawBoxParms[2]);
1356  const Pt3D b2(-hawBoxParms[0], hawBoxParms[1], hawBoxParms[2]);
1357  const Pt3D b3(-hawBoxParms[0], hawBoxParms[1], -hawBoxParms[2]);
1358 
1359  const double zDel(
1360  sqrt(4 * hawBoxParms[2] * hawBoxParms[2] - (h_hawR - alvWedge.hawRCutDelY) * (h_hawR - alvWedge.hawRCutDelY)));
1361 
1362  const Tf3D hawCutForm(b1,
1363  b2,
1364  b3,
1365  vHAW[2] + Pt3D(hawBoxClr, -alvWedge.hawRCutDelY, 0),
1366  vHAW[1] + Pt3D(-hawBoxClr, -alvWedge.hawRCutDelY, 0),
1367  Pt3D(vHAW[0].x() - hawBoxClr, vHAW[0].y(), vHAW[0].z() - zDel));
1368 
1369  ns.addAssembly(alvWedge.hawRName);
1370 
1371  // FAW cut box to cut off back end of wedge
1372  const string fawCutName(alvWedge.fawName + "CUTBOX");
1373  const array<double, 3> fawBoxParms{{2 * hawBoxParms[0], hawBoxParms[1], hawBoxParms[2]}};
1374  Solid fawCutBox = Box(fawCutName, fawBoxParms[0], fawBoxParms[1], fawBoxParms[2]);
1375 #ifdef EDM_ML_DEBUG
1376  edm::LogVerbatim("EBGeom") << fawCutName << " Box " << cms::convert2mm(fawBoxParms[0]) << ":"
1377  << cms::convert2mm(fawBoxParms[1]) << ":" << cms::convert2mm(fawBoxParms[2]);
1378 #endif
1379 
1380  const Pt3D bb1(fawBoxParms[0], fawBoxParms[1], fawBoxParms[2]);
1381  const Pt3D bb2(-fawBoxParms[0], fawBoxParms[1], fawBoxParms[2]);
1382  const Pt3D bb3(-fawBoxParms[0], fawBoxParms[1], -fawBoxParms[2]);
1383 
1384  const Tf3D fawCutForm(bb1,
1385  bb2,
1386  bb3,
1387  vFAW[2] + Pt3D(2 * hawBoxClr, -5 * dd4hep::mm, 0),
1388  vFAW[1] + Pt3D(-2 * hawBoxClr, -5 * dd4hep::mm, 0),
1389  Pt3D(vFAW[1].x() - 2 * hawBoxClr, vFAW[1].y() - trapFAW.h(), vFAW[1].z() - zDel));
1390 
1391  Solid fawSolid = SubtractionSolid(fawSolid1,
1392  fawCutBox,
1393  Transform3D(myrot(ns, fawCutName + "R", fawCutForm.getRotation()),
1394  Position(fawCutForm.getTranslation().x(),
1395  fawCutForm.getTranslation().y(),
1396  fawCutForm.getTranslation().z())));
1397 #ifdef EDM_ML_DEBUG
1398  edm::LogVerbatim("EBGeom") << alvWedge.fawName << " Subtraction " << fawSolid1.name() << ":" << fawCutBox.name()
1399  << " at (" << cms::convert2mm(fawCutForm.getTranslation().x()) << ","
1400  << cms::convert2mm(fawCutForm.getTranslation().y()) << ","
1401  << cms::convert2mm(fawCutForm.getTranslation().z()) << ")";
1402 #endif
1403  Volume fawLog = Volume(alvWedge.fawName, fawSolid, ns.material(spm.mat));
1404 
1405  const Tf3D hawRform(vHAW[3],
1406  vHAW[0],
1407  vHAW[1], // HAW inside FAW
1408  vFAW[3],
1409  0.5 * (vFAW[0] + vFAW[3]),
1410  0.5 * (vFAW[1] + vFAW[2]));
1411 
1412  fawLog.placeVolume(
1413  ns.assembly(alvWedge.hawRName),
1414  copyOne,
1415  Transform3D(
1416  myrot(ns, alvWedge.hawRName + "R", hawRform.getRotation()),
1417  Position(hawRform.getTranslation().x(), hawRform.getTranslation().y(), hawRform.getTranslation().z())));
1418 #ifdef EDM_ML_DEBUG
1419  edm::LogVerbatim("EBGeomX") << ns.assembly(alvWedge.hawRName).name() << ":" << copyOne << " positioned in "
1420  << fawLog.name() << " at (" << cms::convert2mm(hawRform.getTranslation().x()) << ","
1421  << cms::convert2mm(hawRform.getTranslation().y()) << ","
1422  << cms::convert2mm(hawRform.getTranslation().z()) << ") with rotation";
1423 #endif
1424 
1425  fawLog.placeVolume(
1426  ns.assembly(alvWedge.hawRName),
1427  copyTwo,
1428  Transform3D(
1429  Rotation3D(1., 0., 0., 0., 1., 0., 0., 0., -1.) * RotationY(M_PI), // rotate about Y after refl thru Z
1430  Position(-hawRform.getTranslation().x(), -hawRform.getTranslation().y(), -hawRform.getTranslation().z())));
1431 #ifdef EDM_ML_DEBUG
1432  edm::LogVerbatim("EBGeomX") << ns.assembly(alvWedge.hawRName).name() << ":" << copyTwo << " positioned in "
1433  << fawLog.name() << " at (" << cms::convert2mm(-hawRform.getTranslation().x()) << ","
1434  << cms::convert2mm(-hawRform.getTranslation().y()) << ","
1435  << cms::convert2mm(-hawRform.getTranslation().z()) << ") with rotation";
1436 #endif
1437  for (unsigned int iPhi(1); iPhi <= alvWedge.nFawPerSupm; ++iPhi) {
1438  const double rPhi(alvWedge.fawPhiOff + (iPhi - 0.5) * alvWedge.fawDelPhi);
1439 
1440  const Tf3D fawform(RoZ3D(rPhi) *
1441  Tl3D(alvWedge.fawRadOff + (trapFAW.H() + trapFAW.h()) / 4, 0, 0.5 * trapFAW.L()) *
1442  RoZ3D(-90._deg + alvWedge.fawPhiRot));
1443  if (alvWedge.fawHere) {
1444  ns.assembly(spm.name).placeVolume(
1445  fawLog,
1446  iPhi,
1447  Transform3D(
1448  myrot(ns, alvWedge.fawName + "_Rot" + std::to_string(iPhi), fawform.getRotation()),
1449  Position(fawform.getTranslation().x(), fawform.getTranslation().y(), fawform.getTranslation().z())));
1450 #ifdef EDM_ML_DEBUG
1451  edm::LogVerbatim("EBGeomX") << fawLog.name() << ":" << iPhi << " positioned in " << ns.assembly(spm.name).name()
1452  << " at (" << cms::convert2mm(fawform.getTranslation().x()) << ","
1453  << cms::convert2mm(fawform.getTranslation().y()) << ","
1454  << cms::convert2mm(fawform.getTranslation().z()) << ") with rotation";
1455 #endif
1456  }
1457  }
1458 
1459  // End Alveolar Wedge parent ------------------------------------------------------
1460 
1461  // Begin Grid + Tablet insertion
1462 
1463  const double h_Grid(grid.thick);
1464 
1465  const EcalTrap trapGrid(0.5 * (B_hawR - h_Grid * (B_hawR - a_hawR) / H_hawR), // bl1, A/2
1466  0.5 * (b_hawR - h_Grid * (B_hawR - a_hawR) / H_hawR), // bl2, a/2
1467  0.5 * b_hawR, // tl2, b/2
1468  0.5 * h_Grid, // h1, H/2
1469  0.5 * h_Grid, // h2, h/2
1470  0.5 * (L_hawR - 8 * dd4hep::cm), // dz, L/2
1471  90._deg, // alfa1
1472  0, // x15
1473  H_hawR - h_hawR // y15
1474  );
1475 
1476  Solid gridSolid = mytrap(grid.name, trapGrid);
1477  Volume gridLog = Volume(grid.name, gridSolid, ns.material(grid.mat));
1478 
1479  const EcalTrap::VertexList vGrid(trapGrid.vertexList());
1480 
1481  const Tf3D gridForm(vGrid[4],
1482  vGrid[5],
1483  vGrid[6], // Grid inside HAW
1484  vHAW[5] - Pt3D(0, h_Grid, 0),
1485  vHAW[5],
1486  vHAW[6]);
1487 
1488  if (0 != grid.here) {
1489  ns.assembly(alvWedge.hawRName)
1490  .placeVolume(gridLog,
1491  copyOne,
1492  Transform3D(myrot(ns, grid.name + "R", gridForm.getRotation()),
1493  Position(gridForm.getTranslation().x(),
1494  gridForm.getTranslation().y(),
1495  gridForm.getTranslation().z())));
1496 #ifdef EDM_ML_DEBUG
1497  edm::LogVerbatim("EBGeomX") << gridLog.name() << ":" << copyOne << " positioned in "
1498  << ns.assembly(alvWedge.hawRName).name() << " at ("
1499  << cms::convert2mm(gridForm.getTranslation().x()) << ","
1500  << cms::convert2mm(gridForm.getTranslation().y()) << ","
1501  << cms::convert2mm(gridForm.getTranslation().z()) << ") with rotation";
1502 #endif
1503  }
1504  // End Grid + Tablet insertion
1505 
1506  // begin filling Wedge with crystal plus supports --------------------------
1507 
1508  const double aNom(cry.nomCryDimAF);
1509  const double LNom(cry.nomCryDimLZ);
1510 
1511  const double AUnd(cry.underAR);
1512  const double aUnd(cry.underAF);
1513  const double bUnd(cry.underCF);
1514  const double HUnd(cry.underBR);
1515  const double hUnd(cry.underBF);
1516  const double LUnd(cry.underLZ);
1517 
1518  const double sWall(alv.wallThAlv);
1519  const double sWrap(alv.wrapThAlv);
1520  const double sClr(alv.clrThAlv);
1521 
1522  const double fWall(alv.wallFrAlv);
1523  const double fWrap(alv.wrapFrAlv);
1524  const double fClr(alv.clrFrAlv);
1525 
1526  const double rWall(alv.wallReAlv);
1527  const double rWrap(alv.wrapReAlv);
1528  const double rClr(alv.clrReAlv);
1529 
1530  // theta is angle in yz plane between z axis & leading edge of crystal
1531  double theta(90._deg);
1532  double zee(0 * dd4hep::mm);
1533  double side(0 * dd4hep::mm);
1534  double zeta(0._deg); // increment in theta for last crystal
1535 
1536  for (unsigned int cryType(1); cryType <= alv.nCryTypes; ++cryType) {
1537  const string sType("_" + std::string(10 > cryType ? "0" : "") + std::to_string(cryType));
1538 
1539 #ifdef EDM_ML_DEBUG
1540  edm::LogVerbatim("EcalGeom") << "Crytype=" << cryType;
1541 #endif
1542  const double ANom(cry.vecNomCryDimAR[cryType - 1]);
1543  const double BNom(cry.vecNomCryDimCR[cryType - 1]);
1544  const double bNom(cry.vecNomCryDimCF[cryType - 1]);
1545  const double HNom(cry.vecNomCryDimBR[cryType - 1]);
1546  const double hNom(cry.vecNomCryDimBF[cryType - 1]);
1547 
1548  const double alfCry(90._deg + atan((bNom - bUnd - aNom + aUnd) / (hNom - hUnd)));
1549 
1550  const EcalTrap trapCry(0.5 * (ANom - AUnd), //double aHalfLengthXNegZLoY , // bl1, A/2
1551  0.5 * (aNom - aUnd), //double aHalfLengthXPosZLoY , // bl2, a/2
1552  0.5 * (bNom - bUnd), //double aHalfLengthXPosZHiY , // tl2, b/2
1553  0.5 * (HNom - HUnd), //double aHalfLengthYNegZ , // h1, H/2
1554  0.5 * (hNom - hUnd), //double aHalfLengthYPosZ , // h2, h/2
1555  0.5 * (LNom - LUnd), //double aHalfLengthZ , // dz, L/2
1556  alfCry, //double aAngleAD , // alfa1
1557  aNom - aUnd - ANom + AUnd, //double aCoord15X , // x15
1558  hNom - hUnd - HNom + HUnd //double aCoord15Y // y15
1559  );
1560 
1561  const string cryDDName(cry.name + sType);
1562  Solid crySolid = mytrap(cryDDName, trapCry);
1563  Volume cryLog = Volume(cryDDName, crySolid, ns.material(cry.mat));
1564 
1565  //++++++++++++++++++++++++++++++++++ APD ++++++++++++++++++++++++++++++++++
1566  const unsigned int copyCap(1);
1567  const string capDDName(cap.name + sType);
1568  Solid capSolid = Box(capDDName, cap.xSizeHalf, cap.ySizeHalf, cap.thickHalf);
1569 #ifdef EDM_ML_DEBUG
1570  edm::LogVerbatim("EBGeom") << capDDName << " Box " << cms::convert2mm(cap.xSizeHalf) << ":"
1571  << cms::convert2mm(cap.ySizeHalf) << ":" << cms::convert2mm(cap.thickHalf);
1572 #endif
1573  Volume capLog = Volume(capDDName, capSolid, ns.material(cap.mat));
1574 
1575  const string sglDDName(apd.sglName + sType);
1576  Solid sglSolid = Box(sglDDName, cap.xSizeHalf, cap.ySizeHalf, apd.sglThick * 0.5);
1577 #ifdef EDM_ML_DEBUG
1578  edm::LogVerbatim("EBGeom") << sglDDName << " Box " << cms::convert2mm(cap.xSizeHalf) << ":"
1579  << cms::convert2mm(cap.ySizeHalf) << ":" << cms::convert2mm(apd.sglThick * 0.5);
1580 #endif
1581  Volume sglLog = Volume(sglDDName, sglSolid, ns.material(apd.sglMat));
1582  const unsigned int copySGL(1);
1583 
1584  const string cerDDName(cer.name + sType);
1585  Solid cerSolid = Box(cerDDName, cer.xSizeHalf, cer.ySizeHalf, cer.thickHalf);
1586 #ifdef EDM_ML_DEBUG
1587  edm::LogVerbatim("EBGeom") << cerDDName << " Box " << cms::convert2mm(cer.xSizeHalf) << ":"
1588  << cms::convert2mm(cer.ySizeHalf) << ":" << cms::convert2mm(cer.thickHalf);
1589 #endif
1590  Volume cerLog = Volume(cerDDName, cerSolid, ns.material(cer.mat));
1591  unsigned int copyCER(0);
1592 
1593  const string bsiDDName(bSi.name + sType);
1594  Solid bsiSolid = Box(bsiDDName, bSi.xSizeHalf, bSi.ySizeHalf, bSi.thickHalf);
1595 #ifdef EDM_ML_DEBUG
1596  edm::LogVerbatim("EBGeom") << bsiDDName << " Box " << cms::convert2mm(bSi.xSizeHalf) << ":"
1597  << cms::convert2mm(bSi.ySizeHalf) << ":" << cms::convert2mm(bSi.thickHalf);
1598 #endif
1599  Volume bsiLog = Volume(bsiDDName, bsiSolid, ns.material(bSi.mat));
1600  const unsigned int copyBSi(1);
1601 
1602  const string atjDDName(apd.atjName + sType);
1603  Solid atjSolid = Box(atjDDName, 0.5 * apd.side, 0.5 * apd.side, apd.atjThickHalf);
1604 #ifdef EDM_ML_DEBUG
1605  edm::LogVerbatim("EBGeom") << atjDDName << " Box " << cms::convert2mm(0.5 * apd.side) << ":"
1606  << cms::convert2mm(0.5 * apd.side) << ":" << cms::convert2mm(apd.atjThickHalf);
1607 #endif
1608  Volume atjLog = Volume(atjDDName, atjSolid, ns.material(apd.atjMat));
1609  const unsigned int copyATJ(1);
1610 
1611  const string aglDDName(apd.aglName + sType);
1612  Solid aglSolid = Box(aglDDName, bSi.xSizeHalf, bSi.ySizeHalf, 0.5 * apd.aglThick);
1613 #ifdef EDM_ML_DEBUG
1614  edm::LogVerbatim("EBGeom") << aglDDName << " Box " << cms::convert2mm(bSi.xSizeHalf) << ":"
1615  << cms::convert2mm(bSi.ySizeHalf) << ":" << cms::convert2mm(0.5 * apd.aglThick);
1616 #endif
1617  Volume aglLog = Volume(aglDDName, aglSolid, ns.material(apd.aglMat));
1618  const unsigned int copyAGL(1);
1619 
1620  const string andDDName(apd.andName + sType);
1621  Solid andSolid = Box(andDDName, 0.5 * apd.side, 0.5 * apd.side, 0.5 * apd.andThick);
1622 #ifdef EDM_ML_DEBUG
1623  edm::LogVerbatim("EBGeom") << andDDName << " Box " << cms::convert2mm(0.5 * apd.side) << ":"
1624  << cms::convert2mm(0.5 * apd.side) << ":" << cms::convert2mm(0.5 * apd.andThick);
1625 #endif
1626  Volume andLog = Volume(andDDName, andSolid, ns.material(apd.andMat));
1627  const unsigned int copyAND(1);
1628 
1629  const string apdDDName(apd.name + sType);
1630  Solid apdSolid = Box(apdDDName, 0.5 * apd.side, 0.5 * apd.side, 0.5 * apd.thick);
1631 #ifdef EDM_ML_DEBUG
1632  edm::LogVerbatim("EBGeom") << apdDDName << " Box " << cms::convert2mm(0.5 * apd.side) << ":"
1633  << cms::convert2mm(0.5 * apd.side) << ":" << cms::convert2mm(0.5 * apd.thick);
1634 #endif
1635  Volume apdLog = Volume(apdDDName, apdSolid, ns.material(apd.mat));
1636  const unsigned int copyAPD(1);
1637 
1638  //++++++++++++++++++++++++++++++++++ END APD ++++++++++++++++++++++++++++++++++
1639 
1640  const double delta(atan((HNom - hNom) / LNom));
1641  const double sindelta(sin(delta));
1642 
1643  const double gamma(atan((ANom - aNom) / LNom));
1644  const double singamma(sin(gamma));
1645 
1646  const double beta(atan((BNom - bNom) / LNom));
1647  const double sinbeta(sin(beta));
1648 
1649  // Now clearance trap
1650  const double alfClr(90._deg + atan((bNom - aNom) / (hNom + sClr)));
1651 
1652  const EcalTrap trapClr(0.5 * (ANom + sClr + rClr * singamma), //double aHalfLengthXNegZLoY , // bl1, A/2
1653  0.5 * (aNom + sClr - fClr * singamma), //double aHalfLengthXPosZLoY , // bl2, a/2
1654  0.5 * (bNom + sClr - fClr * sinbeta), //double aHalfLengthXPosZHiY , // tl2, b/2
1655  0.5 * (HNom + sClr + rClr * sindelta), //double aHalfLengthYNegZ , // h1, H/2
1656  0.5 * (hNom + sClr - fClr * sindelta), //double aHalfLengthYPosZ , // h2, h/2
1657  0.5 * (LNom + fClr + rClr), // dz, L/2
1658  alfClr, //double aAngleAD , // alfa1
1659  aNom - ANom, //double aCoord15X , // x15
1660  hNom - HNom //double aCoord15Y // y15
1661  );
1662 
1663  const string clrDDName(cry.clrName + sType);
1664  Solid clrSolid = mytrap(clrDDName, trapClr);
1665  Volume clrLog = Volume(clrDDName, clrSolid, ns.material(cry.clrMat));
1666 
1667  // Now wrap trap
1668  const double alfWrap(90._deg + atan((bNom - aNom) / (hNom + sClr + 2. * sWrap)));
1669 
1670  const EcalTrap trapWrap(0.5 * (trapClr.A() + 2. * sWrap + rWrap * singamma), // bl1, A/2
1671  0.5 * (trapClr.a() + 2. * sWrap - fWrap * singamma), // bl2, a/2
1672  0.5 * (trapClr.b() + 2. * sWrap - fWrap * sinbeta), // tl2, b/2
1673  0.5 * (trapClr.H() + 2. * sWrap + rWrap * sindelta), // h1, H/2
1674  0.5 * (trapClr.h() + 2. * sWrap - fWrap * sindelta), // h2, h/2
1675  0.5 * (trapClr.L() + fWrap + rWrap), // dz, L/2
1676  alfWrap, //double aAngleAD , // alfa1
1677  aNom - ANom - (cryType > 9 ? 0 : 0.020 * dd4hep::mm),
1678  hNom - HNom //double aCoord15Y // y15
1679  );
1680 
1681  const string wrapDDName(cry.wrapName + sType);
1682  Solid wrapSolid = mytrap(wrapDDName, trapWrap);
1683  Volume wrapLog = Volume(wrapDDName, wrapSolid, ns.material(cry.wrapMat));
1684 
1685  // Now wall trap
1686 
1687  const double alfWall(90._deg + atan((bNom - aNom) / (hNom + sClr + 2. * sWrap + 2. * sWall)));
1688 
1689  const EcalTrap trapWall(0.5 * (trapWrap.A() + 2 * sWall + rWall * singamma), // A/2
1690  0.5 * (trapWrap.a() + 2 * sWall - fWall * singamma), // a/2
1691  0.5 * (trapWrap.b() + 2 * sWall - fWall * sinbeta), // b/2
1692  0.5 * (trapWrap.H() + 2 * sWall + rWall * sindelta), // H/2
1693  0.5 * (trapWrap.h() + 2 * sWall - fWall * sindelta), // h/2
1694  0.5 * (trapWrap.L() + fWall + rWall), // L/2
1695  alfWall, // alfa1
1696  aNom - ANom - (cryType < 10 ? 0.150 * dd4hep::mm : 0.100 * dd4hep::mm),
1697  hNom - HNom // y15
1698  );
1699 
1700  const string wallDDName(cry.wallName + sType);
1701  Solid wallSolid = mytrap(wallDDName, trapWall);
1702  Volume wallLog = Volume(wallDDName, wallSolid, ns.material(cry.wallMat));
1703 
1704  // Now for placement of cry within clr
1705  const Vec3 cryToClr(0., 0., 0.5 * (rClr - fClr));
1706  clrLog.placeVolume(cryLog, copyOne, Position(0, 0, 0.5 * (rClr - fClr)));
1707 #ifdef EDM_ML_DEBUG
1708  edm::LogVerbatim("EBGeomX") << cryLog.name() << ":" << copyOne << " positioned in " << clrLog.name()
1709  << " at (0,0," << cms::convert2mm(0.5 * (rClr - fClr)) << ") with no rotation";
1710 #endif
1711  if (0 != cap.here) {
1712  bsiLog.placeVolume(aglLog, copyAGL, Position(0, 0, -0.5 * apd.aglThick + bSi.thickHalf));
1713 #ifdef EDM_ML_DEBUG
1714  edm::LogVerbatim("EBGeomX") << aglLog.name() << ":" << copyAGL << " positioned in " << bsiLog.name()
1715  << " at (0,0," << cms::convert2mm(-0.5 * apd.aglThick + bSi.thickHalf)
1716  << ") with no rotation";
1717 #endif
1718  bsiLog.placeVolume(andLog, copyAND, Position(0, 0, -0.5 * apd.andThick - apd.aglThick + bSi.thickHalf));
1719 #ifdef EDM_ML_DEBUG
1720  edm::LogVerbatim("EBGeomX") << andLog.name() << ":" << copyAND << " positioned in " << bsiLog.name()
1721  << " at (0,0,"
1722  << cms::convert2mm(-0.5 * apd.andThick - apd.aglThick + bSi.thickHalf)
1723  << ") with no rotation";
1724 #endif
1725  bsiLog.placeVolume(
1726  apdLog, copyAPD, Position(0, 0, -0.5 * apd.thick - apd.andThick - apd.aglThick + bSi.thickHalf));
1727 #ifdef EDM_ML_DEBUG
1728  edm::LogVerbatim("EBGeomX") << apdLog.name() << ":" << copyAPD << " positioned in " << bsiLog.name()
1729  << " at (0,0,"
1730  << cms::convert2mm(-0.5 * apd.thick - apd.andThick - apd.aglThick + bSi.thickHalf)
1731  << ") with no rotation";
1732 #endif
1733  bsiLog.placeVolume(atjLog,
1734  copyATJ,
1735  Position(0, 0, -apd.atjThickHalf - apd.thick - apd.andThick - apd.aglThick + bSi.thickHalf));
1736 #ifdef EDM_ML_DEBUG
1737  edm::LogVerbatim("EBGeomX") << atjLog.name() << ":" << copyATJ << " positioned in " << bsiLog.name()
1738  << " at (0,0,"
1739  << cms::convert2mm(-apd.atjThickHalf - apd.thick - apd.andThick - apd.aglThick +
1740  bSi.thickHalf)
1741  << ") with no rotation";
1742 #endif
1743  cerLog.placeVolume(bsiLog, copyBSi, Position(0, 0, -bSi.thickHalf + cer.thickHalf));
1744 #ifdef EDM_ML_DEBUG
1745  edm::LogVerbatim("EBGeomX") << bsiLog.name() << ":" << copyBSi << " positioned in " << cerLog.name()
1746  << " at (0,0," << cms::convert2mm(-bSi.thickHalf + cer.thickHalf)
1747  << ") with no rotation";
1748 #endif
1749  capLog.placeVolume(sglLog, copySGL, Position(0, 0, -0.5 * apd.sglThick + cap.thickHalf));
1750 #ifdef EDM_ML_DEBUG
1751  edm::LogVerbatim("EBGeomX") << sglLog.name() << ":" << copySGL << " positioned in " << capLog.name()
1752  << " at (0,0," << cms::convert2mm(-0.5 * apd.sglThick + cap.thickHalf)
1753  << ") with no rotation";
1754 #endif
1755 
1756  for (unsigned int ijkl(0); ijkl != 2; ++ijkl) {
1757  capLog.placeVolume(cerLog,
1758  ++copyCER,
1759  Position(trapCry.bl1() - (0 == ijkl ? apd.x1 : apd.x2),
1760  trapCry.h1() - apd.z,
1761  -apd.sglThick - cer.thickHalf + cap.thickHalf));
1762 #ifdef EDM_ML_DEBUG
1763  edm::LogVerbatim("EBGeomX") << cerLog.name() << ":" << copyCER << " positioned in " << capLog.name()
1764  << " at (" << cms::convert2mm(trapCry.bl1() - (0 == ijkl ? apd.x1 : apd.x2))
1765  << "," << cms::convert2mm(trapCry.h1() - apd.z) << ","
1766  << cms::convert2mm(-apd.sglThick - cer.thickHalf + cap.thickHalf)
1767  << ") with no rotation";
1768 #endif
1769  }
1770  clrLog.placeVolume(capLog, copyCap, Position(0, 0, -trapCry.dz() - cap.thickHalf + 0.5 * (rClr - fClr)));
1771 #ifdef EDM_ML_DEBUG
1772  edm::LogVerbatim("EBGeomX") << capLog.name() << ":" << copyCap << " positioned in " << clrLog.name()
1773  << " at (0,0,"
1774  << cms::convert2mm(-trapCry.dz() - cap.thickHalf + 0.5 * (rClr - fClr))
1775  << ") with no rotation";
1776 #endif
1777  }
1778 
1779  const Vec3 clrToWrap(0, 0, 0.5 * (rWrap - fWrap));
1780  wrapLog.placeVolume(clrLog, copyOne, Position(0, 0, 0.5 * (rWrap - fWrap))); //SAME as cryToWrap
1781 #ifdef EDM_ML_DEBUG
1782  edm::LogVerbatim("EBGeomX") << clrLog.name() << ":" << copyOne << " positioned in " << wrapLog.name()
1783  << " at (0,0," << cms::convert2mm(0.5 * (rWrap - fWrap)) << ") with no rotation";
1784 #endif
1785 
1786  // Now for placement of clr within wall
1787  const Vec3 wrapToWall1(0, 0, 0.5 * (rWall - fWall));
1788  const Vec3 wrapToWall(Vec3((cryType > 9 ? 0 : 0.005 * dd4hep::mm), 0, 0) + wrapToWall1);
1789  wallLog.placeVolume(
1790  wrapLog,
1791  copyOne,
1792  Position(Vec3((cryType > 9 ? 0 : 0.005 * dd4hep::mm), 0, 0) + wrapToWall1)); //SAME as wrapToWall
1793 #ifdef EDM_ML_DEBUG
1794  edm::LogVerbatim("EBGeomX") << wrapLog.name() << ":" << copyOne << " positioned in " << wallLog.name() << " at ("
1795  << cms::convert2mm(wrapToWall.x()) << "," << cms::convert2mm(wrapToWall.y()) << ","
1796  << cms::convert2mm(wrapToWall.z()) << ") with no rotation";
1797 #endif
1798 
1799  const EcalTrap::VertexList vWall(trapWall.vertexList());
1800  const EcalTrap::VertexList vCry(trapCry.vertexList());
1801 
1802  const double sidePrime(0.5 * (trapWall.a() - trapCry.a()));
1803  const double frontPrime(fWall + fWrap + fClr + 0.5 * LUnd);
1804 
1805  // define web plates with clearance ===========================================
1806 
1807  if (1 == cryType) // first web plate: inside clearance volume
1808  {
1809  const unsigned int iWeb(0);
1810  const Pt3D corner(vHAW[4] + Pt3D(0, alvWedge.hawYOffCry, 0));
1811  const unsigned int copyOne(1);
1812  const double LWebx(web.vecWebLength[iWeb]);
1813  const double BWebx(trapWall.b() + (trapWall.B() - trapWall.b()) * LWebx / trapWall.L());
1814 
1815  const double thick(web.vecWebPlTh[iWeb] + web.vecWebClrTh[iWeb]);
1816  const EcalTrap trapWebClr(0.5 * BWebx, // A/2
1817  0.5 * trapWall.b(), // a/2
1818  0.5 * trapWall.b(), // b/2
1819  0.5 * thick, // H/2
1820  0.5 * thick, // h/2
1821  0.5 * LWebx, // L/2
1822  90._deg, // alfa1
1823  trapWall.b() - BWebx, // x15
1824  0 // y15
1825  );
1826  std::string webClrName(web.clrName + std::to_string(iWeb));
1827  Solid webClrSolid = mytrap(webClrName, trapWebClr);
1828  Volume webClrLog = Volume(webClrName, webClrSolid, ns.material(web.clrMat));
1829 
1830  const EcalTrap trapWebPl(0.5 * trapWebClr.A(), // A/2
1831  0.5 * trapWebClr.a(), // a/2
1832  0.5 * trapWebClr.b(), // b/2
1833  0.5 * web.vecWebPlTh[iWeb], // H/2
1834  0.5 * web.vecWebPlTh[iWeb], // h/2
1835  0.5 * trapWebClr.L(), // L/2
1836  90._deg, // alfa1
1837  trapWebClr.b() - trapWebClr.B(), // x15
1838  0 // y15
1839  );
1840  std::string webPlName(web.plName + std::to_string(iWeb));
1841  Solid webPlSolid = mytrap(webPlName, trapWebPl);
1842  Volume webPlLog = Volume(webPlName, webPlSolid, ns.material(web.plMat));
1843 
1844  webClrLog.placeVolume(webPlLog, copyOne); // place plate inside clearance volume
1845 #ifdef EDM_ML_DEBUG
1846  edm::LogVerbatim("EBGeomX") << webPlLog.name() << ":" << copyOne << " positioned in " << webClrName
1847  << " at (0,0,0) with no rotation";
1848 #endif
1849  const EcalTrap::VertexList vWeb(trapWebClr.vertexList());
1850 
1851  zee += trapWebClr.h() / sin(theta);
1852 
1853  const double beta(theta + delta);
1854 
1855  const double zWeb(zee - frontPrime * cos(beta) + sidePrime * sin(beta));
1856  const double yWeb(frontPrime * sin(beta) + sidePrime * cos(beta));
1857 
1858  const Pt3D wedge3(corner + Pt3D(0, -yWeb, zWeb));
1859  const Pt3D wedge2(wedge3 + Pt3D(0, trapWebClr.h() * cos(theta), -trapWebClr.h() * sin(theta)));
1860  const Pt3D wedge1(wedge3 + Pt3D(trapWebClr.a(), 0, 0));
1861 #ifdef EDM_ML_DEBUG
1862  edm::LogVerbatim("EcalGeom") << "trap1=" << vWeb[0] << ", trap2=" << vWeb[2] << ", trap3=" << vWeb[3];
1863  edm::LogVerbatim("EcalGeom") << "wedge1=" << wedge1 << ", wedge2=" << wedge2 << ", wedge3=" << wedge3;
1864 #endif
1865  const Tf3D tForm(vWeb[0], vWeb[2], vWeb[3], wedge1, wedge2, wedge3);
1866 
1867  if (0 != web.here) {
1868  ns.assembly(alvWedge.hawRName)
1869  .placeVolume(
1870  webClrLog,
1871  copyOne,
1872  Transform3D(
1873  myrot(ns, webClrName + std::to_string(iWeb), tForm.getRotation()),
1874  Position(tForm.getTranslation().x(), tForm.getTranslation().y(), tForm.getTranslation().z())));
1875 #ifdef EDM_ML_DEBUG
1876  edm::LogVerbatim("EBGeomX") << webClrLog.name() << ":" << copyOne << " positioned in "
1877  << ns.assembly(alvWedge.hawRName).name() << " at ("
1878  << cms::convert2mm(tForm.getTranslation().x()) << ","
1879  << cms::convert2mm(tForm.getTranslation().y()) << ","
1880  << cms::convert2mm(tForm.getTranslation().z()) << ") with rotation";
1881 #endif
1882  }
1883  zee += alv.vecGapAlvEta[0];
1884  }
1885 
1886  for (unsigned int etaAlv(1); etaAlv <= alv.nCryPerAlvEta; ++etaAlv) {
1887 #ifdef EDM_ML_DEBUG
1888  edm::LogVerbatim("EcalGeom") << "theta=" << convertRadToDeg(theta) << ", sidePrime=" << sidePrime
1889  << ", frontPrime=" << frontPrime << ", zeta=" << zeta << ", delta=" << delta
1890  << ", zee=" << zee;
1891 #endif
1892 
1893  zee += 0.075 * dd4hep::mm + (side * cos(zeta) + trapWall.h() - sidePrime) / sin(theta);
1894 
1895  // make transform for placing enclosed crystal
1896 
1897  const Pt3D trap2(vCry[2] + cryToClr + clrToWrap + wrapToWall);
1898 
1899  const Pt3D trap3(trap2 + Pt3D(0, -trapCry.h(), 0));
1900  const Pt3D trap1(trap3 + Pt3D(-trapCry.a(), 0, 0));
1901 
1902  const Pt3D wedge3(vHAW[4] + Pt3D(sidePrime, alvWedge.hawYOffCry, zee));
1903  const Pt3D wedge2(wedge3 + Pt3D(0, trapCry.h() * cos(theta), -trapCry.h() * sin(theta)));
1904  const Pt3D wedge1(wedge3 + Pt3D(trapCry.a(), 0, 0));
1905 
1906  const Tf3D tForm1(trap1, trap2, trap3, wedge1, wedge2, wedge3);
1907 
1908  const double xx(0.050 * dd4hep::mm);
1909 
1910  const Tf3D tForm(HepGeom::Translate3D(xx, 0, 0) * tForm1);
1911  ns.assembly(alvWedge.hawRName)
1912  .placeVolume(
1913  wallLog,
1914  etaAlv,
1915  Transform3D(
1916  myrot(ns, wallDDName + "_" + std::to_string(etaAlv), tForm.getRotation()),
1917  Position(tForm.getTranslation().x(), tForm.getTranslation().y(), tForm.getTranslation().z())));
1918 #ifdef EDM_ML_DEBUG
1919  edm::LogVerbatim("EBGeomX") << wallLog.name() << ":" << etaAlv << " positioned in "
1920  << ns.assembly(alvWedge.hawRName).name() << " at ("
1921  << cms::convert2mm(tForm.getTranslation().x()) << ","
1922  << cms::convert2mm(tForm.getTranslation().y()) << ","
1923  << cms::convert2mm(tForm.getTranslation().z()) << ") with rotation";
1924 #endif
1925  theta -= delta;
1926  side = sidePrime;
1927  zeta = delta;
1928  }
1929  if (5 == cryType || 9 == cryType || 13 == cryType || 17 == cryType) { // web plates
1930  zee += 0.5 * alv.vecGapAlvEta[cryType] / sin(theta);
1931 
1932  const unsigned int iWeb(cryType / 4);
1933  const Pt3D corner(vHAW[4] + Pt3D(0, alvWedge.hawYOffCry, 0));
1934  const unsigned int copyOne(1);
1935  const double LWebx(web.vecWebLength[iWeb]);
1936  const double BWebx(trapWall.a() + (trapWall.A() - trapWall.a()) * LWebx / trapWall.L());
1937 
1938  const double thick(web.vecWebPlTh[iWeb] + web.vecWebClrTh[iWeb]);
1939  const EcalTrap trapWebClr(0.5 * BWebx, // A/2
1940  0.5 * trapWall.a(), // a/2
1941  0.5 * trapWall.a(), // b/2
1942  0.5 * thick, // H/2
1943  0.5 * thick, // h/2
1944  0.5 * LWebx, // L/2
1945  90._deg, // alfa1
1946  trapWall.a() - BWebx, // x15
1947  0 // y15
1948  );
1949  std::string webClrName(web.clrName + std::to_string(iWeb));
1950  Solid webClrSolid = mytrap(webClrName, trapWebClr);
1951  Volume webClrLog = Volume(webClrName, webClrSolid, ns.material(web.clrMat));
1952 
1953  const EcalTrap trapWebPl(0.5 * trapWebClr.A(), // A/2
1954  0.5 * trapWebClr.a(), // a/2
1955  0.5 * trapWebClr.b(), // b/2
1956  0.5 * web.vecWebPlTh[iWeb], // H/2
1957  0.5 * web.vecWebPlTh[iWeb], // h/2
1958  0.5 * trapWebClr.L(), // L/2
1959  90._deg, // alfa1
1960  trapWebClr.b() - trapWebClr.B(), // x15
1961  0 // y15
1962  );
1963  std::string webPlName(web.plName + std::to_string(iWeb));
1964  Solid webPlSolid = mytrap(webPlName, trapWebPl);
1965  Volume webPlLog = Volume(webPlName, webPlSolid, ns.material(web.plMat));
1966 
1967  webClrLog.placeVolume(webPlLog, copyOne); // place plate inside clearance volume
1968 #ifdef EDM_ML_DEBUG
1969  edm::LogVerbatim("EBGeomX") << webPlLog.name() << ":" << copyOne << " positioned in " << webClrName
1970  << " at (0,0,0) with no rotation";
1971 #endif
1972  const EcalTrap::VertexList vWeb(trapWebClr.vertexList());
1973 
1974  zee += trapWebClr.h() / sin(theta);
1975 
1976  const double beta(theta + delta);
1977 
1978  const double zWeb(zee - frontPrime * cos(beta) + sidePrime * sin(beta));
1979  const double yWeb(frontPrime * sin(beta) + sidePrime * cos(beta));
1980 
1981  const Pt3D wedge3(corner + Pt3D(0, -yWeb, zWeb));
1982  const Pt3D wedge2(wedge3 + Pt3D(0, trapWebClr.h() * cos(theta), -trapWebClr.h() * sin(theta)));
1983  const Pt3D wedge1(wedge3 + Pt3D(trapWebClr.a(), 0, 0));
1984 #ifdef EDM_ML_DEBUG
1985  edm::LogVerbatim("EcalGeom") << "trap1=" << vWeb[0] << ", trap2=" << vWeb[2] << ", trap3=" << vWeb[3];
1986  edm::LogVerbatim("EcalGeom") << "wedge1=" << wedge1 << ", wedge2=" << wedge2 << ", wedge3=" << wedge3;
1987 #endif
1988  const Tf3D tForm(vWeb[0], vWeb[2], vWeb[3], wedge1, wedge2, wedge3);
1989 
1990  if (0 != web.here) {
1991  ns.assembly(alvWedge.hawRName)
1992  .placeVolume(
1993  webClrLog,
1994  copyOne,
1995  Transform3D(
1996  myrot(ns, webClrName + std::to_string(iWeb), tForm.getRotation()),
1997  Position(tForm.getTranslation().x(), tForm.getTranslation().y(), tForm.getTranslation().z())));
1998 #ifdef EDM_ML_DEBUG
1999  edm::LogVerbatim("EBGeomX") << webClrLog.name() << ":" << copyOne << " positioned in "
2000  << ns.assembly(alvWedge.hawRName).name() << " at ("
2001  << cms::convert2mm(tForm.getTranslation().x()) << ","
2002  << cms::convert2mm(tForm.getTranslation().y()) << ","
2003  << cms::convert2mm(tForm.getTranslation().z()) << ") with rotation";
2004 #endif
2005  }
2006 
2007  zee += 0.5 * alv.vecGapAlvEta[cryType] / sin(theta);
2008  } else {
2009  if (17 != cryType)
2010  zee += alv.vecGapAlvEta[cryType] / sin(theta);
2011  }
2012  }
2013  // END filling Wedge with crystal plus supports --------------------------
2014 
2015  //------------------------------------------------------------------------
2016  //------------------------------------------------------------------------
2017  //------------------------------------------------------------------------
2018  //------------------------------------------------------------------------
2019  //**************** Material at outer radius of supermodule ***************
2020  //------------------------------------------------------------------------
2021  //------------------------------------------------------------------------
2022  //------------------------------------------------------------------------
2023  //------------------------------------------------------------------------
2024 
2025  if (0 != back.here) {
2031 
2032  const Position outtra(back.xOff + 0.5 * back.sideHeight, back.yOff, 0.5 * back.sideLength);
2033 
2034  const double realBPthick(back.plateThick + back.plate2Thick);
2035  array<double, 3> backPlateParms{{0.5 * back.plateWidth, 0.5 * realBPthick, 0.5 * back.plateLength}};
2036  Solid backPlateSolid = Box(back.plateName, backPlateParms[0], backPlateParms[1], backPlateParms[2]);
2037 #ifdef EDM_ML_DEBUG
2038  edm::LogVerbatim("EBGeom") << back.plateName << " Box " << cms::convert2mm(backPlateParms[0]) << ":"
2039  << cms::convert2mm(backPlateParms[1]) << ":" << cms::convert2mm(backPlateParms[2]);
2040 #endif
2041  Volume backPlateLog = Volume(back.plateName, backPlateSolid, ns.material(back.plateMat));
2042 
2043  const Position backPlateTra(
2044  0.5 * back.sideHeight + backPlateParms[1], 0 * dd4hep::mm, backPlateParms[2] - 0.5 * back.sideLength);
2045 
2046  Solid backPlate2Solid =
2047  Box(back.plate2Name, 0.5 * back.plateWidth, 0.5 * back.plate2Thick, 0.5 * back.plateLength);
2048 #ifdef EDM_ML_DEBUG
2049  edm::LogVerbatim("EBGeom") << back.plate2Name << " Box " << cms::convert2mm(0.5 * back.plateWidth) << ":"
2050  << cms::convert2mm(0.5 * back.plate2Thick) << ":"
2051  << cms::convert2mm(0.5 * back.plateLength);
2052 #endif
2053  Volume backPlate2Log = Volume(back.plate2Name, backPlate2Solid, ns.material(back.plate2Mat));
2054 
2055  const Position backPlate2Tra(0, -backPlateParms[1] + back.plate2Thick * 0.5, 0);
2056  if (0 != back.plateHere) {
2057  backPlateLog.placeVolume(backPlate2Log, copyOne, Transform3D(backPlate2Tra));
2058 #ifdef EDM_ML_DEBUG
2059  edm::LogVerbatim("EBGeomX") << backPlate2Log.name() << ":" << copyOne << " positioned in "
2060  << backPlateLog.name() << " at (" << cms::convert2mm(backPlate2Tra.x()) << ","
2061  << cms::convert2mm(backPlate2Tra.y()) << "," << cms::convert2mm(backPlate2Tra.z())
2062  << ") with no rotation";
2063 #endif
2064  ns.assembly(spm.name).placeVolume(
2065  backPlateLog,
2066  copyOne,
2067  Transform3D(myrot(ns, back.plateName + "Rot5", CLHEP::HepRotationZ(270._deg)), outtra + backPlateTra));
2068 #ifdef EDM_ML_DEBUG
2069  edm::LogVerbatim("EBGeomX") << backPlateLog.name() << ":" << copyOne << " positioned in "
2070  << ns.assembly(spm.name).name() << " at ("
2071  << cms::convert2mm((outtra + backPlateTra).x()) << ","
2072  << cms::convert2mm((outtra + backPlateTra).y()) << ","
2073  << cms::convert2mm((outtra + backPlateTra).z()) << ") with rotation";
2074 #endif
2075  }
2081 
2087 
2088  const EcalTrap trapBS(back.sideWidth * 0.5, //double aHalfLengthXNegZLoY , // bl1, A/2
2089  back.sideWidth * 0.5, //double aHalfLengthXPosZLoY , // bl2, a/2
2090  back.sideWidth / 4., //double aHalfLengthXPosZHiY , // tl2, b/2
2091  back.sideHeight * 0.5, //double aHalfLengthYNegZ , // h1, H/2
2092  back.sideHeight * 0.5, //double aHalfLengthYPosZ , // h2, h/2
2093  back.sideLength * 0.5, //double aHalfLengthZ , // dz, L/2
2094  back.sideAngle, //double aAngleAD , // alfa1
2095  0, //double aCoord15X , // x15
2096  0 //double aCoord15Y // y15
2097  );
2098 
2099  Solid backSideSolid = mytrap(back.sideName, trapBS);
2100  Volume backSideLog = Volume(back.sideName, backSideSolid, ns.material(back.sideMat));
2101 
2102  const Position backSideTra1(0 * dd4hep::mm, back.plateWidth * 0.5 + back.sideYOff1, 1 * dd4hep::mm);
2103  if (0 != back.sideHere) {
2104  ns.assembly(spm.name).placeVolume(
2105  backSideLog,
2106  copyOne,
2107  Transform3D(myrot(ns, back.sideName + "Rot8", CLHEP::HepRotationX(180._deg) * CLHEP::HepRotationZ(90._deg)),
2108  outtra + backSideTra1));
2109 #ifdef EDM_ML_DEBUG
2110  edm::LogVerbatim("EBGeomX") << backSideLog.name() << ":" << copyOne << " positioned in "
2111  << ns.assembly(spm.name).name() << " at ("
2112  << cms::convert2mm((outtra + backSideTra1).x()) << ","
2113  << cms::convert2mm((outtra + backSideTra1).y()) << ","
2114  << cms::convert2mm((outtra + backSideTra1).z()) << ") with rotation";
2115 #endif
2116  const Position backSideTra2(0 * dd4hep::mm, -back.plateWidth * 0.5 + back.sideYOff2, 1 * dd4hep::mm);
2117  ns.assembly(spm.name).placeVolume(
2118  backSideLog,
2119  copyTwo,
2120  Transform3D(myrot(ns, back.sideName + "Rot9", CLHEP::HepRotationZ(90._deg)), outtra + backSideTra2));
2121 #ifdef EDM_ML_DEBUG
2122  edm::LogVerbatim("EBGeomX") << backSideLog.name() << ":" << copyTwo << " positioned in "
2123  << ns.assembly(spm.name).name() << " at ("
2124  << cms::convert2mm((outtra + backSideTra2).x()) << ","
2125  << cms::convert2mm((outtra + backSideTra2).y()) << ","
2126  << cms::convert2mm((outtra + backSideTra2).z()) << ") with rotation";
2127 #endif
2128  }
2134 
2135  //=====================
2136  const double backCoolWidth(backCool.barWidth + 2. * backCoolTank.width);
2137 
2143 
2144  const double manifCut(2 * dd4hep::mm);
2145 
2146  Solid mBManifSolid = Tube(0, mbManif.outDiam * 0.5, backCoolWidth * 0.5 - manifCut, 0._deg, 360._deg);
2147 #ifdef EDM_ML_DEBUG
2148  edm::LogVerbatim("EBGeom") << mbManif.name << " Tubs " << cms::convert2mm(backCoolWidth * 0.5 - manifCut)
2149  << ":0:" << cms::convert2mm(mbManif.outDiam * 0.5) << ":0:360";
2150 #endif
2151  Volume mBManifLog = Volume(mbManif.name, mBManifSolid, ns.material(mbManif.mat));
2152 
2153  const string mBManifWaName(mbManif.name + "Wa");
2154  Solid mBManifWaSolid = Tube(0, mbManif.innDiam * 0.5, backCoolWidth * 0.5 - manifCut, 0._deg, 360._deg);
2155 #ifdef EDM_ML_DEBUG
2156  edm::LogVerbatim("EBGeom") << mBManifWaName << " Tubs " << cms::convert2mm(backCoolWidth * 0.5 - manifCut)
2157  << ":0:" << cms::convert2mm(mbManif.innDiam * 0.5) << ":0:360";
2158 #endif
2159  Volume mBManifWaLog(mBManifWaName, mBManifWaSolid, ns.material(backPipe.waterMat));
2160  mBManifLog.placeVolume(mBManifWaLog, copyOne);
2161 #ifdef EDM_ML_DEBUG
2162  edm::LogVerbatim("EBGeomX") << mBManifWaLog.name() << ":" << copyOne << " positioned in " << mBManifLog.name()
2163  << " at (0,0,0) with no rotation";
2164 #endif
2165 
2171  //=====================
2172 
2178  const double deltaY(-5 * dd4hep::mm);
2179 
2180  Solid grEdgeSlotSolid =
2181  Box(grille.edgeSlotName, grille.edgeSlotHeight * 0.5, grille.edgeSlotWidth * 0.5, grille.thick * 0.5);
2182 #ifdef EDM_ML_DEBUG
2183  edm::LogVerbatim("EBGeom") << grille.edgeSlotName << " Box " << cms::convert2mm(grille.edgeSlotHeight * 0.5)
2184  << ":" << cms::convert2mm(grille.edgeSlotWidth * 0.5) << ":"
2185  << cms::convert2mm(grille.thick * 0.5);
2186 #endif
2187  Volume grEdgeSlotLog = Volume(grille.edgeSlotName, grEdgeSlotSolid, ns.material(grille.edgeSlotMat));
2188 
2189  unsigned int edgeSlotCopy(0);
2190  unsigned int midSlotCopy(0);
2191 
2192  Volume grMidSlotLog[4];
2193 
2194  for (unsigned int iGr(0); iGr != grille.vecHeight.size(); ++iGr) {
2195  string gName(grille.name + std::to_string(iGr));
2196  Solid grilleSolid = Box(gName, grille.vecHeight[iGr] * 0.5, backCoolWidth * 0.5, grille.thick * 0.5);
2197 #ifdef EDM_ML_DEBUG
2198  edm::LogVerbatim("EBGeom") << gName << " Box " << cms::convert2mm(grille.vecHeight[iGr] * 0.5) << ":"
2199  << cms::convert2mm(backCoolWidth * 0.5) << ":"
2200  << cms::convert2mm(grille.thick * 0.5);
2201 #endif
2202  Volume grilleLog = Volume(gName, grilleSolid, ns.material(grille.mat));
2203 
2204  const Position grilleTra(-realBPthick * 0.5 - grille.vecHeight[iGr] * 0.5,
2205  deltaY,
2206  grille.vecZOff[iGr] + grille.thick * 0.5 - back.sideLength * 0.5);
2207  const Position gTra(outtra + backPlateTra + grilleTra);
2208 
2209  if (0 != grille.midSlotHere && 0 != iGr) {
2210  if (0 == (iGr - 1) % 2) {
2211  string mName(grille.midSlotName + std::to_string(iGr * 0.5));
2212  Solid grMidSlotSolid =
2213  Box(mName, grille.vecMidSlotHeight[(iGr - 1) / 2] * 0.5, grille.midSlotWidth * 0.5, grille.thick * 0.5);
2214 #ifdef EDM_ML_DEBUG
2215  edm::LogVerbatim("EBGeom") << mName << " Box "
2216  << cms::convert2mm(grille.vecMidSlotHeight[(iGr - 1) / 2] * 0.5) << ":"
2217  << cms::convert2mm(grille.midSlotWidth * 0.5) << ":"
2218  << cms::convert2mm(grille.thick * 0.5);
2219 #endif
2220  grMidSlotLog[(iGr - 1) / 2] = Volume(mName, grMidSlotSolid, ns.material(grille.midSlotMat));
2221  }
2222  grilleLog.placeVolume(
2223  grMidSlotLog[(iGr - 1) / 2],
2224  ++midSlotCopy,
2225  Transform3D(Position(
2226  grille.vecHeight[iGr] * 0.5 - grille.vecMidSlotHeight[(iGr - 1) / 2] * 0.5, +grille.midSlotXOff, 0)));
2227 #ifdef EDM_ML_DEBUG
2228  edm::LogVerbatim("EBGeomX") << grMidSlotLog[(iGr - 1) / 2].name() << ":" << midSlotCopy << " positioned in "
2229  << grilleLog.name() << " at ("
2230  << cms::convert2mm(grille.vecHeight[iGr] * 0.5 -
2231  grille.vecMidSlotHeight[(iGr - 1) / 2] * 0.5)
2232  << "," << cms::convert2mm(grille.midSlotXOff) << ",0) with no rotation";
2233 #endif
2234  grilleLog.placeVolume(
2235  grMidSlotLog[(iGr - 1) / 2],
2236  ++midSlotCopy,
2237  Transform3D(Position(
2238  grille.vecHeight[iGr] * 0.5 - grille.vecMidSlotHeight[(iGr - 1) / 2] * 0.5, -grille.midSlotXOff, 0)));
2239 #ifdef EDM_ML_DEBUG
2240  edm::LogVerbatim("EBGeomX") << grMidSlotLog[(iGr - 1) / 2].name() << ":" << midSlotCopy << " positioned in "
2241  << grilleLog.name() << " at ("
2242  << cms::convert2mm(grille.vecHeight[iGr] * 0.5 -
2243  grille.vecMidSlotHeight[(iGr - 1) / 2] * 0.5)
2244  << "," << cms::convert2mm(-grille.midSlotXOff) << ",0) with no rotation";
2245 #endif
2246  }
2247 
2248  if (0 != grille.edgeSlotHere && 0 != iGr) {
2249  grilleLog.placeVolume(grEdgeSlotLog,
2250  ++edgeSlotCopy,
2251  Transform3D(Position(grille.vecHeight[iGr] * 0.5 - grille.edgeSlotHeight * 0.5,
2252  backCoolWidth * 0.5 - grille.edgeSlotWidth * 0.5,
2253  0)));
2254 #ifdef EDM_ML_DEBUG
2255  edm::LogVerbatim("EBGeomX") << grEdgeSlotLog.name() << ":" << edgeSlotCopy << " positioned in "
2256  << grilleLog.name() << " at ("
2257  << cms::convert2mm(grille.vecHeight[iGr] * 0.5 - grille.edgeSlotHeight * 0.5)
2258  << "," << cms::convert2mm(backCoolWidth * 0.5 - grille.edgeSlotWidth * 0.5)
2259  << ",0) with no rotation";
2260 #endif
2261  grilleLog.placeVolume(grEdgeSlotLog,
2262  ++edgeSlotCopy,
2263  Transform3D(Position(grille.vecHeight[iGr] * 0.5 - grille.edgeSlotHeight * 0.5,
2264  -backCoolWidth * 0.5 + grille.edgeSlotWidth * 0.5,
2265  0)));
2266 #ifdef EDM_ML_DEBUG
2267  edm::LogVerbatim("EBGeomX") << grEdgeSlotLog.name() << ":" << edgeSlotCopy << " positioned in "
2268  << grilleLog.name() << " at ("
2269  << cms::convert2mm(grille.vecHeight[iGr] * 0.5 - grille.edgeSlotHeight * 0.5)
2270  << "," << cms::convert2mm(-backCoolWidth * 0.5 + grille.edgeSlotWidth * 0.5)
2271  << ",0) with no rotation";
2272 #endif
2273  }
2274  if (0 != grille.here) {
2275  ns.assembly(spm.name).placeVolume(grilleLog, iGr, Transform3D(gTra));
2276 #ifdef EDM_ML_DEBUG
2277  edm::LogVerbatim("EBGeomX") << grilleLog.name() << ":" << iGr << " positioned in "
2278  << ns.assembly(spm.name).name() << " at (" << cms::convert2mm(gTra.x()) << ","
2279  << cms::convert2mm(gTra.y()) << "," << cms::convert2mm(gTra.z())
2280  << ") with no rotation";
2281 #endif
2282  }
2283 
2284  if ((0 != iGr % 2) && (0 != mbManif.here)) {
2285  ns.assembly(spm.name).placeVolume(
2286  mBManifLog,
2287  iGr,
2288  Transform3D(myrot(ns, mbManif.name + "R1", CLHEP::HepRotationX(90._deg)),
2289  gTra - Position(-mbManif.outDiam * 0.5 + grille.vecHeight[iGr] * 0.5,
2290  manifCut,
2291  grille.thick * 0.5 + 3 * mbManif.outDiam * 0.5)));
2292 #ifdef EDM_ML_DEBUG
2293  edm::LogVerbatim("EBGeomX") << mBManifLog.name() << ":" << iGr << " positioned in "
2294  << ns.assembly(spm.name).name() << " at ("
2295  << cms::convert2mm(gTra.x() + mbManif.outDiam * 0.5 - grille.vecHeight[iGr] * 0.5)
2296  << "," << cms::convert2mm(gTra.y() - manifCut) << ","
2297  << cms::convert2mm(gTra.z() - grille.thick * 0.5 - 3 * mbManif.outDiam * 0.5)
2298  << ") with rotation";
2299 #endif
2300  ns.assembly(spm.name).placeVolume(
2301  mBManifLog,
2302  iGr - 1,
2303  Transform3D(myrot(ns, mbManif.name + "R2", CLHEP::HepRotationX(90._deg)),
2304  gTra - Position(-3 * mbManif.outDiam * 0.5 + grille.vecHeight[iGr] * 0.5,
2305  manifCut,
2306  grille.thick * 0.5 + 3 * mbManif.outDiam * 0.5)));
2307 #ifdef EDM_ML_DEBUG
2308  edm::LogVerbatim("EBGeomX") << mBManifLog.name() << ":" << (iGr - 1) << " positioned in "
2309  << ns.assembly(spm.name).name() << " at ("
2310  << cms::convert2mm(gTra.x() + 3 * mbManif.outDiam * 0.5 -
2311  grille.vecHeight[iGr] * 0.5)
2312  << "," << cms::convert2mm(gTra.y() - manifCut) << ","
2313  << cms::convert2mm(gTra.z() - grille.thick * 0.5 - 3 * mbManif.outDiam * 0.5)
2314  << ") with rotation";
2315 #endif
2316  }
2317  }
2318 
2324 
2330 
2331  Solid backCoolBarSolid =
2332  Box(backCool.barName, backCool.barHeight * 0.5, backCool.barWidth * 0.5, backCool.barThick * 0.5);
2333 #ifdef EDM_ML_DEBUG
2334  edm::LogVerbatim("EBGeom") << backCool.barName << " Box " << cms::convert2mm(backCool.barHeight * 0.5) << ":"
2335  << cms::convert2mm(backCool.barWidth * 0.5) << ":"
2336  << cms::convert2mm(backCool.barThick * 0.5);
2337 #endif
2338  Volume backCoolBarLog = Volume(backCool.barName, backCoolBarSolid, ns.material(backCool.barMat));
2339 
2340  Solid backCoolBarSSSolid =
2341  Box(backCool.barSSName, backCool.barHeight * 0.5, backCool.barWidth * 0.5, backCool.barSSThick * 0.5);
2342 #ifdef EDM_ML_DEBUG
2343  edm::LogVerbatim("EBGeom") << backCool.barSSName << " Box " << cms::convert2mm(backCool.barHeight * 0.5) << ":"
2344  << cms::convert2mm(backCool.barWidth * 0.5) << ":"
2345  << cms::convert2mm(backCool.barSSThick * 0.5);
2346 #endif
2347  Volume backCoolBarSSLog = Volume(backCool.barSSName, backCoolBarSSSolid, ns.material(backCool.barSSMat));
2348  const Position backCoolBarSSTra(0, 0, 0);
2349  backCoolBarLog.placeVolume(backCoolBarSSLog, copyOne, Transform3D(backCoolBarSSTra));
2350 #ifdef EDM_ML_DEBUG
2351  edm::LogVerbatim("EBGeomX") << backCoolBarSSLog.name() << ":" << copyOne << " positioned in "
2352  << backCoolBarLog.name() << " at (" << cms::convert2mm(backCoolBarSSTra.x()) << ","
2353  << cms::convert2mm(backCoolBarSSTra.y()) << ","
2354  << cms::convert2mm(backCoolBarSSTra.z()) << ") with no rotation";
2355 #endif
2356 
2357  Solid backCoolBarWaSolid =
2358  Box(backCool.barWaName, backCool.barHeight * 0.5, backCool.barWidth * 0.5, backCool.barWaThick * 0.5);
2359 #ifdef EDM_ML_DEBUG
2360  edm::LogVerbatim("EBGeom") << backCool.barWaName << " Box " << cms::convert2mm(backCool.barHeight * 0.5) << ":"
2361  << cms::convert2mm(backCool.barWidth * 0.5) << ":"
2362  << cms::convert2mm(backCool.barWaThick * 0.5);
2363 #endif
2364  Volume backCoolBarWaLog = Volume(backCool.barWaName, backCoolBarWaSolid, ns.material(backCool.barWaMat));
2365  const Position backCoolBarWaTra(0, 0, 0);
2366  backCoolBarSSLog.placeVolume(backCoolBarWaLog, copyOne, Transform3D(backCoolBarWaTra));
2367 #ifdef EDM_ML_DEBUG
2368  edm::LogVerbatim("EBGeomX") << backCoolBarWaLog.name() << ":" << copyOne << " positioned in "
2369  << backCoolBarSSLog.name() << " at (" << cms::convert2mm(backCoolBarWaTra.x()) << ","
2370  << cms::convert2mm(backCoolBarWaTra.y()) << ","
2371  << cms::convert2mm(backCoolBarWaTra.z()) << ") with no rotation";
2372 #endif
2373 
2379 
2385 
2386  double thickVFE(0);
2387  for (unsigned int iLyr(0); iLyr != backCool.vecBackVFELyrThick.size(); ++iLyr) {
2388  thickVFE += backCool.vecBackVFELyrThick[iLyr];
2389  }
2390  Solid backVFESolid =
2391  Box((myns + backCool.backVFEName), backCool.barHeight * 0.5, backCool.barWidth * 0.5, thickVFE * 0.5);
2392 #ifdef EDM_ML_DEBUG
2393  edm::LogVerbatim("EBGeom") << (myns + backCool.backVFEName) << " Box "
2394  << cms::convert2mm(backCool.barHeight * 0.5) << ":"
2395  << cms::convert2mm(backCool.barWidth * 0.5) << ":" << cms::convert2mm(thickVFE * 0.5);
2396 #endif
2397  Volume backVFELog =
2398  ns.addVolume(Volume(myns + backCool.backVFEName, backVFESolid, ns.material(backCool.backVFEMat)));
2399  Position offTra(0, 0, -thickVFE * 0.5);
2400  for (unsigned int iLyr(0); iLyr != backCool.vecBackVFELyrThick.size(); ++iLyr) {
2401  Solid backVFELyrSolid = Box(backCool.vecBackVFELyrName[iLyr],
2402  backCool.barHeight * 0.5,
2403  backCool.barWidth * 0.5,
2404  backCool.vecBackVFELyrThick[iLyr] * 0.5);
2405 #ifdef EDM_ML_DEBUG
2406  edm::LogVerbatim("EBGeom") << backCool.vecBackVFELyrName[iLyr] << " Box "
2407  << cms::convert2mm(backCool.barHeight * 0.5) << ":"
2408  << cms::convert2mm(backCool.barWidth * 0.5) << ":"
2409  << cms::convert2mm(backCool.vecBackVFELyrThick[iLyr] * 0.5);
2410 #endif
2411  Volume backVFELyrLog =
2412  Volume(backCool.vecBackVFELyrName[iLyr], backVFELyrSolid, ns.material(backCool.vecBackVFELyrMat[iLyr]));
2413  const Position backVFELyrTra(0, 0, backCool.vecBackVFELyrThick[iLyr] * 0.5);
2414  backVFELog.placeVolume(backVFELyrLog, copyOne, Transform3D(backVFELyrTra + offTra));
2415 #ifdef EDM_ML_DEBUG
2416  edm::LogVerbatim("EBGeomX") << backVFELyrLog.name() << ":" << copyOne << " positioned in " << backVFELog.name()
2417  << " at (" << cms::convert2mm((backVFELyrTra + offTra).x()) << ","
2418  << cms::convert2mm((backVFELyrTra + offTra).y()) << ","
2419  << cms::convert2mm((backVFELyrTra + offTra).z()) << ") with no rotation";
2420 #endif
2421  offTra += 2 * backVFELyrTra;
2422  }
2423 
2429 
2435 
2436  const double halfZCoolVFE(thickVFE + backCool.barThick * 0.5);
2437  Solid backCoolVFESolid = Box(backCool.barHeight * 0.5, backCool.barWidth * 0.5, halfZCoolVFE);
2438 #ifdef EDM_ML_DEBUG
2439  edm::LogVerbatim("EBGeom") << backCool.vFEName << " Box " << cms::convert2mm(backCool.barHeight * 0.5) << ":"
2440  << cms::convert2mm(backCool.barWidth * 0.5) << ":" << cms::convert2mm(halfZCoolVFE);
2441 #endif
2442  Volume backCoolVFELog = ns.addVolume(Volume(backCool.vFEName, backCoolVFESolid, ns.material(backCool.vFEMat)));
2443  if (0 != backCool.barHere) {
2444  backCoolVFELog.placeVolume(backCoolBarLog, copyOne, Transform3D());
2445 #ifdef EDM_ML_DEBUG
2446  edm::LogVerbatim("EBGeomX") << backCoolBarLog.name() << ":" << copyOne << " positioned in "
2447  << backCoolVFELog.name() << " at (0,0,0) with no rotation";
2448 #endif
2449  }
2450  if (0 != backCool.vFEHere) {
2451  backCoolVFELog.placeVolume(
2452  backVFELog, copyOne, Transform3D(Position(0, 0, backCool.barThick * 0.5 + thickVFE * 0.5)));
2453 #ifdef EDM_ML_DEBUG
2454  edm::LogVerbatim("EBGeomX") << backVFELog.name() << ":" << copyOne << " positioned in " << backCoolVFELog.name()
2455  << " at (0,0," << cms::convert2mm(backCool.barThick * 0.5 + thickVFE * 0.5)
2456  << ") with no rotation";
2457 #endif
2458  }
2459  backCoolVFELog.placeVolume(backVFELog,
2460  copyTwo,
2461  Transform3D(myrot(ns, backCool.vFEName + "Flip", CLHEP::HepRotationX(180._deg)),
2462  Position(0, 0, -backCool.barThick * 0.5 - thickVFE * 0.5)));
2463 #ifdef EDM_ML_DEBUG
2464  edm::LogVerbatim("EBGeomX") << backVFELog.name() << ":" << copyTwo << " positioned in " << backCoolVFELog.name()
2465  << " at (0,0," << cms::convert2mm(-backCool.barThick * 0.5 - thickVFE * 0.5)
2466  << ") with rotation";
2467 #endif
2468 
2474 
2480  unsigned int iCVFECopy(1);
2481  unsigned int iSep(0);
2482  unsigned int iNSec(0);
2483  const unsigned int nMisc(backMisc.vecThick.size() / 4);
2484  for (unsigned int iMod(0); iMod != 4; ++iMod) {
2485  const double pipeLength(grille.vecZOff[2 * iMod + 1] - grille.vecZOff[2 * iMod] - grille.thick -
2486  3 * dd4hep::mm);
2487  const double pipeZPos(grille.vecZOff[2 * iMod + 1] - pipeLength * 0.5 - 1.5 * dd4hep::mm);
2488 
2489  // accumulate total height of parent volume
2490  double backCoolHeight(backCool.barHeight + mbCoolTube.outDiam);
2491  for (unsigned int iMisc(0); iMisc != nMisc; ++iMisc) {
2492  backCoolHeight += backMisc.vecThick[iMod * nMisc + iMisc];
2493  }
2494  double bottomThick(mbCoolTube.outDiam);
2495  for (unsigned int iMB(0); iMB != mbLyr.vecMBLyrThick.size(); ++iMB) {
2496  backCoolHeight += mbLyr.vecMBLyrThick[iMB];
2497  bottomThick += mbLyr.vecMBLyrThick[iMB];
2498  }
2499 
2500  const double halfZBCool((pipeLength - 2 * mbManif.outDiam - grille.zSpace) * 0.5);
2501  Solid backCoolSolid = Box(backCool.vecName[iMod], backCoolHeight * 0.5, backCoolWidth * 0.5, halfZBCool);
2502 #ifdef EDM_ML_DEBUG
2503  edm::LogVerbatim("EBGeom") << backCool.vecName[iMod] << " Box " << cms::convert2mm(backCoolHeight * 0.5) << ":"
2504  << cms::convert2mm(backCoolWidth * 0.5) << ":" << cms::convert2mm(halfZBCool);
2505 #endif
2506  Volume backCoolLog = Volume(backCool.vecName[iMod], backCoolSolid, ns.material(spm.mat));
2507 
2508  const Position bCoolTra(
2509  -realBPthick * 0.5 + backCoolHeight * 0.5 - grille.vecHeight[2 * iMod],
2510  deltaY,
2511  grille.vecZOff[2 * iMod] + grille.thick + grille.zSpace + halfZBCool - back.sideLength * 0.5);
2512  if (0 != backCool.here) {
2513  ns.assembly(spm.name).placeVolume(backCoolLog, iMod + 1, outtra + backPlateTra + bCoolTra);
2514 #ifdef EDM_ML_DEBUG
2515  edm::LogVerbatim("EBGeomX") << backCoolLog.name() << ":" << (iMod + 1) << " positioned in "
2516  << ns.assembly(spm.name).name() << " at ("
2517  << cms::convert2mm((outtra + backPlateTra + bCoolTra).x()) << ","
2518  << cms::convert2mm((outtra + backPlateTra + bCoolTra).y()) << ","
2519  << cms::convert2mm((outtra + backPlateTra + bCoolTra).z())
2520  << ") with no rotation";
2521 #endif
2522  }
2523 
2524  //===
2525  const double backCoolTankHeight(backCool.barHeight); // - backBracketHeight() ) ;
2526  const double halfZTank(halfZBCool - 5 * dd4hep::cm);
2527 
2528  string bTankName(backCoolTank.name + std::to_string(iMod + 1));
2529  Solid backCoolTankSolid = Box(bTankName, backCoolTankHeight * 0.5, backCoolTank.width * 0.5, halfZTank);
2530 #ifdef EDM_ML_DEBUG
2531  edm::LogVerbatim("EBGeom") << bTankName << " Box " << cms::convert2mm(backCoolTankHeight * 0.5) << ":"
2532  << cms::convert2mm(backCoolTank.width * 0.5) << ":" << cms::convert2mm(halfZTank);
2533 #endif
2534  Volume backCoolTankLog = Volume(bTankName, backCoolTankSolid, ns.material(backCoolTank.mat));
2535  if (0 != backCoolTank.here) {
2536  backCoolLog.placeVolume(backCoolTankLog,
2537  copyOne,
2538  Transform3D(Rotation3D(),
2539  Position(-backCoolHeight * 0.5 + backCoolTankHeight * 0.5 + bottomThick,
2540  backCool.barWidth * 0.5 + backCoolTank.width * 0.5,
2541  0)));
2542 #ifdef EDM_ML_DEBUG
2543  edm::LogVerbatim("EBGeomX") << backCoolTankLog.name() << ":" << copyOne << " positioned in "
2544  << backCoolLog.name() << " at ("
2545  << cms::convert2mm(-backCoolHeight * 0.5 + backCoolTankHeight * 0.5 + bottomThick)
2546  << "," << cms::convert2mm(backCool.barWidth * 0.5 + backCoolTank.width * 0.5)
2547  << ",0) with no rotation";
2548 #endif
2549  }
2550 
2551  string bTankWaName(backCoolTank.waName + std::to_string(iMod + 1));
2552  Solid backCoolTankWaSolid = Box(bTankWaName,
2553  backCoolTankHeight * 0.5 - backCoolTank.thick * 0.5,
2554  backCoolTank.waWidth * 0.5,
2555  halfZTank - backCoolTank.thick * 0.5);
2556 #ifdef EDM_ML_DEBUG
2557  edm::LogVerbatim("EBGeom") << bTankWaName << " Box "
2558  << cms::convert2mm(backCoolTankHeight * 0.5 - backCoolTank.thick * 0.5) << ":"
2559  << cms::convert2mm(backCoolTank.waWidth * 0.5) << ":"
2560  << cms::convert2mm(halfZTank - backCoolTank.thick * 0.5);
2561 #endif
2562  Volume backCoolTankWaLog = Volume(bTankWaName, backCoolTankWaSolid, ns.material(backCoolTank.waMat));
2563  backCoolTankLog.placeVolume(backCoolTankWaLog, copyOne, Transform3D(Rotation3D(), Position(0, 0, 0)));
2564 #ifdef EDM_ML_DEBUG
2565  edm::LogVerbatim("EBGeomX") << backCoolTankWaLog.name() << ":" << copyOne << " positioned in "
2566  << backCoolTankLog.name() << " at (0,0,0) with no rotation";
2567 #endif
2568 
2569  string bBracketName(backCoolTank.backBracketName + std::to_string(iMod + 1));
2570  Solid backBracketSolid =
2571  Box(bBracketName, backCoolTank.backBracketHeight * 0.5, backCoolTank.width * 0.5, halfZTank);
2572 #ifdef EDM_ML_DEBUG
2573  edm::LogVerbatim("EBGeom") << bBracketName << " Box " << cms::convert2mm(backCoolTank.backBracketHeight * 0.5)
2574  << ":" << cms::convert2mm(backCoolTank.width * 0.5) << ":"
2575  << cms::convert2mm(halfZTank);
2576 #endif
2577  Volume backBracketLog = Volume(bBracketName, backBracketSolid, ns.material(backCoolTank.backBracketMat));
2578  if (0 != backCoolTank.here) {
2579  backCoolLog.placeVolume(backBracketLog,
2580  copyOne,
2581  Transform3D(Rotation3D(),
2582  Position(backCool.barHeight - backCoolHeight * 0.5 -
2583  backCoolTank.backBracketHeight * 0.5 + bottomThick,
2584  -backCool.barWidth * 0.5 - backCoolTank.width * 0.5,
2585  0)));
2586 #ifdef EDM_ML_DEBUG
2587  edm::LogVerbatim("EBGeomX") << backBracketLog.name() << ":" << copyOne << " positioned in "
2588  << backCoolLog.name() << " at ("
2589  << cms::convert2mm(backCool.barHeight - backCoolHeight * 0.5 -
2590  backCoolTank.backBracketHeight * 0.5 + bottomThick)
2591  << "," << cms::convert2mm(-backCool.barWidth * 0.5 - backCoolTank.width * 0.5)
2592  << ",0) with no rotation";
2593 #endif
2594  }
2595  //===
2596 
2597  Position bSumTra(backCool.barHeight - backCoolHeight * 0.5 + bottomThick, 0, 0);
2598  for (unsigned int j(0); j != nMisc; ++j) { // loop over miscellaneous layers
2599  Solid bSolid = Box(backMisc.vecName[iMod * nMisc + j],
2600  backMisc.vecThick[iMod * nMisc + j] * 0.5,
2601  backCool.barWidth * 0.5 + backCoolTank.width,
2602  halfZBCool);
2603 #ifdef EDM_ML_DEBUG
2604  edm::LogVerbatim("EBGeom") << backMisc.vecName[iMod * nMisc + j] << " Box "
2605  << cms::convert2mm(backMisc.vecThick[iMod * nMisc + j] * 0.5) << ":"
2606  << cms::convert2mm(backCool.barWidth * 0.5 + backCoolTank.width) << ":"
2607  << cms::convert2mm(halfZBCool);
2608 #endif
2609 
2610  Volume bLog =
2611  Volume(backMisc.vecName[iMod * nMisc + j], bSolid, ns.material(backMisc.vecMat[iMod * nMisc + j]));
2612 
2613  const Position bTra(backMisc.vecThick[iMod * nMisc + j] * 0.5, 0 * dd4hep::mm, 0 * dd4hep::mm);
2614 
2615  if (0 != backMisc.here) {
2616  backCoolLog.placeVolume(bLog, copyOne, Transform3D(Rotation3D(), bSumTra + bTra));
2617 #ifdef EDM_ML_DEBUG
2618  edm::LogVerbatim("EBGeomX") << bLog.name() << ":" << copyOne << " positioned in " << backCoolLog.name()
2619  << " at (" << cms::convert2mm((bSumTra + bTra).x()) << ","
2620  << cms::convert2mm((bSumTra + bTra).y()) << ","
2621  << cms::convert2mm((bSumTra + bTra).z()) << ") with no rotation";
2622 #endif
2623  }
2624 
2625  bSumTra += 2 * bTra;
2626  }
2627 
2628  const double bHalfWidth(backCool.barWidth * 0.5 + backCoolTank.width);
2629 
2630  if (0 != mbLyr.here) {
2631  Position mTra(-backCoolHeight * 0.5 + mbCoolTube.outDiam, 0, 0);
2632  for (unsigned int j(0); j != mbLyr.vecMBLyrThick.size(); ++j) // loop over MB layers
2633  {
2634  Solid mSolid = Box(mbLyr.vecMBLyrThick[j] * 0.5, bHalfWidth, halfZBCool);
2635 #ifdef EDM_ML_DEBUG
2636  edm::LogVerbatim("EBGeom") << (mbLyr.vecMBLyrName[j] + "_" + std::to_string(iMod + 1)) << " Box "
2637  << cms::convert2mm(mbLyr.vecMBLyrThick[j] * 0.5) << ":"
2638  << cms::convert2mm(bHalfWidth) << ":" << cms::convert2mm(halfZBCool);
2639 #endif
2640  Volume mLog = Volume(
2641  mbLyr.vecMBLyrName[j] + "_" + std::to_string(iMod + 1), mSolid, ns.material(mbLyr.vecMBLyrMat[j]));
2642 
2643  mTra += Position(mbLyr.vecMBLyrThick[j] * 0.5, 0 * dd4hep::mm, 0 * dd4hep::mm);
2644  backCoolLog.placeVolume(mLog, copyOne, Transform3D(Rotation3D(), mTra));
2645 #ifdef EDM_ML_DEBUG
2646  edm::LogVerbatim("EBGeomX") << mLog.name() << ":" << copyOne << " positioned in " << backCoolLog.name()
2647  << " at (" << cms::convert2mm(mTra.x()) << "," << cms::convert2mm(mTra.y())
2648  << "," << cms::convert2mm(mTra.z()) << ") with no rotation";
2649 #endif
2650  mTra += Position(mbLyr.vecMBLyrThick[j] * 0.5, 0 * dd4hep::mm, 0 * dd4hep::mm);
2651  }
2652  }
2653 
2654  if (0 != mbCoolTube.here) {
2655  const string mBName(mbCoolTube.name + "_" + std::to_string(iMod + 1));
2656 
2657  Solid mBCoolTubeSolid = Tube(0, mbCoolTube.outDiam * 0.5, halfZBCool, 0._deg, 360._deg);
2658 #ifdef EDM_ML_DEBUG
2659  edm::LogVerbatim("EBGeom") << mBName << " Tubs " << cms::convert2mm(halfZBCool)
2660  << ":0:" << cms::convert2mm(mbCoolTube.outDiam * 0.5) << ":0:360";
2661 #endif
2662  Volume mBLog = Volume(mBName, mBCoolTubeSolid, ns.material(mbCoolTube.mat));
2663 
2664  const string mBWaName(mbCoolTube.name + "Wa_" + std::to_string(iMod + 1));
2665  Solid mBCoolTubeWaSolid = Tube(mBWaName, 0, mbCoolTube.innDiam * 0.5, halfZBCool, 0._deg, 360._deg);
2666 #ifdef EDM_ML_DEBUG
2667  edm::LogVerbatim("EBGeom") << mBWaName << " Tubs " << cms::convert2mm(halfZBCool)
2668  << ":0:" << cms::convert2mm(mbCoolTube.innDiam * 0.5) << ":0:360";
2669 #endif
2670  Volume mBWaLog = Volume(mBWaName, mBCoolTubeWaSolid, ns.material(backPipe.waterMat));
2671  mBLog.placeVolume(mBWaLog, copyOne);
2672 #ifdef EDM_ML_DEBUG
2673  edm::LogVerbatim("EBGeomX") << mBWaLog.name() << ":" << copyOne << " positioned in " << mBLog.name()
2674  << " at (0,0,0) with no rotation";
2675 #endif
2676 
2677  for (unsigned int j(0); j != dryAirTube.mbCoolTubeNum; ++j) // loop over all MB cooling circuits
2678  {
2679  backCoolLog.placeVolume(mBLog,
2680  2 * j + 1,
2681  Transform3D(Rotation3D(),
2682  Position(-backCoolHeight * 0.5 + mbCoolTube.outDiam * 0.5,
2683  -bHalfWidth + (j + 1) * bHalfWidth / 5,
2684  0)));
2685 #ifdef EDM_ML_DEBUG
2686  edm::LogVerbatim("EBGeomX") << mBLog.name() << ":" << (2 * j + 1) << " positioned in " << backCoolLog.name()
2687  << " at (" << cms::convert2mm(-backCoolHeight * 0.5 + mbCoolTube.outDiam * 0.5)
2688  << "," << cms::convert2mm(-bHalfWidth + (j + 1) * bHalfWidth / 5)
2689  << ",0) with no rotation";
2690 #endif
2691  }
2692  }
2693 
2699  if (0 != backPipe.here && 0 != iMod) {
2700  string bPipeName(backPipe.name + "_" + std::to_string(iMod + 1));
2701  string bInnerName(backPipe.name + "_H2O_" + std::to_string(iMod + 1));
2702 
2703  Solid backPipeSolid =
2704  Tube(bPipeName, 0 * dd4hep::mm, backPipe.vecDiam[iMod] * 0.5, pipeLength * 0.5, 0._deg, 360._deg);
2705  Solid backInnerSolid = Tube(bInnerName,
2706  0 * dd4hep::mm,
2707  backPipe.vecDiam[iMod] * 0.5 - backPipe.vecThick[iMod],
2708  pipeLength * 0.5,
2709  0._deg,
2710  360._deg);
2711 #ifdef EDM_ML_DEBUG
2712  edm::LogVerbatim("EBGeom") << bPipeName << " Tubs " << cms::convert2mm(pipeLength * 0.5)
2713  << ":0:" << cms::convert2mm(backPipe.vecDiam[iMod] * 0.5) << ":0:360";
2714  edm::LogVerbatim("EBGeom") << bInnerName << " Tubs " << cms::convert2mm(pipeLength * 0.5)
2715  << ":0:" << cms::convert2mm(backPipe.vecDiam[iMod] * 0.5 - backPipe.vecThick[iMod])
2716  << ":0:360";
2717 #endif
2718 
2719  Volume backPipeLog = Volume(bPipeName, backPipeSolid, ns.material(backPipe.mat));
2720  Volume backInnerLog = Volume(bInnerName, backInnerSolid, ns.material(backPipe.waterMat));
2721 
2722  const Position bPipeTra1(back.xOff + back.sideHeight - 0.7 * backPipe.vecDiam[iMod],
2723  back.yOff + back.plateWidth * 0.5 - back.sideWidth - 0.7 * backPipe.vecDiam[iMod],
2724  pipeZPos);
2725 
2726  ns.assembly(spm.name).placeVolume(backPipeLog, copyOne, Transform3D(Rotation3D(), bPipeTra1));
2727 #ifdef EDM_ML_DEBUG
2728  edm::LogVerbatim("EBGeomX") << backPipeLog.name() << ":" << copyOne << " positioned in "
2729  << ns.assembly(spm.name).name() << " at (" << cms::convert2mm(bPipeTra1.x())
2730  << "," << cms::convert2mm(bPipeTra1.y()) << "," << cms::convert2mm(bPipeTra1.z())
2731  << ") with no rotation";
2732 #endif
2733  const Position bPipeTra2(bPipeTra1.x(),
2734  back.yOff - back.plateWidth * 0.5 + back.sideWidth + backPipe.vecDiam[iMod],
2735  bPipeTra1.z());
2736 
2737  ns.assembly(spm.name).placeVolume(backPipeLog, copyTwo, Transform3D(Rotation3D(), bPipeTra2));
2738 #ifdef EDM_ML_DEBUG
2739  edm::LogVerbatim("EBGeomX") << backPipeLog.name() << ":" << copyTwo << " positioned in "
2740  << ns.assembly(spm.name).name() << " at (" << cms::convert2mm(bPipeTra2.x())
2741  << "," << cms::convert2mm(bPipeTra2.y()) << "," << cms::convert2mm(bPipeTra2.z())
2742  << ") with no rotation";
2743 #endif
2744 
2745  backPipeLog.placeVolume(backInnerLog, copyOne, Transform3D(Rotation3D(), Position()));
2746 #ifdef EDM_ML_DEBUG
2747  edm::LogVerbatim("EBGeomX") << backInnerLog.name() << ":" << copyOne << " positioned in "
2748  << backPipeLog.name() << " at (0,0,0) with no rotation";
2749 #endif
2750  }
2756 
2757  //=================================================
2758 
2759  if (0 != dryAirTube.here) {
2760  string dryAirTubName(dryAirTube.name + std::to_string(iMod + 1));
2761 
2762  Solid dryAirTubeSolid = Tube(
2763  dryAirTubName, dryAirTube.innDiam * 0.5, dryAirTube.outDiam * 0.5, pipeLength * 0.5, 0._deg, 360._deg);
2764 #ifdef EDM_ML_DEBUG
2765  edm::LogVerbatim("EBGeom") << dryAirTubName << " Tubs " << cms::convert2mm(pipeLength * 0.5) << ":"
2766  << cms::convert2mm(dryAirTube.innDiam * 0.5) << ":"
2767  << cms::convert2mm(dryAirTube.outDiam * 0.5) << ":0:360";
2768 #endif
2769  Volume dryAirTubeLog = Volume((myns + dryAirTubName), dryAirTubeSolid, ns.material(dryAirTube.mat));
2770 
2771  const Position dryAirTubeTra1(back.xOff + back.sideHeight - 0.7 * dryAirTube.outDiam - backPipe.vecDiam[iMod],
2772  back.yOff + back.plateWidth * 0.5 - back.sideWidth - 1.2 * dryAirTube.outDiam,
2773  pipeZPos);
2774 
2775  ns.assembly(spm.name).placeVolume(dryAirTubeLog, copyOne, Transform3D(Rotation3D(), dryAirTubeTra1));
2776 #ifdef EDM_ML_DEBUG
2777  edm::LogVerbatim("EBGeomX") << dryAirTubeLog.name() << ":" << copyOne << " positioned in "
2778  << ns.assembly(spm.name).name() << " at (" << cms::convert2mm(dryAirTubeTra1.x())
2779  << "," << cms::convert2mm(dryAirTubeTra1.y()) << ","
2780  << cms::convert2mm(dryAirTubeTra1.z()) << ") with no rotation";
2781 #endif
2782 
2783  const Position dryAirTubeTra2(dryAirTubeTra1.x(),
2784  back.yOff - back.plateWidth * 0.5 + back.sideWidth + 0.7 * dryAirTube.outDiam,
2785  dryAirTubeTra1.z());
2786 
2787  ns.assembly(spm.name).placeVolume(dryAirTubeLog, copyTwo, Transform3D(Rotation3D(), dryAirTubeTra2));
2788 #ifdef EDM_ML_DEBUG
2789  edm::LogVerbatim("EBGeomX") << dryAirTubeLog.name() << ":" << copyTwo << " positioned in "
2790  << ns.assembly(spm.name).name() << " at (" << cms::convert2mm(dryAirTubeTra2.x())
2791  << "," << cms::convert2mm(dryAirTubeTra2.y()) << ","
2792  << cms::convert2mm(dryAirTubeTra2.z()) << ") with no rotation";
2793 #endif
2794  }
2795  //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2796 
2797  // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2798  // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2799  // !!!!!!!!!!!!!! Begin Placement of Cooling + VFE Cards !!!!!!
2800  // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2801  // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2802 
2803  Position cTra(backCool.barHeight * 0.5 - backCoolHeight * 0.5 + bottomThick, 0, -halfZTank + halfZCoolVFE);
2804  const unsigned int numSec(static_cast<unsigned int>(backCool.vecBackCoolNSec[iMod]));
2805  for (unsigned int jSec(0); jSec != numSec; ++jSec) {
2806  const unsigned int nMax(static_cast<unsigned int>(backCool.vecBackCoolNPerSec[iNSec++]));
2807  for (unsigned int iBar(0); iBar != nMax; ++iBar) {
2808  backCoolLog.placeVolume(backCoolVFELog, iCVFECopy++, cTra);
2809 #ifdef EDM_ML_DEBUG
2810  edm::LogVerbatim("EBGeomX") << backCoolVFELog.name() << ":" << iCVFECopy << " positioned in "
2811  << backCoolLog.name() << " at (" << cms::convert2mm(cTra.x()) << ","
2812  << cms::convert2mm(cTra.y()) << "," << cms::convert2mm(cTra.z())
2813  << ") with no rotation";
2814 #endif
2815  cTra += Position(0, 0, backMisc.backCBStdSep);
2816  }
2817  cTra -= Position(0, 0, backMisc.backCBStdSep); // backspace to previous
2818  if (jSec != numSec - 1)
2819  cTra += Position(0, 0, backCool.vecBackCoolSecSep[iSep++]); // now take atypical step
2820  }
2826  }
2827 
2833 
2839 
2840  double patchHeight(0);
2841  for (unsigned int iPatch(0); iPatch != patchPanel.vecThick.size(); ++iPatch) {
2842  patchHeight += patchPanel.vecThick[iPatch];
2843  }
2844 
2845  array<double, 3> patchParms{{patchHeight * 0.5,
2846  backCool.barWidth * 0.5,
2847  (spm.vecZPts.back() - grille.vecZOff.back() - grille.thick) / 2}};
2848  Solid patchSolid = Box(patchParms[0], patchParms[1], patchParms[2]);
2849 #ifdef EDM_ML_DEBUG
2850  edm::LogVerbatim("EBGeom") << patchPanel.name << " Box " << cms::convert2mm(patchParms[0]) << ":"
2851  << cms::convert2mm(patchParms[1]) << ":" << cms::convert2mm(patchParms[2]);
2852 #endif
2853  Volume patchLog = Volume(patchPanel.name, patchSolid, ns.material(spm.mat));
2854 
2855  const Position patchTra(
2856  back.xOff + 4 * dd4hep::mm, 0 * dd4hep::mm, grille.vecZOff.back() + grille.thick + patchParms[2]);
2857  if (0 != patchPanel.here) {
2858  ns.assembly(spm.name).placeVolume(patchLog, copyOne, patchTra);
2859 #ifdef EDM_ML_DEBUG
2860  edm::LogVerbatim("EBGeomX") << patchLog.name() << ":" << copyOne << " positioned in " << spm.name << " at ("
2861  << cms::convert2mm(patchTra.x()) << "," << cms::convert2mm(patchTra.y()) << ","
2862  << cms::convert2mm(patchTra.z()) << ") with no rotation";
2863 #endif
2864  }
2865 
2866  Position pTra(-patchParms[0], 0, 0);
2867 
2868  for (unsigned int j(0); j != patchPanel.vecNames.size(); ++j) {
2869  Solid pSolid = Box(patchPanel.vecThick[j] * 0.5, patchParms[1], patchParms[2]);
2870 #ifdef EDM_ML_DEBUG
2871  edm::LogVerbatim("EBGeom") << patchPanel.vecNames[j] << " Box " << cms::convert2mm(patchPanel.vecThick[j] * 0.5)
2872  << ":" << cms::convert2mm(patchParms[1]) << ":" << cms::convert2mm(patchParms[2]);
2873 #endif
2874  Volume pLog = Volume(patchPanel.vecNames[j], pSolid, ns.material(patchPanel.vecMat[j]));
2875 
2876  pTra += Position(patchPanel.vecThick[j] * 0.5, 0 * dd4hep::mm, 0 * dd4hep::mm);
2877  patchLog.placeVolume(pLog, copyOne, pTra);
2878 #ifdef EDM_ML_DEBUG
2879  edm::LogVerbatim("EBGeomX") << pLog.name() << ":" << copyOne << " positioned in " << patchLog.name() << " at ("
2880  << cms::convert2mm(pTra.x()) << "," << cms::convert2mm(pTra.y()) << ","
2881  << cms::convert2mm(pTra.z()) << ") with no rotation";
2882 #endif
2883 
2884  pTra += Position(patchPanel.vecThick[j] * 0.5, 0 * dd4hep::mm, 0 * dd4hep::mm);
2885  }
2891 
2897 
2898  if (0 != pincer.rodHere) {
2899  // Make hierarchy of rods, envelopes, blocks, shims, and cutouts
2900 
2901  Solid rodSolid = Box(pincer.rodName, pincer.envWidthHalf, pincer.envHeightHalf, ilyLengthHalf);
2902 #ifdef EDM_ML_DEBUG
2903  edm::LogVerbatim("EBGeom") << pincer.rodName << " Box " << cms::convert2mm(pincer.envWidthHalf) << ":"
2904  << cms::convert2mm(pincer.envHeightHalf) << ":" << cms::convert2mm(ilyLengthHalf);
2905 #endif
2906  Volume rodLog = Volume(pincer.rodName, rodSolid, ns.material(pincer.rodMat));
2907 
2908  array<double, 3> envParms{{pincer.envWidthHalf, pincer.envHeightHalf, pincer.envLengthHalf}};
2909  Solid envSolid = Box(pincer.envName, envParms[0], envParms[1], envParms[2]);
2910 #ifdef EDM_ML_DEBUG
2911  edm::LogVerbatim("EBGeom") << pincer.envName << " Box " << cms::convert2mm(envParms[0]) << ":"
2912  << cms::convert2mm(envParms[1]) << ":" << cms::convert2mm(envParms[2]);
2913 #endif
2914  Volume envLog = Volume(pincer.envName, envSolid, ns.material(pincer.envMat));
2915 
2916  array<double, 3> blkParms{{pincer.envWidthHalf, pincer.envHeightHalf, pincer.blkLengthHalf}};
2917  Solid blkSolid = Box(pincer.blkName, blkParms[0], blkParms[1], blkParms[2]);
2918 #ifdef EDM_ML_DEBUG
2919  edm::LogVerbatim("EBGeom") << pincer.blkName << " Box " << cms::convert2mm(blkParms[0]) << ":"
2920  << cms::convert2mm(blkParms[1]) << ":" << cms::convert2mm(blkParms[2]);
2921 #endif
2922  Volume blkLog = Volume(pincer.blkName, blkSolid, ns.material(pincer.blkMat));
2923 
2924  envLog.placeVolume(blkLog, copyOne, Position(0, 0, pincer.envLengthHalf - pincer.blkLengthHalf));
2925 #ifdef EDM_ML_DEBUG
2926  edm::LogVerbatim("EBGeomX") << blkLog.name() << ":" << copyOne << " positioned in " << envLog.name()
2927  << " at (0,0," << cms::convert2mm(pincer.envLengthHalf - pincer.blkLengthHalf)
2928  << ") with no rotation";
2929 #endif
2930 
2931  array<double, 3> cutParms{{pincer.cutWidth * 0.5, pincer.cutHeight * 0.5, pincer.blkLengthHalf}};
2932  Solid cutSolid = Box(pincer.cutName, cutParms[0], cutParms[1], cutParms[2]);
2933 #ifdef EDM_ML_DEBUG
2934  edm::LogVerbatim("EBGeom") << pincer.cutName << " Box " << cms::convert2mm(cutParms[0]) << ":"
2935  << cms::convert2mm(cutParms[1]) << ":" << cms::convert2mm(cutParms[2]);
2936 #endif
2937  Volume cutLog = Volume(pincer.cutName, cutSolid, ns.material(pincer.cutMat));
2938  blkLog.placeVolume(
2939  cutLog,
2940  copyOne,
2941  Position(
2942  +blkParms[0] - cutParms[0] - pincer.shim1Width + pincer.shim2Width, -blkParms[1] + cutParms[1], 0));
2943 #ifdef EDM_ML_DEBUG
2944  edm::LogVerbatim("EBGeomX") << cutLog.name() << ":" << copyOne << " positioned in " << blkLog.name() << " at ("
2945  << cms::convert2mm(+blkParms[0] - cutParms[0] - pincer.shim1Width +
2946  pincer.shim2Width)
2947  << "," << cms::convert2mm(-blkParms[1] + cutParms[1]) << ",0) with no rotation";
2948 #endif
2949  array<double, 3> shim2Parms{{pincer.shim2Width * 0.5, pincer.shimHeight * 0.5, pincer.blkLengthHalf}};
2950  Solid shim2Solid = Box(pincer.shim2Name, shim2Parms[0], shim2Parms[1], shim2Parms[2]);
2951 #ifdef EDM_ML_DEBUG
2952  edm::LogVerbatim("EBGeom") << pincer.shim2Name << " Box " << cms::convert2mm(shim2Parms[0]) << ":"
2953  << cms::convert2mm(shim2Parms[1]) << ":" << cms::convert2mm(shim2Parms[2]);
2954 #endif
2955  Volume shim2Log = Volume(pincer.shim2Name, shim2Solid, ns.material(pincer.shimMat));
2956  cutLog.placeVolume(shim2Log, copyOne, Position(+cutParms[0] - shim2Parms[0], -cutParms[1] + shim2Parms[1], 0));
2957 #ifdef EDM_ML_DEBUG
2958  edm::LogVerbatim("EBGeomX") << shim2Log.name() << ":" << copyOne << " positioned in " << cutLog.name()
2959  << " at (" << cms::convert2mm(cutParms[0] - shim2Parms[0]) << ","
2960  << cms::convert2mm(-cutParms[1] + shim2Parms[1]) << ",0) with no rotation";
2961 #endif
2962 
2963  array<double, 3> shim1Parms{
2964  {pincer.shim1Width * 0.5, pincer.shimHeight * 0.5, pincer.envLengthHalf - pincer.blkLengthHalf}};
2965  Solid shim1Solid = Box(pincer.shim1Name, shim1Parms[0], shim1Parms[1], shim1Parms[2]);
2966 #ifdef EDM_ML_DEBUG
2967  edm::LogVerbatim("EBGeom") << pincer.shim1Name << " Box " << cms::convert2mm(shim1Parms[0]) << ":"
2968  << cms::convert2mm(shim1Parms[1]) << ":" << cms::convert2mm(shim1Parms[2]);
2969 #endif
2970  Volume shim1Log = Volume(pincer.shim1Name, shim1Solid, ns.material(pincer.shimMat));
2971  envLog.placeVolume(
2972  shim1Log,
2973  copyOne,
2974  Position(+envParms[0] - shim1Parms[0], -envParms[1] + shim1Parms[1], -envParms[2] + shim1Parms[2]));
2975 #ifdef EDM_ML_DEBUG
2976  edm::LogVerbatim("EBGeomX") << shim1Log.name() << ":" << copyOne << " positioned in " << envLog.name()
2977  << " at (" << cms::convert2mm(envParms[0] - shim1Parms[0]) << ","
2978  << cms::convert2mm(-envParms[1] + shim1Parms[1]) << ","
2979  << cms::convert2mm(-envParms[2] + shim1Parms[2]) << ") with no rotation";
2980 #endif
2981 
2982  for (unsigned int iEnv(0); iEnv != pincer.vecEnvZOff.size(); ++iEnv) {
2983  rodLog.placeVolume(
2984  envLog, 1 + iEnv, Position(0, 0, -ilyLengthHalf + pincer.vecEnvZOff[iEnv] - pincer.envLengthHalf));
2985 #ifdef EDM_ML_DEBUG
2986  edm::LogVerbatim("EBGeomX") << envLog.name() << ":" << (1 + iEnv) << " positioned in " << rodLog.name()
2987  << " at (0,0,"
2988  << cms::convert2mm(-ilyLengthHalf + pincer.vecEnvZOff[iEnv] -
2989  pincer.envLengthHalf)
2990  << ") with no rotation";
2991 #endif
2992  }
2993 
2994  // Place the rods
2995  const double radius(ilyRMin - pincer.envHeightHalf - 1 * dd4hep::mm);
2996  const string xilyName(ily.name + std::to_string(ily.vecIlyMat.size() - 1));
2997 
2998  for (unsigned int iRod(0); iRod != pincer.vecRodAzimuth.size(); ++iRod) {
2999  const Position rodTra(radius * cos(pincer.vecRodAzimuth[iRod]), radius * sin(pincer.vecRodAzimuth[iRod]), 0);
3000  xilyLog.placeVolume(rodLog,
3001  1 + iRod,
3002  Transform3D(myrot(ns,
3003  pincer.rodName + std::to_string(iRod),
3004  CLHEP::HepRotationZ(90._deg + pincer.vecRodAzimuth[iRod])),
3005  rodTra));
3006 #ifdef EDM_ML_DEBUG
3007  edm::LogVerbatim("EBGeomX") << rodLog.name() << ":" << (1 + iRod) << " positioned in " << xilyLog.name()
3008  << " at (" << cms::convert2mm(rodTra.x()) << "," << cms::convert2mm(rodTra.y())
3009  << "," << cms::convert2mm(rodTra.z()) << ") with rotation";
3010 #endif
3011  }
3012  }
3018  }
3019  }
3020 
3021  return 1;
3022 }
size
Write out results.
Log< level::Info, true > LogVerbatim
HepGeom::Point3D< double > Pt3D
HepGeom::Translate3D Tl3D
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
constexpr NumType convert2mm(NumType length)
Definition: DDutils.h:7
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Definition: __init__.py:1
HepGeom::Transform3D Tf3D
#define M_PI_2
std::string to_string(const V &value)
Definition: OMSAccess.h:71
HepGeom::RotateZ3D RoZ3D
HepGeom::RotateX3D RoX3D
float float float z
Barrel
Definition: gmt_cfi.py:20
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
float x
static constexpr float b2
math::XYZVector XYZVector
Definition: RawParticle.h:26
CLHEP::HepRotation Rota
HepGeom::Rotate3D Ro3D
Geom::Theta< T > theta() const
CaloCellGeometry::Pt3DVec VertexList
static constexpr float b1
CLHEP::Hep3Vector Vec3
unsigned transform(const HcalDetId &id, unsigned transformCode)

◆ DD4HEP_OPEN_PLUGIN()

DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_ecal_DDEcalBarrelNewAlgo   
)

Definition at line 3024 of file DDEcalBarrelNewAlgo.cc.