Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-05-10 02:20:47

0001 //////////////////////////////////////////////////////////////////////////////
0002 // File: DDEcalBarrelAlgo.cc
0003 // Description: Geometry factory class for Ecal Barrel
0004 ///////////////////////////////////////////////////////////////////////////////
0005 
0006 #include <cmath>
0007 #include <algorithm>
0008 
0009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0010 #include "DetectorDescription/Core/interface/DDLogicalPart.h"
0011 #include "DetectorDescription/Core/interface/DDSolid.h"
0012 #include "DetectorDescription/Core/interface/DDCurrentNamespace.h"
0013 #include "DetectorDescription/Core/interface/DDTranslation.h"
0014 #include <CLHEP/Units/SystemOfUnits.h>
0015 
0016 #include <CLHEP/Geometry/Point3D.h>
0017 #include <CLHEP/Geometry/Vector3D.h>
0018 #include <CLHEP/Geometry/Transform3D.h>
0019 #include <map>
0020 #include <string>
0021 #include <vector>
0022 #include "DetectorDescription/Core/interface/DDTypes.h"
0023 #include "DetectorDescription/Core/interface/DDName.h"
0024 #include "DetectorDescription/Core/interface/DDAlgorithm.h"
0025 #include "DetectorDescription/Core/interface/DDMaterial.h"
0026 #include "DetectorDescription/Core/interface/DDSplit.h"
0027 #include "DetectorDescription/Core/interface/DDTransform.h"
0028 #include "Geometry/CaloGeometry/interface/EcalTrapezoidParameters.h"
0029 #include <CLHEP/Geometry/Transform3D.h>
0030 
0031 using CLHEP::cm;
0032 using CLHEP::deg;
0033 using CLHEP::mm;
0034 //#define EDM_ML_DEBUG
0035 
0036 class DDEcalBarrelAlgo : public DDAlgorithm {
0037 public:
0038   typedef EcalTrapezoidParameters Trap;
0039   typedef HepGeom::Point3D<double> Pt3D;
0040   typedef HepGeom::Transform3D Tf3D;
0041   typedef HepGeom::ReflectZ3D RfZ3D;
0042   typedef HepGeom::Translate3D Tl3D;
0043   typedef HepGeom::Rotate3D Ro3D;
0044   typedef HepGeom::RotateZ3D RoZ3D;
0045   typedef HepGeom::RotateY3D RoY3D;
0046   typedef HepGeom::RotateX3D RoX3D;
0047 
0048   typedef CLHEP::Hep3Vector Vec3;
0049   typedef CLHEP::HepRotation Rota;
0050 
0051   //Constructor and Destructor
0052   DDEcalBarrelAlgo();
0053   ~DDEcalBarrelAlgo() override;
0054 
0055   void initialize(const DDNumericArguments& nArgs,
0056                   const DDVectorArguments& vArgs,
0057                   const DDMapArguments& mArgs,
0058                   const DDStringArguments& sArgs,
0059                   const DDStringVectorArguments& vsArgs) override;
0060   void execute(DDCompactView& cpv) override;
0061 
0062   DDMaterial ddmat(const std::string& s) const;
0063   DDName ddname(const std::string& s) const;
0064   DDRotation myrot(const std::string& s, const CLHEP::HepRotation& r) const;
0065   DDSolid mytrap(const std::string& s, const Trap& t) const;
0066 
0067   const std::string& idNameSpace() const { return m_idNameSpace; }
0068 
0069   // barrel parent volume
0070   DDName barName() const { return ddname(m_BarName); }
0071   DDMaterial barMat() const { return ddmat(m_BarMat); }
0072   const std::vector<double>& vecBarZPts() const { return m_vecBarZPts; }
0073   const std::vector<double>& vecBarRMin() const { return m_vecBarRMin; }
0074   const std::vector<double>& vecBarRMax() const { return m_vecBarRMax; }
0075   const std::vector<double>& vecBarTran() const { return m_vecBarTran; }
0076   const std::vector<double>& vecBarRota() const { return m_vecBarRota; }
0077   const std::vector<double>& vecBarRota2() const { return m_vecBarRota2; }
0078   const std::vector<double>& vecBarRota3() const { return m_vecBarRota3; }
0079   double barPhiLo() const { return m_BarPhiLo; }
0080   double barPhiHi() const { return m_BarPhiHi; }
0081   double barHere() const { return m_BarHere; }
0082 
0083   DDName spmName() const { return ddname(m_SpmName); }
0084   DDMaterial spmMat() const { return ddmat(m_SpmMat); }
0085   const std::vector<double>& vecSpmZPts() const { return m_vecSpmZPts; }
0086   const std::vector<double>& vecSpmRMin() const { return m_vecSpmRMin; }
0087   const std::vector<double>& vecSpmRMax() const { return m_vecSpmRMax; }
0088   const std::vector<double>& vecSpmTran() const { return m_vecSpmTran; }
0089   const std::vector<double>& vecSpmRota() const { return m_vecSpmRota; }
0090   const std::vector<double>& vecSpmBTran() const { return m_vecSpmBTran; }
0091   const std::vector<double>& vecSpmBRota() const { return m_vecSpmBRota; }
0092   unsigned int spmNPerHalf() const { return m_SpmNPerHalf; }
0093   double spmLowPhi() const { return m_SpmLowPhi; }
0094   double spmDelPhi() const { return m_SpmDelPhi; }
0095   double spmPhiOff() const { return m_SpmPhiOff; }
0096   const std::vector<double>& vecSpmHere() const { return m_vecSpmHere; }
0097   DDName spmCutName() const { return ddname(m_SpmCutName); }
0098   double spmCutThick() const { return m_SpmCutThick; }
0099   int spmCutShow() const { return m_SpmCutShow; }
0100   double spmCutRM() const { return m_SpmCutRM; }
0101   double spmCutRP() const { return m_SpmCutRP; }
0102   const std::vector<double>& vecSpmCutTM() const { return m_vecSpmCutTM; }
0103   const std::vector<double>& vecSpmCutTP() const { return m_vecSpmCutTP; }
0104   double spmExpThick() const { return m_SpmExpThick; }
0105   double spmExpWide() const { return m_SpmExpWide; }
0106   double spmExpYOff() const { return m_SpmExpYOff; }
0107   DDName spmSideName() const { return ddname(m_SpmSideName); }
0108   DDMaterial spmSideMat() const { return ddmat(m_SpmSideMat); }
0109   double spmSideHigh() const { return m_SpmSideHigh; }
0110   double spmSideThick() const { return m_SpmSideThick; }
0111   double spmSideYOffM() const { return m_SpmSideYOffM; }
0112   double spmSideYOffP() const { return m_SpmSideYOffP; }
0113 
0114   double nomCryDimAF() const { return m_NomCryDimAF; }
0115   double nomCryDimLZ() const { return m_NomCryDimLZ; }
0116   const std::vector<double>& vecNomCryDimBF() const { return m_vecNomCryDimBF; }
0117   const std::vector<double>& vecNomCryDimCF() const { return m_vecNomCryDimCF; }
0118   const std::vector<double>& vecNomCryDimAR() const { return m_vecNomCryDimAR; }
0119   const std::vector<double>& vecNomCryDimBR() const { return m_vecNomCryDimBR; }
0120   const std::vector<double>& vecNomCryDimCR() const { return m_vecNomCryDimCR; }
0121 
0122   double underAF() const { return m_UnderAF; }
0123   double underLZ() const { return m_UnderLZ; }
0124   double underBF() const { return m_UnderBF; }
0125   double underCF() const { return m_UnderCF; }
0126   double underAR() const { return m_UnderAR; }
0127   double underBR() const { return m_UnderBR; }
0128   double underCR() const { return m_UnderCR; }
0129 
0130   double wallThAlv() const { return m_WallThAlv; }
0131   double wrapThAlv() const { return m_WrapThAlv; }
0132   double clrThAlv() const { return m_ClrThAlv; }
0133   const std::vector<double>& vecGapAlvEta() const { return m_vecGapAlvEta; }
0134 
0135   double wallFrAlv() const { return m_WallFrAlv; }
0136   double wrapFrAlv() const { return m_WrapFrAlv; }
0137   double clrFrAlv() const { return m_ClrFrAlv; }
0138 
0139   double wallReAlv() const { return m_WallReAlv; }
0140   double wrapReAlv() const { return m_WrapReAlv; }
0141   double clrReAlv() const { return m_ClrReAlv; }
0142 
0143   unsigned int nCryTypes() const { return m_NCryTypes; }
0144   unsigned int nCryPerAlvEta() const { return m_NCryPerAlvEta; }
0145 
0146   const std::string& cryName() const { return m_CryName; }
0147   const std::string& clrName() const { return m_ClrName; }
0148   const std::string& wrapName() const { return m_WrapName; }
0149   const std::string& wallName() const { return m_WallName; }
0150 
0151   DDMaterial cryMat() const { return ddmat(m_CryMat); }
0152   DDMaterial clrMat() const { return ddmat(m_ClrMat); }
0153   DDMaterial wrapMat() const { return ddmat(m_WrapMat); }
0154   DDMaterial wallMat() const { return ddmat(m_WallMat); }
0155 
0156   DDName apdName() const { return ddname(m_APDName); }
0157   double apdHere() const { return m_APDHere; }
0158   DDMaterial apdMat() const { return ddmat(m_APDMat); }
0159   double apdSide() const { return m_APDSide; }
0160   double apdThick() const { return m_APDThick; }
0161   double apdZ() const { return m_APDZ; }
0162   double apdX1() const { return m_APDX1; }
0163   double apdX2() const { return m_APDX2; }
0164 
0165   double webHere() const { return m_WebHere; }
0166   const std::string& webPlName() const { return m_WebPlName; }
0167   const std::string& webClrName() const { return m_WebClrName; }
0168   DDMaterial webPlMat() const { return ddmat(m_WebPlMat); }
0169   DDMaterial webClrMat() const { return ddmat(m_WebClrMat); }
0170   const std::vector<double>& vecWebPlTh() const { return m_vecWebPlTh; }
0171   const std::vector<double>& vecWebClrTh() const { return m_vecWebClrTh; }
0172   const std::vector<double>& vecWebLength() const { return m_vecWebLength; }
0173 
0174   double ilyHere() const { return m_IlyHere; }
0175   const std::string& ilyName() const { return m_IlyName; }
0176   double ilyPhiLow() const { return m_IlyPhiLow; }
0177   double ilyDelPhi() const { return m_IlyDelPhi; }
0178   const std::vector<std::string>& vecIlyMat() const { return m_vecIlyMat; }
0179   const std::vector<double>& vecIlyThick() const { return m_vecIlyThick; }
0180 
0181   const std::string& ilyPipeName() const { return m_IlyPipeName; }
0182   double ilyPipeHere() const { return m_IlyPipeHere; }
0183   DDMaterial ilyPipeMat() const { return ddmat(m_IlyPipeMat); }
0184   double ilyPipeOD() const { return m_IlyPipeOD; }
0185   double ilyPipeID() const { return m_IlyPipeID; }
0186   const std::vector<double>& vecIlyPipeLength() const { return m_vecIlyPipeLength; }
0187   const std::vector<double>& vecIlyPipeType() const { return m_vecIlyPipeType; }
0188   const std::vector<double>& vecIlyPipePhi() const { return m_vecIlyPipePhi; }
0189   const std::vector<double>& vecIlyPipeZ() const { return m_vecIlyPipeZ; }
0190 
0191   DDName ilyPTMName() const { return ddname(m_IlyPTMName); }
0192   double ilyPTMHere() const { return m_IlyPTMHere; }
0193   DDMaterial ilyPTMMat() const { return ddmat(m_IlyPTMMat); }
0194   double ilyPTMWidth() const { return m_IlyPTMWidth; }
0195   double ilyPTMLength() const { return m_IlyPTMLength; }
0196   double ilyPTMHeight() const { return m_IlyPTMHeight; }
0197   const std::vector<double>& vecIlyPTMZ() const { return m_vecIlyPTMZ; }
0198   const std::vector<double>& vecIlyPTMPhi() const { return m_vecIlyPTMPhi; }
0199 
0200   DDName ilyFanOutName() const { return ddname(m_IlyFanOutName); }
0201   double ilyFanOutHere() const { return m_IlyFanOutHere; }
0202   DDMaterial ilyFanOutMat() const { return ddmat(m_IlyFanOutMat); }
0203   double ilyFanOutWidth() const { return m_IlyFanOutWidth; }
0204   double ilyFanOutLength() const { return m_IlyFanOutLength; }
0205   double ilyFanOutHeight() const { return m_IlyFanOutHeight; }
0206   const std::vector<double>& vecIlyFanOutZ() const { return m_vecIlyFanOutZ; }
0207   const std::vector<double>& vecIlyFanOutPhi() const { return m_vecIlyFanOutPhi; }
0208   DDName ilyDiffName() const { return ddname(m_IlyDiffName); }
0209   DDMaterial ilyDiffMat() const { return ddmat(m_IlyDiffMat); }
0210   double ilyDiffOff() const { return m_IlyDiffOff; }
0211   double ilyDiffLength() const { return m_IlyDiffLength; }
0212   DDName ilyBndlName() const { return ddname(m_IlyBndlName); }
0213   DDMaterial ilyBndlMat() const { return ddmat(m_IlyBndlMat); }
0214   double ilyBndlOff() const { return m_IlyBndlOff; }
0215   double ilyBndlLength() const { return m_IlyBndlLength; }
0216   DDName ilyFEMName() const { return ddname(m_IlyFEMName); }
0217   DDMaterial ilyFEMMat() const { return ddmat(m_IlyFEMMat); }
0218   double ilyFEMWidth() const { return m_IlyFEMWidth; }
0219   double ilyFEMLength() const { return m_IlyFEMLength; }
0220   double ilyFEMHeight() const { return m_IlyFEMHeight; }
0221   const std::vector<double>& vecIlyFEMZ() const { return m_vecIlyFEMZ; }
0222   const std::vector<double>& vecIlyFEMPhi() const { return m_vecIlyFEMPhi; }
0223 
0224   DDName hawRName() const { return ddname(m_HawRName); }
0225   DDName fawName() const { return ddname(m_FawName); }
0226   double fawHere() const { return m_FawHere; }
0227   double hawRHBIG() const { return m_HawRHBIG; }
0228   double hawRhsml() const { return m_HawRhsml; }
0229   double hawRCutY() const { return m_HawRCutY; }
0230   double hawRCutZ() const { return m_HawRCutZ; }
0231   double hawRCutDelY() const { return m_HawRCutDelY; }
0232   double hawYOffCry() const { return m_HawYOffCry; }
0233 
0234   unsigned int nFawPerSupm() const { return m_NFawPerSupm; }
0235   double fawPhiOff() const { return m_FawPhiOff; }
0236   double fawDelPhi() const { return m_FawDelPhi; }
0237   double fawPhiRot() const { return m_FawPhiRot; }
0238   double fawRadOff() const { return m_FawRadOff; }
0239 
0240   double gridHere() const { return m_GridHere; }
0241   DDName gridName() const { return ddname(m_GridName); }
0242   DDMaterial gridMat() const { return ddmat(m_GridMat); }
0243   double gridThick() const { return m_GridThick; }
0244 
0245   double backHere() const { return m_BackHere; }
0246   double backXOff() const { return m_BackXOff; }
0247   double backYOff() const { return m_BackYOff; }
0248   DDName backSideName() const { return ddname(m_BackSideName); }
0249   double backSideHere() const { return m_BackSideHere; }
0250   double backSideLength() const { return m_BackSideLength; }
0251   double backSideHeight() const { return m_BackSideHeight; }
0252   double backSideWidth() const { return m_BackSideWidth; }
0253   double backSideYOff1() const { return m_BackSideYOff1; }
0254   double backSideYOff2() const { return m_BackSideYOff2; }
0255   double backSideAngle() const { return m_BackSideAngle; }
0256   DDMaterial backSideMat() const { return ddmat(m_BackSideMat); }
0257   DDName backPlateName() const { return ddname(m_BackPlateName); }
0258   double backPlateHere() const { return m_BackPlateHere; }
0259   double backPlateLength() const { return m_BackPlateLength; }
0260   double backPlateThick() const { return m_BackPlateThick; }
0261   double backPlateWidth() const { return m_BackPlateWidth; }
0262   DDMaterial backPlateMat() const { return ddmat(m_BackPlateMat); }
0263   DDName backPlate2Name() const { return ddname(m_BackPlate2Name); }
0264   double backPlate2Thick() const { return m_BackPlate2Thick; }
0265   DDMaterial backPlate2Mat() const { return ddmat(m_BackPlate2Mat); }
0266   const std::string& grilleName() const { return m_GrilleName; }
0267   double grilleThick() const { return m_GrilleThick; }
0268   double grilleHere() const { return m_GrilleHere; }
0269   double grilleWidth() const { return m_GrilleWidth; }
0270   double grilleZSpace() const { return m_GrilleZSpace; }
0271   DDMaterial grilleMat() const { return ddmat(m_GrilleMat); }
0272   const std::vector<double>& vecGrilleHeight() const { return m_vecGrilleHeight; }
0273   const std::vector<double>& vecGrilleZOff() const { return m_vecGrilleZOff; }
0274 
0275   DDName grEdgeSlotName() const { return ddname(m_GrEdgeSlotName); }
0276   DDMaterial grEdgeSlotMat() const { return ddmat(m_GrEdgeSlotMat); }
0277   double grEdgeSlotHere() const { return m_GrEdgeSlotHere; }
0278   double grEdgeSlotHeight() const { return m_GrEdgeSlotHeight; }
0279   double grEdgeSlotWidth() const { return m_GrEdgeSlotWidth; }
0280   const std::string& grMidSlotName() const { return m_GrMidSlotName; }
0281   DDMaterial grMidSlotMat() const { return ddmat(m_GrMidSlotMat); }
0282   double grMidSlotHere() const { return m_GrMidSlotHere; }
0283   double grMidSlotWidth() const { return m_GrMidSlotWidth; }
0284   double grMidSlotXOff() const { return m_GrMidSlotXOff; }
0285   const std::vector<double>& vecGrMidSlotHeight() const { return m_vecGrMidSlotHeight; }
0286 
0287   double backPipeHere() const { return m_BackPipeHere; }
0288   const std::string& backPipeName() const { return m_BackPipeName; }
0289   const std::vector<double>& vecBackPipeDiam() const { return m_vecBackPipeDiam; }
0290   const std::vector<double>& vecBackPipeThick() const { return m_vecBackPipeThick; }
0291   DDMaterial backPipeMat() const { return ddmat(m_BackPipeMat); }
0292   DDMaterial backPipeWaterMat() const { return ddmat(m_BackPipeWaterMat); }
0293   double backMiscHere() const { return m_BackMiscHere; }
0294   const std::vector<double>& vecBackMiscThick() const { return m_vecBackMiscThick; }
0295   const std::vector<std::string>& vecBackMiscName() const { return m_vecBackMiscName; }
0296   const std::vector<std::string>& vecBackMiscMat() const { return m_vecBackMiscMat; }
0297   double patchPanelHere() const { return m_PatchPanelHere; }
0298   const std::vector<double>& vecPatchPanelThick() const { return m_vecPatchPanelThick; }
0299   const std::vector<std::string>& vecPatchPanelNames() const { return m_vecPatchPanelNames; }
0300   const std::vector<std::string>& vecPatchPanelMat() const { return m_vecPatchPanelMat; }
0301   DDName patchPanelName() const { return ddname(m_PatchPanelName); }
0302 
0303   const std::vector<std::string>& vecBackCoolName() const { return m_vecBackCoolName; }
0304   double backCoolHere() const { return m_BackCoolHere; }
0305   double backCoolBarWidth() const { return m_BackCoolBarWidth; }
0306   double backCoolBarHeight() const { return m_BackCoolBarHeight; }
0307   DDMaterial backCoolMat() const { return ddmat(m_BackCoolMat); }
0308   double backCoolBarHere() const { return m_BackCoolBarHere; }
0309   DDName backCoolBarName() const { return ddname(m_BackCoolBarName); }
0310   double backCoolBarThick() const { return m_BackCoolBarThick; }
0311   DDMaterial backCoolBarMat() const { return ddmat(m_BackCoolBarMat); }
0312   DDName backCoolBarSSName() const { return ddname(m_BackCoolBarSSName); }
0313   double backCoolBarSSThick() const { return m_BackCoolBarSSThick; }
0314   DDMaterial backCoolBarSSMat() const { return ddmat(m_BackCoolBarSSMat); }
0315   DDName backCoolBarWaName() const { return ddname(m_BackCoolBarWaName); }
0316   double backCoolBarWaThick() const { return m_BackCoolBarWaThick; }
0317   DDMaterial backCoolBarWaMat() const { return ddmat(m_BackCoolBarWaMat); }
0318   double backCoolVFEHere() const { return m_BackCoolVFEHere; }
0319   DDName backCoolVFEName() const { return ddname(m_BackCoolVFEName); }
0320   DDMaterial backCoolVFEMat() const { return ddmat(m_BackCoolVFEMat); }
0321   DDName backVFEName() const { return ddname(m_BackVFEName); }
0322   DDMaterial backVFEMat() const { return ddmat(m_BackVFEMat); }
0323   const std::vector<double>& vecBackVFELyrThick() const { return m_vecBackVFELyrThick; }
0324   const std::vector<std::string>& vecBackVFELyrName() const { return m_vecBackVFELyrName; }
0325   const std::vector<std::string>& vecBackVFELyrMat() const { return m_vecBackVFELyrMat; }
0326   const std::vector<double>& vecBackCoolNSec() const { return m_vecBackCoolNSec; }
0327   const std::vector<double>& vecBackCoolSecSep() const { return m_vecBackCoolSecSep; }
0328   const std::vector<double>& vecBackCoolNPerSec() const { return m_vecBackCoolNPerSec; }
0329   double backCBStdSep() const { return m_BackCBStdSep; }
0330 
0331   double backCoolTankHere() const { return m_BackCoolTankHere; }
0332   const std::string& backCoolTankName() const { return m_BackCoolTankName; }
0333   double backCoolTankWidth() const { return m_BackCoolTankWidth; }
0334   double backCoolTankThick() const { return m_BackCoolTankThick; }
0335   DDMaterial backCoolTankMat() const { return ddmat(m_BackCoolTankMat); }
0336   const std::string& backCoolTankWaName() const { return m_BackCoolTankWaName; }
0337   double backCoolTankWaWidth() const { return m_BackCoolTankWaWidth; }
0338   DDMaterial backCoolTankWaMat() const { return ddmat(m_BackCoolTankWaMat); }
0339   const std::string& backBracketName() const { return m_BackBracketName; }
0340   double backBracketHeight() const { return m_BackBracketHeight; }
0341   DDMaterial backBracketMat() const { return ddmat(m_BackBracketMat); }
0342 
0343   double dryAirTubeHere() const { return m_DryAirTubeHere; }
0344   const std::string& dryAirTubeName() const { return m_DryAirTubeName; }
0345   double mBCoolTubeNum() const { return m_MBCoolTubeNum; }
0346   double dryAirTubeInnDiam() const { return m_DryAirTubeInnDiam; }
0347   double dryAirTubeOutDiam() const { return m_DryAirTubeOutDiam; }
0348   DDMaterial dryAirTubeMat() const { return ddmat(m_DryAirTubeMat); }
0349   double mBCoolTubeHere() const { return m_MBCoolTubeHere; }
0350   const std::string& mBCoolTubeName() const { return m_MBCoolTubeName; }
0351   double mBCoolTubeInnDiam() const { return m_MBCoolTubeInnDiam; }
0352   double mBCoolTubeOutDiam() const { return m_MBCoolTubeOutDiam; }
0353   DDMaterial mBCoolTubeMat() const { return ddmat(m_MBCoolTubeMat); }
0354   double mBManifHere() const { return m_MBManifHere; }
0355   DDName mBManifName() const { return ddname(m_MBManifName); }
0356   double mBManifInnDiam() const { return m_MBManifInnDiam; }
0357   double mBManifOutDiam() const { return m_MBManifOutDiam; }
0358   DDMaterial mBManifMat() const { return ddmat(m_MBManifMat); }
0359   double mBLyrHere() const { return m_MBLyrHere; }
0360   const std::vector<double>& vecMBLyrThick() const { return m_vecMBLyrThick; }
0361   const std::vector<std::string>& vecMBLyrName() const { return m_vecMBLyrName; }
0362   const std::vector<std::string>& vecMBLyrMat() const { return m_vecMBLyrMat; }
0363 
0364   //----------
0365 
0366   double pincerRodHere() const { return m_PincerRodHere; }
0367   DDName pincerRodName() const { return ddname(m_PincerRodName); }
0368   DDMaterial pincerRodMat() const { return ddmat(m_PincerRodMat); }
0369   std::vector<double> vecPincerRodAzimuth() const { return m_vecPincerRodAzimuth; }
0370   DDName pincerEnvName() const { return ddname(m_PincerEnvName); }
0371   DDMaterial pincerEnvMat() const { return ddmat(m_PincerEnvMat); }
0372   double pincerEnvWidth() const { return m_PincerEnvWidth; }
0373   double pincerEnvHeight() const { return m_PincerEnvHeight; }
0374   double pincerEnvLength() const { return m_PincerEnvLength; }
0375   std::vector<double> vecPincerEnvZOff() const { return m_vecPincerEnvZOff; }
0376 
0377   DDName pincerBlkName() const { return ddname(m_PincerBlkName); }
0378   DDMaterial pincerBlkMat() const { return ddmat(m_PincerBlkMat); }
0379   double pincerBlkLength() const { return m_PincerBlkLength; }
0380 
0381   DDName pincerShim1Name() const { return ddname(m_PincerShim1Name); }
0382   double pincerShimHeight() const { return m_PincerShimHeight; }
0383   DDName pincerShim2Name() const { return ddname(m_PincerShim2Name); }
0384   DDMaterial pincerShimMat() const { return ddmat(m_PincerShimMat); }
0385   double pincerShim1Width() const { return m_PincerShim1Width; }
0386   double pincerShim2Width() const { return m_PincerShim2Width; }
0387 
0388   DDName pincerCutName() const { return ddname(m_PincerCutName); }
0389   DDMaterial pincerCutMat() const { return ddmat(m_PincerCutMat); }
0390   double pincerCutWidth() const { return m_PincerCutWidth; }
0391   double pincerCutHeight() const { return m_PincerCutHeight; }
0392 
0393 protected:
0394 private:
0395   void web(unsigned int iWeb,
0396            double bWeb,
0397            double BWeb,
0398            double LWeb,
0399            double theta,
0400            const Pt3D& corner,
0401            const DDLogicalPart& logPar,
0402            double& zee,
0403            double side,
0404            double front,
0405            double delta,
0406            DDCompactView& cpv);
0407 
0408   std::string m_idNameSpace;  //Namespace of this and ALL sub-parts
0409 
0410   // Barrel volume
0411   std::string m_BarName;              // Barrel volume name
0412   std::string m_BarMat;               // Barrel material name
0413   std::vector<double> m_vecBarZPts;   // Barrel list of z pts
0414   std::vector<double> m_vecBarRMin;   // Barrel list of rMin pts
0415   std::vector<double> m_vecBarRMax;   // Barrel list of rMax pts
0416   std::vector<double> m_vecBarTran;   // Barrel translation
0417   std::vector<double> m_vecBarRota;   // Barrel rotation
0418   std::vector<double> m_vecBarRota2;  // 2nd Barrel rotation
0419   std::vector<double> m_vecBarRota3;  // 2nd Barrel rotation
0420   double m_BarPhiLo;                  // Barrel phi lo
0421   double m_BarPhiHi;                  // Barrel phi hi
0422   double m_BarHere;                   // Barrel presence flag
0423 
0424   // Supermodule volume
0425   std::string m_SpmName;              // Supermodule volume name
0426   std::string m_SpmMat;               // Supermodule material name
0427   std::vector<double> m_vecSpmZPts;   // Supermodule list of z pts
0428   std::vector<double> m_vecSpmRMin;   // Supermodule list of rMin pts
0429   std::vector<double> m_vecSpmRMax;   // Supermodule list of rMax pts
0430   std::vector<double> m_vecSpmTran;   // Supermodule translation
0431   std::vector<double> m_vecSpmRota;   // Supermodule rotation
0432   std::vector<double> m_vecSpmBTran;  // Base Supermodule translation
0433   std::vector<double> m_vecSpmBRota;  // Base Supermodule rotation
0434   unsigned int m_SpmNPerHalf;         // # Supermodules per half detector
0435   double m_SpmLowPhi;                 // Low   phi value of base supermodule
0436   double m_SpmDelPhi;                 // Delta phi value of base supermodule
0437   double m_SpmPhiOff;                 // Phi offset value supermodule
0438   std::vector<double> m_vecSpmHere;   // Bit saying if a supermodule is present or not
0439   std::string m_SpmCutName;           // Name of cut box
0440   double m_SpmCutThick;               // Box thickness
0441   int m_SpmCutShow;                   // Non-zero means show the box on display (testing only)
0442   std::vector<double> m_vecSpmCutTM;  // Translation for minus phi cut box
0443   std::vector<double> m_vecSpmCutTP;  // Translation for plus  phi cut box
0444   double m_SpmCutRM;                  // Rotation for minus phi cut box
0445   double m_SpmCutRP;                  // Rotation for plus  phi cut box
0446   double m_SpmExpThick;               // Thickness (x) of supermodule expansion box
0447   double m_SpmExpWide;                // Width     (y) of supermodule expansion box
0448   double m_SpmExpYOff;                // Offset    (y) of supermodule expansion box
0449   std::string m_SpmSideName;          // Supermodule Side Plate volume name
0450   std::string m_SpmSideMat;           // Supermodule Side Plate material name
0451   double m_SpmSideHigh;               // Side plate height
0452   double m_SpmSideThick;              // Side plate thickness
0453   double m_SpmSideYOffM;              // Side plate Y offset on minus phi side
0454   double m_SpmSideYOffP;              // Side plate Y offset on plus  phi side
0455 
0456   double m_NomCryDimAF;                  // Nominal crystal AF
0457   double m_NomCryDimLZ;                  // Nominal crystal LZ
0458   std::vector<double> m_vecNomCryDimBF;  // Nominal crystal BF
0459   std::vector<double> m_vecNomCryDimCF;  // Nominal crystal CF
0460   std::vector<double> m_vecNomCryDimAR;  // Nominal crystal AR
0461   std::vector<double> m_vecNomCryDimBR;  // Nominal crystal BR
0462   std::vector<double> m_vecNomCryDimCR;  // Nominal crystal CR
0463 
0464   double m_UnderAF;  // undershoot of AF
0465   double m_UnderLZ;  // undershoot of LZ
0466   double m_UnderBF;  // undershoot of BF
0467   double m_UnderCF;  // undershoot of CF
0468   double m_UnderAR;  // undershoot of AR
0469   double m_UnderBR;  // undershoot of BR
0470   double m_UnderCR;  // undershoot of CR
0471 
0472   double m_WallThAlv;                  // alveoli wall thickness
0473   double m_WrapThAlv;                  // wrapping thickness
0474   double m_ClrThAlv;                   // clearance thickness (nominal)
0475   std::vector<double> m_vecGapAlvEta;  // Extra clearance after each alveoli perp to crystal axis
0476 
0477   double m_WallFrAlv;  // alveoli wall frontage
0478   double m_WrapFrAlv;  // wrapping frontage
0479   double m_ClrFrAlv;   // clearance frontage (nominal)
0480 
0481   double m_WallReAlv;  // alveoli wall rearage
0482   double m_WrapReAlv;  // wrapping rearage
0483   double m_ClrReAlv;   // clearance rearage (nominal)
0484 
0485   unsigned int m_NCryTypes;      // number of crystal shapes
0486   unsigned int m_NCryPerAlvEta;  // number of crystals in eta per alveolus
0487 
0488   std::string m_CryName;   // string name of crystal volume
0489   std::string m_ClrName;   // string name of clearance volume
0490   std::string m_WrapName;  // string name of wrap volume
0491   std::string m_WallName;  // string name of wall volume
0492 
0493   std::string m_CryMat;   // string name of crystal material
0494   std::string m_ClrMat;   // string name of clearance material
0495   std::string m_WrapMat;  // string name of wrap material
0496   std::string m_WallMat;  // string name of wall material
0497 
0498   std::string m_APDName;  // APD
0499   double m_APDHere;       //
0500   std::string m_APDMat;   //
0501   double m_APDSide;       //
0502   double m_APDThick;      //
0503   double m_APDZ;          //
0504   double m_APDX1;         //
0505   double m_APDX2;         //
0506 
0507   double m_WebHere;                    // here flag
0508   std::string m_WebPlName;             // string name of web plate volume
0509   std::string m_WebClrName;            // string name of web clearance volume
0510   std::string m_WebPlMat;              // string name of web material
0511   std::string m_WebClrMat;             // string name of web clearance material
0512   std::vector<double> m_vecWebPlTh;    // Thickness of web plates
0513   std::vector<double> m_vecWebClrTh;   // Thickness of total web clearance
0514   std::vector<double> m_vecWebLength;  // Length of web plate
0515 
0516   double m_IlyHere;                      // here flag
0517   std::string m_IlyName;                 // string name of inner layer volume
0518   double m_IlyPhiLow;                    // low phi of volumes
0519   double m_IlyDelPhi;                    // delta phi of ily
0520   std::vector<std::string> m_vecIlyMat;  // materials of inner layer volumes
0521   std::vector<double> m_vecIlyThick;     // Thicknesses of inner layer volumes
0522 
0523   std::string m_IlyPipeName;               // Cooling pipes
0524   double m_IlyPipeHere;                    //
0525   std::string m_IlyPipeMat;                //
0526   double m_IlyPipeOD;                      //
0527   double m_IlyPipeID;                      //
0528   std::vector<double> m_vecIlyPipeLength;  //
0529   std::vector<double> m_vecIlyPipeType;    //
0530   std::vector<double> m_vecIlyPipePhi;     //
0531   std::vector<double> m_vecIlyPipeZ;       //
0532 
0533   std::string m_IlyPTMName;            // PTM
0534   double m_IlyPTMHere;                 //
0535   std::string m_IlyPTMMat;             //
0536   double m_IlyPTMWidth;                //
0537   double m_IlyPTMLength;               //
0538   double m_IlyPTMHeight;               //
0539   std::vector<double> m_vecIlyPTMZ;    //
0540   std::vector<double> m_vecIlyPTMPhi;  //
0541 
0542   std::string m_IlyFanOutName;            // FanOut
0543   double m_IlyFanOutHere;                 //
0544   std::string m_IlyFanOutMat;             //
0545   double m_IlyFanOutWidth;                //
0546   double m_IlyFanOutLength;               //
0547   double m_IlyFanOutHeight;               //
0548   std::vector<double> m_vecIlyFanOutZ;    //
0549   std::vector<double> m_vecIlyFanOutPhi;  //
0550   std::string m_IlyDiffName;              // Diffuser
0551   std::string m_IlyDiffMat;               //
0552   double m_IlyDiffOff;                    //
0553   double m_IlyDiffLength;                 //
0554   std::string m_IlyBndlName;              // Fiber bundle
0555   std::string m_IlyBndlMat;               //
0556   double m_IlyBndlOff;                    //
0557   double m_IlyBndlLength;                 //
0558   std::string m_IlyFEMName;               // FEM
0559   std::string m_IlyFEMMat;                //
0560   double m_IlyFEMWidth;                   //
0561   double m_IlyFEMLength;                  //
0562   double m_IlyFEMHeight;                  //
0563   std::vector<double> m_vecIlyFEMZ;       //
0564   std::vector<double> m_vecIlyFEMPhi;     //
0565 
0566   std::string m_HawRName;      // string name of half-alveolar wedge
0567   std::string m_FawName;       // string name of full-alveolar wedge
0568   double m_FawHere;            // here flag
0569   double m_HawRHBIG;           // height at big end of half alveolar wedge
0570   double m_HawRhsml;           // height at small end of half alveolar wedge
0571   double m_HawRCutY;           // x dim of hawR cut box
0572   double m_HawRCutZ;           // y dim of hawR cut box
0573   double m_HawRCutDelY;        // y offset of hawR cut box from top of HAW
0574   double m_HawYOffCry;         // Y offset of crystal wrt HAW at front
0575   unsigned int m_NFawPerSupm;  // Number of Full Alv. Wedges per supermodule
0576   double m_FawPhiOff;          // Phi offset for FAW placement
0577   double m_FawDelPhi;          // Phi delta for FAW placement
0578   double m_FawPhiRot;          // Phi rotation of FAW about own axis prior to placement
0579   double m_FawRadOff;          // Radial offset for FAW placement
0580 
0581   double m_GridHere;       // here flag
0582   std::string m_GridName;  // Grid name
0583   std::string m_GridMat;   // Grid material
0584   double m_GridThick;      // Grid Thickness
0585 
0586   double m_BackXOff;  //
0587   double m_BackYOff;  //
0588 
0589   double m_BackHere;                      // here flag
0590   std::string m_BackSideName;             // Back Sides
0591   double m_BackSideHere;                  //
0592   double m_BackSideLength;                //
0593   double m_BackSideHeight;                //
0594   double m_BackSideWidth;                 //
0595   double m_BackSideYOff1;                 //
0596   double m_BackSideYOff2;                 //
0597   double m_BackSideAngle;                 //
0598   std::string m_BackSideMat;              //
0599   std::string m_BackPlateName;            // back plate
0600   double m_BackPlateHere;                 //
0601   double m_BackPlateLength;               //
0602   double m_BackPlateThick;                //
0603   double m_BackPlateWidth;                //
0604   std::string m_BackPlateMat;             //
0605   std::string m_BackPlate2Name;           // back plate2
0606   double m_BackPlate2Thick;               //
0607   std::string m_BackPlate2Mat;            //
0608   std::string m_GrilleName;               // grille
0609   double m_GrilleHere;                    //
0610   double m_GrilleThick;                   //
0611   double m_GrilleWidth;                   //
0612   double m_GrilleZSpace;                  //
0613   std::string m_GrilleMat;                //
0614   std::vector<double> m_vecGrilleHeight;  //
0615   std::vector<double> m_vecGrilleZOff;    //
0616 
0617   std::string m_GrEdgeSlotName;  // Slots in Grille
0618   std::string m_GrEdgeSlotMat;   //
0619   double m_GrEdgeSlotHere;       //
0620   double m_GrEdgeSlotHeight;     //
0621   double m_GrEdgeSlotWidth;      //
0622 
0623   std::string m_GrMidSlotName;               // Slots in Grille
0624   std::string m_GrMidSlotMat;                //
0625   double m_GrMidSlotHere;                    //
0626   double m_GrMidSlotWidth;                   //
0627   double m_GrMidSlotXOff;                    //
0628   std::vector<double> m_vecGrMidSlotHeight;  //
0629 
0630   double m_BackPipeHere;                   // here flag
0631   std::string m_BackPipeName;              //
0632   std::vector<double> m_vecBackPipeDiam;   // pipes
0633   std::vector<double> m_vecBackPipeThick;  // pipes
0634   std::string m_BackPipeMat;               //
0635   std::string m_BackPipeWaterMat;          //
0636 
0637   std::vector<std::string> m_vecBackCoolName;  // cooling circuits
0638   double m_BackCoolHere;                       // here flag
0639   double m_BackCoolBarHere;                    // here flag
0640   double m_BackCoolBarWidth;                   //
0641   double m_BackCoolBarHeight;                  //
0642   std::string m_BackCoolMat;
0643   std::string m_BackCoolBarName;  // cooling bar
0644   double m_BackCoolBarThick;      //
0645   std::string m_BackCoolBarMat;
0646   std::string m_BackCoolBarSSName;  // cooling bar tubing
0647   double m_BackCoolBarSSThick;      //
0648   std::string m_BackCoolBarSSMat;
0649   std::string m_BackCoolBarWaName;  // cooling bar water
0650   double m_BackCoolBarWaThick;      //
0651   std::string m_BackCoolBarWaMat;
0652   double m_BackCoolVFEHere;  // here flag
0653   std::string m_BackCoolVFEName;
0654   std::string m_BackCoolVFEMat;
0655   std::string m_BackVFEName;
0656   std::string m_BackVFEMat;
0657   std::vector<double> m_vecBackVFELyrThick;      //
0658   std::vector<std::string> m_vecBackVFELyrName;  //
0659   std::vector<std::string> m_vecBackVFELyrMat;   //
0660   std::vector<double> m_vecBackCoolNSec;         //
0661   std::vector<double> m_vecBackCoolSecSep;       //
0662   std::vector<double> m_vecBackCoolNPerSec;      //
0663   double m_BackMiscHere;                         // here flag
0664   std::vector<double> m_vecBackMiscThick;        // misc materials
0665   std::vector<std::string> m_vecBackMiscName;    //
0666   std::vector<std::string> m_vecBackMiscMat;     //
0667   double m_BackCBStdSep;                         //
0668 
0669   double m_PatchPanelHere;                        // here flag
0670   std::string m_PatchPanelName;                   //
0671   std::vector<double> m_vecPatchPanelThick;       // patch panel materials
0672   std::vector<std::string> m_vecPatchPanelNames;  //
0673   std::vector<std::string> m_vecPatchPanelMat;    //
0674 
0675   double m_BackCoolTankHere;         // here flag
0676   std::string m_BackCoolTankName;    // service tank
0677   double m_BackCoolTankWidth;        //
0678   double m_BackCoolTankThick;        //
0679   std::string m_BackCoolTankMat;     //
0680   std::string m_BackCoolTankWaName;  //
0681   double m_BackCoolTankWaWidth;      //
0682   std::string m_BackCoolTankWaMat;   //
0683   std::string m_BackBracketName;     //
0684   double m_BackBracketHeight;        //
0685   std::string m_BackBracketMat;      //
0686 
0687   double m_DryAirTubeHere;                  // here flag
0688   std::string m_DryAirTubeName;             // dry air tube
0689   unsigned int m_MBCoolTubeNum;             //
0690   double m_DryAirTubeInnDiam;               //
0691   double m_DryAirTubeOutDiam;               //
0692   std::string m_DryAirTubeMat;              //
0693   double m_MBCoolTubeHere;                  // here flag
0694   std::string m_MBCoolTubeName;             // mothr bd cooling tube
0695   double m_MBCoolTubeInnDiam;               //
0696   double m_MBCoolTubeOutDiam;               //
0697   std::string m_MBCoolTubeMat;              //
0698   double m_MBManifHere;                     // here flag
0699   std::string m_MBManifName;                //mother bd manif
0700   double m_MBManifInnDiam;                  //
0701   double m_MBManifOutDiam;                  //
0702   std::string m_MBManifMat;                 //
0703   double m_MBLyrHere;                       // here flag
0704   std::vector<double> m_vecMBLyrThick;      // mother bd lyrs
0705   std::vector<std::string> m_vecMBLyrName;  //
0706   std::vector<std::string> m_vecMBLyrMat;   //
0707 
0708   //-------------------------------------------------------------------
0709 
0710   double m_PincerRodHere;                     // here flag
0711   std::string m_PincerRodName;                // pincer rod
0712   std::string m_PincerRodMat;                 //
0713   std::vector<double> m_vecPincerRodAzimuth;  //
0714 
0715   std::string m_PincerEnvName;             // pincer envelope
0716   std::string m_PincerEnvMat;              //
0717   double m_PincerEnvWidth;                 //
0718   double m_PincerEnvHeight;                //
0719   double m_PincerEnvLength;                //
0720   std::vector<double> m_vecPincerEnvZOff;  //
0721 
0722   std::string m_PincerBlkName;  // pincer block
0723   std::string m_PincerBlkMat;   //
0724   double m_PincerBlkLength;     //
0725 
0726   std::string m_PincerShim1Name;  // pincer shim
0727   double m_PincerShimHeight;      //
0728   std::string m_PincerShim2Name;  //
0729   std::string m_PincerShimMat;    //
0730   double m_PincerShim1Width;      //
0731   double m_PincerShim2Width;      //
0732 
0733   std::string m_PincerCutName;  // pincer block
0734   std::string m_PincerCutMat;   //
0735   double m_PincerCutWidth;      //
0736   double m_PincerCutHeight;     //
0737 };
0738 
0739 namespace std {}
0740 using namespace std;
0741 
0742 DDEcalBarrelAlgo::DDEcalBarrelAlgo()
0743     : m_idNameSpace(""),
0744       m_BarName(""),
0745       m_BarMat(""),
0746       m_vecBarZPts(),
0747       m_vecBarRMin(),
0748       m_vecBarRMax(),
0749       m_vecBarTran(),
0750       m_vecBarRota(),
0751       m_vecBarRota2(),
0752       m_vecBarRota3(),
0753       m_BarPhiLo(0),
0754       m_BarPhiHi(0),
0755       m_BarHere(0),
0756       m_SpmName(""),
0757       m_SpmMat(""),
0758       m_vecSpmZPts(),
0759       m_vecSpmRMin(),
0760       m_vecSpmRMax(),
0761       m_vecSpmTran(),
0762       m_vecSpmRota(),
0763       m_vecSpmBTran(),
0764       m_vecSpmBRota(),
0765       m_SpmNPerHalf(0),
0766       m_SpmLowPhi(0),
0767       m_SpmDelPhi(0),
0768       m_SpmPhiOff(0),
0769       m_vecSpmHere(),
0770       m_SpmCutName(""),
0771       m_SpmCutThick(0),
0772       m_SpmCutShow(0),
0773       m_vecSpmCutTM(),
0774       m_vecSpmCutTP(),
0775       m_SpmCutRM(0),
0776       m_SpmCutRP(0),
0777       m_SpmExpThick(0),
0778       m_SpmExpWide(0),
0779       m_SpmExpYOff(0),
0780       m_SpmSideName(""),
0781       m_SpmSideMat(""),
0782       m_SpmSideHigh(0),
0783       m_SpmSideThick(0),
0784       m_SpmSideYOffM(0),
0785       m_SpmSideYOffP(0),
0786       m_NomCryDimAF(0),
0787       m_NomCryDimLZ(0),
0788       m_vecNomCryDimBF(),
0789       m_vecNomCryDimCF(),
0790       m_vecNomCryDimAR(),
0791       m_vecNomCryDimBR(),
0792       m_vecNomCryDimCR(),
0793       m_UnderAF(0),
0794       m_UnderLZ(0),
0795       m_UnderBF(0),
0796       m_UnderCF(0),
0797       m_UnderAR(0),
0798       m_UnderBR(0),
0799       m_UnderCR(0),
0800       m_WallThAlv(0),
0801       m_WrapThAlv(0),
0802       m_ClrThAlv(0),
0803       m_vecGapAlvEta(),
0804       m_WallFrAlv(0),
0805       m_WrapFrAlv(0),
0806       m_ClrFrAlv(0),
0807       m_WallReAlv(0),
0808       m_WrapReAlv(0),
0809       m_ClrReAlv(0),
0810       m_NCryTypes(0),
0811       m_NCryPerAlvEta(0),
0812       m_CryName(""),
0813       m_ClrName(""),
0814       m_WrapName(""),
0815       m_WallName(""),
0816       m_CryMat(""),
0817       m_ClrMat(""),
0818       m_WrapMat(""),
0819       m_WallMat(""),
0820 
0821       m_APDName(""),
0822       m_APDHere(0),
0823       m_APDMat(""),
0824       m_APDSide(0),
0825       m_APDThick(0),
0826       m_APDZ(0),
0827       m_APDX1(0),
0828       m_APDX2(0),
0829 
0830       m_WebHere(0),
0831       m_WebPlName(""),
0832       m_WebClrName(""),
0833       m_WebPlMat(""),
0834       m_WebClrMat(""),
0835       m_vecWebPlTh(),
0836       m_vecWebClrTh(),
0837       m_vecWebLength(),
0838       m_IlyHere(0),
0839       m_IlyName(),
0840       m_IlyPhiLow(0),
0841       m_IlyDelPhi(0),
0842       m_vecIlyMat(),
0843       m_vecIlyThick(),
0844       m_IlyPipeName(""),
0845       m_IlyPipeHere(0),
0846       m_IlyPipeMat(""),
0847       m_IlyPipeOD(0),
0848       m_IlyPipeID(0),
0849       m_vecIlyPipeLength(),
0850       m_vecIlyPipeType(),
0851       m_vecIlyPipePhi(),
0852       m_vecIlyPipeZ(),
0853       m_IlyPTMName(""),
0854       m_IlyPTMHere(0),
0855       m_IlyPTMMat(""),
0856       m_IlyPTMWidth(0),
0857       m_IlyPTMLength(0),
0858       m_IlyPTMHeight(0),
0859       m_vecIlyPTMZ(),
0860       m_vecIlyPTMPhi(),
0861       m_IlyFanOutName(""),
0862       m_IlyFanOutHere(0),
0863       m_IlyFanOutMat(""),
0864       m_IlyFanOutWidth(0),
0865       m_IlyFanOutLength(0),
0866       m_IlyFanOutHeight(0),
0867       m_vecIlyFanOutZ(),
0868       m_vecIlyFanOutPhi(),
0869       m_IlyDiffName(""),
0870       m_IlyDiffMat(""),
0871       m_IlyDiffOff(0),
0872       m_IlyDiffLength(0),
0873       m_IlyBndlName(""),
0874       m_IlyBndlMat(""),
0875       m_IlyBndlOff(0),
0876       m_IlyBndlLength(0),
0877       m_IlyFEMName(""),
0878       m_IlyFEMMat(""),
0879       m_IlyFEMWidth(0),
0880       m_IlyFEMLength(0),
0881       m_IlyFEMHeight(0),
0882       m_vecIlyFEMZ(),
0883       m_vecIlyFEMPhi(),
0884       m_HawRName(""),
0885       m_FawName(""),
0886       m_FawHere(0),
0887       m_HawRHBIG(0),
0888       m_HawRhsml(0),
0889       m_HawRCutY(0),
0890       m_HawRCutZ(0),
0891       m_HawRCutDelY(0),
0892       m_HawYOffCry(0),
0893       m_NFawPerSupm(0),
0894       m_FawPhiOff(0),
0895       m_FawDelPhi(0),
0896       m_FawPhiRot(0),
0897       m_FawRadOff(0),
0898       m_GridHere(0),
0899       m_GridName(""),
0900       m_GridMat(""),
0901       m_GridThick(0),
0902       m_BackXOff(0),
0903       m_BackYOff(0),
0904       m_BackHere(0),
0905       m_BackSideName(""),
0906       m_BackSideHere(0),
0907       m_BackSideLength(0),
0908       m_BackSideHeight(0),
0909       m_BackSideWidth(0),
0910       m_BackSideYOff1(0),
0911       m_BackSideYOff2(0),
0912       m_BackSideAngle(0),
0913       m_BackSideMat(""),
0914       m_BackPlateName(""),
0915       m_BackPlateHere(0),
0916       m_BackPlateLength(0),
0917       m_BackPlateThick(0),
0918       m_BackPlateWidth(0),
0919       m_BackPlateMat(""),
0920       m_BackPlate2Name(""),
0921       m_BackPlate2Thick(0),
0922       m_BackPlate2Mat(""),
0923       m_GrilleName(""),
0924       m_GrilleHere(0),
0925       m_GrilleThick(0),
0926       m_GrilleWidth(0),
0927       m_GrilleZSpace(0),
0928       m_GrilleMat(""),
0929       m_vecGrilleHeight(),
0930       m_vecGrilleZOff(),
0931       m_GrEdgeSlotName(""),
0932       m_GrEdgeSlotMat(""),
0933       m_GrEdgeSlotHere(0),
0934       m_GrEdgeSlotHeight(0),
0935       m_GrEdgeSlotWidth(0),
0936       m_GrMidSlotName(""),
0937       m_GrMidSlotMat(""),
0938       m_GrMidSlotHere(0),
0939       m_GrMidSlotWidth(0),
0940       m_GrMidSlotXOff(0),
0941       m_vecGrMidSlotHeight(),
0942       m_BackPipeHere(0),
0943       m_BackPipeName(""),
0944       m_vecBackPipeDiam(),
0945       m_vecBackPipeThick(),
0946       m_BackPipeMat(""),
0947       m_BackPipeWaterMat(""),
0948 
0949       m_vecBackCoolName(),
0950       m_BackCoolHere(0),
0951       m_BackCoolBarHere(0),
0952       m_BackCoolBarWidth(0),
0953       m_BackCoolBarHeight(0),
0954       m_BackCoolMat(""),
0955       m_BackCoolBarName(""),
0956       m_BackCoolBarThick(0),
0957       m_BackCoolBarMat(""),
0958       m_BackCoolBarSSName(""),
0959       m_BackCoolBarSSThick(0),
0960       m_BackCoolBarSSMat(""),
0961       m_BackCoolBarWaName(""),
0962       m_BackCoolBarWaThick(0),
0963       m_BackCoolBarWaMat(""),
0964       m_BackCoolVFEHere(0),
0965       m_BackCoolVFEName(""),
0966       m_BackCoolVFEMat(""),
0967       m_BackVFEName(""),
0968       m_BackVFEMat(""),
0969       m_vecBackVFELyrThick(),
0970       m_vecBackVFELyrName(),
0971       m_vecBackVFELyrMat(),
0972       m_vecBackCoolNSec(),
0973       m_vecBackCoolSecSep(),
0974       m_vecBackCoolNPerSec(),
0975 
0976       m_BackMiscHere(0),
0977       m_vecBackMiscThick(),
0978       m_vecBackMiscName(),
0979       m_vecBackMiscMat(),
0980       m_BackCBStdSep(0),
0981       m_PatchPanelHere(0),
0982       m_PatchPanelName(""),
0983       m_vecPatchPanelThick(),
0984       m_vecPatchPanelNames(),
0985       m_vecPatchPanelMat(),
0986       m_BackCoolTankHere(0),
0987       m_BackCoolTankName(""),
0988       m_BackCoolTankWidth(0),
0989       m_BackCoolTankThick(0),
0990       m_BackCoolTankMat(""),
0991       m_BackCoolTankWaName(""),
0992       m_BackCoolTankWaWidth(0),
0993       m_BackCoolTankWaMat(""),
0994       m_BackBracketName(""),
0995       m_BackBracketHeight(0),
0996       m_BackBracketMat(""),
0997 
0998       m_DryAirTubeHere(0),
0999       m_DryAirTubeName(""),
1000       m_MBCoolTubeNum(0),
1001       m_DryAirTubeInnDiam(0),
1002       m_DryAirTubeOutDiam(0),
1003       m_DryAirTubeMat(""),
1004       m_MBCoolTubeHere(0),
1005       m_MBCoolTubeName(""),
1006       m_MBCoolTubeInnDiam(0),
1007       m_MBCoolTubeOutDiam(0),
1008       m_MBCoolTubeMat(""),
1009       m_MBManifHere(0),
1010       m_MBManifName(""),
1011       m_MBManifInnDiam(0),
1012       m_MBManifOutDiam(0),
1013       m_MBManifMat(""),
1014       m_MBLyrHere(0),
1015       m_vecMBLyrThick(0),
1016       m_vecMBLyrName(),
1017       m_vecMBLyrMat(),
1018 
1019       m_PincerRodHere(0),
1020       m_PincerRodName(""),
1021       m_PincerRodMat(""),
1022       m_vecPincerRodAzimuth(),
1023       m_PincerEnvName(""),
1024       m_PincerEnvMat(""),
1025       m_PincerEnvWidth(0),
1026       m_PincerEnvHeight(0),
1027       m_PincerEnvLength(0),
1028       m_vecPincerEnvZOff(),
1029       m_PincerBlkName(""),
1030       m_PincerBlkMat(""),
1031       m_PincerBlkLength(0),
1032       m_PincerShim1Name(""),
1033       m_PincerShimHeight(0),
1034       m_PincerShim2Name(""),
1035       m_PincerShimMat(""),
1036       m_PincerShim1Width(0),
1037       m_PincerShim2Width(0),
1038       m_PincerCutName(""),
1039       m_PincerCutMat(""),
1040       m_PincerCutWidth(0),
1041       m_PincerCutHeight(0)
1042 
1043 {
1044 #ifdef EDM_ML_DEBUG
1045   edm::LogVerbatim("EcalGeom") << "DDEcalBarrelAlgo info: Creating an instance";
1046 #endif
1047 }
1048 
1049 DDEcalBarrelAlgo::~DDEcalBarrelAlgo() {}
1050 
1051 void DDEcalBarrelAlgo::initialize(const DDNumericArguments& nArgs,
1052                                   const DDVectorArguments& vArgs,
1053                                   const DDMapArguments& /*mArgs*/,
1054                                   const DDStringArguments& sArgs,
1055                                   const DDStringVectorArguments& vsArgs) {
1056 #ifdef EDM_ML_DEBUG
1057   edm::LogVerbatim("EcalGeom") << "DDEcalBarrelAlgo info: Initialize";
1058 #endif
1059   m_idNameSpace = DDCurrentNamespace::ns();
1060   // TRICK!
1061   m_idNameSpace = parent().name().ns();
1062   // barrel parent volume
1063   m_BarName = sArgs["BarName"];
1064   m_BarMat = sArgs["BarMat"];
1065   m_vecBarZPts = vArgs["BarZPts"];
1066   m_vecBarRMin = vArgs["BarRMin"];
1067   m_vecBarRMax = vArgs["BarRMax"];
1068   m_vecBarTran = vArgs["BarTran"];
1069   m_vecBarRota = vArgs["BarRota"];
1070   m_vecBarRota2 = vArgs["BarRota2"];
1071   m_vecBarRota3 = vArgs["BarRota3"];
1072   m_BarPhiLo = nArgs["BarPhiLo"];
1073   m_BarPhiHi = nArgs["BarPhiHi"];
1074   m_BarHere = nArgs["BarHere"];
1075 
1076   m_SpmName = sArgs["SpmName"];
1077   m_SpmMat = sArgs["SpmMat"];
1078   m_vecSpmZPts = vArgs["SpmZPts"];
1079   m_vecSpmRMin = vArgs["SpmRMin"];
1080   m_vecSpmRMax = vArgs["SpmRMax"];
1081   m_vecSpmTran = vArgs["SpmTran"];
1082   m_vecSpmRota = vArgs["SpmRota"];
1083   m_vecSpmBTran = vArgs["SpmBTran"];
1084   m_vecSpmBRota = vArgs["SpmBRota"];
1085   m_SpmNPerHalf = static_cast<unsigned int>(nArgs["SpmNPerHalf"]);
1086   m_SpmLowPhi = nArgs["SpmLowPhi"];
1087   m_SpmDelPhi = nArgs["SpmDelPhi"];
1088   m_SpmPhiOff = nArgs["SpmPhiOff"];
1089   m_vecSpmHere = vArgs["SpmHere"];
1090   m_SpmCutName = sArgs["SpmCutName"];
1091   m_SpmCutThick = nArgs["SpmCutThick"];
1092   m_SpmCutShow = int(nArgs["SpmCutShow"]);
1093   m_vecSpmCutTM = vArgs["SpmCutTM"];
1094   m_vecSpmCutTP = vArgs["SpmCutTP"];
1095   m_SpmCutRM = nArgs["SpmCutRM"];
1096   m_SpmCutRP = nArgs["SpmCutRP"];
1097   m_SpmExpThick = nArgs["SpmExpThick"];
1098   m_SpmExpWide = nArgs["SpmExpWide"];
1099   m_SpmExpYOff = nArgs["SpmExpYOff"];
1100   m_SpmSideName = sArgs["SpmSideName"];
1101   m_SpmSideMat = sArgs["SpmSideMat"];
1102   m_SpmSideHigh = nArgs["SpmSideHigh"];
1103   m_SpmSideThick = nArgs["SpmSideThick"];
1104   m_SpmSideYOffM = nArgs["SpmSideYOffM"];
1105   m_SpmSideYOffP = nArgs["SpmSideYOffP"];
1106 
1107   m_NomCryDimAF = nArgs["NomCryDimAF"];
1108   m_NomCryDimLZ = nArgs["NomCryDimLZ"];
1109   m_vecNomCryDimBF = vArgs["NomCryDimBF"];
1110   m_vecNomCryDimCF = vArgs["NomCryDimCF"];
1111   m_vecNomCryDimAR = vArgs["NomCryDimAR"];
1112   m_vecNomCryDimBR = vArgs["NomCryDimBR"];
1113   m_vecNomCryDimCR = vArgs["NomCryDimCR"];
1114 
1115   m_UnderAF = nArgs["UnderAF"];
1116   m_UnderLZ = nArgs["UnderLZ"];
1117   m_UnderBF = nArgs["UnderBF"];
1118   m_UnderCF = nArgs["UnderCF"];
1119   m_UnderAR = nArgs["UnderAR"];
1120   m_UnderBR = nArgs["UnderBR"];
1121   m_UnderCR = nArgs["UnderCR"];
1122 
1123   m_WallThAlv = nArgs["WallThAlv"];
1124   m_WrapThAlv = nArgs["WrapThAlv"];
1125   m_ClrThAlv = nArgs["ClrThAlv"];
1126   m_vecGapAlvEta = vArgs["GapAlvEta"];
1127 
1128   m_WallFrAlv = nArgs["WallFrAlv"];
1129   m_WrapFrAlv = nArgs["WrapFrAlv"];
1130   m_ClrFrAlv = nArgs["ClrFrAlv"];
1131 
1132   m_WallReAlv = nArgs["WallReAlv"];
1133   m_WrapReAlv = nArgs["WrapReAlv"];
1134   m_ClrReAlv = nArgs["ClrReAlv"];
1135 
1136   m_NCryTypes = static_cast<unsigned int>(nArgs["NCryTypes"]);
1137   m_NCryPerAlvEta = static_cast<unsigned int>(nArgs["NCryPerAlvEta"]);
1138 
1139   m_CryName = sArgs["CryName"];
1140   m_ClrName = sArgs["ClrName"];
1141   m_WrapName = sArgs["WrapName"];
1142   m_WallName = sArgs["WallName"];
1143 
1144   m_CryMat = sArgs["CryMat"];
1145   m_ClrMat = sArgs["ClrMat"];
1146   m_WrapMat = sArgs["WrapMat"];
1147   m_WallMat = sArgs["WallMat"];
1148 
1149   m_APDName = sArgs["APDName"];
1150   m_APDHere = nArgs["APDHere"];
1151   m_APDMat = sArgs["APDMat"];
1152   m_APDSide = nArgs["APDSide"];
1153   m_APDThick = nArgs["APDThick"];
1154   m_APDZ = nArgs["APDZ"];
1155   m_APDX1 = nArgs["APDX1"];
1156   m_APDX2 = nArgs["APDX2"];
1157 
1158   m_WebHere = nArgs["WebHere"];
1159   m_WebPlName = sArgs["WebPlName"];
1160   m_WebClrName = sArgs["WebClrName"];
1161   m_WebPlMat = sArgs["WebPlMat"];
1162   m_WebClrMat = sArgs["WebClrMat"];
1163   m_vecWebPlTh = vArgs["WebPlTh"];
1164   m_vecWebClrTh = vArgs["WebClrTh"];
1165   m_vecWebLength = vArgs["WebLength"];
1166 
1167   m_IlyHere = nArgs["IlyHere"];
1168   m_IlyName = sArgs["IlyName"];
1169   m_IlyPhiLow = nArgs["IlyPhiLow"];
1170   m_IlyDelPhi = nArgs["IlyDelPhi"];
1171   m_vecIlyMat = vsArgs["IlyMat"];
1172   m_vecIlyThick = vArgs["IlyThick"];
1173 
1174   m_IlyPipeName = sArgs["IlyPipeName"];
1175   m_IlyPipeHere = nArgs["IlyPipeHere"];
1176   m_IlyPipeMat = sArgs["IlyPipeMat"];
1177   m_IlyPipeOD = nArgs["IlyPipeOD"];
1178   m_IlyPipeID = nArgs["IlyPipeID"];
1179   m_vecIlyPipeLength = vArgs["IlyPipeLength"];
1180   m_vecIlyPipeType = vArgs["IlyPipeType"];
1181   m_vecIlyPipePhi = vArgs["IlyPipePhi"];
1182   m_vecIlyPipeZ = vArgs["IlyPipeZ"];
1183 
1184   m_IlyPTMName = sArgs["IlyPTMName"];
1185   m_IlyPTMHere = nArgs["IlyPTMHere"];
1186   m_IlyPTMMat = sArgs["IlyPTMMat"];
1187   m_IlyPTMWidth = nArgs["IlyPTMWidth"];
1188   m_IlyPTMLength = nArgs["IlyPTMLength"];
1189   m_IlyPTMHeight = nArgs["IlyPTMHeight"];
1190   m_vecIlyPTMZ = vArgs["IlyPTMZ"];
1191   m_vecIlyPTMPhi = vArgs["IlyPTMPhi"];
1192 
1193   m_IlyFanOutName = sArgs["IlyFanOutName"];
1194   m_IlyFanOutHere = nArgs["IlyFanOutHere"];
1195   m_IlyFanOutMat = sArgs["IlyFanOutMat"];
1196   m_IlyFanOutWidth = nArgs["IlyFanOutWidth"];
1197   m_IlyFanOutLength = nArgs["IlyFanOutLength"];
1198   m_IlyFanOutHeight = nArgs["IlyFanOutHeight"];
1199   m_vecIlyFanOutZ = vArgs["IlyFanOutZ"];
1200   m_vecIlyFanOutPhi = vArgs["IlyFanOutPhi"];
1201   m_IlyDiffName = sArgs["IlyDiffName"];
1202   m_IlyDiffMat = sArgs["IlyDiffMat"];
1203   m_IlyDiffOff = nArgs["IlyDiffOff"];
1204   m_IlyDiffLength = nArgs["IlyDiffLength"];
1205   m_IlyBndlName = sArgs["IlyBndlName"];
1206   m_IlyBndlMat = sArgs["IlyBndlMat"];
1207   m_IlyBndlOff = nArgs["IlyBndlOff"];
1208   m_IlyBndlLength = nArgs["IlyBndlLength"];
1209   m_IlyFEMName = sArgs["IlyFEMName"];
1210   m_IlyFEMMat = sArgs["IlyFEMMat"];
1211   m_IlyFEMWidth = nArgs["IlyFEMWidth"];
1212   m_IlyFEMLength = nArgs["IlyFEMLength"];
1213   m_IlyFEMHeight = nArgs["IlyFEMHeight"];
1214   m_vecIlyFEMZ = vArgs["IlyFEMZ"];
1215   m_vecIlyFEMPhi = vArgs["IlyFEMPhi"];
1216 
1217   m_HawRName = sArgs["HawRName"];
1218   m_FawName = sArgs["FawName"];
1219   m_FawHere = nArgs["FawHere"];
1220   m_HawRHBIG = nArgs["HawRHBIG"];
1221   m_HawRhsml = nArgs["HawRhsml"];
1222   m_HawRCutY = nArgs["HawRCutY"];
1223   m_HawRCutZ = nArgs["HawRCutZ"];
1224   m_HawRCutDelY = nArgs["HawRCutDelY"];
1225   m_HawYOffCry = nArgs["HawYOffCry"];
1226 
1227   m_NFawPerSupm = static_cast<unsigned int>(nArgs["NFawPerSupm"]);
1228   m_FawPhiOff = nArgs["FawPhiOff"];
1229   m_FawDelPhi = nArgs["FawDelPhi"];
1230   m_FawPhiRot = nArgs["FawPhiRot"];
1231   m_FawRadOff = nArgs["FawRadOff"];
1232 
1233   m_GridHere = nArgs["GridHere"];
1234   m_GridName = sArgs["GridName"];
1235   m_GridMat = sArgs["GridMat"];
1236   m_GridThick = nArgs["GridThick"];
1237 
1238   m_BackHere = nArgs["BackHere"];
1239   m_BackXOff = nArgs["BackXOff"];
1240   m_BackYOff = nArgs["BackYOff"];
1241   m_BackSideName = sArgs["BackSideName"];
1242   m_BackSideHere = nArgs["BackSideHere"];
1243   m_BackSideLength = nArgs["BackSideLength"];
1244   m_BackSideHeight = nArgs["BackSideHeight"];
1245   m_BackSideWidth = nArgs["BackSideWidth"];
1246   m_BackSideYOff1 = nArgs["BackSideYOff1"];
1247   m_BackSideYOff2 = nArgs["BackSideYOff2"];
1248   m_BackSideAngle = nArgs["BackSideAngle"];
1249   m_BackSideMat = sArgs["BackSideMat"];
1250   m_BackPlateName = sArgs["BackPlateName"];
1251   m_BackPlateHere = nArgs["BackPlateHere"];
1252   m_BackPlateLength = nArgs["BackPlateLength"];
1253   m_BackPlateThick = nArgs["BackPlateThick"];
1254   m_BackPlateWidth = nArgs["BackPlateWidth"];
1255   m_BackPlateMat = sArgs["BackPlateMat"];
1256   m_BackPlate2Name = sArgs["BackPlate2Name"];
1257   m_BackPlate2Thick = nArgs["BackPlate2Thick"];
1258   m_BackPlate2Mat = sArgs["BackPlate2Mat"];
1259   m_GrilleName = sArgs["GrilleName"];
1260   m_GrilleHere = nArgs["GrilleHere"];
1261   m_GrilleThick = nArgs["GrilleThick"];
1262   m_GrilleWidth = nArgs["GrilleWidth"];
1263   m_GrilleZSpace = nArgs["GrilleZSpace"];
1264   m_GrilleMat = sArgs["GrilleMat"];
1265   m_vecGrilleHeight = vArgs["GrilleHeight"];
1266   m_vecGrilleZOff = vArgs["GrilleZOff"];
1267 
1268   m_GrEdgeSlotName = sArgs["GrEdgeSlotName"];
1269   m_GrEdgeSlotMat = sArgs["GrEdgeSlotMat"];
1270   m_GrEdgeSlotHere = nArgs["GrEdgeSlotHere"];
1271   m_GrEdgeSlotHeight = nArgs["GrEdgeSlotHeight"];
1272   m_GrEdgeSlotWidth = nArgs["GrEdgeSlotWidth"];
1273   m_GrMidSlotName = sArgs["GrMidSlotName"];
1274   m_GrMidSlotMat = sArgs["GrMidSlotMat"];
1275   m_GrMidSlotHere = nArgs["GrMidSlotHere"];
1276   m_GrMidSlotWidth = nArgs["GrMidSlotWidth"];
1277   m_GrMidSlotXOff = nArgs["GrMidSlotXOff"];
1278   m_vecGrMidSlotHeight = vArgs["GrMidSlotHeight"];
1279 
1280   m_BackPipeHere = nArgs["BackPipeHere"];
1281   m_BackPipeName = sArgs["BackPipeName"];
1282   m_vecBackPipeDiam = vArgs["BackPipeDiam"];
1283   m_vecBackPipeThick = vArgs["BackPipeThick"];
1284   m_BackPipeMat = sArgs["BackPipeMat"];
1285   m_BackPipeWaterMat = sArgs["BackPipeWaterMat"];
1286 
1287   m_BackCoolHere = nArgs["BackCoolHere"];
1288   m_vecBackCoolName = vsArgs["BackCoolName"];
1289   m_BackCoolBarHere = nArgs["BackCoolBarHere"];
1290   m_BackCoolBarWidth = nArgs["BackCoolBarWidth"];
1291   m_BackCoolBarHeight = nArgs["BackCoolBarHeight"];
1292   m_BackCoolMat = sArgs["BackCoolMat"];
1293   m_BackCoolBarName = sArgs["BackCoolBarName"];
1294   m_BackCoolBarThick = nArgs["BackCoolBarThick"];
1295   m_BackCoolBarMat = sArgs["BackCoolBarMat"];
1296   m_BackCoolBarSSName = sArgs["BackCoolBarSSName"];
1297   m_BackCoolBarSSThick = nArgs["BackCoolBarSSThick"];
1298   m_BackCoolBarSSMat = sArgs["BackCoolBarSSMat"];
1299   m_BackCoolBarWaName = sArgs["BackCoolBarWaName"];
1300   m_BackCoolBarWaThick = nArgs["BackCoolBarWaThick"];
1301   m_BackCoolBarWaMat = sArgs["BackCoolBarWaMat"];
1302   m_BackCoolVFEHere = nArgs["BackCoolVFEHere"];
1303   m_BackCoolVFEName = sArgs["BackCoolVFEName"];
1304   m_BackCoolVFEMat = sArgs["BackCoolVFEMat"];
1305   m_BackVFEName = sArgs["BackVFEName"];
1306   m_BackVFEMat = sArgs["BackVFEMat"];
1307   m_vecBackVFELyrThick = vArgs["BackVFELyrThick"];
1308   m_vecBackVFELyrName = vsArgs["BackVFELyrName"];
1309   m_vecBackVFELyrMat = vsArgs["BackVFELyrMat"];
1310   m_vecBackCoolNSec = vArgs["BackCoolNSec"];
1311   m_vecBackCoolSecSep = vArgs["BackCoolSecSep"];
1312   m_vecBackCoolNPerSec = vArgs["BackCoolNPerSec"];
1313   m_BackCBStdSep = nArgs["BackCBStdSep"];
1314 
1315   m_BackMiscHere = nArgs["BackMiscHere"];
1316   m_vecBackMiscThick = vArgs["BackMiscThick"];
1317   m_vecBackMiscName = vsArgs["BackMiscName"];
1318   m_vecBackMiscMat = vsArgs["BackMiscMat"];
1319   m_PatchPanelHere = nArgs["PatchPanelHere"];
1320   m_vecPatchPanelThick = vArgs["PatchPanelThick"];
1321   m_vecPatchPanelNames = vsArgs["PatchPanelNames"];
1322   m_vecPatchPanelMat = vsArgs["PatchPanelMat"];
1323   m_PatchPanelName = sArgs["PatchPanelName"];
1324 
1325   m_BackCoolTankHere = nArgs["BackCoolTankHere"];
1326   m_BackCoolTankName = sArgs["BackCoolTankName"];
1327   m_BackCoolTankWidth = nArgs["BackCoolTankWidth"];
1328   m_BackCoolTankThick = nArgs["BackCoolTankThick"];
1329   m_BackCoolTankMat = sArgs["BackCoolTankMat"];
1330   m_BackCoolTankWaName = sArgs["BackCoolTankWaName"];
1331   m_BackCoolTankWaWidth = nArgs["BackCoolTankWaWidth"];
1332   m_BackCoolTankWaMat = sArgs["BackCoolTankWaMat"];
1333   m_BackBracketName = sArgs["BackBracketName"];
1334   m_BackBracketHeight = nArgs["BackBracketHeight"];
1335   m_BackBracketMat = sArgs["BackBracketMat"];
1336 
1337   m_DryAirTubeHere = nArgs["DryAirTubeHere"];
1338   m_DryAirTubeName = sArgs["DryAirTubeName"];
1339   m_MBCoolTubeNum = static_cast<unsigned int>(nArgs["MBCoolTubeNum"]);
1340   m_DryAirTubeInnDiam = nArgs["DryAirTubeInnDiam"];
1341   m_DryAirTubeOutDiam = nArgs["DryAirTubeOutDiam"];
1342   m_DryAirTubeMat = sArgs["DryAirTubeMat"];
1343   m_MBCoolTubeHere = nArgs["MBCoolTubeHere"];
1344   m_MBCoolTubeName = sArgs["MBCoolTubeName"];
1345   m_MBCoolTubeInnDiam = nArgs["MBCoolTubeInnDiam"];
1346   m_MBCoolTubeOutDiam = nArgs["MBCoolTubeOutDiam"];
1347   m_MBCoolTubeMat = sArgs["MBCoolTubeMat"];
1348   m_MBManifHere = nArgs["MBManifHere"];
1349   m_MBManifName = sArgs["MBManifName"];
1350   m_MBManifInnDiam = nArgs["MBManifInnDiam"];
1351   m_MBManifOutDiam = nArgs["MBManifOutDiam"];
1352   m_MBManifMat = sArgs["MBManifMat"];
1353   m_MBLyrHere = nArgs["MBLyrHere"];
1354   m_vecMBLyrThick = vArgs["MBLyrThick"];
1355   m_vecMBLyrName = vsArgs["MBLyrName"];
1356   m_vecMBLyrMat = vsArgs["MBLyrMat"];
1357 
1358   m_PincerRodHere = nArgs["PincerRodHere"];
1359   m_PincerRodName = sArgs["PincerRodName"];
1360   m_PincerRodMat = sArgs["PincerRodMat"];
1361   m_vecPincerRodAzimuth = vArgs["PincerRodAzimuth"];
1362   m_PincerEnvName = sArgs["PincerEnvName"];
1363   m_PincerEnvMat = sArgs["PincerEnvMat"];
1364   m_PincerEnvWidth = nArgs["PincerEnvWidth"];
1365   m_PincerEnvHeight = nArgs["PincerEnvHeight"];
1366   m_PincerEnvLength = nArgs["PincerEnvLength"];
1367   m_vecPincerEnvZOff = vArgs["PincerEnvZOff"];
1368   m_PincerBlkName = sArgs["PincerBlkName"];
1369   m_PincerBlkMat = sArgs["PincerBlkMat"];
1370   m_PincerBlkLength = nArgs["PincerBlkLength"];
1371   m_PincerShim1Name = sArgs["PincerShim1Name"];
1372   m_PincerShimHeight = nArgs["PincerShimHeight"];
1373   m_PincerShim2Name = sArgs["PincerShim2Name"];
1374   m_PincerShimMat = sArgs["PincerShimMat"];
1375   m_PincerShim1Width = nArgs["PincerShim1Width"];
1376   m_PincerShim2Width = nArgs["PincerShim2Width"];
1377   m_PincerCutName = sArgs["PincerCutName"];
1378   m_PincerCutMat = sArgs["PincerCutMat"];
1379   m_PincerCutWidth = nArgs["PincerCutWidth"];
1380   m_PincerCutHeight = nArgs["PincerCutHeight"];
1381 
1382 #ifdef EDM_ML_DEBUG
1383   edm::LogVerbatim("EcalGeom") << "DDEcalBarrelAlgo info: end initialize";
1384 #endif
1385 }
1386 
1387 ////////////////////////////////////////////////////////////////////
1388 // DDEcalBarrelAlgo methods...
1389 ////////////////////////////////////////////////////////////////////
1390 
1391 void DDEcalBarrelAlgo::execute(DDCompactView& cpv) {
1392 #ifdef EDM_ML_DEBUG
1393   edm::LogVerbatim("EcalGeom") << "******** DDEcalBarrelAlgo execute!" << std::endl;
1394 #endif
1395   if (barHere() != 0) {
1396     const unsigned int copyOne(1);
1397     const unsigned int copyTwo(2);
1398     // Barrel parent volume----------------------------------------------------------
1399     cpv.position(
1400         DDLogicalPart(barName(),
1401                       barMat(),
1402                       DDSolidFactory::polycone(
1403                           barName(), barPhiLo(), (barPhiHi() - barPhiLo()), vecBarZPts(), vecBarRMin(), vecBarRMax())),
1404         parent().name(),
1405         copyOne,
1406         DDTranslation(vecBarTran()[0], vecBarTran()[1], vecBarTran()[2]),
1407         myrot(barName().name() + "Rot",
1408               Rota(Vec3(vecBarRota3()[0], vecBarRota3()[1], vecBarRota3()[2]), vecBarRota3()[3]) *
1409                   Rota(Vec3(vecBarRota2()[0], vecBarRota2()[1], vecBarRota2()[2]), vecBarRota2()[3]) *
1410                   Rota(Vec3(vecBarRota()[0], vecBarRota()[1], vecBarRota()[2]), vecBarRota()[3])));
1411     // End Barrel parent volume----------------------------------------------------------
1412 
1413     // Supermodule parent------------------------------------------------------------
1414 
1415     const DDName spmcut1ddname((0 != spmCutShow()) ? spmName() : ddname(m_SpmName + "CUT1"));
1416     const DDSolid ddspm(
1417         DDSolidFactory::polycone(spmcut1ddname, spmLowPhi(), spmDelPhi(), vecSpmZPts(), vecSpmRMin(), vecSpmRMax()));
1418 
1419     const unsigned int indx(vecSpmRMax().size() / 2);
1420 
1421     // Deal with the cut boxes first
1422     const DDSolid spmCutBox(DDSolidFactory::box(spmCutName(),
1423                                                 1.05 * (vecSpmRMax()[indx] - vecSpmRMin()[indx]) / 2.,
1424                                                 spmCutThick() / 2.,
1425                                                 fabs(vecSpmZPts().back() - vecSpmZPts().front()) / 2. + 1 * mm));
1426     const std::vector<double>& cutBoxParms(spmCutBox.parameters());
1427     const DDLogicalPart spmCutLog(spmCutName(), spmMat(), spmCutBox);
1428 
1429     // Now the expansion box
1430     const double xExp(spmExpThick() / 2.);
1431     const double yExp(spmExpWide() / 2.);
1432     const double zExp(fabs(vecSpmZPts().back() - vecSpmZPts().front()) / 2.);
1433     const DDName expName(m_SpmName + "EXP");
1434     const DDSolid spmExpBox(DDSolidFactory::box(expName, xExp, yExp, zExp));
1435     const DDTranslation expTra(vecSpmRMax().back() - xExp, spmExpYOff(), vecSpmZPts().front() + zExp);
1436     const DDLogicalPart expLog(expName, spmMat(), spmExpBox);
1437 
1438     // Supermodule side platess
1439     const DDSolid sideSolid(DDSolidFactory::box(
1440         spmSideName(), spmSideHigh() / 2., spmSideThick() / 2., fabs(vecSpmZPts()[1] - vecSpmZPts()[0]) / 2.));
1441     const std::vector<double>& sideParms(sideSolid.parameters());
1442     const DDLogicalPart sideLog(spmSideName(), spmSideMat(), sideSolid);
1443 
1444     DDSolid temp1;
1445     DDSolid temp2;
1446     for (unsigned int icopy(1); icopy <= 2; ++icopy) {
1447       const std::vector<double>& tvec(1 == icopy ? vecSpmCutTM() : vecSpmCutTP());
1448       const double rang(1 == icopy ? spmCutRM() : spmCutRP());
1449 
1450       const Tl3D tr(tvec[0], tvec[1], tvec[2]);
1451       const RoZ3D ro(rang);
1452       const Tf3D alltrot(
1453           RoZ3D(1 == icopy ? spmLowPhi() : spmLowPhi() + spmDelPhi()) *
1454           Tl3D((vecSpmRMax()[indx] + vecSpmRMin()[indx]) / 2., 0, (vecSpmZPts().front() + vecSpmZPts().back()) / 2.) *
1455           tr * ro);
1456 
1457       const DDRotation ddrot(myrot(spmCutName().name() + std::to_string(icopy), alltrot.getRotation()));
1458       const DDTranslation ddtra(alltrot.getTranslation());
1459 
1460       const Tl3D trSide(tvec[0],
1461                         tvec[1] + (1 == icopy ? 1. : -1.) * (cutBoxParms[1] + sideParms[1]) +
1462                             (1 == icopy ? spmSideYOffM() : spmSideYOffP()),
1463                         tvec[2]);
1464       const RoZ3D roSide(rang);
1465       const Tf3D sideRot(RoZ3D(1 == icopy ? spmLowPhi() : spmLowPhi() + spmDelPhi()) *
1466                          Tl3D(vecSpmRMin().front() + sideParms[0], 0, vecSpmZPts().front() + sideParms[2]) * trSide *
1467                          roSide);
1468 
1469       const DDRotation sideddrot(myrot(spmSideName().name() + std::to_string(icopy), sideRot.getRotation()));
1470       const DDTranslation sideddtra(sideRot.getTranslation());
1471 
1472       cpv.position(sideLog, spmName(), icopy, sideddtra, sideddrot);
1473 
1474       if (0 != spmCutShow())  // do this if we are "showing" the boxes
1475       {
1476         cpv.position(spmCutLog, spmName(), icopy, ddtra, ddrot);
1477       } else  // do this if we are subtracting the boxes
1478       {
1479         if (1 == icopy) {
1480           temp1 = DDSolidFactory::subtraction(DDName(m_SpmName + "_T1"), spmcut1ddname, spmCutBox, ddtra, ddrot);
1481         } else {
1482           temp2 = DDSolidFactory::subtraction(spmName(), temp1, spmCutBox, ddtra, ddrot);
1483         }
1484       }
1485     }
1486 
1487     const DDLogicalPart spmLog(spmName(), spmMat(), ((0 != spmCutShow()) ? ddspm : temp2));
1488 
1489     const double dphi(360. * deg / (1. * spmNPerHalf()));
1490     for (unsigned int iphi(0); iphi < 2 * spmNPerHalf(); ++iphi) {
1491       const double phi(iphi * dphi + spmPhiOff());  //- 0.000130/deg ) ;
1492 
1493       // this base rotation includes the base translation & rotation
1494       // plus flipping for the negative z hemisphere, plus
1495       // the phi rotation for this module
1496       const Tf3D rotaBase(RoZ3D(phi) * (iphi < spmNPerHalf() ? Ro3D() : RoX3D(180. * deg)) *
1497                           Ro3D(vecSpmBRota()[3], Vec3(vecSpmBRota()[0], vecSpmBRota()[1], vecSpmBRota()[2])) *
1498                           Tl3D(Vec3(vecSpmBTran()[0], vecSpmBTran()[1], vecSpmBTran()[2])));
1499 
1500       // here the individual rotations & translations of the supermodule
1501       // are implemented on top of the overall "base" rotation & translation
1502 
1503       const unsigned int offr(4 * iphi);
1504       const unsigned int offt(3 * iphi);
1505 
1506       const Ro3D r1(vecSpmRota()[offr + 3],
1507                     Vec3(vecSpmRota()[offr + 0], vecSpmRota()[offr + 1], vecSpmRota()[offr + 2]));
1508 
1509       const Tf3D rotaExtra(r1 * Tl3D(Vec3(vecSpmTran()[offt + 0], vecSpmTran()[offt + 1], vecSpmTran()[offt + 2])));
1510 
1511       const Tf3D both(rotaExtra * rotaBase);
1512 
1513       const DDRotation rota(myrot(spmName().name() + std::to_string(phi / deg), both.getRotation()));
1514 
1515       if (vecSpmHere()[iphi] != 0) {
1516         // convert from CLHEP to DDTranslation & etc. -- Michael Case
1517         DDTranslation myTran(both.getTranslation().x(), both.getTranslation().y(), both.getTranslation().z());
1518         cpv.position(spmLog, barName(), iphi + 1, myTran, rota);
1519       }
1520     }
1521     // End Supermodule parent------------------------------------------------------------
1522 
1523     // Begin Inner Layer volumes---------------------------------------------------------
1524     const double ilyLength(vecSpmZPts()[1] - vecSpmZPts()[0]);
1525     double ilyRMin(vecSpmRMin()[0]);
1526     double ilyThick(0);
1527     for (unsigned int ilyx(0); ilyx != vecIlyThick().size(); ++ilyx) {
1528       ilyThick += vecIlyThick()[ilyx];
1529     }
1530     const DDName ilyDDName(ddname(ilyName()));
1531     const DDSolid ilySolid(
1532         DDSolidFactory::tubs(ilyDDName, ilyLength / 2, ilyRMin, ilyRMin + ilyThick, ilyPhiLow(), ilyDelPhi()));
1533     const DDLogicalPart ilyLog(ilyDDName, spmMat(), ilySolid);
1534     cpv.position(ilyLog, spmLog, copyOne, DDTranslation(0, 0, ilyLength / 2), DDRotation());
1535 
1536     DDLogicalPart ilyPipeLog[200];
1537 
1538     if (0 != ilyPipeHere()) {
1539       for (unsigned int iPipeType(0); iPipeType != vecIlyPipeLength().size(); ++iPipeType) {
1540         const DDName pName(ddname(ilyPipeName() + "_" + std::to_string(iPipeType + 1)));
1541 
1542         DDSolid ilyPipeSolid(
1543             DDSolidFactory::tubs(pName, vecIlyPipeLength()[iPipeType] / 2., 0, ilyPipeOD() / 2, 0 * deg, 360 * deg));
1544         ilyPipeLog[iPipeType] = DDLogicalPart(pName, ilyPipeMat(), ilyPipeSolid);
1545 
1546         const DDName pWaName(ddname(ilyPipeName() + "Wa_" + std::to_string(iPipeType + 1)));
1547         DDSolid ilyPipeWaSolid(
1548             DDSolidFactory::tubs(pWaName, vecIlyPipeLength()[iPipeType] / 2., 0, ilyPipeID() / 2, 0 * deg, 360 * deg));
1549         const DDLogicalPart ilyPipeWaLog(pWaName, backPipeWaterMat(), ilyPipeWaSolid);
1550 
1551         cpv.position(ilyPipeWaLog, pName, copyOne, DDTranslation(0, 0, 0), DDRotation());
1552       }
1553     }
1554 
1555     DDSolid ilyPTMSolid(
1556         DDSolidFactory::box(ilyPTMName(), ilyPTMHeight() / 2., ilyPTMWidth() / 2., ilyPTMLength() / 2.));
1557     const DDLogicalPart ilyPTMLog(ilyPTMName(), ilyPTMMat(), ilyPTMSolid);
1558 
1559     DDSolid ilyFanOutSolid(
1560         DDSolidFactory::box(ilyFanOutName(), ilyFanOutHeight() / 2., ilyFanOutWidth() / 2., ilyFanOutLength() / 2.));
1561     const DDLogicalPart ilyFanOutLog(ilyFanOutName(), ilyFanOutMat(), ilyFanOutSolid);
1562 
1563     DDSolid ilyFEMSolid(
1564         DDSolidFactory::box(ilyFEMName(), ilyFEMHeight() / 2., ilyFEMWidth() / 2., ilyFEMLength() / 2.));
1565     const DDLogicalPart ilyFEMLog(ilyFEMName(), ilyFEMMat(), ilyFEMSolid);
1566 
1567     DDSolid ilyDiffSolid(
1568         DDSolidFactory::box(ilyDiffName(), ilyFanOutHeight() / 2., ilyFanOutWidth() / 2., ilyDiffLength() / 2.));
1569     const DDLogicalPart ilyDiffLog(ilyDiffName(), ilyDiffMat(), ilyDiffSolid);
1570 
1571     DDSolid ilyBndlSolid(
1572         DDSolidFactory::box(ilyBndlName(), ilyFanOutHeight() / 2., ilyFanOutWidth() / 2., ilyBndlLength() / 2.));
1573     const DDLogicalPart ilyBndlLog(ilyBndlName(), ilyBndlMat(), ilyBndlSolid);
1574     cpv.position(ilyDiffLog,
1575                  ilyFanOutName(),
1576                  copyOne,
1577                  DDTranslation(0, 0, -ilyFanOutLength() / 2 + ilyDiffLength() / 2 + ilyDiffOff()),
1578                  DDRotation());
1579     cpv.position(ilyBndlLog,
1580                  ilyFanOutName(),
1581                  copyOne,
1582                  DDTranslation(0, 0, -ilyFanOutLength() / 2 + ilyBndlLength() / 2 + ilyBndlOff()),
1583                  DDRotation());
1584 
1585     for (unsigned int ily(0); ily != vecIlyThick().size(); ++ily) {
1586       const double ilyRMax(ilyRMin + vecIlyThick()[ily]);
1587       const DDName xilyName(ddname(ilyName() + std::to_string(ily)));
1588       const DDSolid xilySolid(
1589           DDSolidFactory::tubs(xilyName, ilyLength / 2, ilyRMin, ilyRMax, ilyPhiLow(), ilyDelPhi()));
1590 
1591       const DDLogicalPart xilyLog(xilyName, ddmat(vecIlyMat()[ily]), xilySolid);
1592 
1593       if (0 != ilyHere()) {
1594         cpv.position(xilyLog, ilyLog, copyOne, DDTranslation(0, 0, 0), DDRotation());
1595 
1596         unsigned int copyNum[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
1597 
1598         if (10 * mm < vecIlyThick()[ily] && vecIlyThick().size() != (ily + 1) && 0 != ilyPipeHere()) {
1599           if (0 != ilyPTMHere()) {
1600             unsigned int ptmCopy(0);
1601             for (unsigned int ilyPTM(0); ilyPTM != vecIlyPTMZ().size(); ++ilyPTM) {
1602               const double radius(ilyRMax - 1 * mm - ilyPTMHeight() / 2.);
1603               const double phi(vecIlyPTMPhi()[ilyPTM]);
1604               const double yy(radius * sin(phi));
1605               const double xx(radius * cos(phi));
1606               ++ptmCopy;
1607               cpv.position(ilyPTMLog,
1608                            xilyLog,
1609                            ptmCopy,
1610                            DDTranslation(xx, yy, vecIlyPTMZ()[ilyPTM] - ilyLength / 2),
1611                            myrot(ilyPTMLog.name().name() + "_rot" + std::to_string(ptmCopy), CLHEP::HepRotationZ(phi)));
1612             }
1613           }
1614           if (0 != ilyFanOutHere()) {
1615             unsigned int fanOutCopy(0);
1616             for (unsigned int ilyFO(0); ilyFO != vecIlyFanOutZ().size(); ++ilyFO) {
1617               const double radius(ilyRMax - 1 * mm - ilyFanOutHeight() / 2.);
1618               const double phi(vecIlyFanOutPhi()[ilyFO]);
1619               const double yy(radius * sin(phi));
1620               const double xx(radius * cos(phi));
1621               ++fanOutCopy;
1622               cpv.position(ilyFanOutLog,
1623                            xilyLog,
1624                            fanOutCopy,
1625                            DDTranslation(xx, yy, vecIlyFanOutZ()[ilyFO] - ilyLength / 2),
1626                            myrot(ilyFanOutLog.name().name() + "_rot" + std::to_string(fanOutCopy),
1627                                  CLHEP::HepRotationZ(phi) * CLHEP::HepRotationY(180 * deg)));
1628             }
1629             unsigned int femCopy(0);
1630             for (unsigned int ilyFEM(0); ilyFEM != vecIlyFEMZ().size(); ++ilyFEM) {
1631               const double radius(ilyRMax - 1 * mm - ilyFEMHeight() / 2.);
1632               const double phi(vecIlyFEMPhi()[ilyFEM]);
1633               const double yy(radius * sin(phi));
1634               const double xx(radius * cos(phi));
1635               ++femCopy;
1636               cpv.position(ilyFEMLog,
1637                            xilyLog,
1638                            femCopy,
1639                            DDTranslation(xx, yy, vecIlyFEMZ()[ilyFEM] - ilyLength / 2),
1640                            myrot(ilyFEMLog.name().name() + "_rot" + std::to_string(femCopy), CLHEP::HepRotationZ(phi)));
1641             }
1642           }
1643           for (unsigned int iPipe(0); iPipe != vecIlyPipePhi().size(); ++iPipe) {
1644             const unsigned int type(static_cast<unsigned int>(round(vecIlyPipeType()[iPipe])));
1645 #ifdef EDM_ML_DEBUG
1646             edm::LogVerbatim("EcalGeom") << " iPipe, type= " << iPipe << ", " << type;
1647 #endif
1648             const double zz(-ilyLength / 2 + vecIlyPipeZ()[iPipe] + (9 > type ? vecIlyPipeLength()[type] / 2. : 0));
1649 
1650             for (unsigned int ly(0); ly != 2; ++ly) {
1651               const double radius(0 == ly ? ilyRMin + ilyPipeOD() / 2. + 1 * mm : ilyRMax - ilyPipeOD() / 2. - 1 * mm);
1652               const double phi(vecIlyPipePhi()[iPipe]);
1653               const double yy(radius * sin(phi));
1654               const double xx(radius * cos(phi));
1655               ++copyNum[type],
1656                   cpv.position(
1657                       ilyPipeLog[type],
1658                       xilyLog,
1659                       copyNum[type],
1660                       DDTranslation(xx, yy, zz),
1661                       (9 > type ? DDRotation()
1662                                 : myrot(ilyPipeLog[type].name().name() + "_rot" + std::to_string(copyNum[type]),
1663                                         Rota(Vec3(xx, yy, 0), 90 * deg))));
1664             }
1665           }
1666         }
1667       }
1668       ilyRMin = ilyRMax;
1669     }
1670     // End Inner Layer volumes---------------------------------------------------------
1671 
1672     const DDName clyrName(DDName("ECLYR"));
1673     std::vector<double> cri;
1674     std::vector<double> cro;
1675     std::vector<double> czz;
1676     czz.emplace_back(vecSpmZPts()[1]);
1677     cri.emplace_back(vecSpmRMin()[0]);
1678     cro.emplace_back(vecSpmRMin()[0] + 25 * mm);
1679     czz.emplace_back(vecSpmZPts()[2]);
1680     cri.emplace_back(vecSpmRMin()[2]);
1681     cro.emplace_back(vecSpmRMin()[2] + 10 * mm);
1682     const DDSolid clyrSolid(DDSolidFactory::polycone(clyrName, -9.5 * deg, 19 * deg, czz, cri, cro));
1683     const DDLogicalPart clyrLog(clyrName, ddmat(vecIlyMat()[4]), clyrSolid);
1684     cpv.position(clyrLog, spmLog, copyOne, DDTranslation(0, 0, 0), DDRotation());
1685 
1686     // Begin Alveolar Wedge parent ------------------------------------------------------
1687     //----------------
1688 
1689     // the next few lines accumulate dimensions appropriate to crystal type 1
1690     // which we use to set some of the features of the half-alveolar wedge (hawR).
1691 
1692     //      const double ANom1 ( vecNomCryDimAR()[0] ) ;
1693     const double BNom1(vecNomCryDimCR()[0]);
1694     const double bNom1(vecNomCryDimCF()[0]);
1695     //      const double HNom1 ( vecNomCryDimBR()[0] ) ;
1696     //      const double hNom1 ( vecNomCryDimBF()[0] ) ;
1697     const double sWall1(wallThAlv());
1698     const double fWall1(wallFrAlv());
1699     //      const double rWall1( wallReAlv() ) ;
1700     const double sWrap1(wrapThAlv());
1701     const double fWrap1(wrapFrAlv());
1702     //      const double rWrap1( wrapReAlv() ) ;
1703     const double sClr1(clrThAlv());
1704     const double fClr1(clrFrAlv());
1705     //      const double rClr1 ( clrReAlv() ) ;
1706     const double LNom1(nomCryDimLZ());
1707     const double beta1(atan((BNom1 - bNom1) / LNom1));
1708     //      const double cosbeta1   ( cos( beta1 ) ) ;
1709     const double sinbeta1(sin(beta1));
1710 
1711     const double tana_hawR((BNom1 - bNom1) / LNom1);
1712 
1713     const double H_hawR(hawRHBIG());
1714     const double h_hawR(hawRhsml());
1715     const double a_hawR(bNom1 + sClr1 + 2 * sWrap1 + 2 * sWall1 - sinbeta1 * (fClr1 + fWrap1 + fWall1));
1716     const double B_hawR(a_hawR + H_hawR * tana_hawR);
1717     const double b_hawR(a_hawR + h_hawR * tana_hawR);
1718     const double L_hawR(vecSpmZPts()[2]);
1719 
1720     const Trap trapHAWR(a_hawR / 2.,  //double aHalfLengthXNegZLoY , // bl1, A/2
1721                         a_hawR / 2.,  //double aHalfLengthXPosZLoY , // bl2, a/2
1722                         b_hawR / 2.,  //double aHalfLengthXPosZHiY , // tl2, b/2
1723                         H_hawR / 2.,  //double aHalfLengthYNegZ    , // h1, H/2
1724                         h_hawR / 2.,  //double aHalfLengthYPosZ    , // h2, h/2
1725                         L_hawR / 2.,  //double aHalfLengthZ        , // dz,  L/2
1726                         90 * deg,     //double aAngleAD            , // alfa1
1727                         0,            //double aCoord15X           , // x15
1728                         0             //double aCoord15Y             // y15
1729     );
1730 
1731     const DDName hawRName1(ddname(hawRName().name() + "1"));
1732     const DDSolid hawRSolid1(mytrap(hawRName1.name(), trapHAWR));
1733     const DDLogicalPart hawRLog1(hawRName1, spmMat(), hawRSolid1);
1734 
1735     const double al1_fawR(atan((B_hawR - a_hawR) / H_hawR) + M_PI_2);
1736 
1737     // here is trap for Full Alveolar Wedge
1738     const Trap trapFAW(a_hawR,       //double aHalfLengthXNegZLoY , // bl1, A/2
1739                        a_hawR,       //double aHalfLengthXPosZLoY , // bl2, a/2
1740                        b_hawR,       //double aHalfLengthXPosZHiY , // tl2, b/2
1741                        H_hawR / 2.,  //double aHalfLengthYNegZ    , // h1, H/2
1742                        h_hawR / 2.,  //double aHalfLengthYPosZ    , // h2, h/2
1743                        L_hawR / 2.,  //double aHalfLengthZ        , // dz,  L/2
1744                        al1_fawR,     //double aAngleAD            , // alfa1
1745                        0,            //double aCoord15X           , // x15
1746                        0             //double aCoord15Y             // y15
1747     );
1748 
1749     const DDName fawName1(ddname(fawName().name() + "1"));
1750     const DDSolid fawSolid1(mytrap(fawName1.name(), trapFAW));
1751     const DDLogicalPart fawLog1(fawName1, spmMat(), fawSolid1);
1752 
1753     const Trap::VertexList vHAW(trapHAWR.vertexList());
1754     const Trap::VertexList vFAW(trapFAW.vertexList());
1755 
1756     const double hawBoxClr(1 * mm);
1757 
1758     // HAW cut box to cut off back end of wedge
1759     const DDName hawCutName(ddname(hawRName().name() + "CUTBOX"));
1760     const DDSolid hawCutBox(DDSolidFactory::box(hawCutName, b_hawR / 2 + hawBoxClr, hawRCutY() / 2, hawRCutZ() / 2));
1761     const std::vector<double>& hawBoxParms(hawCutBox.parameters());
1762     const DDLogicalPart hawCutLog(hawCutName, spmMat(), hawCutBox);
1763 
1764     const Pt3D b1(hawBoxParms[0], hawBoxParms[1], hawBoxParms[2]);
1765     const Pt3D b2(-hawBoxParms[0], hawBoxParms[1], hawBoxParms[2]);
1766     const Pt3D b3(-hawBoxParms[0], hawBoxParms[1], -hawBoxParms[2]);
1767 
1768     const double zDel(sqrt(4 * hawBoxParms[2] * hawBoxParms[2] - (h_hawR - hawRCutDelY()) * (h_hawR - hawRCutDelY())));
1769 
1770     const Tf3D hawCutForm(b1,
1771                           b2,
1772                           b3,
1773                           vHAW[2] + Pt3D(hawBoxClr, -hawRCutDelY(), 0),
1774                           vHAW[1] + Pt3D(-hawBoxClr, -hawRCutDelY(), 0),
1775                           Pt3D(vHAW[0].x() - hawBoxClr, vHAW[0].y(), vHAW[0].z() - zDel));
1776 
1777     const DDSolid hawRSolid(DDSolidFactory::subtraction(
1778         hawRName(),
1779         hawRSolid1,
1780         hawCutBox,
1781         DDTranslation(
1782             hawCutForm.getTranslation().x(), hawCutForm.getTranslation().y(), hawCutForm.getTranslation().z()),
1783         myrot(hawCutName.name() + "R", hawCutForm.getRotation())));
1784     const DDLogicalPart hawRLog(hawRName(), spmMat(), hawRSolid);
1785 
1786     // FAW cut box to cut off back end of wedge
1787     const DDName fawCutName(ddname(fawName().name() + "CUTBOX"));
1788     const DDSolid fawCutBox(DDSolidFactory::box(fawCutName, 2 * hawBoxParms[0], hawBoxParms[1], hawBoxParms[2]));
1789 
1790     const std::vector<double>& fawBoxParms(fawCutBox.parameters());
1791     const DDLogicalPart fawCutLog(fawCutName, spmMat(), fawCutBox);
1792 
1793     const Pt3D bb1(fawBoxParms[0], fawBoxParms[1], fawBoxParms[2]);
1794     const Pt3D bb2(-fawBoxParms[0], fawBoxParms[1], fawBoxParms[2]);
1795     const Pt3D bb3(-fawBoxParms[0], fawBoxParms[1], -fawBoxParms[2]);
1796 
1797     const Tf3D fawCutForm(bb1,
1798                           bb2,
1799                           bb3,
1800                           vFAW[2] + Pt3D(2 * hawBoxClr, -5 * mm, 0),
1801                           vFAW[1] + Pt3D(-2 * hawBoxClr, -5 * mm, 0),
1802                           Pt3D(vFAW[1].x() - 2 * hawBoxClr, vFAW[1].y() - trapFAW.h(), vFAW[1].z() - zDel));
1803 
1804     const DDSolid fawSolid(DDSolidFactory::subtraction(
1805         fawName(),
1806         fawSolid1,
1807         fawCutBox,
1808         DDTranslation(
1809             fawCutForm.getTranslation().x(), fawCutForm.getTranslation().y(), fawCutForm.getTranslation().z()),
1810         myrot(fawCutName.name() + "R", fawCutForm.getRotation())));
1811     const DDLogicalPart fawLog(fawName(), spmMat(), fawSolid);
1812 
1813     const Tf3D hawRform(vHAW[3],
1814                         vHAW[0],
1815                         vHAW[1],  // HAW inside FAW
1816                         vFAW[3],
1817                         0.5 * (vFAW[0] + vFAW[3]),
1818                         0.5 * (vFAW[1] + vFAW[2]));
1819     cpv.position(
1820         hawRLog,
1821         fawLog,
1822         copyOne,
1823         DDTranslation(hawRform.getTranslation().x(), hawRform.getTranslation().y(), hawRform.getTranslation().z()),
1824         myrot(hawRName().name() + "R", hawRform.getRotation()));
1825 
1826     cpv.position(
1827         hawRLog,
1828         fawLog,
1829         copyTwo,
1830         DDTranslation(-hawRform.getTranslation().x(), -hawRform.getTranslation().y(), -hawRform.getTranslation().z()),
1831         myrot(hawRName().name() + "RotRefl",
1832               CLHEP::HepRotationY(180 * deg) *  // rotate about Y after refl thru Z
1833                   CLHEP::HepRep3x3(1, 0, 0, 0, 1, 0, 0, 0, -1)));
1834 
1835     /* this for display of haw cut box instead of subtraction
1836       cpv.position( hawCutLog,
1837          hawRName, 
1838          copyOne, 
1839          hawCutForm.getTranslation(),
1840          myrot( hawCutName.name()+"R", 
1841             hawCutForm.getRotation() )   ) ;
1842 */
1843 
1844     for (unsigned int iPhi(1); iPhi <= nFawPerSupm(); ++iPhi) {
1845       const double rPhi(fawPhiOff() + (iPhi - 0.5) * fawDelPhi());
1846 
1847       const Tf3D fawform(RoZ3D(rPhi) * Tl3D(fawRadOff() + (trapFAW.H() + trapFAW.h()) / 4, 0, trapFAW.L() / 2) *
1848                          RoZ3D(-90 * deg + fawPhiRot()));
1849       if (fawHere())
1850         cpv.position(
1851             fawLog,
1852             spmLog,
1853             iPhi,
1854             DDTranslation(fawform.getTranslation().x(), fawform.getTranslation().y(), fawform.getTranslation().z()),
1855             myrot(fawName().name() + "_Rot" + std::to_string(iPhi), fawform.getRotation()));
1856     }
1857 
1858     // End Alveolar Wedge parent ------------------------------------------------------
1859 
1860     // Begin Grid + Tablet insertion
1861 
1862     const double h_Grid(gridThick());
1863 
1864     const Trap trapGrid((B_hawR - h_Grid * (B_hawR - a_hawR) / H_hawR) / 2,  // bl1, A/2
1865                         (b_hawR - h_Grid * (B_hawR - a_hawR) / H_hawR) / 2,  // bl2, a/2
1866                         b_hawR / 2.,                                         // tl2, b/2
1867                         h_Grid / 2.,                                         // h1, H/2
1868                         h_Grid / 2.,                                         // h2, h/2
1869                         (L_hawR - 8 * cm) / 2.,                              // dz,  L/2
1870                         90 * deg,                                            // alfa1
1871                         0,                                                   // x15
1872                         H_hawR - h_hawR                                      // y15
1873     );
1874 
1875     const DDSolid gridSolid(mytrap(gridName().name(), trapGrid));
1876     const DDLogicalPart gridLog(gridName(), gridMat(), gridSolid);
1877 
1878     const Trap::VertexList vGrid(trapGrid.vertexList());
1879 
1880     const Tf3D gridForm(vGrid[4],
1881                         vGrid[5],
1882                         vGrid[6],  // Grid inside HAW
1883                         vHAW[5] - Pt3D(0, h_Grid, 0),
1884                         vHAW[5],
1885                         vHAW[6]);
1886 
1887     if (0 != gridHere())
1888       cpv.position(
1889           gridLog,
1890           hawRLog,
1891           copyOne,
1892           DDTranslation(gridForm.getTranslation().x(), gridForm.getTranslation().y(), gridForm.getTranslation().z()),
1893           myrot(gridName().name() + "R", gridForm.getRotation()));
1894 
1895     // End Grid + Tablet insertion
1896 
1897     // begin filling Wedge with crystal plus supports --------------------------
1898 
1899     const double aNom(nomCryDimAF());
1900     const double LNom(nomCryDimLZ());
1901 
1902     const double AUnd(underAR());
1903     const double aUnd(underAF());
1904     //      const double BUnd ( underCR() ) ;
1905     const double bUnd(underCF());
1906     const double HUnd(underBR());
1907     const double hUnd(underBF());
1908     const double LUnd(underLZ());
1909 
1910     const double sWall(wallThAlv());
1911     const double sWrap(wrapThAlv());
1912     const double sClr(clrThAlv());
1913 
1914     const double fWall(wallFrAlv());
1915     const double fWrap(wrapFrAlv());
1916     const double fClr(clrFrAlv());
1917 
1918     const double rWall(wallReAlv());
1919     const double rWrap(wrapReAlv());
1920     const double rClr(clrReAlv());
1921 
1922     // theta is angle in yz plane between z axis & leading edge of crystal
1923     double theta(90 * deg);
1924     double zee(0 * mm);
1925     double side(0 * mm);
1926     double zeta(0 * deg);  // increment in theta for last crystal
1927 
1928     for (unsigned int cryType(1); cryType <= nCryTypes(); ++cryType) {
1929       const std::string sType("_" + std::string(10 > cryType ? "0" : "") + std::to_string(cryType));
1930 
1931 #ifdef EDM_ML_DEBUG
1932       edm::LogVerbatim("EcalGeom") << "Crytype=" << cryType;
1933 #endif
1934       const double ANom(vecNomCryDimAR()[cryType - 1]);
1935       const double BNom(vecNomCryDimCR()[cryType - 1]);
1936       const double bNom(vecNomCryDimCF()[cryType - 1]);
1937       const double HNom(vecNomCryDimBR()[cryType - 1]);
1938       const double hNom(vecNomCryDimBF()[cryType - 1]);
1939 
1940       const double alfCry(90 * deg + atan((bNom - bUnd - aNom + aUnd) / (hNom - hUnd)));
1941 
1942       const Trap trapCry((ANom - AUnd) / 2.,         //double aHalfLengthXNegZLoY , // bl1, A/2
1943                          (aNom - aUnd) / 2.,         //double aHalfLengthXPosZLoY , // bl2, a/2
1944                          (bNom - bUnd) / 2.,         //double aHalfLengthXPosZHiY , // tl2, b/2
1945                          (HNom - HUnd) / 2.,         //double aHalfLengthYNegZ    , // h1, H/2
1946                          (hNom - hUnd) / 2.,         //double aHalfLengthYPosZ    , // h2, h/2
1947                          (LNom - LUnd) / 2.,         //double aHalfLengthZ        , // dz,  L/2
1948                          alfCry,                     //double aAngleAD            , // alfa1
1949                          aNom - aUnd - ANom + AUnd,  //double aCoord15X           , // x15
1950                          hNom - hUnd - HNom + HUnd   //double aCoord15Y             // y15
1951       );
1952 
1953       const DDName cryDDName(cryName() + sType);
1954       const DDSolid crySolid(mytrap(cryDDName.name(), trapCry));
1955       const DDLogicalPart cryLog(cryDDName, cryMat(), crySolid);
1956 
1957       //++++++++++++++++++++++++++++++++++  APD ++++++++++++++++++++++++++++++++++
1958 
1959       const DDName apdDDName(apdName().name() + sType);
1960 
1961       const Trap trapAPD(apdSide() / 2.,   //double aHalfLengthXNegZLoY , // bl1, A/2
1962                          apdSide() / 2.,   //double aHalfLengthXPosZLoY , // bl2, a/2
1963                          apdSide() / 2.,   //double aHalfLengthXPosZHiY , // tl2, b/2
1964                          apdSide() / 2.,   //double aHalfLengthYNegZ    , // h1,  H/2
1965                          apdSide() / 2.,   //double aHalfLengthYPosZ    , // h2,  h/2
1966                          apdThick() / 2.,  // dz,  L/2
1967                          90 * deg,         //double aAngleAD            , // alfa1
1968                          0,                //double aCoord15X           , // x15
1969                          0                 //double aCoord15Y             // y15
1970       );
1971 
1972       //     DDSolid apdSolid ( DDSolidFactory::box( apdDDName,
1973       //                         apdSide()/2.,
1974       //                         apdSide()/2.,
1975       //                         apdThick()/2.   ) ) ;
1976       const DDSolid apdSolid(mytrap(apdDDName.name(), trapAPD));
1977       const DDLogicalPart apdLog(apdDDName, apdMat(), apdSolid);
1978 
1979       unsigned int copyAPD(0);
1980       //++++++++++++++++++++++++++++++++++ END APD ++++++++++++++++++++++++++++++++++
1981 
1982       const double delta(atan((HNom - hNom) / LNom));
1983       //unused   const double cosdelta  ( cos( delta ) ) ;
1984       const double sindelta(sin(delta));
1985 
1986       const double gamma(atan((ANom - aNom) / LNom));
1987       //unused   const double cosgamma  ( cos( gamma ) ) ;
1988       const double singamma(sin(gamma));
1989 
1990       const double beta(atan((BNom - bNom) / LNom));
1991       //unused   const double cosbeta   ( cos( beta ) ) ;
1992       const double sinbeta(sin(beta));
1993 
1994       // Now clearance trap
1995       const double alfClr(90 * deg + atan((bNom - aNom) / (hNom + sClr)));
1996 
1997       const Trap trapClr((ANom + sClr + rClr * singamma) / 2.,  //double aHalfLengthXNegZLoY , // bl1, A/2
1998                          (aNom + sClr - fClr * singamma) / 2.,  //double aHalfLengthXPosZLoY , // bl2, a/2
1999                          (bNom + sClr - fClr * sinbeta) / 2.,   //double aHalfLengthXPosZHiY , // tl2, b/2
2000                          (HNom + sClr + rClr * sindelta) / 2.,  //double aHalfLengthYNegZ    , // h1,  H/2
2001                          (hNom + sClr - fClr * sindelta) / 2.,  //double aHalfLengthYPosZ    , // h2,  h/2
2002                          (LNom + fClr + rClr) / 2.,             // dz,  L/2
2003                          alfClr,                                //double aAngleAD            , // alfa1
2004                          aNom - ANom,                           //double aCoord15X           , // x15
2005                          hNom - HNom                            //double aCoord15Y             // y15
2006       );
2007 
2008       const DDName clrDDName(clrName() + sType);
2009       const DDSolid clrSolid(mytrap(clrDDName.name(), trapClr));
2010       const DDLogicalPart clrLog(clrDDName, clrMat(), clrSolid);
2011 
2012       // Now wrap trap
2013 
2014       const double alfWrap(90 * deg + atan((bNom - aNom) / (hNom + sClr + 2 * sWrap)));
2015 
2016       const Trap trapWrap((trapClr.A() + 2 * sWrap + rWrap * singamma) / 2,  // bl1, A/2
2017                           (trapClr.a() + 2 * sWrap - fWrap * singamma) / 2,  // bl2, a/2
2018                           (trapClr.b() + 2 * sWrap - fWrap * sinbeta) / 2,   // tl2, b/2
2019                           (trapClr.H() + 2 * sWrap + rWrap * sindelta) / 2,  // h1,  H/2
2020                           (trapClr.h() + 2 * sWrap - fWrap * sindelta) / 2,  // h2,  h/2
2021                           (trapClr.L() + fWrap + rWrap) / 2.,                // dz,  L/2
2022                           alfWrap,                                           //double aAngleAD            , // alfa1
2023                           aNom - ANom - (cryType > 9 ? 0 : 0.020 * mm),
2024                           hNom - HNom  //double aCoord15Y             // y15
2025       );
2026 
2027       const DDName wrapDDName(wrapName() + sType);
2028       const DDSolid wrapSolid(mytrap(wrapDDName.name(), trapWrap));
2029       const DDLogicalPart wrapLog(wrapDDName, wrapMat(), wrapSolid);
2030 
2031       // Now wall trap
2032 
2033       const double alfWall(90 * deg + atan((bNom - aNom) / (hNom + sClr + 2 * sWrap + 2 * sWall)));
2034 
2035       const Trap trapWall((trapWrap.A() + 2 * sWall + rWall * singamma) / 2,  // A/2
2036                           (trapWrap.a() + 2 * sWall - fWall * singamma) / 2,  // a/2
2037                           (trapWrap.b() + 2 * sWall - fWall * sinbeta) / 2,   // b/2
2038                           (trapWrap.H() + 2 * sWall + rWall * sindelta) / 2,  // H/2
2039                           (trapWrap.h() + 2 * sWall - fWall * sindelta) / 2,  // h/2
2040                           (trapWrap.L() + fWall + rWall) / 2.,                // L/2
2041                           alfWall,                                            // alfa1
2042                           aNom - ANom - (cryType < 10 ? 0.150 * mm : 0.100 * mm),
2043                           hNom - HNom  // y15
2044       );
2045 
2046       const DDName wallDDName(wallName() + sType);
2047       const DDSolid wallSolid(mytrap(wallDDName.name(), trapWall));
2048       const DDLogicalPart wallLog(wallDDName, wallMat(), wallSolid);
2049 
2050 #ifdef EDM_ML_DEBUG
2051       edm::LogVerbatim("EcalGeom") << "Traps:\n a: " << trapCry.a() << ", " << trapClr.a() << ", " << trapWrap.a()
2052                                    << ", " << trapWall.a() << "\n b: " << trapCry.b() << ", " << trapClr.b() << ", "
2053                                    << trapWrap.b() << ", " << trapWall.b() << "\n A: " << trapCry.A() << ", "
2054                                    << trapClr.A() << ", " << trapWrap.A() << ", " << trapWall.A()
2055                                    << "\n B: " << trapCry.B() << ", " << trapClr.B() << ", " << trapWrap.B() << ", "
2056                                    << trapWall.B() << "\n h: " << trapCry.h() << ", " << trapClr.h() << ", "
2057                                    << trapWrap.h() << ", " << trapWall.h() << "\n H: " << trapCry.H() << ", "
2058                                    << trapClr.H() << ", " << trapWrap.H() << ", " << trapWall.H()
2059                                    << "\n a1: " << trapCry.a1() / deg << ", " << trapClr.a1() / deg << ", "
2060                                    << trapWrap.a1() / deg << ", " << trapWall.a1() / deg
2061                                    << "\n a4: " << trapCry.a4() / deg << ", " << trapClr.a4() / deg << ", "
2062                                    << trapWrap.a4() / deg << ", " << trapWall.a4() / deg << "\n x15: " << trapCry.x15()
2063                                    << ", " << trapClr.x15() << ", " << trapWrap.x15() << ", " << trapWall.x15()
2064                                    << "\n y15: " << trapCry.y15() << ", " << trapClr.y15() << ", " << trapWrap.y15()
2065                                    << ", " << trapWall.y15();
2066 #endif
2067       // Now for placement of cry within clr
2068       const Vec3 cryToClr(0, 0, (rClr - fClr) / 2);
2069 
2070       cpv.position(cryLog,
2071                    clrLog,
2072                    copyOne,
2073                    DDTranslation(0, 0, (rClr - fClr) / 2),  //SAME as cryToClr above.
2074                    DDRotation());
2075 
2076       if (0 != apdHere()) {
2077         cpv.position(
2078             apdLog,
2079             clrLog,
2080             ++copyAPD,
2081             DDTranslation(
2082                 +trapCry.bl1() - apdX1(), +trapCry.h1() - apdZ(), -trapCry.dz() - apdThick() / 2. + (rClr - fClr) / 2.),
2083             DDRotation());
2084         cpv.position(
2085             apdLog,
2086             clrLog,
2087             ++copyAPD,
2088             DDTranslation(
2089                 +trapCry.bl1() - apdX2(), +trapCry.h1() - apdZ(), -trapCry.dz() - apdThick() / 2. + (rClr - fClr) / 2.),
2090             DDRotation());
2091       }
2092 
2093       const Vec3 clrToWrap(0, 0, (rWrap - fWrap) / 2);
2094 
2095       cpv.position(clrLog,
2096                    wrapLog,
2097                    copyOne,
2098                    DDTranslation(0, 0, (rWrap - fWrap) / 2),  //SAME as cryToWrap
2099                    DDRotation());
2100 
2101       // Now for placement of clr within wall
2102       const Vec3 wrapToWall1(0, 0, (rWall - fWall) / 2);
2103       const Vec3 wrapToWall(Vec3((cryType > 9 ? 0 : 0.005 * mm), 0, 0) + wrapToWall1);
2104 
2105       cpv.position(wrapLog,
2106                    wallLog,
2107                    copyOne,
2108                    DDTranslation(Vec3((cryType > 9 ? 0 : 0.005 * mm), 0, 0) + wrapToWall1),  //SAME as wrapToWall
2109                    DDRotation());
2110 
2111       const Trap::VertexList vWall(trapWall.vertexList());
2112       const Trap::VertexList vCry(trapCry.vertexList());
2113 
2114       const double sidePrime((trapWall.a() - trapCry.a()) / 2);
2115       const double frontPrime(fWall + fWrap + fClr + LUnd / 2);
2116 
2117       // define web plates with clearance ===========================================
2118 
2119       if (1 == cryType)  // first web plate: inside clearance volume
2120       {
2121         web(0,
2122             trapWall.b(),
2123             trapWall.B(),
2124             trapWall.L(),
2125             theta,
2126             vHAW[4] + Pt3D(0, hawYOffCry(), 0),
2127             hawRLog,
2128             zee,
2129             sidePrime,
2130             frontPrime,
2131             delta,
2132             cpv);
2133         zee += vecGapAlvEta()[0];
2134       }
2135 
2136       for (unsigned int etaAlv(1); etaAlv <= nCryPerAlvEta(); ++etaAlv) {
2137 #ifdef EDM_ML_DEBUG
2138         edm::LogVerbatim("EcalGeom") << "theta=" << theta / deg << ", sidePrime=" << sidePrime
2139                                      << ", frontPrime=" << frontPrime << ",  zeta=" << zeta << ", delta=" << delta
2140                                      << ",  zee=" << zee;
2141 #endif
2142         zee += 0.075 * mm + (side * cos(zeta) + trapWall.h() - sidePrime) / sin(theta);
2143 
2144 #ifdef EDM_ML_DEBUG
2145         edm::LogVerbatim("EcalGeom") << "New zee=" << zee;
2146 #endif
2147 
2148         // make transform for placing enclosed crystal
2149 
2150         const Pt3D trap2(vCry[2] + cryToClr + clrToWrap + wrapToWall);
2151 
2152         const Pt3D trap3(trap2 + Pt3D(0, -trapCry.h(), 0));
2153         const Pt3D trap1(trap3 + Pt3D(-trapCry.a(), 0, 0));
2154 
2155         const Pt3D wedge3(vHAW[4] + Pt3D(sidePrime, hawYOffCry(), zee));
2156         const Pt3D wedge2(wedge3 + Pt3D(0, trapCry.h() * cos(theta), -trapCry.h() * sin(theta)));
2157         const Pt3D wedge1(wedge3 + Pt3D(trapCry.a(), 0, 0));
2158 
2159         const Tf3D tForm1(trap1, trap2, trap3, wedge1, wedge2, wedge3);
2160 
2161         const double xx(0.050 * mm);
2162 
2163         const Tf3D tForm(HepGeom::Translate3D(xx, 0, 0) * tForm1);
2164 
2165         cpv.position(wallLog,
2166                      hawRLog,
2167                      etaAlv,
2168                      DDTranslation(tForm.getTranslation().x(), tForm.getTranslation().y(), tForm.getTranslation().z()),
2169                      myrot(wallLog.name().name() + "_" + std::to_string(etaAlv), tForm.getRotation()));
2170 
2171         theta -= delta;
2172         side = sidePrime;
2173         zeta = delta;
2174       }
2175       if (5 == cryType || 9 == cryType || 13 == cryType || 17 == cryType)  // web plates
2176       {
2177         const unsigned int webIndex(cryType / 4);
2178         zee += 0.5 * vecGapAlvEta()[cryType] / sin(theta);
2179         web(webIndex,
2180             trapWall.a(),
2181             trapWall.A(),
2182             trapWall.L(),
2183             theta,
2184             vHAW[4] + Pt3D(0, hawYOffCry(), 0),
2185             hawRLog,
2186             zee,
2187             sidePrime,
2188             frontPrime,
2189             delta,
2190             cpv);
2191         zee += 0.5 * vecGapAlvEta()[cryType] / sin(theta);
2192       } else {
2193         if (17 != cryType)
2194           zee += vecGapAlvEta()[cryType] / sin(theta);
2195       }
2196     }
2197     // END   filling Wedge with crystal plus supports --------------------------
2198 
2199     //------------------------------------------------------------------------
2200     //------------------------------------------------------------------------
2201     //------------------------------------------------------------------------
2202     //------------------------------------------------------------------------
2203     //**************** Material at outer radius of supermodule ***************
2204     //------------------------------------------------------------------------
2205     //------------------------------------------------------------------------
2206     //------------------------------------------------------------------------
2207     //------------------------------------------------------------------------
2208 
2209     if (0 != backHere()) {
2210       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2211       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2212       //!!!!!!!!!!!!!!     Begin Back Cover Plate     !!!!!!!!!!!!!!!!!!!!!!!
2213       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2214       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2215 
2216       const DDTranslation outtra(backXOff() + backSideHeight() / 2, backYOff(), backSideLength() / 2);
2217 
2218       const double realBPthick(backPlateThick() + backPlate2Thick());
2219 
2220       DDSolid backPlateSolid(
2221           DDSolidFactory::box(backPlateName(), backPlateWidth() / 2., realBPthick / 2., backPlateLength() / 2.));
2222       const std::vector<double>& backPlateParms(backPlateSolid.parameters());
2223       const DDLogicalPart backPlateLog(backPlateName(), backPlateMat(), backPlateSolid);
2224 
2225       const DDTranslation backPlateTra(
2226           backSideHeight() / 2 + backPlateParms[1], 0 * mm, backPlateParms[2] - backSideLength() / 2);
2227 
2228       DDSolid backPlate2Solid(
2229           DDSolidFactory::box(backPlate2Name(), backPlateWidth() / 2., backPlate2Thick() / 2., backPlateLength() / 2.));
2230 
2231       const DDLogicalPart backPlate2Log(backPlate2Name(), backPlate2Mat(), backPlate2Solid);
2232 
2233       const DDTranslation backPlate2Tra(0, -backPlateParms[1] + backPlate2Thick() / 2., 0);
2234       if (0 != backPlateHere()) {
2235         cpv.position(backPlate2Log, backPlateName(), copyOne, backPlate2Tra, DDRotation());
2236 
2237         cpv.position(backPlateLog,
2238                      spmName(),
2239                      copyOne,
2240                      outtra + backPlateTra,
2241                      myrot(backPlateName().name() + "Rot5", CLHEP::HepRotationZ(270 * deg)));
2242       }
2243       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2244       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2245       //!!!!!!!!!!!!!!     End Back Cover Plate       !!!!!!!!!!!!!!!!!!!!!!!
2246       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2247       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2248 
2249       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2250       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2251       //!!!!!!!!!!!!!!     Begin Back Side Plates    !!!!!!!!!!!!!!!!!!!!!!!
2252       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2253       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2254 
2255       const Trap trapBS(backSideWidth() / 2.,   //double aHalfLengthXNegZLoY , // bl1, A/2
2256                         backSideWidth() / 2.,   //double aHalfLengthXPosZLoY , // bl2, a/2
2257                         backSideWidth() / 4.,   //double aHalfLengthXPosZHiY , // tl2, b/2
2258                         backSideHeight() / 2.,  //double aHalfLengthYNegZ    , // h1, H/2
2259                         backSideHeight() / 2.,  //double aHalfLengthYPosZ    , // h2, h/2
2260                         backSideLength() / 2.,  //double aHalfLengthZ        , // dz,  L/2
2261                         backSideAngle(),        //double aAngleAD            , // alfa1
2262                         0,                      //double aCoord15X           , // x15
2263                         0                       //double aCoord15Y             // y15
2264       );
2265 
2266       const DDSolid backSideSolid(mytrap(backSideName().name(), trapBS));
2267       const DDLogicalPart backSideLog(backSideName(), backSideMat(), backSideSolid);
2268 
2269       const DDTranslation backSideTra1(0 * mm, backPlateWidth() / 2 + backSideYOff1(), 1 * mm);
2270       if (0 != backSideHere()) {
2271         cpv.position(
2272             backSideLog,
2273             spmName(),
2274             copyOne,
2275             outtra + backSideTra1,
2276             myrot(backSideName().name() + "Rot8", CLHEP::HepRotationX(180 * deg) * CLHEP::HepRotationZ(90 * deg)));
2277 
2278         const DDTranslation backSideTra2(0 * mm, -backPlateWidth() / 2 + backSideYOff2(), 1 * mm);
2279         cpv.position(backSideLog,
2280                      spmName(),
2281                      copyTwo,
2282                      outtra + backSideTra2,
2283                      myrot(backSideName().name() + "Rot9", CLHEP::HepRotationZ(90 * deg)));
2284       }
2285       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2286       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2287       //!!!!!!!!!!!!!!     End Back Side Plates       !!!!!!!!!!!!!!!!!!!!!!!
2288       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2289       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2290 
2291       //=====================
2292       const double backCoolWidth(backCoolBarWidth() + 2. * backCoolTankWidth());
2293 
2294       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2295       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2296       //!!!!!!!!!!!!!!     Begin Mother Board Cooling Manifold Setup !!!!!!!!
2297       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2298       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2299 
2300       const double manifCut(2 * mm);
2301 
2302       DDSolid mBManifSolid(DDSolidFactory::tubs(
2303           mBManifName(), backCoolWidth / 2. - manifCut, 0, mBManifOutDiam() / 2, 0 * deg, 360 * deg));
2304       const DDLogicalPart mBManifLog(mBManifName(), mBManifMat(), mBManifSolid);
2305 
2306       const DDName mBManifWaName(ddname(mBManifName().name() + "Wa"));
2307       DDSolid mBManifWaSolid(DDSolidFactory::tubs(
2308           mBManifWaName, backCoolWidth / 2. - manifCut, 0, mBManifInnDiam() / 2, 0 * deg, 360 * deg));
2309       const DDLogicalPart mBManifWaLog(mBManifWaName, backPipeWaterMat(), mBManifWaSolid);
2310       cpv.position(mBManifWaLog, mBManifName(), copyOne, DDTranslation(0, 0, 0), DDRotation());
2311 
2312       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2313       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2314       //!!!!!!!!!!!!!!     End Mother Board Cooling Manifold Setup   !!!!!!!!
2315       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2316       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2317       //=====================
2318 
2319       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2320       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2321       //!!!!!!!!!!!!!!     Begin Loop over Grilles & MB Cooling Manifold !!!!
2322       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2323       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2324       const double deltaY(-5 * mm);
2325 
2326       DDSolid grEdgeSlotSolid(
2327           DDSolidFactory::box(grEdgeSlotName(), grEdgeSlotHeight() / 2., grEdgeSlotWidth() / 2., grilleThick() / 2.));
2328       const DDLogicalPart grEdgeSlotLog(grEdgeSlotName(), grEdgeSlotMat(), grEdgeSlotSolid);
2329 
2330       unsigned int edgeSlotCopy(0);
2331       unsigned int midSlotCopy(0);
2332 
2333       DDLogicalPart grMidSlotLog[4];
2334 
2335       for (unsigned int iGr(0); iGr != vecGrilleHeight().size(); ++iGr) {
2336         DDName gName(ddname(grilleName() + std::to_string(iGr)));
2337         DDSolid grilleSolid(
2338             DDSolidFactory::box(gName, vecGrilleHeight()[iGr] / 2., backCoolWidth / 2., grilleThick() / 2.));
2339         const DDLogicalPart grilleLog(gName, grilleMat(), grilleSolid);
2340 
2341         const DDTranslation grilleTra(-realBPthick / 2 - vecGrilleHeight()[iGr] / 2,
2342                                       deltaY,
2343                                       vecGrilleZOff()[iGr] + grilleThick() / 2 - backSideLength() / 2);
2344         const DDTranslation gTra(outtra + backPlateTra + grilleTra);
2345 
2346         if (0 != grMidSlotHere() && 0 != iGr) {
2347           if (0 == (iGr - 1) % 2) {
2348             DDName mName(ddname(grMidSlotName() + std::to_string(iGr / 2)));
2349             DDSolid grMidSlotSolid(DDSolidFactory::box(
2350                 mName, vecGrMidSlotHeight()[(iGr - 1) / 2] / 2., grMidSlotWidth() / 2., grilleThick() / 2.));
2351             grMidSlotLog[(iGr - 1) / 2] = DDLogicalPart(mName, grMidSlotMat(), grMidSlotSolid);
2352           }
2353           cpv.position(grMidSlotLog[(iGr - 1) / 2],
2354                        gName,
2355                        ++midSlotCopy,
2356                        DDTranslation(
2357                            vecGrilleHeight()[iGr] / 2. - vecGrMidSlotHeight()[(iGr - 1) / 2] / 2., +grMidSlotXOff(), 0),
2358                        DDRotation());
2359           cpv.position(grMidSlotLog[(iGr - 1) / 2],
2360                        gName,
2361                        ++midSlotCopy,
2362                        DDTranslation(
2363                            vecGrilleHeight()[iGr] / 2. - vecGrMidSlotHeight()[(iGr - 1) / 2] / 2., -grMidSlotXOff(), 0),
2364                        DDRotation());
2365         }
2366 
2367         if (0 != grEdgeSlotHere() && 0 != iGr) {
2368           cpv.position(
2369               grEdgeSlotLog,
2370               gName,
2371               ++edgeSlotCopy,
2372               DDTranslation(
2373                   vecGrilleHeight()[iGr] / 2. - grEdgeSlotHeight() / 2., backCoolWidth / 2 - grEdgeSlotWidth() / 2., 0),
2374               DDRotation());
2375           cpv.position(grEdgeSlotLog,
2376                        gName,
2377                        ++edgeSlotCopy,
2378                        DDTranslation(vecGrilleHeight()[iGr] / 2. - grEdgeSlotHeight() / 2.,
2379                                      -backCoolWidth / 2 + grEdgeSlotWidth() / 2.,
2380                                      0),
2381                        DDRotation());
2382         }
2383         if (0 != grilleHere())
2384           cpv.position(grilleLog, spmName(), iGr, gTra, DDRotation());
2385 
2386         if ((0 != iGr % 2) && (0 != mBManifHere())) {
2387           cpv.position(mBManifLog,
2388                        spmName(),
2389                        iGr,
2390                        gTra - DDTranslation(-mBManifOutDiam() / 2. + vecGrilleHeight()[iGr] / 2.,
2391                                             manifCut,
2392                                             grilleThick() / 2. + 3 * mBManifOutDiam() / 2.),
2393                        myrot(mBManifName().name() + "R1", CLHEP::HepRotationX(90 * deg)));
2394           cpv.position(mBManifLog,
2395                        spmName(),
2396                        iGr - 1,
2397                        gTra - DDTranslation(-3 * mBManifOutDiam() / 2. + vecGrilleHeight()[iGr] / 2.,
2398                                             manifCut,
2399                                             grilleThick() / 2 + 3 * mBManifOutDiam() / 2.),
2400                        myrot(mBManifName().name() + "R2", CLHEP::HepRotationX(90 * deg)));
2401         }
2402       }
2403 
2404       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2405       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2406       //!!!!!!!!!!!!!!     End Loop over Grilles & MB Cooling Manifold   !!!!
2407       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2408       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2409 
2410       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2411       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2412       //!!!!!!!!!!!!!!     Begin Cooling Bar Setup    !!!!!!!!!!!!!!!!!!!!!!!
2413       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2414       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2415 
2416       DDSolid backCoolBarSolid(DDSolidFactory::box(
2417           backCoolBarName(), backCoolBarHeight() / 2., backCoolBarWidth() / 2., backCoolBarThick() / 2.));
2418       const DDLogicalPart backCoolBarLog(backCoolBarName(), backCoolBarMat(), backCoolBarSolid);
2419 
2420       DDSolid backCoolBarSSSolid(DDSolidFactory::box(
2421           backCoolBarSSName(), backCoolBarHeight() / 2., backCoolBarWidth() / 2., backCoolBarSSThick() / 2.));
2422       const DDLogicalPart backCoolBarSSLog(backCoolBarSSName(), backCoolBarSSMat(), backCoolBarSSSolid);
2423       const DDTranslation backCoolBarSSTra(0, 0, 0);
2424       cpv.position(backCoolBarSSLog, backCoolBarName(), copyOne, backCoolBarSSTra, DDRotation());
2425 
2426       DDSolid backCoolBarWaSolid(DDSolidFactory::box(
2427           backCoolBarWaName(), backCoolBarHeight() / 2., backCoolBarWidth() / 2., backCoolBarWaThick() / 2.));
2428       const DDLogicalPart backCoolBarWaLog(backCoolBarWaName(), backCoolBarWaMat(), backCoolBarWaSolid);
2429       const DDTranslation backCoolBarWaTra(0, 0, 0);
2430       cpv.position(backCoolBarWaLog, backCoolBarSSName(), copyOne, backCoolBarWaTra, DDRotation());
2431 
2432       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2433       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2434       //!!!!!!!!!!!!!!     End Cooling Bar Setup      !!!!!!!!!!!!!!!!!!!!!!!
2435       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2436       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2437 
2438       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2439       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2440       //!!!!!!!!!!!!!!     Begin VFE Card Setup       !!!!!!!!!!!!!!!!!!!!!!!
2441       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2442       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2443 
2444       double thickVFE(0);
2445       for (unsigned int iLyr(0); iLyr != vecBackVFELyrThick().size(); ++iLyr) {
2446         thickVFE += vecBackVFELyrThick()[iLyr];
2447       }
2448       DDSolid backVFESolid(
2449           DDSolidFactory::box(backVFEName(), backCoolBarHeight() / 2., backCoolBarWidth() / 2., thickVFE / 2.));
2450       const DDLogicalPart backVFELog(backVFEName(), backVFEMat(), backVFESolid);
2451       DDTranslation offTra(0, 0, -thickVFE / 2);
2452       for (unsigned int iLyr(0); iLyr != vecBackVFELyrThick().size(); ++iLyr) {
2453         DDSolid backVFELyrSolid(DDSolidFactory::box(ddname(vecBackVFELyrName()[iLyr]),
2454                                                     backCoolBarHeight() / 2.,
2455                                                     backCoolBarWidth() / 2.,
2456                                                     vecBackVFELyrThick()[iLyr] / 2.));
2457         const DDLogicalPart backVFELyrLog(
2458             ddname(vecBackVFELyrName()[iLyr]), ddmat(vecBackVFELyrMat()[iLyr]), backVFELyrSolid);
2459         const DDTranslation backVFELyrTra(0, 0, vecBackVFELyrThick()[iLyr] / 2);
2460         cpv.position(backVFELyrLog, backVFEName(), copyOne, backVFELyrTra + offTra, DDRotation());
2461         offTra += 2 * backVFELyrTra;
2462       }
2463 
2464       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2465       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2466       //!!!!!!!!!!!!!!     End VFE Card Setup         !!!!!!!!!!!!!!!!!!!!!!!
2467       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2468       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2469 
2470       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2471       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2472       //!!!!!!!!!!!!!!     Begin Cooling Bar + VFE Setup  !!!!!!!!!!!!!!!!!!!
2473       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2474       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2475 
2476       const double halfZCoolVFE(thickVFE + backCoolBarThick() / 2.);
2477       DDSolid backCoolVFESolid(
2478           DDSolidFactory::box(backCoolVFEName(), backCoolBarHeight() / 2., backCoolBarWidth() / 2., halfZCoolVFE));
2479       const DDLogicalPart backCoolVFELog(backCoolVFEName(), backCoolVFEMat(), backCoolVFESolid);
2480       if (0 != backCoolBarHere())
2481         cpv.position(backCoolBarLog, backCoolVFEName(), copyOne, DDTranslation(), DDRotation());
2482       if (0 != backCoolVFEHere())
2483         cpv.position(backVFELog,
2484                      backCoolVFEName(),
2485                      copyOne,
2486                      DDTranslation(0, 0, backCoolBarThick() / 2. + thickVFE / 2.),
2487                      DDRotation());
2488       cpv.position(backVFELog,
2489                    backCoolVFEName(),
2490                    copyTwo,
2491                    DDTranslation(0, 0, -backCoolBarThick() / 2. - thickVFE / 2.),
2492                    myrot(backVFEName().name() + "Flip", CLHEP::HepRotationX(180 * deg)));
2493 
2494       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2495       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2496       //!!!!!!!!!!!!!!     End Cooling Bar + VFE Setup    !!!!!!!!!!!!!!!!!!!
2497       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2498       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2499 
2500       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2501       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2502       //!!!!!!!!!!!!!! Begin Placement of Readout & Cooling by Module  !!!!!!
2503       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2504       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2505       unsigned int iCVFECopy(1);
2506       unsigned int iSep(0);
2507       unsigned int iNSec(0);
2508       const unsigned int nMisc(vecBackMiscThick().size() / 4);
2509       for (unsigned int iMod(0); iMod != 4; ++iMod) {
2510         const double pipeLength(vecGrilleZOff()[2 * iMod + 1] - vecGrilleZOff()[2 * iMod] - grilleThick() - 3 * mm);
2511 
2512         const double pipeZPos(vecGrilleZOff()[2 * iMod + 1] - pipeLength / 2 - 1.5 * mm);
2513 
2514         // accumulate total height of parent volume
2515 
2516         double backCoolHeight(backCoolBarHeight() + mBCoolTubeOutDiam());
2517         for (unsigned int iMisc(0); iMisc != nMisc; ++iMisc) {
2518           backCoolHeight += vecBackMiscThick()[iMod * nMisc + iMisc];
2519         }
2520         double bottomThick(mBCoolTubeOutDiam());
2521         for (unsigned int iMB(0); iMB != vecMBLyrThick().size(); ++iMB) {
2522           backCoolHeight += vecMBLyrThick()[iMB];
2523           bottomThick += vecMBLyrThick()[iMB];
2524         }
2525 
2526         DDName backCName(ddname(vecBackCoolName()[iMod]));
2527         const double halfZBCool((pipeLength - 2 * mBManifOutDiam() - grilleZSpace()) / 2);
2528         DDSolid backCoolSolid(DDSolidFactory::box(backCName, backCoolHeight / 2., backCoolWidth / 2., halfZBCool));
2529         const DDLogicalPart backCoolLog(backCName, spmMat(), backCoolSolid);
2530 
2531         const DDTranslation bCoolTra(
2532             -realBPthick / 2 + backCoolHeight / 2 - vecGrilleHeight()[2 * iMod],
2533             deltaY,
2534             vecGrilleZOff()[2 * iMod] + grilleThick() + grilleZSpace() + halfZBCool - backSideLength() / 2);
2535         if (0 != backCoolHere())
2536           cpv.position(backCoolLog, spmName(), iMod + 1, outtra + backPlateTra + bCoolTra, DDRotation());
2537 
2538         //===
2539         const double backCoolTankHeight(backCoolBarHeight());  // - backBracketHeight() ) ;
2540 
2541         const double halfZTank(halfZBCool - 5 * cm);
2542 
2543         DDName bTankName(ddname(backCoolTankName() + std::to_string(iMod + 1)));
2544         DDSolid backCoolTankSolid(
2545             DDSolidFactory::box(bTankName, backCoolTankHeight / 2., backCoolTankWidth() / 2., halfZTank));
2546         const DDLogicalPart backCoolTankLog(bTankName, backCoolTankMat(), backCoolTankSolid);
2547         if (0 != backCoolTankHere())
2548           cpv.position(backCoolTankLog,
2549                        backCName,
2550                        copyOne,
2551                        DDTranslation(-backCoolHeight / 2 + backCoolTankHeight / 2. + bottomThick,
2552                                      backCoolBarWidth() / 2. + backCoolTankWidth() / 2.,
2553                                      0),
2554                        DDRotation());
2555 
2556         DDName bTankWaName(ddname(backCoolTankWaName() + std::to_string(iMod + 1)));
2557         DDSolid backCoolTankWaSolid(DDSolidFactory::box(bTankWaName,
2558                                                         backCoolTankHeight / 2. - backCoolTankThick() / 2.,
2559                                                         backCoolTankWaWidth() / 2.,
2560                                                         halfZTank - backCoolTankThick() / 2.));
2561         const DDLogicalPart backCoolTankWaLog(bTankWaName, backCoolTankWaMat(), backCoolTankWaSolid);
2562         cpv.position(backCoolTankWaLog, bTankName, copyOne, DDTranslation(0, 0, 0), DDRotation());
2563 
2564         DDName bBracketName(ddname(backBracketName() + std::to_string(iMod + 1)));
2565         DDSolid backBracketSolid(
2566             DDSolidFactory::box(bBracketName, backBracketHeight() / 2., backCoolTankWidth() / 2., halfZTank));
2567         const DDLogicalPart backBracketLog(bBracketName, backBracketMat(), backBracketSolid);
2568         if (0 != backCoolTankHere())
2569           cpv.position(backBracketLog,
2570                        backCName,
2571                        copyOne,
2572                        DDTranslation(backCoolBarHeight() - backCoolHeight / 2. - backBracketHeight() / 2. + bottomThick,
2573                                      -backCoolBarWidth() / 2. - backCoolTankWidth() / 2.,
2574                                      0),
2575                        DDRotation());
2576 
2577         /*   cpv.position( backBracketLog,
2578         backCName, 
2579         copyTwo, 
2580         DDTranslation( backCoolBarHeight() - backCoolHeight/2. - backBracketHeight()/2.,
2581                    backCoolBarWidth()/2. + backCoolTankWidth()/2., 0),
2582                    DDRotation() ) ;*/
2583 
2584         //===
2585 
2586         DDTranslation bSumTra(backCoolBarHeight() - backCoolHeight / 2. + bottomThick, 0, 0);
2587         for (unsigned int j(0); j != nMisc; ++j)  // loop over miscellaneous layers
2588         {
2589           const DDName bName(ddname(vecBackMiscName()[iMod * nMisc + j]));
2590 
2591           DDSolid bSolid(DDSolidFactory::box(bName,
2592                                              vecBackMiscThick()[iMod * nMisc + j] / 2,
2593                                              backCoolBarWidth() / 2. + backCoolTankWidth(),
2594                                              halfZBCool));
2595 
2596           const DDLogicalPart bLog(bName, ddmat(vecBackMiscMat()[iMod * nMisc + j]), bSolid);
2597 
2598           const DDTranslation bTra(vecBackMiscThick()[iMod * nMisc + j] / 2, 0 * mm, 0 * mm);
2599 
2600           if (0 != backMiscHere())
2601             cpv.position(bLog, backCName, copyOne, bSumTra + bTra, DDRotation());
2602 
2603           bSumTra += 2 * bTra;
2604         }
2605 
2606         const double bHalfWidth(backCoolBarWidth() / 2. + backCoolTankWidth());
2607 
2608         if (0 != mBLyrHere()) {
2609           DDTranslation mTra(-backCoolHeight / 2. + mBCoolTubeOutDiam(), 0, 0);
2610           for (unsigned int j(0); j != vecMBLyrThick().size(); ++j)  // loop over MB layers
2611           {
2612             const DDName mName(ddname(vecMBLyrName()[j] + "_" + std::to_string(iMod + 1)));
2613 
2614             DDSolid mSolid(DDSolidFactory::box(mName, vecMBLyrThick()[j] / 2, bHalfWidth, halfZBCool));
2615 
2616             const DDLogicalPart mLog(mName, ddmat(vecMBLyrMat()[j]), mSolid);
2617 
2618             mTra += DDTranslation(vecMBLyrThick()[j] / 2.0, 0 * mm, 0 * mm);
2619             cpv.position(mLog, backCName, copyOne, mTra, DDRotation());
2620             mTra += DDTranslation(vecMBLyrThick()[j] / 2.0, 0 * mm, 0 * mm);
2621           }
2622         }
2623 
2624         if (0 != mBCoolTubeHere()) {
2625           const DDName mBName(ddname(mBCoolTubeName() + "_" + std::to_string(iMod + 1)));
2626 
2627           DDSolid mBCoolTubeSolid(
2628               DDSolidFactory::tubs(mBName, halfZBCool, 0, mBCoolTubeOutDiam() / 2, 0 * deg, 360 * deg));
2629           const DDLogicalPart mBLog(mBName, mBCoolTubeMat(), mBCoolTubeSolid);
2630 
2631           const DDName mBWaName(ddname(mBCoolTubeName() + "Wa_" + std::to_string(iMod + 1)));
2632           DDSolid mBCoolTubeWaSolid(
2633               DDSolidFactory::tubs(mBWaName, halfZBCool, 0, mBCoolTubeInnDiam() / 2, 0 * deg, 360 * deg));
2634           const DDLogicalPart mBWaLog(mBWaName, backPipeWaterMat(), mBCoolTubeWaSolid);
2635           cpv.position(mBWaLog, mBName, copyOne, DDTranslation(0, 0, 0), DDRotation());
2636 
2637           for (unsigned int j(0); j != mBCoolTubeNum(); ++j)  // loop over all MB cooling circuits
2638           {
2639             cpv.position(
2640                 mBLog,
2641                 backCName,
2642                 2 * j + 1,
2643                 DDTranslation(
2644                     -backCoolHeight / 2.0 + mBCoolTubeOutDiam() / 2., -bHalfWidth + (j + 1) * bHalfWidth / 5, 0),
2645                 DDRotation());
2646           }
2647         }
2648 
2649         //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2650         //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2651         //!!!!!!!!!!!!!! Begin Back Water Pipes   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2652         //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2653         //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2654         if (0 != backPipeHere() && 0 != iMod) {
2655           DDName bPipeName(ddname(backPipeName() + "_" + std::to_string(iMod + 1)));
2656           DDName bInnerName(ddname(backPipeName() + "_H2O_" + std::to_string(iMod + 1)));
2657 
2658           DDSolid backPipeSolid(
2659               DDSolidFactory::tubs(bPipeName, pipeLength / 2, 0 * mm, vecBackPipeDiam()[iMod] / 2, 0 * deg, 360 * deg));
2660 
2661           DDSolid backInnerSolid(DDSolidFactory::tubs(bInnerName,
2662                                                       pipeLength / 2,
2663                                                       0 * mm,
2664                                                       vecBackPipeDiam()[iMod] / 2 - vecBackPipeThick()[iMod],
2665                                                       0 * deg,
2666                                                       360 * deg));
2667 
2668           const DDLogicalPart backPipeLog(bPipeName, backPipeMat(), backPipeSolid);
2669 
2670           const DDLogicalPart backInnerLog(bInnerName, backPipeWaterMat(), backInnerSolid);
2671 
2672           const DDTranslation bPipeTra1(
2673               backXOff() + backSideHeight() - 0.7 * vecBackPipeDiam()[iMod],
2674               backYOff() + backPlateWidth() / 2 - backSideWidth() - 0.7 * vecBackPipeDiam()[iMod],
2675               pipeZPos);
2676 
2677           cpv.position(backPipeLog, spmName(), copyOne, bPipeTra1, DDRotation());
2678 
2679           const DDTranslation bPipeTra2(bPipeTra1.x(),
2680                                         backYOff() - backPlateWidth() / 2 + backSideWidth() + vecBackPipeDiam()[iMod],
2681                                         bPipeTra1.z());
2682 
2683           cpv.position(backPipeLog, spmName(), copyTwo, bPipeTra2, DDRotation());
2684 
2685           cpv.position(backInnerLog, bPipeName, copyOne, DDTranslation(), DDRotation());
2686         }
2687         //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2688         //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2689         //!!!!!!!!!!!!!! End Back Water Pipes   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2690         //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2691         //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2692 
2693         //=================================================
2694 
2695         if (0 != dryAirTubeHere()) {
2696           DDName dryAirTubName(ddname(dryAirTubeName() + std::to_string(iMod + 1)));
2697 
2698           DDSolid dryAirTubeSolid(DDSolidFactory::tubs(
2699               dryAirTubName, pipeLength / 2, dryAirTubeInnDiam() / 2, dryAirTubeOutDiam() / 2, 0 * deg, 360 * deg));
2700 
2701           const DDLogicalPart dryAirTubeLog(dryAirTubName, dryAirTubeMat(), dryAirTubeSolid);
2702 
2703           const DDTranslation dryAirTubeTra1(
2704               backXOff() + backSideHeight() - 0.7 * dryAirTubeOutDiam() - vecBackPipeDiam()[iMod],
2705               backYOff() + backPlateWidth() / 2 - backSideWidth() - 1.2 * dryAirTubeOutDiam(),
2706               pipeZPos);
2707 
2708           cpv.position(dryAirTubeLog, spmName(), copyOne, dryAirTubeTra1, DDRotation());
2709 
2710           const DDTranslation dryAirTubeTra2(
2711               dryAirTubeTra1.x(),
2712               backYOff() - backPlateWidth() / 2 + backSideWidth() + 0.7 * dryAirTubeOutDiam(),
2713               dryAirTubeTra1.z());
2714 
2715           cpv.position(dryAirTubeLog, spmName(), copyTwo, dryAirTubeTra2, DDRotation());
2716         }
2717         //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2718 
2719         //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2720         //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2721         //!!!!!!!!!!!!!! Begin Placement of Cooling + VFE Cards          !!!!!!
2722         //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2723         //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2724 
2725         DDTranslation cTra(backCoolBarHeight() / 2. - backCoolHeight / 2. + bottomThick, 0, -halfZTank + halfZCoolVFE);
2726         const unsigned int numSec(static_cast<unsigned int>(vecBackCoolNSec()[iMod]));
2727         for (unsigned int jSec(0); jSec != numSec; ++jSec) {
2728           const unsigned int nMax(static_cast<unsigned int>(vecBackCoolNPerSec()[iNSec++]));
2729           for (unsigned int iBar(0); iBar != nMax; ++iBar) {
2730             cpv.position(backCoolVFELog, backCName, iCVFECopy++, cTra, DDRotation());
2731             cTra += DDTranslation(0, 0, backCBStdSep());
2732           }
2733           cTra -= DDTranslation(0, 0, backCBStdSep());  // backspace to previous
2734           if (jSec != numSec - 1)
2735             cTra += DDTranslation(0, 0, vecBackCoolSecSep()[iSep++]);  // now take atypical step
2736         }
2737         //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2738         //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2739         //!!!!!!!!!!!!!! End Placement of Cooling + VFE Cards            !!!!!!
2740         //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2741         //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2742       }
2743 
2744       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2745       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2746       //!!!!!!!!!!!!!! End Placement of Readout & Cooling by Module    !!!!!!
2747       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2748       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2749 
2750       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2751       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2752       //!!!!!!!!!!!!!! Begin Patch Panel   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2753       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2754       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2755 
2756       double patchHeight(0);
2757       for (unsigned int iPatch(0); iPatch != vecPatchPanelThick().size(); ++iPatch) {
2758         patchHeight += vecPatchPanelThick()[iPatch];
2759       }
2760 
2761       DDSolid patchSolid(DDSolidFactory::box(patchPanelName(),
2762                                              patchHeight / 2.,
2763                                              backCoolBarWidth() / 2.,
2764                                              (vecSpmZPts().back() - vecGrilleZOff().back() - grilleThick()) / 2));
2765 
2766       const std::vector<double>& patchParms(patchSolid.parameters());
2767 
2768       const DDLogicalPart patchLog(patchPanelName(), spmMat(), patchSolid);
2769 
2770       const DDTranslation patchTra(backXOff() + 4 * mm, 0 * mm, vecGrilleZOff().back() + grilleThick() + patchParms[2]);
2771       if (0 != patchPanelHere())
2772         cpv.position(patchLog, spmName(), copyOne, patchTra, DDRotation());
2773 
2774       DDTranslation pTra(-patchParms[0], 0, 0);
2775 
2776       for (unsigned int j(0); j != vecPatchPanelNames().size(); ++j) {
2777         const DDName pName(ddname(vecPatchPanelNames()[j]));
2778 
2779         DDSolid pSolid(DDSolidFactory::box(pName, vecPatchPanelThick()[j] / 2., patchParms[1], patchParms[2]));
2780 
2781         const DDLogicalPart pLog(pName, ddmat(vecPatchPanelMat()[j]), pSolid);
2782 
2783         pTra += DDTranslation(vecPatchPanelThick()[j] / 2, 0 * mm, 0 * mm);
2784 
2785         cpv.position(pLog, patchPanelName(), copyOne, pTra, DDRotation());
2786 
2787         pTra += DDTranslation(vecPatchPanelThick()[j] / 2, 0 * mm, 0 * mm);
2788       }
2789       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2790       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2791       //!!!!!!!!!!!!!! End Patch Panel     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2792       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2793       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2794 
2795       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2796       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2797       //!!!!!!!!!!!!!! Begin Pincers       !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2798       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2799       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2800 
2801       if (0 != pincerRodHere()) {
2802         // Make hierarchy of rods, envelopes, blocks, shims, and cutouts
2803 
2804         DDSolid rodSolid(
2805             DDSolidFactory::box(pincerRodName(), pincerEnvWidth() / 2., pincerEnvHeight() / 2., ilyLength / 2));
2806         const DDLogicalPart rodLog(pincerRodName(), pincerRodMat(), rodSolid);
2807 
2808         DDSolid envSolid(
2809             DDSolidFactory::box(pincerEnvName(), pincerEnvWidth() / 2., pincerEnvHeight() / 2., pincerEnvLength() / 2));
2810         const DDLogicalPart envLog(pincerEnvName(), pincerEnvMat(), envSolid);
2811         const std::vector<double>& envParms(envSolid.parameters());
2812 
2813         DDSolid blkSolid(
2814             DDSolidFactory::box(pincerBlkName(), pincerEnvWidth() / 2., pincerEnvHeight() / 2., pincerBlkLength() / 2));
2815         const DDLogicalPart blkLog(pincerBlkName(), pincerBlkMat(), blkSolid);
2816         const std::vector<double>& blkParms(blkSolid.parameters());
2817         cpv.position(blkLog,
2818                      pincerEnvName(),
2819                      copyOne,
2820                      DDTranslation(0, 0, pincerEnvLength() / 2 - pincerBlkLength() / 2),
2821                      DDRotation());
2822 
2823         DDSolid cutSolid(
2824             DDSolidFactory::box(pincerCutName(), pincerCutWidth() / 2., pincerCutHeight() / 2., pincerBlkLength() / 2));
2825         const DDLogicalPart cutLog(pincerCutName(), pincerCutMat(), cutSolid);
2826         const std::vector<double>& cutParms(cutSolid.parameters());
2827         cpv.position(
2828             cutLog,
2829             pincerBlkName(),
2830             copyOne,
2831             DDTranslation(
2832                 +blkParms[0] - cutParms[0] - pincerShim1Width() + pincerShim2Width(), -blkParms[1] + cutParms[1], 0),
2833             DDRotation());
2834 
2835         DDSolid shim2Solid(DDSolidFactory::box(
2836             pincerShim2Name(), pincerShim2Width() / 2., pincerShimHeight() / 2., pincerBlkLength() / 2));
2837         const DDLogicalPart shim2Log(pincerShim2Name(), pincerShimMat(), shim2Solid);
2838         const std::vector<double>& shim2Parms(shim2Solid.parameters());
2839         cpv.position(shim2Log,
2840                      pincerCutName(),
2841                      copyOne,
2842                      DDTranslation(+cutParms[0] - shim2Parms[0], -cutParms[1] + shim2Parms[1], 0),
2843                      DDRotation());
2844 
2845         DDSolid shim1Solid(DDSolidFactory::box(pincerShim1Name(),
2846                                                pincerShim1Width() / 2.,
2847                                                pincerShimHeight() / 2.,
2848                                                (pincerEnvLength() - pincerBlkLength()) / 2));
2849 
2850         const DDLogicalPart shim1Log(pincerShim1Name(), pincerShimMat(), shim1Solid);
2851         const std::vector<double>& shim1Parms(shim1Solid.parameters());
2852         cpv.position(
2853             shim1Log,
2854             pincerEnvName(),
2855             copyOne,
2856             DDTranslation(+envParms[0] - shim1Parms[0], -envParms[1] + shim1Parms[1], -envParms[2] + shim1Parms[2]),
2857             DDRotation());
2858 
2859         for (unsigned int iEnv(0); iEnv != vecPincerEnvZOff().size(); ++iEnv) {
2860           cpv.position(envLog,
2861                        pincerRodName(),
2862                        1 + iEnv,
2863                        DDTranslation(0, 0, -ilyLength / 2. + vecPincerEnvZOff()[iEnv] - pincerEnvLength() / 2.),
2864                        DDRotation());
2865         }
2866 
2867         // Place the rods
2868         //   const double radius ( fawRadOff() - pincerEnvHeight()/2 -1*mm ) ;
2869         const double radius(ilyRMin - pincerEnvHeight() / 2 - 1 * mm);
2870 
2871         const DDName xilyName(ddname(ilyName() + std::to_string(vecIlyMat().size() - 1)));
2872 
2873         for (unsigned int iRod(0); iRod != vecPincerRodAzimuth().size(); ++iRod) {
2874           const DDTranslation rodTra(
2875               radius * cos(vecPincerRodAzimuth()[iRod]), radius * sin(vecPincerRodAzimuth()[iRod]), 0);
2876 
2877           cpv.position(rodLog,
2878                        xilyName,
2879                        1 + iRod,
2880                        rodTra,
2881                        myrot(pincerRodName().name() + std::to_string(iRod),
2882                              CLHEP::HepRotationZ(90 * deg + vecPincerRodAzimuth()[iRod])));
2883         }
2884       }
2885       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2886       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2887       //!!!!!!!!!!!!!! End   Pincers       !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2888       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2889       //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2890     }
2891   }
2892 
2893 #ifdef EDM_ML_DEBUG
2894   edm::LogVerbatim("EcalGeom") << "******** DDEcalBarrelAlgo test: end it...";
2895 #endif
2896 }
2897 
2898 ///Create a DDRotation from a string converted to DDName and CLHEP::HepRotation converted to DDRotationMatrix. -- Michael Case
2899 DDRotation DDEcalBarrelAlgo::myrot(const std::string& s, const CLHEP::HepRotation& r) const {
2900   return DDrot(
2901       ddname(m_idNameSpace + ":" + s),
2902       std::make_unique<DDRotationMatrix>(r.xx(), r.xy(), r.xz(), r.yx(), r.yy(), r.yz(), r.zx(), r.zy(), r.zz()));
2903 }
2904 
2905 DDMaterial DDEcalBarrelAlgo::ddmat(const std::string& s) const { return DDMaterial(ddname(s)); }
2906 
2907 DDName DDEcalBarrelAlgo::ddname(const std::string& s) const {
2908   const pair<std::string, std::string> temp(DDSplit(s));
2909   if (temp.second.empty()) {
2910     return DDName(temp.first, m_idNameSpace);
2911   } else {
2912     return DDName(temp.first, temp.second);
2913   }
2914 }
2915 
2916 DDSolid DDEcalBarrelAlgo::mytrap(const std::string& s, const EcalTrapezoidParameters& t) const {
2917   return DDSolidFactory::trap(
2918       ddname(s), t.dz(), t.theta(), t.phi(), t.h1(), t.bl1(), t.tl1(), t.alp1(), t.h2(), t.bl2(), t.tl2(), t.alp2());
2919 }
2920 
2921 void DDEcalBarrelAlgo::web(unsigned int iWeb,
2922                            double bWeb,
2923                            double BWeb,
2924                            double LWeb,
2925                            double theta,
2926                            const HepGeom::Point3D<double>& corner,
2927                            const DDLogicalPart& logPar,
2928                            double& zee,
2929                            double side,
2930                            double front,
2931                            double delta,
2932                            DDCompactView& cpv) {
2933   const unsigned int copyOne(1);
2934 
2935   const double LWebx(vecWebLength()[iWeb]);
2936 
2937   const double BWebx(bWeb + (BWeb - bWeb) * LWebx / LWeb);
2938 
2939   const double thick(vecWebPlTh()[iWeb] + vecWebClrTh()[iWeb]);
2940   const Trap trapWebClr(BWebx / 2,     // A/2
2941                         bWeb / 2,      // a/2
2942                         bWeb / 2,      // b/2
2943                         thick / 2,     // H/2
2944                         thick / 2,     // h/2
2945                         LWebx / 2,     // L/2
2946                         90 * deg,      // alfa1
2947                         bWeb - BWebx,  // x15
2948                         0              // y15
2949   );
2950   const DDName webClrDDName(webClrName() + std::to_string(iWeb));
2951   const DDSolid webClrSolid(mytrap(webClrDDName.name(), trapWebClr));
2952   const DDLogicalPart webClrLog(webClrDDName, webClrMat(), webClrSolid);
2953 
2954   const Trap trapWebPl(trapWebClr.A() / 2,               // A/2
2955                        trapWebClr.a() / 2,               // a/2
2956                        trapWebClr.b() / 2,               // b/2
2957                        vecWebPlTh()[iWeb] / 2,           // H/2
2958                        vecWebPlTh()[iWeb] / 2,           // h/2
2959                        trapWebClr.L() / 2.,              // L/2
2960                        90 * deg,                         // alfa1
2961                        trapWebClr.b() - trapWebClr.B(),  // x15
2962                        0                                 // y15
2963   );
2964   const DDName webPlDDName(webPlName() + std::to_string(iWeb));
2965   const DDSolid webPlSolid(mytrap(webPlDDName.fullname(), trapWebPl));
2966   const DDLogicalPart webPlLog(webPlDDName, webPlMat(), webPlSolid);
2967 
2968   cpv.position(webPlLog,  // place plate inside clearance volume
2969                webClrDDName,
2970                copyOne,
2971                DDTranslation(0, 0, 0),
2972                DDRotation());
2973 
2974   const Trap::VertexList vWeb(trapWebClr.vertexList());
2975 
2976   zee += trapWebClr.h() / sin(theta);
2977 
2978   const double beta(theta + delta);
2979 
2980   const double zWeb(zee - front * cos(beta) + side * sin(beta));
2981   const double yWeb(front * sin(beta) + side * cos(beta));
2982 
2983   const Pt3D wedge3(corner + Pt3D(0, -yWeb, zWeb));
2984   const Pt3D wedge2(wedge3 + Pt3D(0, trapWebClr.h() * cos(theta), -trapWebClr.h() * sin(theta)));
2985   const Pt3D wedge1(wedge3 + Pt3D(trapWebClr.a(), 0, 0));
2986 
2987 #ifdef EDM_ML_DEBUG
2988   edm::LogVerbatim("EcalGeom") << "trap1=" << vWeb[0] << ", trap2=" << vWeb[2] << ", trap3=" << vWeb[3];
2989 
2990   edm::LogVerbatim("EcalGeom") << "wedge1=" << wedge1 << ", wedge2=" << wedge2 << ", wedge3=" << wedge3;
2991 #endif
2992   const Tf3D tForm(vWeb[0], vWeb[2], vWeb[3], wedge1, wedge2, wedge3);
2993 
2994   if (0 != webHere())
2995     cpv.position(webClrLog,
2996                  logPar,
2997                  copyOne,
2998                  DDTranslation(tForm.getTranslation().x(), tForm.getTranslation().y(), tForm.getTranslation().z()),
2999                  myrot(webClrLog.name().name() + std::to_string(iWeb), tForm.getRotation()));
3000 }
3001 
3002 #include "DetectorDescription/Core/interface/DDAlgorithmFactory.h"
3003 
3004 DEFINE_EDM_PLUGIN(DDAlgorithmFactory, DDEcalBarrelAlgo, "ecal:DDEcalBarrelAlgo");