Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-08 08:16:18

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