CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/Geometry/EcalCommonData/src/DDEcalBarrelAlgo.cc

Go to the documentation of this file.
00001 
00003 // File: DDEcalBarrelAlgo.cc
00004 // Description: Geometry factory class for Ecal Barrel
00006 
00007 #include <cmath>
00008 #include <algorithm>
00009 
00010 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00011 #include "DetectorDescription/Base/interface/DDutils.h"
00012 #include "DetectorDescription/Core/interface/DDLogicalPart.h"
00013 #include "DetectorDescription/Core/interface/DDSolid.h"
00014 #include "DetectorDescription/Core/interface/DDCurrentNamespace.h"
00015 #include "DetectorDescription/Base/interface/DDTranslation.h"
00016 #include "Geometry/EcalCommonData/interface/DDEcalBarrelAlgo.h"
00017 #include "CLHEP/Units/GlobalSystemOfUnits.h"
00018 
00019 #include <CLHEP/Geometry/Point3D.h>
00020 #include <CLHEP/Geometry/Vector3D.h>
00021 #include <CLHEP/Geometry/Transform3D.h>
00022 
00023 namespace std{} using namespace std;
00024 
00025 DDEcalBarrelAlgo::DDEcalBarrelAlgo() :
00026   m_idNameSpace  ( "" ),
00027   m_BarName      ( "" ),
00028   m_BarMat       ( "" ),
00029   m_vecBarZPts   (    ),
00030   m_vecBarRMin   (    ),
00031   m_vecBarRMax   (    ),
00032   m_vecBarTran   (    ),
00033   m_vecBarRota   (    ),
00034   m_vecBarRota2  (    ),
00035   m_vecBarRota3  (    ),
00036   m_BarPhiLo     (0),
00037   m_BarPhiHi     (0),
00038   m_BarHere      (0),
00039   m_SpmName      (""),
00040   m_SpmMat       (""),
00041   m_vecSpmZPts   (),
00042   m_vecSpmRMin   (),
00043   m_vecSpmRMax   (),
00044   m_vecSpmTran   (),
00045   m_vecSpmRota   (),
00046   m_vecSpmBTran  (),
00047   m_vecSpmBRota  (),
00048   m_SpmNPerHalf  (0),
00049   m_SpmLowPhi    (0),
00050   m_SpmDelPhi    (0),
00051   m_SpmPhiOff    (0),
00052   m_vecSpmHere   (),
00053   m_SpmCutName   (""),
00054   m_SpmCutThick  (0),
00055   m_SpmCutShow   (0),
00056   m_vecSpmCutTM  (),
00057   m_vecSpmCutTP  (),
00058   m_SpmCutRM     (0),
00059   m_SpmCutRP     (0),
00060   m_SpmExpThick  (0),
00061   m_SpmExpWide   (0),
00062   m_SpmExpYOff   (0),
00063   m_SpmSideName  (""),
00064   m_SpmSideMat   (""),
00065   m_SpmSideHigh  (0),
00066   m_SpmSideThick (0),
00067   m_SpmSideYOffM (0),
00068   m_SpmSideYOffP (0),
00069   m_NomCryDimAF  (0),    
00070   m_NomCryDimLZ  (0),  
00071   m_vecNomCryDimBF (),
00072   m_vecNomCryDimCF (),
00073   m_vecNomCryDimAR (),
00074   m_vecNomCryDimBR (),
00075   m_vecNomCryDimCR (),
00076   m_UnderAF      (0),  
00077   m_UnderLZ      (0),
00078   m_UnderBF      (0),
00079   m_UnderCF      (0),
00080   m_UnderAR      (0),
00081   m_UnderBR      (0),
00082   m_UnderCR      (0),
00083   m_WallThAlv    (0),
00084   m_WrapThAlv    (0),
00085   m_ClrThAlv     (0),
00086   m_vecGapAlvEta (),
00087   m_WallFrAlv    (0),
00088   m_WrapFrAlv    (0),
00089   m_ClrFrAlv     (0),
00090   m_WallReAlv    (0),
00091   m_WrapReAlv    (0),
00092   m_ClrReAlv     (0),
00093   m_NCryTypes    (0),
00094   m_NCryPerAlvEta (0),
00095   m_CryName      (""),
00096   m_ClrName      (""),
00097   m_WrapName     (""),
00098   m_WallName     (""),
00099   m_CryMat       (""),
00100   m_ClrMat       (""),
00101   m_WrapMat      (""),
00102   m_WallMat      (""),
00103 
00104   m_APDName      (""),
00105   m_APDHere      (0),
00106   m_APDMat       (""),
00107   m_APDSide      (0),
00108   m_APDThick     (0),
00109   m_APDZ         (0),
00110   m_APDX1        (0),
00111   m_APDX2        (0),
00112 
00113   m_WebHere      (0),
00114   m_WebPlName    (""),    
00115   m_WebClrName   (""),    
00116   m_WebPlMat     (""),
00117   m_WebClrMat    (""),
00118   m_vecWebPlTh   (),
00119   m_vecWebClrTh  (),
00120   m_vecWebLength (),
00121   m_IlyHere      (0),
00122   m_IlyName      (),
00123   m_IlyPhiLow    (0),
00124   m_IlyDelPhi    (0),
00125   m_vecIlyMat    (),
00126   m_vecIlyThick  (),
00127   m_IlyPipeName      (""),
00128   m_IlyPipeHere      (0),
00129   m_IlyPipeMat       (""),
00130   m_IlyPipeOD        (0),
00131   m_IlyPipeID        (0),
00132   m_vecIlyPipeLength (),
00133   m_vecIlyPipeType   (),
00134   m_vecIlyPipePhi    (),
00135   m_vecIlyPipeZ      (),
00136   m_IlyPTMName        (""),
00137   m_IlyPTMHere        (0),
00138   m_IlyPTMMat         (""),
00139   m_IlyPTMWidth       (0),
00140   m_IlyPTMLength      (0),
00141   m_IlyPTMHeight      (0),
00142   m_vecIlyPTMZ        (),
00143   m_vecIlyPTMPhi      (),
00144   m_IlyFanOutName  (""),
00145   m_IlyFanOutHere  (0),
00146   m_IlyFanOutMat   (""),
00147   m_IlyFanOutWidth (0),
00148   m_IlyFanOutLength(0),
00149   m_IlyFanOutHeight(0),
00150   m_vecIlyFanOutZ  (),
00151   m_vecIlyFanOutPhi(),
00152   m_IlyDiffName    (""),
00153   m_IlyDiffMat     (""),
00154   m_IlyDiffOff     (0),
00155   m_IlyDiffLength  (0),
00156   m_IlyBndlName    (""),
00157   m_IlyBndlMat     (""),
00158   m_IlyBndlOff     (0),
00159   m_IlyBndlLength  (0),
00160   m_IlyFEMName     (""),
00161   m_IlyFEMMat      (""),
00162   m_IlyFEMWidth    (0),
00163   m_IlyFEMLength   (0),
00164   m_IlyFEMHeight   (0),
00165   m_vecIlyFEMZ     (),
00166   m_vecIlyFEMPhi   (),
00167   m_HawRName     (""),
00168   m_FawName      (""),
00169   m_FawHere      (0),
00170   m_HawRHBIG     (0),
00171   m_HawRhsml     (0),
00172   m_HawRCutY     (0),
00173   m_HawRCutZ     (0),
00174   m_HawRCutDelY  (0),
00175   m_HawYOffCry   (0),
00176   m_NFawPerSupm  (0),
00177   m_FawPhiOff    (0),
00178   m_FawDelPhi    (0),
00179   m_FawPhiRot    (0),
00180   m_FawRadOff    (0),
00181   m_GridHere      (0),
00182   m_GridName     (""),
00183   m_GridMat      (""),
00184   m_GridThick    (0),
00185   m_BackXOff     (0),
00186   m_BackYOff     (0),
00187   m_BackHere      (0),
00188   m_BackSideName          (""),
00189   m_BackSideHere          (0),
00190   m_BackSideLength        (0),
00191   m_BackSideHeight        (0),
00192   m_BackSideWidth         (0),
00193   m_BackSideYOff1        (0),
00194   m_BackSideYOff2        (0),
00195   m_BackSideAngle        (0),
00196   m_BackSideMat           (""),
00197   m_BackPlateName    (""),
00198   m_BackPlateHere          (0),
00199   m_BackPlateLength  (0),
00200   m_BackPlateThick   (0),
00201   m_BackPlateWidth   (0),
00202   m_BackPlateMat     (""),
00203   m_BackPlate2Name    (""),
00204   m_BackPlate2Thick   (0),
00205   m_BackPlate2Mat     (""),
00206   m_GrilleName      (""),
00207   m_GrilleHere      (0),
00208   m_GrilleThick     (0),
00209   m_GrilleWidth     (0),
00210   m_GrilleZSpace    (0),
00211   m_GrilleMat       (""),
00212   m_vecGrilleHeight (),
00213   m_vecGrilleZOff   (),
00214   m_GrEdgeSlotName     (""),
00215   m_GrEdgeSlotMat      (""),
00216   m_GrEdgeSlotHere     (0),
00217   m_GrEdgeSlotHeight   (0),
00218   m_GrEdgeSlotWidth    (0),
00219   m_GrMidSlotName      (""),
00220   m_GrMidSlotMat       (""),
00221   m_GrMidSlotHere      (0),
00222   m_GrMidSlotWidth     (0),
00223   m_GrMidSlotXOff      (0),
00224   m_vecGrMidSlotHeight (),
00225   m_BackPipeHere      (0),
00226   m_BackPipeName    (""),
00227   m_vecBackPipeDiam (),
00228   m_vecBackPipeThick (),
00229   m_BackPipeMat     (""),
00230   m_BackPipeWaterMat (""),
00231 
00232   m_vecBackCoolName       (),
00233   m_BackCoolHere      (0),
00234   m_BackCoolBarHere      (0),
00235   m_BackCoolBarWidth       (0),
00236   m_BackCoolBarHeight      (0),
00237   m_BackCoolMat           (""),
00238   m_BackCoolBarName       (""),
00239   m_BackCoolBarThick      (0),
00240   m_BackCoolBarMat        (""),
00241   m_BackCoolBarSSName     (""),
00242   m_BackCoolBarSSThick    (0),
00243   m_BackCoolBarSSMat      (""),
00244   m_BackCoolBarWaName     (""),
00245   m_BackCoolBarWaThick    (0),
00246   m_BackCoolBarWaMat      (""),
00247   m_BackCoolVFEHere      (0),
00248   m_BackCoolVFEName       (""),
00249   m_BackCoolVFEMat        (""),
00250   m_BackVFEName           (""),
00251   m_BackVFEMat            (""),
00252   m_vecBackVFELyrThick    (),
00253   m_vecBackVFELyrName     (),
00254   m_vecBackVFELyrMat      (),
00255   m_vecBackCoolNSec       (),
00256   m_vecBackCoolSecSep     (),
00257   m_vecBackCoolNPerSec    (),     
00258 
00259   m_BackMiscHere      (0),
00260   m_vecBackMiscThick (),
00261   m_vecBackMiscName  (),
00262   m_vecBackMiscMat   (),
00263   m_BackCBStdSep         (0),
00264   m_PatchPanelHere      (0),
00265   m_PatchPanelName   (""),
00266   m_vecPatchPanelThick (),
00267   m_vecPatchPanelNames  (),
00268   m_vecPatchPanelMat   (),
00269   m_BackCoolTankHere      (0),
00270   m_BackCoolTankName    (""),
00271   m_BackCoolTankWidth   (0),
00272   m_BackCoolTankThick   (0),
00273   m_BackCoolTankMat     (""),
00274   m_BackCoolTankWaName  (""),
00275   m_BackCoolTankWaWidth (0),
00276   m_BackCoolTankWaMat   (""),
00277   m_BackBracketName     (""),
00278   m_BackBracketHeight   (0),
00279   m_BackBracketMat      (""),
00280 
00281   m_DryAirTubeHere      (0),
00282   m_DryAirTubeName      (""),
00283   m_MBCoolTubeNum       (0),
00284   m_DryAirTubeInnDiam   (0),
00285   m_DryAirTubeOutDiam   (0),
00286   m_DryAirTubeMat       (""),
00287   m_MBCoolTubeHere      (0),
00288   m_MBCoolTubeName      (""),
00289   m_MBCoolTubeInnDiam   (0),
00290   m_MBCoolTubeOutDiam   (0),
00291   m_MBCoolTubeMat       (""),
00292   m_MBManifHere      (0),
00293   m_MBManifName         (""),
00294   m_MBManifInnDiam      (0),
00295   m_MBManifOutDiam      (0),
00296   m_MBManifMat          (""),
00297   m_MBLyrHere      (0),
00298   m_vecMBLyrThick       (0),
00299   m_vecMBLyrName        (),
00300   m_vecMBLyrMat         (),
00301 
00302 
00303   m_PincerRodHere      (0),
00304   m_PincerRodName      (""),
00305   m_PincerRodMat       (""),
00306   m_vecPincerRodAzimuth(),
00307   m_PincerEnvName      (""),
00308   m_PincerEnvMat       (""),
00309   m_PincerEnvWidth     (0),
00310   m_PincerEnvHeight    (0),
00311   m_PincerEnvLength    (0),
00312   m_vecPincerEnvZOff   (),
00313   m_PincerBlkName      (""),
00314   m_PincerBlkMat       (""),
00315   m_PincerBlkLength    (0),
00316   m_PincerShim1Name    (""),
00317   m_PincerShimHeight   (0),
00318   m_PincerShim2Name    (""),
00319   m_PincerShimMat      (""),
00320   m_PincerShim1Width   (0),
00321   m_PincerShim2Width   (0),
00322   m_PincerCutName      (""),
00323   m_PincerCutMat       (""),
00324   m_PincerCutWidth    (0),
00325   m_PincerCutHeight    (0)
00326 
00327 {
00328    LogDebug("EcalGeom") << "DDEcalBarrelAlgo info: Creating an instance" ;
00329 }
00330 
00331 DDEcalBarrelAlgo::~DDEcalBarrelAlgo() {}
00332 
00333 
00334 
00335 
00336 void DDEcalBarrelAlgo::initialize(const DDNumericArguments      & nArgs,
00337                                   const DDVectorArguments       & vArgs,
00338                                   const DDMapArguments          & /*mArgs*/,
00339                                   const DDStringArguments       & sArgs,
00340                                   const DDStringVectorArguments & vsArgs) {
00341 
00342    LogDebug("EcalGeom") << "DDEcalBarrelAlgo info: Initialize" ;
00343    m_idNameSpace = DDCurrentNamespace::ns();
00344    // TRICK!
00345    m_idNameSpace = parent().name().ns();
00346    // barrel parent volume
00347    m_BarName     = sArgs["BarName" ] ;
00348    m_BarMat      = sArgs["BarMat"  ] ;
00349    m_vecBarZPts  = vArgs["BarZPts" ] ;
00350    m_vecBarRMin  = vArgs["BarRMin" ] ;
00351    m_vecBarRMax  = vArgs["BarRMax" ] ;
00352    m_vecBarTran  = vArgs["BarTran" ] ;
00353    m_vecBarRota  = vArgs["BarRota" ] ;
00354    m_vecBarRota2 = vArgs["BarRota2" ] ;
00355    m_vecBarRota3 = vArgs["BarRota3" ] ;
00356    m_BarPhiLo    = nArgs["BarPhiLo" ] ;
00357    m_BarPhiHi    = nArgs["BarPhiHi" ] ;
00358    m_BarHere     = nArgs["BarHere" ] ;
00359 
00360    m_SpmName     = sArgs["SpmName"] ;
00361    m_SpmMat      = sArgs["SpmMat" ] ;
00362    m_vecSpmZPts  = vArgs["SpmZPts"] ;
00363    m_vecSpmRMin  = vArgs["SpmRMin"] ;
00364    m_vecSpmRMax  = vArgs["SpmRMax"] ;
00365    m_vecSpmTran  = vArgs["SpmTran"] ;
00366    m_vecSpmRota  = vArgs["SpmRota"] ;
00367    m_vecSpmBTran = vArgs["SpmBTran"] ;
00368    m_vecSpmBRota = vArgs["SpmBRota"] ;
00369    m_SpmNPerHalf = static_cast<unsigned int> (nArgs["SpmNPerHalf"]) ;
00370    m_SpmLowPhi   = nArgs["SpmLowPhi"] ;
00371    m_SpmDelPhi   = nArgs["SpmDelPhi"] ;
00372    m_SpmPhiOff   = nArgs["SpmPhiOff"] ;
00373    m_vecSpmHere  = vArgs["SpmHere"] ;
00374    m_SpmCutName  = sArgs["SpmCutName"] ;
00375    m_SpmCutThick = nArgs["SpmCutThick"] ;
00376    m_SpmCutShow  = int(nArgs["SpmCutShow"]) ;
00377    m_vecSpmCutTM = vArgs["SpmCutTM"] ;
00378    m_vecSpmCutTP = vArgs["SpmCutTP"] ;
00379    m_SpmCutRM    = nArgs["SpmCutRM"] ;
00380    m_SpmCutRP    = nArgs["SpmCutRP"] ;
00381    m_SpmExpThick = nArgs["SpmExpThick"] ;
00382    m_SpmExpWide  = nArgs["SpmExpWide"] ;
00383    m_SpmExpYOff  = nArgs["SpmExpYOff"] ;
00384    m_SpmSideName = sArgs["SpmSideName"] ;
00385    m_SpmSideMat  = sArgs["SpmSideMat" ] ;
00386    m_SpmSideHigh = nArgs["SpmSideHigh"] ;
00387    m_SpmSideThick= nArgs["SpmSideThick"] ;
00388    m_SpmSideYOffM= nArgs["SpmSideYOffM"] ;
00389    m_SpmSideYOffP= nArgs["SpmSideYOffP"] ;
00390 
00391    m_NomCryDimAF    = nArgs["NomCryDimAF"] ;
00392    m_NomCryDimLZ    = nArgs["NomCryDimLZ"] ;
00393    m_vecNomCryDimBF = vArgs["NomCryDimBF"] ;
00394    m_vecNomCryDimCF = vArgs["NomCryDimCF"] ;
00395    m_vecNomCryDimAR = vArgs["NomCryDimAR"] ;
00396    m_vecNomCryDimBR = vArgs["NomCryDimBR"] ;
00397    m_vecNomCryDimCR = vArgs["NomCryDimCR"] ;
00398 
00399    m_UnderAF = nArgs["UnderAF"] ; 
00400    m_UnderLZ = nArgs["UnderLZ"] ; 
00401    m_UnderBF = nArgs["UnderBF"] ; 
00402    m_UnderCF = nArgs["UnderCF"] ; 
00403    m_UnderAR = nArgs["UnderAR"] ; 
00404    m_UnderBR = nArgs["UnderBR"] ; 
00405    m_UnderCR = nArgs["UnderCR"] ; 
00406 
00407    m_WallThAlv = nArgs["WallThAlv"] ;
00408    m_WrapThAlv = nArgs["WrapThAlv"] ;
00409    m_ClrThAlv  = nArgs["ClrThAlv"] ;
00410    m_vecGapAlvEta = vArgs["GapAlvEta"] ;
00411 
00412    m_WallFrAlv = nArgs["WallFrAlv"] ;
00413    m_WrapFrAlv = nArgs["WrapFrAlv"] ;
00414    m_ClrFrAlv  = nArgs["ClrFrAlv"] ;
00415 
00416    m_WallReAlv = nArgs["WallReAlv"] ;
00417    m_WrapReAlv = nArgs["WrapReAlv"] ;
00418    m_ClrReAlv  = nArgs["ClrReAlv"] ;
00419 
00420    m_NCryTypes     = static_cast<unsigned int> ( nArgs["NCryTypes"] ) ;
00421    m_NCryPerAlvEta = static_cast<unsigned int> ( nArgs["NCryPerAlvEta"] ) ;
00422 
00423    m_CryName  = sArgs["CryName"] ;
00424    m_ClrName  = sArgs["ClrName"] ;
00425    m_WrapName = sArgs["WrapName"] ; 
00426    m_WallName = sArgs["WallName"] ; 
00427 
00428    m_CryMat  = sArgs["CryMat"] ; 
00429    m_ClrMat  = sArgs["ClrMat"] ; 
00430    m_WrapMat = sArgs["WrapMat"] ; 
00431    m_WallMat = sArgs["WallMat"] ;
00432 
00433    m_APDName  = sArgs["APDName"] ;
00434    m_APDHere  = nArgs["APDHere"] ;
00435    m_APDMat   = sArgs["APDMat"] ;
00436    m_APDSide  = nArgs["APDSide"] ;
00437    m_APDThick = nArgs["APDThick"] ;
00438    m_APDZ     = nArgs["APDZ"] ;
00439    m_APDX1    = nArgs["APDX1"] ;
00440    m_APDX2    = nArgs["APDX2"] ;
00441 
00442    m_WebHere     = nArgs["WebHere"] ;
00443    m_WebPlName   = sArgs["WebPlName"] ;
00444    m_WebClrName  = sArgs["WebClrName"] ;
00445    m_WebPlMat    = sArgs["WebPlMat"] ;
00446    m_WebClrMat   = sArgs["WebClrMat"] ;
00447    m_vecWebPlTh  = vArgs["WebPlTh"] ;
00448    m_vecWebClrTh = vArgs["WebClrTh"] ;
00449    m_vecWebLength= vArgs["WebLength"] ;
00450 
00451    m_IlyHere     = nArgs["IlyHere"] ;
00452    m_IlyName     = sArgs["IlyName"] ;
00453    m_IlyPhiLow   = nArgs["IlyPhiLow"] ;
00454    m_IlyDelPhi   = nArgs["IlyDelPhi"] ;
00455    m_vecIlyMat   = vsArgs["IlyMat"] ;
00456    m_vecIlyThick = vArgs["IlyThick"] ;
00457 
00458    m_IlyPipeName      = sArgs["IlyPipeName"] ;
00459    m_IlyPipeHere      = nArgs["IlyPipeHere"] ;
00460    m_IlyPipeMat       = sArgs["IlyPipeMat"] ;
00461    m_IlyPipeOD        = nArgs["IlyPipeOD"] ;
00462    m_IlyPipeID        = nArgs["IlyPipeID"] ;
00463    m_vecIlyPipeLength = vArgs["IlyPipeLength"] ;
00464    m_vecIlyPipeType   = vArgs["IlyPipeType"] ;
00465    m_vecIlyPipePhi    = vArgs["IlyPipePhi"] ;
00466    m_vecIlyPipeZ      = vArgs["IlyPipeZ"] ;
00467 
00468    m_IlyPTMName   = sArgs["IlyPTMName"] ;
00469    m_IlyPTMHere   = nArgs["IlyPTMHere"] ;
00470    m_IlyPTMMat    = sArgs["IlyPTMMat"] ;
00471    m_IlyPTMWidth  = nArgs["IlyPTMWidth"] ;
00472    m_IlyPTMLength = nArgs["IlyPTMLength"] ;
00473    m_IlyPTMHeight = nArgs["IlyPTMHeight"] ;
00474    m_vecIlyPTMZ   = vArgs["IlyPTMZ"] ;
00475    m_vecIlyPTMPhi = vArgs["IlyPTMPhi"] ;
00476 
00477    m_IlyFanOutName   = sArgs["IlyFanOutName"] ;
00478    m_IlyFanOutHere   = nArgs["IlyFanOutHere"] ;
00479    m_IlyFanOutMat    = sArgs["IlyFanOutMat"] ;
00480    m_IlyFanOutWidth  = nArgs["IlyFanOutWidth"] ;
00481    m_IlyFanOutLength = nArgs["IlyFanOutLength"] ;
00482    m_IlyFanOutHeight = nArgs["IlyFanOutHeight"] ;
00483    m_vecIlyFanOutZ   = vArgs["IlyFanOutZ"] ;
00484    m_vecIlyFanOutPhi = vArgs["IlyFanOutPhi"] ;
00485    m_IlyDiffName     = sArgs["IlyDiffName"] ;
00486    m_IlyDiffMat      = sArgs["IlyDiffMat"] ;
00487    m_IlyDiffOff      = nArgs["IlyDiffOff"] ;
00488    m_IlyDiffLength   = nArgs["IlyDiffLength"] ;
00489    m_IlyBndlName     = sArgs["IlyBndlName"] ;
00490    m_IlyBndlMat      = sArgs["IlyBndlMat"] ;
00491    m_IlyBndlOff      = nArgs["IlyBndlOff"] ;
00492    m_IlyBndlLength   = nArgs["IlyBndlLength"] ;
00493    m_IlyFEMName      = sArgs["IlyFEMName"] ;
00494    m_IlyFEMMat       = sArgs["IlyFEMMat"] ;
00495    m_IlyFEMWidth     = nArgs["IlyFEMWidth"] ;
00496    m_IlyFEMLength    = nArgs["IlyFEMLength"] ;
00497    m_IlyFEMHeight    = nArgs["IlyFEMHeight"] ;
00498    m_vecIlyFEMZ      = vArgs["IlyFEMZ"] ;
00499    m_vecIlyFEMPhi    = vArgs["IlyFEMPhi"];
00500 
00501    m_HawRName   = sArgs["HawRName"] ;
00502    m_FawName    = sArgs["FawName"] ;
00503    m_FawHere    = nArgs["FawHere"] ;
00504    m_HawRHBIG   = nArgs["HawRHBIG"] ;
00505    m_HawRhsml   = nArgs["HawRhsml"] ;
00506    m_HawRCutY   = nArgs["HawRCutY"] ;
00507    m_HawRCutZ   = nArgs["HawRCutZ"] ;
00508    m_HawRCutDelY= nArgs["HawRCutDelY"] ;
00509    m_HawYOffCry = nArgs["HawYOffCry"] ;
00510 
00511    m_NFawPerSupm=  static_cast<unsigned int> ( nArgs["NFawPerSupm"] ) ;
00512    m_FawPhiOff  = nArgs["FawPhiOff"] ;
00513    m_FawDelPhi  = nArgs["FawDelPhi"] ;
00514    m_FawPhiRot  = nArgs["FawPhiRot"] ;
00515    m_FawRadOff  = nArgs["FawRadOff"] ;
00516 
00517    m_GridHere     = nArgs["GridHere"] ;
00518    m_GridName   = sArgs["GridName"]  ;
00519    m_GridMat    = sArgs["GridMat"]   ;
00520    m_GridThick  = nArgs["GridThick"] ;
00521 
00522    m_BackHere         = nArgs["BackHere"] ;
00523    m_BackXOff         = nArgs["BackXOff"] ;
00524    m_BackYOff         = nArgs["BackYOff"] ;
00525    m_BackSideName     = sArgs["BackSideName"] ;
00526    m_BackSideHere     = nArgs["BackSideHere"] ;
00527    m_BackSideLength   = nArgs["BackSideLength"] ;
00528    m_BackSideHeight   = nArgs["BackSideHeight"] ;
00529    m_BackSideWidth    = nArgs["BackSideWidth"] ;
00530    m_BackSideYOff1    = nArgs["BackSideYOff1"] ;
00531    m_BackSideYOff2    = nArgs["BackSideYOff2"] ;
00532    m_BackSideAngle    = nArgs["BackSideAngle"] ;
00533    m_BackSideMat      = sArgs["BackSideMat"] ;
00534    m_BackPlateName    = sArgs["BackPlateName"] ;
00535    m_BackPlateHere    = nArgs["BackPlateHere"] ;
00536    m_BackPlateLength  = nArgs["BackPlateLength"] ;
00537    m_BackPlateThick   = nArgs["BackPlateThick"] ;
00538    m_BackPlateWidth   = nArgs["BackPlateWidth"] ;
00539    m_BackPlateMat     = sArgs["BackPlateMat"] ;
00540    m_BackPlate2Name    = sArgs["BackPlate2Name"] ;
00541    m_BackPlate2Thick   = nArgs["BackPlate2Thick"] ;
00542    m_BackPlate2Mat     = sArgs["BackPlate2Mat"] ;
00543    m_GrilleName       = sArgs["GrilleName"] ;
00544    m_GrilleHere       = nArgs["GrilleHere"] ;
00545    m_GrilleThick      = nArgs["GrilleThick"] ;
00546    m_GrilleWidth      = nArgs["GrilleWidth"] ;
00547    m_GrilleZSpace     = nArgs["GrilleZSpace"] ;
00548    m_GrilleMat        = sArgs["GrilleMat"] ;
00549    m_vecGrilleHeight  = vArgs["GrilleHeight"] ;
00550    m_vecGrilleZOff    = vArgs["GrilleZOff"] ;
00551 
00552    m_GrEdgeSlotName     = sArgs["GrEdgeSlotName"] ;
00553    m_GrEdgeSlotMat      = sArgs["GrEdgeSlotMat"] ;
00554    m_GrEdgeSlotHere     = nArgs["GrEdgeSlotHere"] ;
00555    m_GrEdgeSlotHeight   = nArgs["GrEdgeSlotHeight"] ;
00556    m_GrEdgeSlotWidth    = nArgs["GrEdgeSlotWidth"] ;
00557    m_GrMidSlotName      = sArgs["GrMidSlotName"] ;
00558    m_GrMidSlotMat       = sArgs["GrMidSlotMat"] ;
00559    m_GrMidSlotHere      = nArgs["GrMidSlotHere"] ;
00560    m_GrMidSlotWidth     = nArgs["GrMidSlotWidth"] ;
00561    m_GrMidSlotXOff      = nArgs["GrMidSlotXOff"] ;
00562    m_vecGrMidSlotHeight = vArgs["GrMidSlotHeight"] ;
00563 
00564    m_BackPipeHere     = nArgs["BackPipeHere"] ;
00565    m_BackPipeName    = sArgs["BackPipeName"] ;
00566    m_vecBackPipeDiam = vArgs["BackPipeDiam"] ;
00567    m_vecBackPipeThick = vArgs["BackPipeThick"] ;
00568    m_BackPipeMat     = sArgs["BackPipeMat"] ;
00569    m_BackPipeWaterMat = sArgs["BackPipeWaterMat"] ;
00570 
00571 
00572    m_BackCoolHere          = nArgs["BackCoolHere"] ;
00573    m_vecBackCoolName       = vsArgs["BackCoolName"] ;
00574    m_BackCoolBarHere       = nArgs["BackCoolBarHere"] ;
00575    m_BackCoolBarWidth      = nArgs["BackCoolBarWidth"] ; 
00576    m_BackCoolBarHeight     = nArgs["BackCoolBarHeight"] ; 
00577    m_BackCoolMat           = sArgs["BackCoolMat"] ;     
00578    m_BackCoolBarName       = sArgs["BackCoolBarName"] ;      
00579    m_BackCoolBarThick      = nArgs["BackCoolBarThick"] ;  
00580    m_BackCoolBarMat        = sArgs["BackCoolBarMat"] ; 
00581    m_BackCoolBarSSName     = sArgs["BackCoolBarSSName"] ;   
00582    m_BackCoolBarSSThick    = nArgs["BackCoolBarSSThick"] ;
00583    m_BackCoolBarSSMat      = sArgs["BackCoolBarSSMat"] ;
00584    m_BackCoolBarWaName     = sArgs["BackCoolBarWaName"] ; 
00585    m_BackCoolBarWaThick    = nArgs["BackCoolBarWaThick"] ;
00586    m_BackCoolBarWaMat      = sArgs["BackCoolBarWaMat"] ;
00587    m_BackCoolVFEHere       = nArgs["BackCoolVFEHere"] ;
00588    m_BackCoolVFEName       = sArgs["BackCoolVFEName"] ; 
00589    m_BackCoolVFEMat        = sArgs["BackCoolVFEMat"] ;  
00590    m_BackVFEName           = sArgs["BackVFEName"] ;   
00591    m_BackVFEMat            = sArgs["BackVFEMat"] ;      
00592    m_vecBackVFELyrThick    = vArgs["BackVFELyrThick"] ;   
00593    m_vecBackVFELyrName     = vsArgs["BackVFELyrName"] ;
00594    m_vecBackVFELyrMat      = vsArgs["BackVFELyrMat"] ;
00595    m_vecBackCoolNSec       = vArgs["BackCoolNSec"] ; 
00596    m_vecBackCoolSecSep     = vArgs["BackCoolSecSep"] ;  
00597    m_vecBackCoolNPerSec    = vArgs["BackCoolNPerSec"] ;  
00598    m_BackCBStdSep          = nArgs["BackCBStdSep"] ;
00599 
00600    m_BackMiscHere       = nArgs["BackMiscHere"] ;
00601    m_vecBackMiscThick   = vArgs["BackMiscThick"] ;
00602    m_vecBackMiscName    = vsArgs["BackMiscName"] ;
00603    m_vecBackMiscMat     = vsArgs["BackMiscMat"] ;
00604    m_PatchPanelHere     = nArgs["PatchPanelHere"] ;
00605    m_vecPatchPanelThick = vArgs["PatchPanelThick"] ;
00606    m_vecPatchPanelNames = vsArgs["PatchPanelNames"] ;
00607    m_vecPatchPanelMat   = vsArgs["PatchPanelMat"] ;
00608    m_PatchPanelName     = sArgs["PatchPanelName"] ;
00609 
00610    m_BackCoolTankHere    = nArgs["BackCoolTankHere"] ;
00611    m_BackCoolTankName    = sArgs["BackCoolTankName"] ;
00612    m_BackCoolTankWidth   = nArgs["BackCoolTankWidth"] ;
00613    m_BackCoolTankThick   = nArgs["BackCoolTankThick"] ;
00614    m_BackCoolTankMat     = sArgs["BackCoolTankMat"] ;
00615    m_BackCoolTankWaName  = sArgs["BackCoolTankWaName"] ;
00616    m_BackCoolTankWaWidth = nArgs["BackCoolTankWaWidth"] ;
00617    m_BackCoolTankWaMat   = sArgs["BackCoolTankWaMat"] ;
00618    m_BackBracketName     = sArgs["BackBracketName"] ;
00619    m_BackBracketHeight   = nArgs["BackBracketHeight"] ;
00620    m_BackBracketMat      = sArgs["BackBracketMat"] ;
00621 
00622    m_DryAirTubeHere     = nArgs["DryAirTubeHere"] ;
00623    m_DryAirTubeName     = sArgs["DryAirTubeName"];
00624    m_MBCoolTubeNum      = static_cast<unsigned int> ( nArgs["MBCoolTubeNum"] ) ;
00625    m_DryAirTubeInnDiam  = nArgs["DryAirTubeInnDiam"];
00626    m_DryAirTubeOutDiam  = nArgs["DryAirTubeOutDiam"];
00627    m_DryAirTubeMat      = sArgs["DryAirTubeMat"];
00628    m_MBCoolTubeHere     = nArgs["MBCoolTubeHere"] ;
00629    m_MBCoolTubeName     = sArgs["MBCoolTubeName"];
00630    m_MBCoolTubeInnDiam  = nArgs["MBCoolTubeInnDiam"];
00631    m_MBCoolTubeOutDiam  = nArgs["MBCoolTubeOutDiam"];
00632    m_MBCoolTubeMat      = sArgs["MBCoolTubeMat"];
00633    m_MBManifHere        = nArgs["MBManifHere"] ;
00634    m_MBManifName        = sArgs["MBManifName"];
00635    m_MBManifInnDiam     = nArgs["MBManifInnDiam"];
00636    m_MBManifOutDiam     = nArgs["MBManifOutDiam"];
00637    m_MBManifMat         = sArgs["MBManifMat"];
00638    m_MBLyrHere          = nArgs["MBLyrHere"] ;
00639    m_vecMBLyrThick      = vArgs["MBLyrThick"];
00640    m_vecMBLyrName       = vsArgs["MBLyrName"];
00641    m_vecMBLyrMat        = vsArgs["MBLyrMat"];
00642 
00643    m_PincerRodHere      = nArgs["PincerRodHere"];
00644    m_PincerRodName      = sArgs["PincerRodName"];
00645    m_PincerRodMat       = sArgs["PincerRodMat"];
00646    m_vecPincerRodAzimuth= vArgs["PincerRodAzimuth"];
00647    m_PincerEnvName      = sArgs["PincerEnvName"];
00648    m_PincerEnvMat       = sArgs["PincerEnvMat"];
00649    m_PincerEnvWidth     = nArgs["PincerEnvWidth"];
00650    m_PincerEnvHeight    = nArgs["PincerEnvHeight"];
00651    m_PincerEnvLength    = nArgs["PincerEnvLength"];
00652    m_vecPincerEnvZOff   = vArgs["PincerEnvZOff"];
00653    m_PincerBlkName      = sArgs["PincerBlkName"];
00654    m_PincerBlkMat       = sArgs["PincerBlkMat"];
00655    m_PincerBlkLength    = nArgs["PincerBlkLength"];
00656    m_PincerShim1Name    = sArgs["PincerShim1Name"];
00657    m_PincerShimHeight   = nArgs["PincerShimHeight"];
00658    m_PincerShim2Name    = sArgs["PincerShim2Name"];
00659    m_PincerShimMat      = sArgs["PincerShimMat"];
00660    m_PincerShim1Width   = nArgs["PincerShim1Width"];
00661    m_PincerShim2Width   = nArgs["PincerShim2Width"];
00662    m_PincerCutName      = sArgs["PincerCutName"];
00663    m_PincerCutMat       = sArgs["PincerCutMat"];
00664    m_PincerCutWidth     = nArgs["PincerCutWidth"];
00665    m_PincerCutHeight    = nArgs["PincerCutHeight"];
00666 
00667    
00668    LogDebug("EcalGeom") << "DDEcalBarrelAlgo info: end initialize" ;
00669 }
00670 
00672 // DDEcalBarrelAlgo methods...
00674 
00675 void DDEcalBarrelAlgo::execute(DDCompactView& cpv) 
00676 {
00677    LogDebug("EcalGeom") << "******** DDEcalBarrelAlgo execute!" << std::endl ;
00678 
00679    if( barHere() != 0 )
00680    {
00681       const unsigned int copyOne (1) ;
00682       const unsigned int copyTwo (2) ;
00683       // Barrel parent volume----------------------------------------------------------
00684       cpv.position( DDLogicalPart( barName(), barMat(), 
00685                             DDSolidFactory::polycone(
00686                                barName(), barPhiLo(), ( barPhiHi() - barPhiLo() ), 
00687                                vecBarZPts(), vecBarRMin(), vecBarRMax())),
00688              parent().name() , 
00689              copyOne, 
00690              DDTranslation(vecBarTran()[0],
00691                            vecBarTran()[1],
00692                            vecBarTran()[2]), 
00693              myrot(barName().name()+"Rot",
00694                    Rota(Vec3(vecBarRota3()[0],
00695                              vecBarRota3()[1],
00696                              vecBarRota3()[2]),
00697                         vecBarRota3()[3])*
00698                    Rota(Vec3(vecBarRota2()[0],
00699                              vecBarRota2()[1],
00700                              vecBarRota2()[2]),
00701                         vecBarRota2()[3])*
00702                    Rota(Vec3(vecBarRota()[0],
00703                              vecBarRota()[1],
00704                              vecBarRota()[2]),
00705                         vecBarRota()[3]) ) ) ;
00706       // End Barrel parent volume----------------------------------------------------------
00707 
00708 
00709       // Supermodule parent------------------------------------------------------------
00710 
00711       const DDName spmcut1ddname ( ( 0 != spmCutShow() ) ?
00712                                    spmName() : ddname( m_SpmName + "CUT1" ) ) ;
00713       const DDSolid ddspm ( DDSolidFactory::polycone(
00714                                spmcut1ddname,
00715                                spmLowPhi(),  spmDelPhi(),
00716                                vecSpmZPts(), vecSpmRMin(), vecSpmRMax())) ;
00717 
00718       const unsigned int indx ( vecSpmRMax().size()/2 ) ;
00719 
00720 
00721       // Deal with the cut boxes first
00722       const DDSolid spmCutBox ( DDSolidFactory::box(
00723                                    spmCutName(), 
00724                                    1.05*(vecSpmRMax()[indx] - vecSpmRMin()[indx])/2.,  
00725                                    spmCutThick()/2.,
00726                                    fabs( vecSpmZPts().back() - vecSpmZPts().front() )/2.+1*mm) ) ;
00727       const std::vector<double>& cutBoxParms ( spmCutBox.parameters() ) ;
00728       const DDLogicalPart spmCutLog ( spmCutName(), spmMat(), spmCutBox ) ;
00729 
00730       // Now the expansion box
00731       const double xExp ( spmExpThick()/2. ) ;
00732       const double yExp ( spmExpWide()/2. ) ;
00733       const double zExp ( fabs( vecSpmZPts().back() -
00734                                 vecSpmZPts().front() )/2.) ;
00735       const DDName expName ( m_SpmName + "EXP" ) ;
00736       const DDSolid spmExpBox ( DDSolidFactory::box(
00737                                    expName , 
00738                                    xExp    ,  
00739                                    yExp    ,
00740                                    zExp     )) ;
00741       const DDTranslation expTra ( vecSpmRMax().back() - xExp, spmExpYOff(),
00742                                    vecSpmZPts().front() + zExp ) ;
00743       const DDLogicalPart expLog ( expName, spmMat(), spmExpBox ) ;
00744 
00745 /*      const DDName unionName ( ddname( m_SpmName + "UNI" ) ) ;
00746       if( 0 != spmCutShow() )
00747       {
00748          cpv.position( expLog, spmName(), copyOne, expTra, DDRotation() ) ;
00749       }
00750       else
00751       {
00752          const DDSolid unionSolid ( DDSolidFactory::unionSolid(
00753                                        unionName,
00754                                        spmcut1ddname, expName,
00755                                        expTra, DDRotation() ) ) ;
00756                                        }*/
00757 
00758 
00759       // Supermodule side platess
00760       const DDSolid sideSolid ( DDSolidFactory::box(
00761                                    spmSideName(), 
00762                                    spmSideHigh()/2.,  
00763                                    spmSideThick()/2.,
00764                                    fabs( vecSpmZPts()[1] - vecSpmZPts()[0] )/2.) ) ;
00765       const std::vector<double>& sideParms ( sideSolid.parameters() ) ;
00766       const DDLogicalPart sideLog ( spmSideName(), spmSideMat(), sideSolid ) ;
00767       
00768       DDSolid temp1 ;
00769       DDSolid temp2 ;
00770       for( unsigned int icopy(1); icopy <= 2; ++icopy )
00771       {
00772          const std::vector<double>& tvec ( 1==icopy ? vecSpmCutTM() : vecSpmCutTP() ) ;
00773          const double rang               ( 1==icopy ? spmCutRM() : spmCutRP() ) ;
00774          
00775          const Tl3D tr ( tvec[0], tvec[1], tvec[2] );
00776          const RoZ3D   ro ( rang ) ;
00777          const Tf3D alltrot (
00778             RoZ3D( 1==icopy ? spmLowPhi() : spmLowPhi()+spmDelPhi() )*
00779             Tl3D( ( vecSpmRMax()[indx]+vecSpmRMin()[indx])/2.,
00780                   0,
00781                   (vecSpmZPts().front()+ vecSpmZPts().back())/2.)*
00782             tr*ro) ;
00783 
00784          const DDRotation    ddrot ( myrot(spmCutName().name() + 
00785                                            dbl_to_string(icopy),
00786                                            alltrot.getRotation() ) ) ;
00787          const DDTranslation ddtra ( alltrot.getTranslation() ) ;
00788 
00789          
00790          const Tl3D trSide ( tvec[0], 
00791                              tvec[1] + ( 1==icopy ? 1. : -1. )*( cutBoxParms[1]+sideParms[1] )
00792                              + ( 1==icopy ? spmSideYOffM() : spmSideYOffP() ), 
00793                              tvec[2] );
00794          const RoZ3D   roSide ( rang ) ;
00795          const Tf3D sideRot (
00796             RoZ3D( 1==icopy ? spmLowPhi() : spmLowPhi()+spmDelPhi() )*
00797             Tl3D( vecSpmRMin().front() + sideParms[0] ,
00798                   0,
00799                   vecSpmZPts().front()+ sideParms[2] )*
00800             trSide*roSide) ;
00801 
00802          const DDRotation    sideddrot ( myrot(spmSideName().name() + 
00803                                                dbl_to_string(icopy),
00804                                                sideRot.getRotation() ) ) ;
00805          const DDTranslation sideddtra ( sideRot.getTranslation() ) ;
00806 
00807          cpv.position( sideLog,
00808                 spmName(), 
00809                 icopy, 
00810                 sideddtra,
00811                 sideddrot ) ;
00812 
00813 
00814          if( 0 != spmCutShow() ) // do this if we are "showing" the boxes
00815          {
00816             cpv.position( spmCutLog,
00817                    spmName(), 
00818                    icopy, 
00819                    ddtra,
00820                    ddrot ) ;
00821          }
00822          else // do this if we are subtracting the boxes
00823          {
00824             if( 1 == icopy )
00825             {
00826                temp1 = DDSolidFactory::subtraction( DDName( m_SpmName+"_T1" ),
00827                                                     spmcut1ddname, spmCutBox,
00828                                                     ddtra, ddrot ) ;
00829             }
00830             else
00831             {
00832                temp2 = DDSolidFactory::subtraction( spmName(),
00833                                                     temp1, spmCutBox,
00834                                                     ddtra, ddrot ) ;
00835             }
00836          }
00837       }
00838 
00839       const DDLogicalPart spmLog (spmName(), spmMat(), 
00840                                   ((0 != spmCutShow()) ? ddspm : temp2)  ) ;
00841 
00842       const double dphi ( 360.*deg/(1.*spmNPerHalf() ) ) ;
00843       for( unsigned int iphi (0); iphi<2*spmNPerHalf() ; ++iphi ) 
00844       {
00845          const double phi ( iphi*dphi + spmPhiOff() ) ; //- 0.000130/deg ) ;
00846 
00847          // this base rotation includes the base translation & rotation
00848          // plus flipping for the negative z hemisphere, plus
00849          // the phi rotation for this module
00850          const Tf3D rotaBase ( RoZ3D( phi )*
00851                                ( iphi < spmNPerHalf() ? Ro3D() :
00852                                  RoX3D( 180.*deg ) )*
00853                                Ro3D( vecSpmBRota()[3],
00854                                      Vec3( vecSpmBRota()[0],
00855                                            vecSpmBRota()[1],
00856                                            vecSpmBRota()[2]))*
00857                                Tl3D( Vec3( vecSpmBTran()[0],
00858                                            vecSpmBTran()[1],
00859                                            vecSpmBTran()[2] ))) ;
00860 
00861          // here the individual rotations & translations of the supermodule
00862          // are implemented on top of the overall "base" rotation & translation
00863 
00864          const unsigned int offr ( 4*iphi ) ;
00865          const unsigned int offt ( 3*iphi ) ;
00866 
00867          const Ro3D r1 ( vecSpmRota()[     offr+3], 
00868                          Vec3(vecSpmRota()[offr+0],
00869                               vecSpmRota()[offr+1],
00870                               vecSpmRota()[offr+2]  ) ) ;
00871 
00872          const Tf3D rotaExtra ( r1*Tl3D( Vec3(vecSpmTran()[offt+0],
00873                                               vecSpmTran()[offt+1],
00874                                               vecSpmTran()[offt+2]  ) ) ) ;
00875 
00876          const Tf3D both ( rotaExtra*rotaBase ) ;
00877 
00878          const DDRotation rota ( myrot( spmName().name()+dbl_to_string(phi/deg), 
00879                                         both.getRotation() ) );
00880 
00881          if( vecSpmHere()[iphi] != 0 )
00882          {
00883            // convert from CLHEP to DDTranslation & etc. -- Michael Case
00884            DDTranslation myTran(both.getTranslation().x(), both.getTranslation().y(), both.getTranslation().z());
00885             cpv.position( spmLog,
00886                    barName(), 
00887                    iphi+1, 
00888                    myTran,
00889                    rota                     ) ;
00890          }
00891       } 
00892       // End Supermodule parent------------------------------------------------------------
00893 
00894       // Begin Inner Layer volumes---------------------------------------------------------
00895       const double  ilyLength  ( vecSpmZPts()[1] - vecSpmZPts()[0] ) ;
00896       double        ilyRMin    ( vecSpmRMin()[0] ) ;
00897       double        ilyThick   ( 0 ) ;
00898       for( unsigned int ilyx ( 0 ) ; ilyx != vecIlyThick().size() ; ++ilyx )
00899       {
00900          ilyThick += vecIlyThick()[ilyx] ;
00901       }
00902       const DDName        ilyDDName  ( ddname( ilyName() ) ) ;
00903       const DDSolid       ilySolid   ( DDSolidFactory::tubs( ilyDDName,
00904                                                              ilyLength/2,
00905                                                              ilyRMin,
00906                                                              ilyRMin + ilyThick,
00907                                                              ilyPhiLow(),
00908                                                              ilyDelPhi() ) ) ;
00909       const DDLogicalPart ilyLog     ( ilyDDName, spmMat(), ilySolid ) ;
00910       cpv.position( ilyLog,
00911              spmLog, 
00912              copyOne, 
00913              DDTranslation(0,0, ilyLength/2 ),
00914              DDRotation() ) ;
00915 
00916       DDLogicalPart ilyPipeLog[200] ;
00917 
00918       if( 0 != ilyPipeHere() )
00919       {
00920          for( unsigned int iPipeType ( 0 ) ; iPipeType != vecIlyPipeLength().size(); ++iPipeType )
00921          {
00922             const DDName pName ( ddname( ilyPipeName() + "_" + 
00923                                          int_to_string(iPipeType+1) ) ) ;
00924          
00925             DDSolid ilyPipeSolid ( DDSolidFactory::tubs( pName ,
00926                                                          vecIlyPipeLength()[iPipeType]/2.,
00927                                                          0,
00928                                                          ilyPipeOD()/2,
00929                                                          0*deg, 360*deg ) ) ;
00930             ilyPipeLog[iPipeType] = DDLogicalPart( pName, ilyPipeMat(), ilyPipeSolid ) ;
00931                   
00932             const DDName pWaName ( ddname( ilyPipeName() + "Wa_" + 
00933                                            int_to_string(iPipeType+1) ) ) ;
00934             DDSolid ilyPipeWaSolid ( DDSolidFactory::tubs( pWaName ,
00935                                                            vecIlyPipeLength()[iPipeType]/2.,
00936                                                            0, 
00937                                                            ilyPipeID()/2,
00938                                                            0*deg, 360*deg ) ) ;
00939             const DDLogicalPart ilyPipeWaLog ( pWaName, backPipeWaterMat(), ilyPipeWaSolid ) ;
00940 
00941             cpv.position( ilyPipeWaLog,
00942                    pName, 
00943                    copyOne, 
00944                    DDTranslation(0,0,0),
00945                    DDRotation() ) ;
00946          }
00947       } 
00948 
00949       DDSolid ilyPTMSolid ( DDSolidFactory::box( ilyPTMName(), 
00950                                                  ilyPTMHeight()/2.,
00951                                                  ilyPTMWidth()/2.,  
00952                                                  ilyPTMLength()/2.   ) ) ;
00953       const DDLogicalPart ilyPTMLog ( ilyPTMName(),
00954                                       ilyPTMMat(),
00955                                       ilyPTMSolid ) ;
00956 
00957       DDSolid ilyFanOutSolid ( DDSolidFactory::box( ilyFanOutName(), 
00958                                                     ilyFanOutHeight()/2.,
00959                                                     ilyFanOutWidth()/2.,  
00960                                                     ilyFanOutLength()/2.   ) ) ;
00961       const DDLogicalPart ilyFanOutLog ( ilyFanOutName(),
00962                                          ilyFanOutMat(),
00963                                          ilyFanOutSolid ) ;
00964 
00965       DDSolid ilyFEMSolid ( DDSolidFactory::box( ilyFEMName(), 
00966                                                  ilyFEMHeight()/2.,
00967                                                  ilyFEMWidth()/2.,  
00968                                                  ilyFEMLength()/2.   ) ) ;
00969       const DDLogicalPart ilyFEMLog ( ilyFEMName(),
00970                                       ilyFEMMat(),
00971                                       ilyFEMSolid ) ;
00972 
00973       DDSolid ilyDiffSolid ( DDSolidFactory::box( ilyDiffName(), 
00974                                                   ilyFanOutHeight()/2.,
00975                                                   ilyFanOutWidth()/2.,  
00976                                                   ilyDiffLength()/2.   ) ) ;
00977       const DDLogicalPart ilyDiffLog ( ilyDiffName(),
00978                                        ilyDiffMat(),
00979                                        ilyDiffSolid ) ;
00980 
00981       DDSolid ilyBndlSolid ( DDSolidFactory::box( ilyBndlName(), 
00982                                                   ilyFanOutHeight()/2.,
00983                                                   ilyFanOutWidth()/2.,  
00984                                                   ilyBndlLength()/2.   ) ) ;
00985       const DDLogicalPart ilyBndlLog ( ilyBndlName(),
00986                                        ilyBndlMat(),
00987                                        ilyBndlSolid ) ;
00988       cpv.position( ilyDiffLog,
00989              ilyFanOutName(), 
00990              copyOne, 
00991              DDTranslation(0,0, -ilyFanOutLength()/2 + ilyDiffLength()/2 + ilyDiffOff() ),
00992              DDRotation() ) ;
00993       cpv.position( ilyBndlLog,
00994              ilyFanOutName(), 
00995              copyOne, 
00996              DDTranslation(0,0, -ilyFanOutLength()/2 + ilyBndlLength()/2 + ilyBndlOff() ),
00997              DDRotation() ) ;
00998 
00999       for( unsigned int ily ( 0 ) ; ily != vecIlyThick().size() ; ++ily )
01000       {
01001          const double        ilyRMax     ( ilyRMin + vecIlyThick()[ily] ) ;
01002          const DDName        xilyName    ( ddname( ilyName() + int_to_string(ily) ) ) ;
01003          const DDSolid       xilySolid   ( DDSolidFactory::tubs( xilyName,
01004                                                                  ilyLength/2,
01005                                                                  ilyRMin,
01006                                                                  ilyRMax,
01007                                                                  ilyPhiLow(),
01008                                                                  ilyDelPhi() ) ) ;
01009 
01010          const DDLogicalPart xilyLog     ( xilyName, ddmat(vecIlyMat()[ily]), xilySolid ) ;
01011 
01012          if( 0 != ilyHere() )
01013          {
01014             cpv.position( xilyLog,
01015                    ilyLog, 
01016                    copyOne, 
01017                    DDTranslation(0,0,0),
01018                    DDRotation() ) ;
01019 
01020             unsigned int copyNum[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} ;
01021 
01022             if( 10*mm <  vecIlyThick()[ily] &&
01023                 vecIlyThick().size() != (ily+1) &&
01024                 0     != ilyPipeHere()         )
01025             {
01026                if( 0 != ilyPTMHere() )
01027                {
01028                   unsigned int ptmCopy ( 0 ) ;
01029                   for( unsigned int ilyPTM ( 0 ) ; ilyPTM != vecIlyPTMZ().size() ; ++ilyPTM )
01030                   {
01031                      const double radius ( ilyRMax - 1*mm - ilyPTMHeight()/2. ) ;
01032                      const double phi    ( vecIlyPTMPhi()[ilyPTM] ) ;
01033                      const double yy     ( radius*sin(phi) ) ;
01034                      const double xx     ( radius*cos(phi) ) ;
01035                      ++ptmCopy ; 
01036                      cpv.position( ilyPTMLog,
01037                             xilyLog, 
01038                             ptmCopy, 
01039                             DDTranslation(xx,yy, vecIlyPTMZ()[ilyPTM] -ilyLength/2 ),
01040                             myrot( ilyPTMLog.name().name() + "_rot" +
01041                                    int_to_string( ptmCopy ) , CLHEP::HepRotationZ( phi ) )) ;
01042                   }
01043                }
01044                if( 0 != ilyFanOutHere() )
01045                {
01046                   unsigned int fanOutCopy ( 0 ) ;
01047                   for( unsigned int ilyFO ( 0 ) ; ilyFO != vecIlyFanOutZ().size() ; ++ilyFO )
01048                   {
01049                      const double radius ( ilyRMax - 1*mm - ilyFanOutHeight()/2. ) ;
01050                      const double phi    ( vecIlyFanOutPhi()[ilyFO] ) ;
01051                      const double yy     ( radius*sin(phi) ) ;
01052                      const double xx     ( radius*cos(phi) ) ;
01053                      ++fanOutCopy ; 
01054                      cpv.position( ilyFanOutLog,
01055                             xilyLog, 
01056                             fanOutCopy, 
01057                             DDTranslation(xx,yy, vecIlyFanOutZ()[ilyFO] -ilyLength/2 ),
01058                             myrot( ilyFanOutLog.name().name() + "_rot" +
01059                                    int_to_string( fanOutCopy ) , 
01060                                    CLHEP::HepRotationZ( phi )*CLHEP::HepRotationY( 180*deg ) )) ;
01061                   }
01062                   unsigned int femCopy ( 0 ) ;
01063                   for( unsigned int ilyFEM ( 0 ) ; ilyFEM != vecIlyFEMZ().size() ; ++ilyFEM )
01064                   {
01065                      const double radius ( ilyRMax - 1*mm - ilyFEMHeight()/2. ) ;
01066                      const double phi    ( vecIlyFEMPhi()[ilyFEM] ) ;
01067                      const double yy     ( radius*sin(phi) ) ;
01068                      const double xx     ( radius*cos(phi) ) ;
01069                      ++femCopy ; 
01070                      cpv.position( ilyFEMLog,
01071                             xilyLog, 
01072                             femCopy, 
01073                             DDTranslation(xx,yy, vecIlyFEMZ()[ilyFEM] -ilyLength/2 ),
01074                             myrot( ilyFEMLog.name().name() + "_rot" +
01075                                    int_to_string( femCopy ) , CLHEP::HepRotationZ( phi ) )) ;
01076                   }
01077                }
01078                for( unsigned int iPipe ( 0 ) ; iPipe != vecIlyPipePhi().size(); ++iPipe )
01079                {
01080                   const unsigned int type ( static_cast<unsigned int> ( round( vecIlyPipeType()[iPipe] ) ) ) ;
01081 //                std::cout<<" iPipe, type= " << iPipe << ", " << type << std::endl ;
01082                   const double       zz   ( -ilyLength/2 + vecIlyPipeZ()[iPipe] +
01083                                             ( 9>type ? vecIlyPipeLength()[type]/2. : 0 ) ) ;
01084 
01085                   for( unsigned int ly ( 0 ) ; ly != 2 ; ++ly )
01086                   {
01087                      const double radius ( 0 == ly ? ilyRMin + ilyPipeOD()/2. + 1*mm :
01088                                            ilyRMax - ilyPipeOD()/2. - 1*mm  ) ;
01089                      const double phi    ( vecIlyPipePhi()[iPipe] ) ;
01090                      const double yy     ( radius*sin(phi) ) ;
01091                      const double xx     ( radius*cos(phi) ) ;
01092                      ++copyNum[type],
01093                      cpv.position( ilyPipeLog[type],
01094                             xilyLog, 
01095                             copyNum[type],
01096                             DDTranslation(xx,yy,zz),
01097                             ( 9 > type ? DDRotation() :
01098                               myrot( ilyPipeLog[type].name().name() + "_rot" +
01099                                      int_to_string( copyNum[type] ) , Rota( Vec3(xx,yy,0), 90*deg) ) ) ) ;
01100                   }
01101                }
01102             }
01103          }
01104          ilyRMin = ilyRMax ;
01105       }      
01106       // End Inner Layer volumes---------------------------------------------------------
01107 
01108       const DDName clyrName ( DDName( "ECLYR" ) ) ;
01109       std::vector<double> cri;
01110       std::vector<double> cro;
01111       std::vector<double> czz;
01112       czz.push_back( vecSpmZPts()[1] ) ;
01113       cri.push_back( vecSpmRMin()[0] ) ;
01114       cro.push_back( vecSpmRMin()[0] + 25*mm ) ;
01115       czz.push_back( vecSpmZPts()[2] ) ;
01116       cri.push_back( vecSpmRMin()[2] ) ;
01117       cro.push_back( vecSpmRMin()[2] + 10*mm ) ;
01118       const DDSolid clyrSolid ( DDSolidFactory::polycone( clyrName, -9.5*deg,  19*deg, czz,cri,cro) ) ;
01119       const DDLogicalPart clyrLog ( clyrName, ddmat(vecIlyMat()[4]), clyrSolid ) ;
01120       cpv.position( clyrLog, spmLog, copyOne, DDTranslation(0,0,0), DDRotation() ) ;
01121 
01122       // Begin Alveolar Wedge parent ------------------------------------------------------
01123 //----------------
01124 
01125       // the next few lines accumulate dimensions appropriate to crystal type 1
01126       // which we use to set some of the features of the half-alveolar wedge (hawR).
01127 
01128 //      const double ANom1 ( vecNomCryDimAR()[0] ) ;
01129       const double BNom1 ( vecNomCryDimCR()[0] ) ;
01130       const double bNom1 ( vecNomCryDimCF()[0] ) ;
01131 //      const double HNom1 ( vecNomCryDimBR()[0] ) ;
01132 //      const double hNom1 ( vecNomCryDimBF()[0] ) ;
01133       const double sWall1( wallThAlv() ) ;
01134       const double fWall1( wallFrAlv() ) ;
01135 //      const double rWall1( wallReAlv() ) ;
01136       const double sWrap1( wrapThAlv() ) ;
01137       const double fWrap1( wrapFrAlv() ) ;
01138 //      const double rWrap1( wrapReAlv() ) ;
01139       const double sClr1 ( clrThAlv() ) ;
01140       const double fClr1 ( clrFrAlv() ) ;
01141 //      const double rClr1 ( clrReAlv() ) ;
01142       const double LNom1 ( nomCryDimLZ() ) ;
01143       const double beta1      ( atan( ( BNom1 - bNom1 )/LNom1 ) ) ;
01144 //      const double cosbeta1   ( cos( beta1 ) ) ;
01145       const double sinbeta1   ( sin( beta1 ) ) ;
01146 
01147       const double tana_hawR ( ( BNom1 - bNom1 )/LNom1 ) ;
01148 
01149       const double H_hawR ( hawRHBIG() ) ;
01150       const double h_hawR ( hawRhsml() ) ;
01151       const double a_hawR ( bNom1 + sClr1 + 2*sWrap1 + 2*sWall1
01152                             - sinbeta1*( fClr1 + fWrap1 + fWall1 ) ) ;
01153       const double B_hawR ( a_hawR + H_hawR*tana_hawR ) ;
01154       const double b_hawR ( a_hawR + h_hawR*tana_hawR ) ;
01155       const double L_hawR ( vecSpmZPts()[2] ) ;
01156 
01157       const Trap trapHAWR (
01158          a_hawR/2.,           //double aHalfLengthXNegZLoY , // bl1, A/2
01159          a_hawR/2.,           //double aHalfLengthXPosZLoY , // bl2, a/2
01160          b_hawR/2.,           //double aHalfLengthXPosZHiY , // tl2, b/2
01161          H_hawR/2.,           //double aHalfLengthYNegZ    , // h1, H/2
01162          h_hawR/2.,           //double aHalfLengthYPosZ    , // h2, h/2
01163          L_hawR/2.,           //double aHalfLengthZ        , // dz,  L/2
01164          90*deg,              //double aAngleAD            , // alfa1
01165          0,                   //double aCoord15X           , // x15
01166          0                    //double aCoord15Y             // y15
01167          ) ;
01168 
01169       const DDName        hawRName1  ( ddname( hawRName().name() + "1") ) ;
01170       const DDSolid       hawRSolid1 ( mytrap(hawRName1.name(), trapHAWR ) ) ;
01171       const DDLogicalPart hawRLog1   ( hawRName1, spmMat(), hawRSolid1 ) ;
01172 
01173       const double al1_fawR ( atan( ( B_hawR - a_hawR )/H_hawR ) + M_PI_2 ) ;
01174 
01175       // here is trap for Full Alveolar Wedge
01176       const Trap trapFAW (
01177          a_hawR,           //double aHalfLengthXNegZLoY , // bl1, A/2
01178          a_hawR,           //double aHalfLengthXPosZLoY , // bl2, a/2
01179          b_hawR,           //double aHalfLengthXPosZHiY , // tl2, b/2
01180          H_hawR/2.,        //double aHalfLengthYNegZ    , // h1, H/2
01181          h_hawR/2.,        //double aHalfLengthYPosZ    , // h2, h/2
01182          L_hawR/2.,        //double aHalfLengthZ        , // dz,  L/2
01183          al1_fawR,         //double aAngleAD            , // alfa1
01184          0,                //double aCoord15X           , // x15
01185          0                 //double aCoord15Y             // y15
01186          ) ;
01187 
01188       const DDName        fawName1  ( ddname( fawName().name() + "1") ) ;
01189       const DDSolid       fawSolid1 ( mytrap( fawName1.name(), trapFAW ) ) ;
01190       const DDLogicalPart fawLog1   ( fawName1, spmMat(), fawSolid1 ) ;
01191 
01192       const Trap::VertexList vHAW ( trapHAWR.vertexList() ) ;
01193       const Trap::VertexList vFAW ( trapFAW.vertexList() ) ;
01194 
01195       const double hawBoxClr ( 1*mm ) ;
01196 
01197       // HAW cut box to cut off back end of wedge
01198       const DDName  hawCutName ( ddname( hawRName().name() + "CUTBOX" ) ) ;
01199       const DDSolid hawCutBox  ( DDSolidFactory::box(
01200                                     hawCutName, 
01201                                     b_hawR/2 + hawBoxClr,  
01202                                     hawRCutY()/2,
01203                                     hawRCutZ()/2 ) ) ;
01204       const std::vector<double>& hawBoxParms ( hawCutBox.parameters() ) ;
01205       const DDLogicalPart hawCutLog ( hawCutName, spmMat(), hawCutBox ) ;
01206       
01207       const Pt3D b1 (  hawBoxParms[0],  hawBoxParms[1],  hawBoxParms[2] ) ;
01208       const Pt3D b2 ( -hawBoxParms[0],  hawBoxParms[1],  hawBoxParms[2] ) ;
01209       const Pt3D b3 ( -hawBoxParms[0],  hawBoxParms[1], -hawBoxParms[2] ) ;
01210 
01211       const double zDel ( sqrt( 4*hawBoxParms[2]*hawBoxParms[2] 
01212                                 -(h_hawR-hawRCutDelY())*(h_hawR-hawRCutDelY())  ) ) ;
01213 
01214       const Tf3D hawCutForm ( 
01215          b1, b2, b3,
01216          vHAW[2]    + Pt3D( hawBoxClr, -hawRCutDelY(), 0), 
01217          vHAW[1]    + Pt3D(-hawBoxClr, -hawRCutDelY(), 0),
01218          Pt3D( vHAW[0].x() -hawBoxClr, vHAW[0].y(), vHAW[0].z() - zDel  ) ) ;
01219 
01220       const DDSolid       hawRSolid ( DDSolidFactory::subtraction(
01221                                          hawRName(),
01222                                          hawRSolid1, hawCutBox,
01223                                          DDTranslation(hawCutForm.getTranslation().x(), hawCutForm.getTranslation().y(), hawCutForm.getTranslation().z()),
01224                                          myrot( hawCutName.name()+"R",
01225                                                 hawCutForm.getRotation() ) ) ) ;
01226       const DDLogicalPart hawRLog   ( hawRName(), spmMat(), hawRSolid ) ;
01227 
01228       // FAW cut box to cut off back end of wedge
01229       const DDName  fawCutName ( ddname( fawName().name() + "CUTBOX") ) ;
01230       const DDSolid fawCutBox  ( DDSolidFactory::box(
01231                                     fawCutName, 
01232                                     2*hawBoxParms[0],  
01233                                     hawBoxParms[1],
01234                                     hawBoxParms[2] ) ) ;
01235 
01236       const std::vector<double>& fawBoxParms ( fawCutBox.parameters() ) ;
01237       const DDLogicalPart fawCutLog ( fawCutName, spmMat(), fawCutBox ) ;
01238       
01239       const Pt3D bb1 (  fawBoxParms[0],  fawBoxParms[1],  fawBoxParms[2] ) ;
01240       const Pt3D bb2 ( -fawBoxParms[0],  fawBoxParms[1],  fawBoxParms[2] ) ;
01241       const Pt3D bb3 ( -fawBoxParms[0],  fawBoxParms[1], -fawBoxParms[2] ) ;
01242 
01243       const Tf3D fawCutForm ( 
01244          bb1, bb2, bb3,
01245          vFAW[2]   + Pt3D( 2*hawBoxClr,-5*mm,0), 
01246          vFAW[1]   + Pt3D(-2*hawBoxClr,-5*mm,0),
01247          Pt3D( vFAW[1].x()-2*hawBoxClr, vFAW[1].y()-trapFAW.h(), vFAW[1].z() - zDel ) ) ;
01248 
01249       const DDSolid       fawSolid ( DDSolidFactory::subtraction(
01250                                          fawName(),
01251                                          fawSolid1, fawCutBox,
01252                                          DDTranslation(fawCutForm.getTranslation().x(), fawCutForm.getTranslation().y(), fawCutForm.getTranslation().z()) ,
01253                                          myrot( fawCutName.name()+"R",
01254                                                 fawCutForm.getRotation() ) ) ) ;
01255       const DDLogicalPart fawLog   ( fawName(), spmMat(), fawSolid ) ;
01256 
01257 
01258       const Tf3D hawRform ( vHAW[3], vHAW[0], vHAW[1], // HAW inside FAW
01259                             vFAW[3], 0.5*(vFAW[0]+vFAW[3]), 0.5*(vFAW[1]+vFAW[2] ) ) ;
01260       cpv.position( hawRLog,
01261              fawLog, 
01262              copyOne, 
01263              DDTranslation(hawRform.getTranslation().x(), hawRform.getTranslation().y(), hawRform.getTranslation().z()),
01264              myrot( hawRName().name()+"R", 
01265                     hawRform.getRotation() ) ) ;
01266 
01267       cpv.position( hawRLog,
01268              fawLog, 
01269              copyTwo, 
01270              DDTranslation( -hawRform.getTranslation().x(),
01271                             -hawRform.getTranslation().y(),
01272                             -hawRform.getTranslation().z() ),
01273              myrot( hawRName().name()+"RotRefl",
01274                     CLHEP::HepRotationY(180*deg)*                 // rotate about Y after refl thru Z
01275                     CLHEP::HepRep3x3(1,0,0, 0,1,0, 0,0,-1) ) ) ;
01276 
01277 /* this for display of haw cut box instead of subtraction
01278       cpv.position( hawCutLog,
01279              hawRName, 
01280              copyOne, 
01281              hawCutForm.getTranslation(),
01282              myrot( hawCutName.name()+"R", 
01283                     hawCutForm.getRotation() )   ) ;
01284 */
01285 
01286       for( unsigned int iPhi ( 1 ); iPhi <= nFawPerSupm() ; ++iPhi )
01287       {
01288          const double rPhi ( fawPhiOff() + ( iPhi - 0.5 )*fawDelPhi() ) ;
01289 
01290          const Tf3D fawform ( RoZ3D( rPhi )*
01291                               Tl3D( fawRadOff() + ( trapFAW.H() + trapFAW.h() )/4 ,
01292                                     0, 
01293                                     trapFAW.L()/2 )*
01294                               RoZ3D( -90*deg + fawPhiRot() ) ) ;
01295          if( fawHere() )
01296             cpv.position( fawLog,
01297                    spmLog, 
01298                    iPhi, 
01299                    DDTranslation(fawform.getTranslation().x(), fawform.getTranslation().y(), fawform.getTranslation().z() ),
01300                    myrot( fawName().name()+"_Rot" + int_to_string(iPhi), 
01301                           fawform.getRotation() ) ) ;
01302       }
01303 
01304       // End Alveolar Wedge parent ------------------------------------------------------
01305 
01306       // Begin Grid + Tablet insertion
01307 
01308       const double h_Grid ( gridThick() ) ;
01309 
01310       const Trap trapGrid (
01311          ( B_hawR - h_Grid*( B_hawR - a_hawR )/H_hawR )/2, // bl1, A/2
01312          ( b_hawR - h_Grid*( B_hawR - a_hawR )/H_hawR )/2, // bl2, a/2
01313          b_hawR/2., // tl2, b/2
01314          h_Grid/2., // h1, H/2
01315          h_Grid/2., // h2, h/2
01316          (L_hawR-8*cm)/2., // dz,  L/2
01317          90*deg,    // alfa1
01318          0,         // x15
01319          H_hawR - h_hawR // y15
01320          ) ;
01321 
01322       const DDSolid       gridSolid ( mytrap( gridName().name(), trapGrid ) ) ;
01323       const DDLogicalPart gridLog   ( gridName(), gridMat(), gridSolid ) ;
01324 
01325       const Trap::VertexList vGrid ( trapGrid.vertexList() ) ;
01326 
01327       const Tf3D gridForm ( vGrid[4],                   vGrid[5], vGrid[6], // Grid inside HAW
01328                             vHAW[5] - Pt3D(0,h_Grid,0),  vHAW[5],  vHAW[6]   ) ;
01329 
01330       if( 0 != gridHere() )
01331          cpv.position( gridLog,
01332                 hawRLog, 
01333                 copyOne, 
01334                 DDTranslation(gridForm.getTranslation().x(), gridForm.getTranslation().y(), gridForm.getTranslation().z() ),
01335                 myrot( gridName().name()+"R", 
01336                        gridForm.getRotation() ) ) ;
01337 
01338       // End Grid + Tablet insertion
01339 
01340       // begin filling Wedge with crystal plus supports --------------------------
01341 
01342       const double aNom ( nomCryDimAF() ) ;
01343       const double LNom ( nomCryDimLZ() ) ;
01344 
01345       const double AUnd ( underAR() ) ;
01346       const double aUnd ( underAF() ) ;
01347 //      const double BUnd ( underCR() ) ;
01348       const double bUnd ( underCF() ) ;
01349       const double HUnd ( underBR() ) ;
01350       const double hUnd ( underBF() ) ;
01351       const double LUnd ( underLZ() ) ;
01352 
01353       const double sWall ( wallThAlv() ) ;
01354       const double sWrap ( wrapThAlv() ) ;
01355       const double sClr  ( clrThAlv() ) ;
01356 
01357       const double fWall ( wallFrAlv() ) ;
01358       const double fWrap ( wrapFrAlv() ) ;
01359       const double fClr  ( clrFrAlv() ) ;
01360 
01361       const double rWall ( wallReAlv() ) ;
01362       const double rWrap ( wrapReAlv() ) ;
01363       const double rClr  ( clrReAlv() ) ;
01364       
01365       // theta is angle in yz plane between z axis & leading edge of crystal
01366       double theta ( 90*deg ) ;
01367       double zee   ( 0*mm ) ;
01368       double side  ( 0*mm ) ;
01369       double zeta  ( 0*deg ) ; // increment in theta for last crystal
01370 
01371       for( unsigned int cryType ( 1 ) ; cryType <= nCryTypes() ; ++cryType )
01372       {
01373          const std::string sType ( "_" + 
01374                                    std::string( 10>cryType ? "0" : "") + 
01375                                    int_to_string( cryType ) ) ;
01376 
01377          LogDebug("EcalGeom") << "Crytype=" << cryType ;
01378          const double ANom ( vecNomCryDimAR()[ cryType-1 ] ) ;
01379          const double BNom ( vecNomCryDimCR()[ cryType-1 ] ) ;
01380          const double bNom ( vecNomCryDimCF()[ cryType-1 ] ) ;
01381          const double HNom ( vecNomCryDimBR()[ cryType-1 ] ) ;
01382          const double hNom ( vecNomCryDimBF()[ cryType-1 ] ) ;
01383 
01384          const double alfCry ( 90*deg + atan( ( bNom - bUnd - aNom + aUnd )/
01385                                               ( hNom - hUnd ) ) ) ;
01386 
01387          const Trap trapCry (
01388             ( ANom - AUnd )/2.,           //double aHalfLengthXNegZLoY , // bl1, A/2
01389             ( aNom - aUnd )/2.,           //double aHalfLengthXPosZLoY , // bl2, a/2
01390             ( bNom - bUnd )/2.,           //double aHalfLengthXPosZHiY , // tl2, b/2
01391             ( HNom - HUnd )/2.,           //double aHalfLengthYNegZ    , // h1, H/2
01392             ( hNom - hUnd )/2.,           //double aHalfLengthYPosZ    , // h2, h/2
01393             ( LNom - LUnd )/2.,           //double aHalfLengthZ        , // dz,  L/2
01394             alfCry,                       //double aAngleAD            , // alfa1
01395             aNom - aUnd - ANom + AUnd,    //double aCoord15X           , // x15
01396             hNom - hUnd - HNom + HUnd     //double aCoord15Y             // y15      
01397          ) ;
01398 
01399          const DDName        cryDDName ( cryName() + sType ) ;
01400          const DDSolid       crySolid  ( mytrap( cryDDName.name(), trapCry ) ) ;
01401          const DDLogicalPart cryLog    ( cryDDName, cryMat(), crySolid ) ;
01402 
01403 
01404 //++++++++++++++++++++++++++++++++++  APD ++++++++++++++++++++++++++++++++++
01405 
01406          const DDName        apdDDName ( apdName().name() + sType ) ;
01407 
01408          const Trap trapAPD (
01409             apdSide()/2.,    //double aHalfLengthXNegZLoY , // bl1, A/2
01410             apdSide()/2.,    //double aHalfLengthXPosZLoY , // bl2, a/2
01411             apdSide()/2.,    //double aHalfLengthXPosZHiY , // tl2, b/2
01412             apdSide()/2.,    //double aHalfLengthYNegZ    , // h1,  H/2
01413             apdSide()/2.,    //double aHalfLengthYPosZ    , // h2,  h/2
01414             apdThick()/2.,   // dz,  L/2
01415             90*deg,                //double aAngleAD            , // alfa1
01416             0,          //double aCoord15X           , // x15
01417             0           //double aCoord15Y             // y15  
01418             ) ;
01419 
01420 //       DDSolid apdSolid ( DDSolidFactory::box( apdDDName, 
01421 //                                               apdSide()/2.,
01422 //                                               apdSide()/2.,  
01423 //                                               apdThick()/2.   ) ) ;
01424          const DDSolid       apdSolid  ( mytrap( apdDDName.name(), trapAPD ) ) ;
01425          const DDLogicalPart apdLog ( apdDDName, apdMat(), apdSolid ) ;
01426          
01427          unsigned int copyAPD ( 0 ) ;
01428 //++++++++++++++++++++++++++++++++++ END APD ++++++++++++++++++++++++++++++++++
01429 
01430 
01431          const double delta     ( atan( ( HNom - hNom )/LNom ) ) ;
01432 //unused         const double cosdelta  ( cos( delta ) ) ;
01433          const double sindelta  ( sin( delta ) ) ;
01434 
01435          const double gamma     ( atan( ( ANom - aNom )/LNom ) ) ;
01436 //unused         const double cosgamma  ( cos( gamma ) ) ;
01437          const double singamma  ( sin( gamma ) ) ;
01438 
01439          const double beta      ( atan( ( BNom - bNom )/LNom ) ) ;
01440 //unused         const double cosbeta   ( cos( beta ) ) ;
01441          const double sinbeta   ( sin( beta ) ) ;
01442 
01443          // Now clearance trap
01444          const double alfClr ( 90*deg + atan( ( bNom - aNom )/( hNom + sClr ) ) ) ;
01445 
01446          const Trap trapClr (
01447             ( ANom + sClr + rClr*singamma )/2.,    //double aHalfLengthXNegZLoY , // bl1, A/2
01448             ( aNom + sClr - fClr*singamma )/2.,    //double aHalfLengthXPosZLoY , // bl2, a/2
01449             ( bNom + sClr - fClr*sinbeta  )/2.,    //double aHalfLengthXPosZHiY , // tl2, b/2
01450             ( HNom + sClr + rClr*sindelta )/2.,    //double aHalfLengthYNegZ    , // h1,  H/2
01451             ( hNom + sClr - fClr*sindelta )/2.,    //double aHalfLengthYPosZ    , // h2,  h/2
01452             ( LNom + fClr + rClr )/2., // dz,  L/2
01453             alfClr,                //double aAngleAD            , // alfa1
01454             aNom - ANom ,          //double aCoord15X           , // x15
01455             hNom - HNom            //double aCoord15Y             // y15  
01456          ) ;
01457 
01458          const DDName        clrDDName ( clrName() + sType ) ;
01459          const DDSolid       clrSolid  ( mytrap( clrDDName.name(), trapClr ) ) ;
01460          const DDLogicalPart clrLog    ( clrDDName, clrMat(), clrSolid ) ;
01461 
01462          // Now wrap trap
01463 
01464          const double alfWrap ( 90*deg + atan( ( bNom - aNom )/
01465                                                ( hNom + sClr + 2*sWrap ) ) ) ;
01466 
01467          const Trap trapWrap (
01468             ( trapClr.A() + 2*sWrap + rWrap*singamma )/2, // bl1, A/2
01469             ( trapClr.a() + 2*sWrap - fWrap*singamma )/2, // bl2, a/2
01470             ( trapClr.b() + 2*sWrap - fWrap*sinbeta  )/2, // tl2, b/2
01471             ( trapClr.H() + 2*sWrap + rWrap*sindelta )/2, // h1,  H/2
01472             ( trapClr.h() + 2*sWrap - fWrap*sindelta )/2, // h2,  h/2
01473             ( trapClr.L() + fWrap + rWrap )/2., // dz,  L/2
01474             alfWrap,                       //double aAngleAD            , // alfa1
01475             aNom - ANom - (cryType>9 ? 0 : 0.020*mm) ,
01476             hNom - HNom                    //double aCoord15Y             // y15  
01477          ) ;
01478 
01479          const DDName        wrapDDName ( wrapName() + sType ) ;
01480          const DDSolid       wrapSolid  ( mytrap( wrapDDName.name(), trapWrap ) ) ;
01481          const DDLogicalPart wrapLog    ( wrapDDName, wrapMat(), wrapSolid ) ;
01482 
01483          // Now wall trap
01484 
01485          const double alfWall ( 90*deg + atan( ( bNom - aNom )/
01486                                                ( hNom + sClr + 2*sWrap + 2*sWall ) ) ) ;
01487 
01488          const Trap trapWall (
01489             ( trapWrap.A() + 2*sWall + rWall*singamma )/2,  // A/2 
01490             ( trapWrap.a() + 2*sWall - fWall*singamma )/2,  // a/2
01491             ( trapWrap.b() + 2*sWall - fWall*sinbeta  )/2,  // b/2
01492             ( trapWrap.H() + 2*sWall + rWall*sindelta )/2,  // H/2
01493             ( trapWrap.h() + 2*sWall - fWall*sindelta )/2,  // h/2
01494             ( trapWrap.L() + fWall + rWall )/2.,  // L/2
01495             alfWall,                             // alfa1
01496             aNom - ANom - (cryType<10? 0.150*mm : 0.100*mm ) ,       
01497             hNom - HNom                          // y15
01498          ) ;
01499 
01500          const DDName        wallDDName ( wallName() + sType ) ;
01501          const DDSolid       wallSolid  ( mytrap( wallDDName.name(), trapWall ) ) ;
01502          const DDLogicalPart wallLog    ( wallDDName, wallMat(), wallSolid ) ;
01503          
01504 /*       std::cout << "Traps:\n a: " 
01505                 << trapCry.a() << ", " 
01506                 << trapClr.a() << ", " 
01507                 << trapWrap.a() << ", " 
01508                 << trapWall.a() << "\n b: " 
01509                 << trapCry.b() << ", " 
01510                 << trapClr.b() << ", " 
01511                 << trapWrap.b() << ", " 
01512                 << trapWall.b() << "\n A: " 
01513                 << trapCry.A() << ", " 
01514                 << trapClr.A() << ", " 
01515                 << trapWrap.A() << ", " 
01516                 << trapWall.A() << "\n B: " 
01517                 << trapCry.B() << ", " 
01518                 << trapClr.B() << ", " 
01519                 << trapWrap.B() << ", " 
01520                 << trapWall.B() << "\n h: " 
01521                 << trapCry.h() << ", " 
01522                 << trapClr.h() << ", " 
01523                 << trapWrap.h() << ", " 
01524                 << trapWall.h() << "\n H: " 
01525                 << trapCry.H() << ", " 
01526                 << trapClr.H() << ", " 
01527                 << trapWrap.H() << ", " 
01528                 << trapWall.H() << "\n a1: " 
01529                 << trapCry.a1()/deg << ", " 
01530                 << trapClr.a1()/deg << ", " 
01531                 << trapWrap.a1()/deg << ", " 
01532                 << trapWall.a1()/deg << "\n a4: " 
01533                 << trapCry.a4()/deg << ", " 
01534                 << trapClr.a4()/deg << ", " 
01535                 << trapWrap.a4()/deg << ", " 
01536                 << trapWall.a4()/deg << "\n x15: " 
01537                 << trapCry.x15() << ", " 
01538                 << trapClr.x15() << ", " 
01539                 << trapWrap.x15() << ", " 
01540                 << trapWall.x15() << "\n y15: " 
01541                 << trapCry.y15() << ", " 
01542                 << trapClr.y15() << ", " 
01543                 << trapWrap.y15() << ", " 
01544                 << trapWall.y15()
01545                 << std::endl ;
01546 */
01547          // Now for placement of cry within clr
01548          const Vec3 cryToClr ( 0, 0, ( rClr - fClr )/2 ) ;
01549 
01550          cpv.position( cryLog,
01551                 clrLog, 
01552                 copyOne, 
01553                 DDTranslation ( 0, 0, ( rClr - fClr )/2 ), //SAME as cryToClr above.
01554                 DDRotation() ) ;
01555 
01556          if( 0 != apdHere() )
01557          { 
01558             cpv.position( apdLog,
01559                    clrLog, 
01560                    ++copyAPD, 
01561                    DDTranslation( +trapCry.bl1() - apdX1(),
01562                                   +trapCry.h1()  - apdZ(),
01563                                   -trapCry.dz()  - apdThick()/2. + (rClr - fClr)/2. ),
01564                    DDRotation() ) ;
01565             cpv.position( apdLog,
01566                    clrLog, 
01567                    ++copyAPD, 
01568                    DDTranslation( +trapCry.bl1() - apdX2(),
01569                                   +trapCry.h1()  - apdZ(),
01570                                   -trapCry.dz()  - apdThick()/2. + (rClr - fClr)/2.),
01571                    DDRotation() ) ;
01572          }
01573 
01574          const Vec3 clrToWrap ( 0, 0, ( rWrap - fWrap )/2 ) ;
01575 
01576          cpv.position( clrLog,
01577                 wrapLog, 
01578                 copyOne, 
01579                 DDTranslation ( 0, 0, ( rWrap - fWrap )/2 ), //SAME as cryToWrap
01580                 DDRotation() ) ;
01581 
01582 
01583          // Now for placement of clr within wall
01584          const Vec3 wrapToWall1 ( 0, 0, ( rWall - fWall )/2 ) ;
01585          const Vec3 wrapToWall ( Vec3( (cryType>9?0:0.005*mm),0,0 )+wrapToWall1 ) ;
01586 
01587          cpv.position( wrapLog,
01588                 wallLog, 
01589                 copyOne, 
01590                 DDTranslation ( Vec3( (cryType>9?0:0.005*mm),0,0 )+wrapToWall1 ), //SAME as wrapToWall
01591                 DDRotation() ) ;
01592 
01593          const Trap::VertexList vWall ( trapWall.vertexList() ) ;
01594          const Trap::VertexList vCry  ( trapCry.vertexList() ) ;
01595 
01596          const double sidePrime  ( ( trapWall.a() - trapCry.a() )/2 ) ;
01597          const double frontPrime ( fWall + fWrap + fClr + LUnd/2 ) ;
01598 
01599          // define web plates with clearance ===========================================
01600 
01601          if( 1 == cryType ) // first web plate: inside clearance volume
01602          {
01603             web( 0,
01604                  trapWall.b(),
01605                  trapWall.B(),
01606                  trapWall.L(),
01607                  theta,
01608                  vHAW[4] + Pt3D( 0, hawYOffCry(), 0 ),
01609                  hawRLog,
01610                  zee,
01611                  sidePrime,
01612                  frontPrime,
01613                  delta, cpv ) ;
01614             zee += vecGapAlvEta()[0] ;
01615          }
01616 
01617          for( unsigned int etaAlv ( 1 ) ; etaAlv <= nCryPerAlvEta() ; ++etaAlv )
01618          {
01619             LogDebug("EcalGeom") << "theta=" << theta/deg
01620                       << ", sidePrime=" << sidePrime << ", frontPrime=" << frontPrime
01621                       << ",  zeta="<<zeta<<", delta="<<delta<<",  zee=" << zee;
01622 
01623             zee += 0.075*mm +
01624                ( side*cos(zeta) + trapWall.h() - sidePrime )/sin(theta) ;
01625 
01626             LogDebug("EcalGeom") << "New zee="<< zee ;
01627 
01628             // make transform for placing enclosed crystal
01629 
01630             const Pt3D trap2 ( vCry[2] + cryToClr + clrToWrap + wrapToWall ) ;
01631             
01632             const Pt3D trap3 ( trap2 + Pt3D( 0,           
01633                                              -trapCry.h(),
01634                                              0 ) ) ;
01635             const Pt3D trap1 ( trap3 + Pt3D( -trapCry.a(),
01636                                              0,           
01637                                              0 ) ) ;
01638 
01639             const Pt3D wedge3 ( vHAW[4] + Pt3D( sidePrime,
01640                                                 hawYOffCry(), 
01641                                                 zee ) ) ;
01642             const Pt3D wedge2 ( wedge3  + Pt3D( 0,
01643                                                 trapCry.h()*cos(theta),
01644                                                 -trapCry.h()*sin(theta)  ) ) ;
01645             const Pt3D wedge1 ( wedge3  + Pt3D( trapCry.a(),
01646                                                 0,
01647                                                 0            ) ) ;
01648 
01649             const Tf3D tForm1 ( trap1,  trap2,  trap3,
01650                                 wedge1, wedge2, wedge3    ) ;
01651 
01652             const double xx ( 0.050*mm ) ;
01653 
01654             const Tf3D tForm ( HepGeom::Translate3D(xx,0,0)*tForm1 ) ;
01655 
01656             cpv.position( wallLog,
01657                    hawRLog, 
01658                    etaAlv, 
01659                    DDTranslation(tForm.getTranslation().x(), tForm.getTranslation().y(), tForm.getTranslation().z() ),
01660                    myrot( wallLog.name().name() + "_" + int_to_string( etaAlv ),
01661                           tForm.getRotation() ) ) ;
01662 
01663             theta     -= delta ;
01664             side       = sidePrime ;
01665             zeta       = delta ;
01666          }
01667          if( 5 == cryType ||
01668              9 == cryType ||
01669             13 == cryType ||
01670             17 == cryType    ) // web plates
01671          {
01672             const unsigned int webIndex ( cryType/4 ) ;
01673             zee += 0.5*vecGapAlvEta()[cryType]/sin(theta) ;
01674             web( webIndex,
01675                  trapWall.a(),
01676                  trapWall.A(),
01677                  trapWall.L(),
01678                  theta,
01679                  vHAW[4] + Pt3D( 0, hawYOffCry(), 0 ),
01680                  hawRLog,
01681                  zee ,
01682                  sidePrime,
01683                  frontPrime,
01684                  delta, cpv ) ;
01685             zee += 0.5*vecGapAlvEta()[cryType]/sin(theta) ;
01686          }
01687          else
01688          {
01689             if( 17 != cryType ) zee += vecGapAlvEta()[cryType]/sin(theta) ;
01690          }
01691       }
01692       // END   filling Wedge with crystal plus supports --------------------------
01693 
01694 //------------------------------------------------------------------------
01695 //------------------------------------------------------------------------
01696 //------------------------------------------------------------------------
01697 //------------------------------------------------------------------------
01698 //**************** Material at outer radius of supermodule ***************
01699 //------------------------------------------------------------------------
01700 //------------------------------------------------------------------------
01701 //------------------------------------------------------------------------
01702 //------------------------------------------------------------------------
01703 
01704       if( 0 != backHere() )
01705       {
01706 
01712       
01713       const DDTranslation outtra ( backXOff() + backSideHeight()/2,
01714                                    backYOff(),
01715                                    backSideLength()/2 ) ;
01716 
01717       const double realBPthick ( backPlateThick() + backPlate2Thick() ) ;
01718 
01719       DDSolid backPlateSolid ( DDSolidFactory::box( backPlateName(), 
01720                                                     backPlateWidth()/2.,  
01721                                                     realBPthick/2.,
01722                                                     backPlateLength()/2.   ) ) ;
01723       const std::vector<double>& backPlateParms ( backPlateSolid.parameters() ) ;
01724       const DDLogicalPart backPlateLog ( backPlateName(),
01725                                          backPlateMat(),
01726                                          backPlateSolid ) ;
01727       
01728       const DDTranslation backPlateTra ( backSideHeight()/2 + 
01729                                          backPlateParms[1],
01730                                          0*mm,
01731                                          backPlateParms[2] -
01732                                          backSideLength()/2 ) ;
01733 
01734       DDSolid backPlate2Solid ( DDSolidFactory::box( backPlate2Name(), 
01735                                                     backPlateWidth()/2.,  
01736                                                     backPlate2Thick()/2.,
01737                                                     backPlateLength()/2.   ) ) ;
01738 
01739       const DDLogicalPart backPlate2Log ( backPlate2Name(),
01740                                           backPlate2Mat(),
01741                                           backPlate2Solid ) ;
01742       
01743       const DDTranslation backPlate2Tra ( 0,
01744                                           -backPlateParms[1] + backPlate2Thick()/2., 0 ) ;
01745       if( 0 != backPlateHere() )
01746       {
01747          cpv.position( backPlate2Log,
01748                 backPlateName(), 
01749                 copyOne, 
01750                 backPlate2Tra,
01751                 DDRotation() ) ;
01752 
01753          cpv.position( backPlateLog,
01754                 spmName(), 
01755                 copyOne, 
01756                 outtra + backPlateTra,
01757                 myrot( backPlateName().name()+"Rot5",
01758                        CLHEP::HepRotationZ(270*deg)    ) ) ;
01759 
01760       }
01766 
01767 
01773 
01774       const Trap trapBS (
01775          backSideWidth()/2.,  //double aHalfLengthXNegZLoY , // bl1, A/2
01776          backSideWidth()/2.,  //double aHalfLengthXPosZLoY , // bl2, a/2
01777          backSideWidth()/4.,  //double aHalfLengthXPosZHiY , // tl2, b/2
01778          backSideHeight()/2., //double aHalfLengthYNegZ    , // h1, H/2
01779          backSideHeight()/2., //double aHalfLengthYPosZ    , // h2, h/2
01780          backSideLength()/2., //double aHalfLengthZ        , // dz,  L/2
01781          backSideAngle(),              //double aAngleAD            , // alfa1
01782          0,                   //double aCoord15X           , // x15
01783          0                    //double aCoord15Y             // y15
01784          ) ;
01785 
01786       const DDSolid       backSideSolid ( mytrap( backSideName().name(), trapBS ) ) ;
01787       const DDLogicalPart backSideLog ( backSideName(), 
01788                                         backSideMat(), 
01789                                         backSideSolid ) ;
01790       
01791       const DDTranslation backSideTra1 ( 0*mm,
01792                                          backPlateWidth()/2 + backSideYOff1(),
01793                                          1*mm ) ;
01794       if( 0 != backSideHere() )
01795       {
01796          cpv.position( backSideLog,
01797                 spmName(), 
01798                 copyOne, 
01799                 outtra + backSideTra1,
01800                 myrot( backSideName().name()+"Rot8",
01801                        CLHEP::HepRotationX(180*deg)*CLHEP::HepRotationZ(90*deg)    ) ) ;
01802              
01803          const DDTranslation backSideTra2( 0*mm,
01804                                            -backPlateWidth()/2 + backSideYOff2(),
01805                                            1*mm ) ;
01806          cpv.position( backSideLog,
01807                 spmName(), 
01808                 copyTwo, 
01809                 outtra + backSideTra2,
01810                 myrot( backSideName().name()+"Rot9",
01811                        CLHEP::HepRotationZ(90*deg)    ) ) ;
01812       }
01818              
01819 //=====================
01820       const double backCoolWidth ( backCoolBarWidth() + 2.*backCoolTankWidth() ) ;
01821 
01827 
01828       const double manifCut ( 2*mm ) ;
01829 
01830       DDSolid mBManifSolid ( DDSolidFactory::tubs( mBManifName() ,
01831                                                    backCoolWidth/2. - manifCut,
01832                                                    0, 
01833                                                    mBManifOutDiam()/2,
01834                                                    0*deg, 360*deg ) ) ;
01835       const DDLogicalPart mBManifLog ( mBManifName(), mBManifMat(), mBManifSolid ) ;
01836 
01837       const DDName mBManifWaName ( ddname( mBManifName().name() + "Wa" ) ) ;
01838       DDSolid mBManifWaSolid ( DDSolidFactory::tubs( mBManifWaName ,
01839                                                      backCoolWidth/2.-manifCut,
01840                                                      0, 
01841                                                      mBManifInnDiam()/2,
01842                                                      0*deg, 360*deg ) ) ;
01843       const DDLogicalPart mBManifWaLog ( mBManifWaName, backPipeWaterMat(), 
01844                                          mBManifWaSolid ) ;
01845       cpv.position( mBManifWaLog,
01846              mBManifName(), 
01847              copyOne, 
01848              DDTranslation(0,0,0),
01849              DDRotation() ) ;
01850 
01856 //=====================
01857 
01858 
01859 
01865       const double deltaY ( -5*mm ) ;
01866 
01867       DDSolid grEdgeSlotSolid ( DDSolidFactory::box( grEdgeSlotName(), 
01868                                                      grEdgeSlotHeight()/2.,  
01869                                                      grEdgeSlotWidth()/2.,
01870                                                      grilleThick()/2.   ) ) ;
01871       const DDLogicalPart grEdgeSlotLog ( grEdgeSlotName(), grEdgeSlotMat(), grEdgeSlotSolid );
01872 
01873       unsigned int edgeSlotCopy ( 0 ) ;
01874       unsigned int midSlotCopy ( 0 ) ;
01875 
01876       DDLogicalPart grMidSlotLog[4] ;
01877 
01878       for( unsigned int iGr ( 0 ) ; iGr != vecGrilleHeight().size() ; ++iGr )
01879       {
01880          DDName gName ( ddname( grilleName() + int_to_string( iGr ) ) ) ;
01881          DDSolid grilleSolid ( DDSolidFactory::box( gName, 
01882                                                     vecGrilleHeight()[iGr]/2.,  
01883                                                     backCoolWidth/2.,
01884                                                     grilleThick()/2.   ) ) ;
01885          const DDLogicalPart grilleLog ( gName,
01886                                          grilleMat(),
01887                                          grilleSolid ) ;
01888          
01889          const DDTranslation grilleTra ( -realBPthick/2 -
01890                                          vecGrilleHeight()[iGr]/2,
01891                                          deltaY,
01892                                          vecGrilleZOff()[iGr] +
01893                                          grilleThick()/2 - backSideLength()/2 ) ;
01894          const DDTranslation gTra ( outtra + backPlateTra + grilleTra ) ;
01895 
01896          if( 0 != grMidSlotHere() &&
01897              0 != iGr   )
01898          {
01899             if( 0 == (iGr-1)%2      )
01900             {
01901                DDName mName ( ddname( grMidSlotName() + int_to_string( iGr/2 ) ) ) ;
01902                DDSolid grMidSlotSolid ( DDSolidFactory::box(
01903                                            mName, 
01904                                            vecGrMidSlotHeight()[(iGr-1)/2]/2.,
01905                                            grMidSlotWidth()/2.,
01906                                            grilleThick()/2.   ) ) ;
01907                grMidSlotLog[(iGr-1)/2] = DDLogicalPart( mName, grMidSlotMat(), grMidSlotSolid ) ;
01908             }          
01909             cpv.position( grMidSlotLog[(iGr-1)/2],
01910                    gName, 
01911                    ++midSlotCopy, 
01912                    DDTranslation( vecGrilleHeight()[iGr]/2. - vecGrMidSlotHeight()[(iGr-1)/2]/2.,
01913                                   +grMidSlotXOff(),    0 ),
01914                    DDRotation() ) ;
01915             cpv.position( grMidSlotLog[(iGr-1)/2],
01916                    gName, 
01917                    ++midSlotCopy, 
01918                    DDTranslation( vecGrilleHeight()[iGr]/2. - vecGrMidSlotHeight()[(iGr-1)/2]/2.,
01919                          -grMidSlotXOff(),    0 ),
01920                    DDRotation() ) ;
01921          }
01922 
01923          if( 0 != grEdgeSlotHere() &&
01924              0 != iGr                   )
01925          {
01926             cpv.position( grEdgeSlotLog,
01927                    gName, 
01928                    ++edgeSlotCopy, 
01929                    DDTranslation( vecGrilleHeight()[iGr]/2. - grEdgeSlotHeight()/2.,
01930                                   backCoolWidth/2           - grEdgeSlotWidth()/2.,    0 ),
01931                    DDRotation() ) ;
01932             cpv.position( grEdgeSlotLog,
01933                    gName, 
01934                    ++edgeSlotCopy, 
01935                    DDTranslation( vecGrilleHeight()[iGr]/2. - grEdgeSlotHeight()/2.,
01936                          -backCoolWidth/2          + grEdgeSlotWidth()/2.,    0 ),
01937                    DDRotation() ) ;
01938          }
01939          if( 0 != grilleHere() )
01940             cpv.position( grilleLog,
01941                    spmName(), 
01942                    iGr, 
01943                    gTra,
01944                    DDRotation() ) ;
01945 
01946          if( ( 0 != iGr%2 )         &&
01947              ( 0 != mBManifHere() )     )
01948          {
01949             cpv.position( mBManifLog,
01950                    spmName(),
01951                    iGr,
01952                    gTra - DDTranslation( -mBManifOutDiam()/2. +
01953                                          vecGrilleHeight()[iGr]/2.,manifCut, 
01954                                          grilleThick()/2.+3*mBManifOutDiam()/2.) ,
01955                    myrot( mBManifName().name()+"R1",
01956                           CLHEP::HepRotationX(90*deg)             ) ) ;
01957             cpv.position( mBManifLog,
01958                    spmName(),
01959                    iGr-1,
01960                    gTra - DDTranslation( -3*mBManifOutDiam()/2. +
01961                                          vecGrilleHeight()[iGr]/2.,manifCut, 
01962                                          grilleThick()/2+3*mBManifOutDiam()/2.) ,
01963                    myrot( mBManifName().name()+"R2",
01964                           CLHEP::HepRotationX(90*deg)             ) ) ;
01965          }
01966       }
01967 
01973 
01974 
01980 
01981       DDSolid backCoolBarSolid ( DDSolidFactory::box( backCoolBarName(), 
01982                                                       backCoolBarHeight()/2.,
01983                                                       backCoolBarWidth()/2.,  
01984                                                       backCoolBarThick()/2.   ) ) ;
01985       const DDLogicalPart backCoolBarLog ( backCoolBarName(),
01986                                            backCoolBarMat(),
01987                                            backCoolBarSolid ) ;
01988 
01989       DDSolid backCoolBarSSSolid ( DDSolidFactory::box( backCoolBarSSName(), 
01990                                                         backCoolBarHeight()/2.,
01991                                                         backCoolBarWidth()/2.,  
01992                                                         backCoolBarSSThick()/2.   ) ) ;
01993       const DDLogicalPart backCoolBarSSLog ( backCoolBarSSName(),
01994                                              backCoolBarSSMat(),
01995                                              backCoolBarSSSolid ) ;
01996       const DDTranslation backCoolBarSSTra (0,0,0) ;
01997       cpv.position( backCoolBarSSLog,
01998              backCoolBarName(), 
01999              copyOne, 
02000              backCoolBarSSTra,
02001              DDRotation() ) ;
02002 
02003       DDSolid backCoolBarWaSolid ( DDSolidFactory::box( backCoolBarWaName(), 
02004                                                         backCoolBarHeight()/2.,
02005                                                         backCoolBarWidth()/2.,  
02006                                                         backCoolBarWaThick()/2.   ) ) ;
02007       const DDLogicalPart backCoolBarWaLog ( backCoolBarWaName(),
02008                                              backCoolBarWaMat(),
02009                                              backCoolBarWaSolid ) ;
02010       const DDTranslation backCoolBarWaTra (0,0,0) ;
02011       cpv.position( backCoolBarWaLog,
02012              backCoolBarSSName(), 
02013              copyOne, 
02014              backCoolBarWaTra,
02015              DDRotation() ) ;
02016 
02022 
02023 
02029 
02030       double thickVFE ( 0 ) ;
02031       for( unsigned int iLyr ( 0 ) ; iLyr != vecBackVFELyrThick().size() ; ++iLyr )
02032       {
02033          thickVFE += vecBackVFELyrThick()[iLyr] ;
02034       }
02035       DDSolid backVFESolid ( DDSolidFactory::box( backVFEName(), 
02036                                                   backCoolBarHeight()/2.,
02037                                                   backCoolBarWidth()/2.,  
02038                                                   thickVFE/2.   ) ) ;
02039       const DDLogicalPart backVFELog ( backVFEName(),
02040                                        backVFEMat(),
02041                                        backVFESolid ) ;
02042       DDTranslation offTra ( 0,0,-thickVFE/2 ) ;
02043       for( unsigned int iLyr ( 0 ) ; iLyr != vecBackVFELyrThick().size() ; ++iLyr )
02044       {
02045          DDSolid backVFELyrSolid ( DDSolidFactory::box( ddname(vecBackVFELyrName()[iLyr]), 
02046                                                         backCoolBarHeight()/2.,
02047                                                         backCoolBarWidth()/2.,  
02048                                                         vecBackVFELyrThick()[iLyr]/2.   ) ) ;
02049          const DDLogicalPart backVFELyrLog ( ddname(vecBackVFELyrName()[iLyr]),
02050                                              ddmat(vecBackVFELyrMat()[iLyr]),
02051                                              backVFELyrSolid ) ;
02052          const DDTranslation backVFELyrTra (0,0, vecBackVFELyrThick()[iLyr]/2) ;
02053          cpv.position( backVFELyrLog,
02054                 backVFEName(), 
02055                 copyOne, 
02056                 backVFELyrTra + offTra,
02057                 DDRotation() ) ;
02058          offTra += 2*backVFELyrTra ;
02059       }
02060 
02066 
02067 
02073 
02074       const double halfZCoolVFE ( thickVFE + backCoolBarThick()/2. ) ;
02075       DDSolid backCoolVFESolid ( DDSolidFactory::box( backCoolVFEName(), 
02076                                                       backCoolBarHeight()/2.,
02077                                                       backCoolBarWidth()/2.,  
02078                                                       halfZCoolVFE   ) ) ;
02079       const DDLogicalPart backCoolVFELog ( backCoolVFEName(),
02080                                            backCoolVFEMat(),
02081                                            backCoolVFESolid ) ;
02082       if( 0 != backCoolBarHere() )
02083          cpv.position( backCoolBarLog    ,
02084                 backCoolVFEName() , 
02085                 copyOne           , 
02086                 DDTranslation()   ,
02087                 DDRotation()       ) ;
02088       if( 0 != backCoolVFEHere() )
02089          cpv.position( backVFELog        ,
02090                 backCoolVFEName() , 
02091                 copyOne           , 
02092                 DDTranslation( 0,0, backCoolBarThick()/2. + thickVFE/2. )   ,
02093                 DDRotation()       ) ;
02094       cpv.position( backVFELog        ,
02095              backCoolVFEName() , 
02096              copyTwo           , 
02097              DDTranslation( 0,0, -backCoolBarThick()/2. - thickVFE/2. )   ,
02098              myrot( backVFEName().name() + "Flip",
02099                     CLHEP::HepRotationX( 180*deg ) )        ) ;
02100 
02106 
02107 
02113       unsigned int iCVFECopy ( 1 ) ;
02114       unsigned int iSep ( 0 ) ;
02115       unsigned int iNSec ( 0 ) ;
02116       const unsigned int nMisc ( vecBackMiscThick().size()/4 ) ;
02117       for( unsigned int iMod ( 0 ) ; iMod != 4 ; ++iMod )
02118       {
02119          const double pipeLength ( vecGrilleZOff()[2*iMod+1] -
02120                                    vecGrilleZOff()[2*iMod  ] -
02121                                    grilleThick()   - 3*mm            ) ;
02122 
02123          const double pipeZPos ( vecGrilleZOff()[2*iMod+1] - pipeLength/2 - 1.5*mm  ) ;
02124 
02125 
02126 
02127          // accumulate total height of parent volume
02128 
02129          double backCoolHeight ( backCoolBarHeight() + mBCoolTubeOutDiam() ) ;
02130          for( unsigned int iMisc ( 0 ) ; iMisc != nMisc ; ++iMisc )
02131          {
02132             backCoolHeight += vecBackMiscThick()[ iMod*nMisc + iMisc ] ;
02133          }
02134          double bottomThick ( mBCoolTubeOutDiam() ) ;
02135          for( unsigned int iMB ( 0 ) ; iMB != vecMBLyrThick().size() ; ++iMB )
02136          {
02137             backCoolHeight += vecMBLyrThick()[iMB] ;
02138             bottomThick    += vecMBLyrThick()[iMB] ;
02139          }
02140 
02141          DDName backCName ( ddname( vecBackCoolName()[iMod] ) ) ;
02142          const double halfZBCool ( ( pipeLength - 2*mBManifOutDiam() - grilleZSpace() )/2 ) ;
02143          DDSolid backCoolSolid ( DDSolidFactory::box( backCName ,
02144                                                       backCoolHeight/2.,  
02145                                                       backCoolWidth/2.,
02146                                                       halfZBCool   ) ) ;
02147          const DDLogicalPart backCoolLog ( backCName,
02148                                            spmMat(),
02149                                            backCoolSolid ) ;
02150          
02151          const DDTranslation bCoolTra ( -realBPthick/2 +
02152                                         backCoolHeight/2    -
02153                                         vecGrilleHeight()[2*iMod],
02154                                         deltaY,
02155                                         vecGrilleZOff()[2*iMod] +
02156                                         grilleThick() + grilleZSpace() +
02157                                         halfZBCool - 
02158                                         backSideLength()/2 ) ;
02159          if( 0 != backCoolHere() )
02160             cpv.position( backCoolLog,
02161                    spmName(), 
02162                    iMod+1, 
02163                    outtra + backPlateTra + bCoolTra,
02164                    DDRotation() ) ;
02165 
02166 //===
02167          const double backCoolTankHeight ( backCoolBarHeight() ) ;// - backBracketHeight() ) ;
02168 
02169          const double halfZTank ( halfZBCool - 5*cm ) ;
02170 
02171          DDName bTankName ( ddname( backCoolTankName()+int_to_string(iMod+1) ) ) ;
02172          DDSolid backCoolTankSolid ( DDSolidFactory::box( bTankName ,
02173                                                           backCoolTankHeight/2.,  
02174                                                           backCoolTankWidth()/2.,
02175                                                           halfZTank  ) ) ;
02176          const DDLogicalPart backCoolTankLog ( bTankName,
02177                                                backCoolTankMat(),
02178                                                backCoolTankSolid ) ;
02179          if( 0 != backCoolTankHere() )
02180             cpv.position( backCoolTankLog,
02181                    backCName, 
02182                    copyOne, 
02183                    DDTranslation( -backCoolHeight/2 + 
02184                                   backCoolTankHeight/2. + 
02185                                   bottomThick,
02186                                   backCoolBarWidth()/2. + backCoolTankWidth()/2., 0),
02187                    DDRotation() ) ;
02188 
02189          DDName bTankWaName ( ddname( backCoolTankWaName()+int_to_string(iMod+1) ) ) ;
02190          DDSolid backCoolTankWaSolid ( DDSolidFactory::box( bTankWaName ,
02191                                                             backCoolTankHeight/2. -
02192                                                             backCoolTankThick()/2.,  
02193                                                             backCoolTankWaWidth()/2.,
02194                                                             halfZTank -
02195                                                             backCoolTankThick()/2. ) ) ;
02196          const DDLogicalPart backCoolTankWaLog ( bTankWaName,
02197                                                  backCoolTankWaMat(),
02198                                                  backCoolTankWaSolid ) ;
02199          cpv.position( backCoolTankWaLog,
02200                 bTankName, 
02201                 copyOne, 
02202                 DDTranslation(0,0,0),
02203                 DDRotation() ) ;
02204 
02205          DDName bBracketName ( ddname( backBracketName()+int_to_string(iMod+1) ) ) ;
02206          DDSolid backBracketSolid ( DDSolidFactory::box( bBracketName ,
02207                                                          backBracketHeight()/2.,  
02208                                                          backCoolTankWidth()/2.,
02209                                                          halfZTank   ) ) ;
02210          const DDLogicalPart backBracketLog ( bBracketName,
02211                                               backBracketMat(),
02212                                               backBracketSolid ) ;
02213          if( 0 != backCoolTankHere() )
02214             cpv.position( backBracketLog,
02215                    backCName, 
02216                    copyOne, 
02217                    DDTranslation( backCoolBarHeight() - 
02218                                   backCoolHeight/2. - 
02219                                   backBracketHeight()/2. +
02220                                   bottomThick,
02221                                   -backCoolBarWidth()/2. - backCoolTankWidth()/2., 0),
02222                    DDRotation() ) ;
02223 
02224 /*       cpv.position( backBracketLog,
02225                 backCName, 
02226                 copyTwo, 
02227                 DDTranslation( backCoolBarHeight() - backCoolHeight/2. - backBracketHeight()/2.,
02228                                backCoolBarWidth()/2. + backCoolTankWidth()/2., 0),
02229                                DDRotation() ) ;*/
02230 
02231 //===
02232 
02233          DDTranslation bSumTra ( backCoolBarHeight() - 
02234                                  backCoolHeight/2. +
02235                                  bottomThick, 0, 0 ) ;
02236          for( unsigned int j ( 0 ) ; j != nMisc ; ++j ) // loop over miscellaneous layers
02237          {
02238             const DDName bName ( ddname( vecBackMiscName()[ iMod*nMisc + j ] ) ) ;
02239 
02240             DDSolid bSolid ( DDSolidFactory::box( bName ,
02241                                                   vecBackMiscThick()[ iMod*nMisc + j ]/2,  
02242                                                   backCoolBarWidth()/2. + backCoolTankWidth(),
02243                                                   halfZBCool ) ) ;
02244 
02245             const DDLogicalPart bLog ( bName, ddmat(vecBackMiscMat()[ iMod*nMisc + j ]), bSolid ) ;
02246  
02247             const DDTranslation bTra ( vecBackMiscThick()[ iMod*nMisc + j ]/2, 0*mm, 0*mm ) ;
02248 
02249 
02250             if( 0 != backMiscHere() )
02251                cpv.position( bLog,
02252                       backCName, 
02253                       copyOne, 
02254                       bSumTra + bTra,
02255                       DDRotation() ) ;
02256 
02257             bSumTra += 2*bTra ;
02258          }
02259 
02260          const double bHalfWidth ( backCoolBarWidth()/2. + backCoolTankWidth() ) ;
02261 
02262          if( 0 != mBLyrHere() )
02263          {
02264             DDTranslation mTra ( -backCoolHeight/2. + mBCoolTubeOutDiam(), 0, 0 ) ;
02265             for( unsigned int j ( 0 ) ; j != vecMBLyrThick().size() ; ++j ) // loop over MB layers
02266             {
02267                const DDName mName ( ddname( vecMBLyrName()[j] + "_" + 
02268                                             int_to_string(iMod+1) ) ) ;
02269 
02270                DDSolid mSolid ( DDSolidFactory::box( mName ,
02271                                                      vecMBLyrThick()[j]/2,  
02272                                                      bHalfWidth,
02273                                                      halfZBCool ) ) ;
02274 
02275                const DDLogicalPart mLog ( mName, ddmat(vecMBLyrMat()[j]), mSolid ) ;
02276  
02277                mTra += DDTranslation( vecMBLyrThick()[j]/2.0, 0*mm, 0*mm ) ;
02278                cpv.position( mLog,
02279                       backCName, 
02280                       copyOne, 
02281                       mTra,
02282                       DDRotation() ) ;
02283                mTra += DDTranslation( vecMBLyrThick()[j]/2.0, 0*mm, 0*mm ) ;
02284             }
02285          }
02286 
02287          if( 0 != mBCoolTubeHere() )
02288          {
02289             const DDName mBName ( ddname( mBCoolTubeName() + "_" + 
02290                                           int_to_string(iMod+1) ) ) ;
02291             
02292             DDSolid mBCoolTubeSolid ( DDSolidFactory::tubs( mBName ,
02293                                                             halfZBCool,
02294                                                             0, 
02295                                                             mBCoolTubeOutDiam()/2,
02296                                                             0*deg, 360*deg ) ) ;
02297             const DDLogicalPart mBLog ( mBName, mBCoolTubeMat(), mBCoolTubeSolid ) ;
02298 
02299             const DDName mBWaName ( ddname( mBCoolTubeName() + "Wa_" + 
02300                                             int_to_string(iMod+1) ) ) ;
02301             DDSolid mBCoolTubeWaSolid ( DDSolidFactory::tubs( mBWaName ,
02302                                                               halfZBCool,
02303                                                               0, 
02304                                                               mBCoolTubeInnDiam()/2,
02305                                                               0*deg, 360*deg ) ) ;
02306             const DDLogicalPart mBWaLog ( mBWaName, backPipeWaterMat(), 
02307                                           mBCoolTubeWaSolid ) ;
02308             cpv.position( mBWaLog,
02309                    mBName, 
02310                    copyOne, 
02311                    DDTranslation(0,0,0),
02312                    DDRotation() ) ;
02313 
02314             for( unsigned int j ( 0 ) ; j != mBCoolTubeNum() ; ++j ) // loop over all MB cooling circuits
02315             {
02316                cpv.position( mBLog,
02317                       backCName, 
02318                       2*j + 1, 
02319                       DDTranslation(-backCoolHeight/2.0+mBCoolTubeOutDiam()/2.,
02320                                     -bHalfWidth + (j+1)*bHalfWidth/5, 0),
02321                       DDRotation() ) ;
02322             }
02323          }
02324 
02325 
02331          if( 0 != backPipeHere() &&
02332              0 != iMod               )
02333          {
02334             DDName bPipeName ( ddname( backPipeName() + "_" + 
02335                                        int_to_string( iMod+1 ) ) ) ; 
02336             DDName bInnerName ( ddname( backPipeName() + 
02337                                         "_H2O_" + int_to_string( iMod+1 ) ) ) ; 
02338          
02339             DDSolid backPipeSolid ( DDSolidFactory::tubs( bPipeName ,
02340                                                           pipeLength/2,
02341                                                           0*mm, 
02342                                                           vecBackPipeDiam()[iMod]/2,
02343                                                           0*deg, 360*deg ) ) ;
02344 
02345             DDSolid backInnerSolid ( DDSolidFactory::tubs( bInnerName ,
02346                                                            pipeLength/2,
02347                                                            0*mm, 
02348                                                            vecBackPipeDiam()[iMod]/2 -
02349                                                            vecBackPipeThick()[iMod],
02350                                                            0*deg, 360*deg ) ) ;
02351 
02352             const DDLogicalPart backPipeLog ( bPipeName, 
02353                                               backPipeMat(), 
02354                                               backPipeSolid ) ;
02355 
02356             const DDLogicalPart backInnerLog ( bInnerName, 
02357                                                backPipeWaterMat(), 
02358                                                backInnerSolid ) ;
02359 
02360             const DDTranslation bPipeTra1 ( backXOff() + 
02361                                             backSideHeight() -
02362                                             0.7*vecBackPipeDiam()[iMod],
02363                                             backYOff() +
02364                                             backPlateWidth()/2 -
02365                                             backSideWidth() -
02366                                             0.7*vecBackPipeDiam()[iMod],
02367                                             pipeZPos ) ;
02368 
02369             cpv.position( backPipeLog,
02370                    spmName(), 
02371                    copyOne, 
02372                    bPipeTra1,
02373                    DDRotation() ) ;
02374 
02375             const DDTranslation bPipeTra2 ( bPipeTra1.x(),
02376                                             backYOff() -
02377                                             backPlateWidth()/2 +
02378                                             backSideWidth() +
02379                                             vecBackPipeDiam()[iMod],
02380                                             bPipeTra1.z()  ) ;
02381 
02382             cpv.position( backPipeLog,
02383                    spmName(), 
02384                    copyTwo, 
02385                    bPipeTra2,
02386                    DDRotation() ) ;
02387 
02388             cpv.position( backInnerLog,
02389                    bPipeName, 
02390                    copyOne, 
02391                    DDTranslation(),
02392                    DDRotation() ) ;
02393          }
02399 
02400 //=================================================
02401 
02402          if( 0 != dryAirTubeHere() )
02403          {
02404             DDName dryAirTubName ( ddname( dryAirTubeName() + int_to_string( iMod+1 ) ) ) ; 
02405 
02406             DDSolid dryAirTubeSolid ( DDSolidFactory::tubs( dryAirTubName ,
02407                                                             pipeLength/2,
02408                                                             dryAirTubeInnDiam()/2, 
02409                                                             dryAirTubeOutDiam()/2,
02410                                                             0*deg, 360*deg ) ) ;
02411 
02412             const DDLogicalPart dryAirTubeLog ( dryAirTubName , 
02413                                                 dryAirTubeMat(), 
02414                                                 dryAirTubeSolid ) ;
02415 
02416             const DDTranslation dryAirTubeTra1 ( backXOff() + 
02417                                                  backSideHeight() -
02418                                                  0.7*dryAirTubeOutDiam() -
02419                                                  vecBackPipeDiam()[iMod],
02420                                                  backYOff() +
02421                                                  backPlateWidth()/2 -
02422                                                  backSideWidth() -
02423                                                  1.2*dryAirTubeOutDiam(),
02424                                                  pipeZPos ) ;
02425 
02426             cpv.position( dryAirTubeLog,
02427                    spmName(), 
02428                    copyOne, 
02429                    dryAirTubeTra1,
02430                    DDRotation() ) ;
02431 
02432             const DDTranslation dryAirTubeTra2 ( dryAirTubeTra1.x(),
02433                                                  backYOff() -
02434                                                  backPlateWidth()/2 +
02435                                                  backSideWidth() +
02436                                                  0.7*dryAirTubeOutDiam() ,
02437                                                  dryAirTubeTra1.z()  ) ;
02438          
02439             cpv.position( dryAirTubeLog,
02440                    spmName(), 
02441                    copyTwo, 
02442                    dryAirTubeTra2,
02443                    DDRotation() ) ;
02444          }
02445          //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
02446 
02452 
02453          DDTranslation cTra ( backCoolBarHeight()/2. - 
02454                               backCoolHeight/2. +
02455                               bottomThick, 0 ,
02456                               -halfZTank + halfZCoolVFE ) ;
02457          const unsigned int numSec ( static_cast<unsigned int> (vecBackCoolNSec()[iMod]) ) ; 
02458          for( unsigned int jSec ( 0 ) ; jSec != numSec ; ++jSec )
02459          {
02460             const unsigned int nMax ( static_cast<unsigned int> (vecBackCoolNPerSec()[iNSec++]) ) ; 
02461             for( unsigned int iBar ( 0 ) ; iBar !=  nMax ; ++iBar )
02462             {
02463                cpv.position( backCoolVFELog,
02464                       backCName, 
02465                       iCVFECopy++, 
02466                       cTra,
02467                       DDRotation() ) ;         
02468                cTra += DDTranslation( 0, 0, backCBStdSep() ) ;
02469             }
02470             cTra -= DDTranslation( 0, 0, backCBStdSep() ) ; // backspace to previous
02471             if( jSec != numSec-1 ) cTra += DDTranslation( 
02472                0, 0, vecBackCoolSecSep()[iSep++] ) ; // now take atypical step
02473          }
02479       }
02480 
02486 
02492 
02493       double patchHeight ( 0  ) ;
02494       for( unsigned int iPatch ( 0 ) ; iPatch != vecPatchPanelThick().size() ; ++iPatch )
02495       {
02496          patchHeight += vecPatchPanelThick()[iPatch] ;
02497       }
02498 
02499       DDSolid patchSolid ( DDSolidFactory::box( patchPanelName() ,
02500                                                 patchHeight/2.,  
02501                                                 backCoolBarWidth()/2.,
02502                                                 ( vecSpmZPts().back() -
02503                                                   vecGrilleZOff().back() -
02504                                                   grilleThick() )/2   ) ) ;
02505 
02506       const std::vector<double>& patchParms ( patchSolid.parameters() ) ;
02507 
02508       const DDLogicalPart patchLog ( patchPanelName(), spmMat(), patchSolid ) ;
02509          
02510       const DDTranslation patchTra ( backXOff() + 4*mm ,
02511                                      0*mm,
02512                                      vecGrilleZOff().back() +
02513                                      grilleThick() +
02514                                      patchParms[2]  ) ;
02515       if( 0 != patchPanelHere() )
02516          cpv.position( patchLog,
02517                 spmName(), 
02518                 copyOne, 
02519                 patchTra,
02520                 DDRotation() ) ;
02521 
02522       DDTranslation pTra (-patchParms[0],0,0) ;
02523 
02524       for( unsigned int j ( 0 ) ; j != vecPatchPanelNames().size() ; ++j )
02525       {
02526          const DDName pName ( ddname( vecPatchPanelNames()[j] ) ) ;
02527 
02528          DDSolid pSolid ( DDSolidFactory::box( pName ,
02529                                                vecPatchPanelThick()[j]/2.,  
02530                                                patchParms[1],
02531                                                patchParms[2] ) ) ;
02532          
02533          const DDLogicalPart pLog ( pName, ddmat(vecPatchPanelMat()[j]), pSolid ) ;
02534          
02535          pTra += DDTranslation( vecPatchPanelThick()[j]/2, 0*mm, 0*mm ) ;
02536          
02537          cpv.position( pLog,
02538                 patchPanelName(), 
02539                 copyOne, 
02540                 pTra,
02541                 DDRotation() ) ;
02542          
02543          pTra += DDTranslation( vecPatchPanelThick()[j]/2, 0*mm, 0*mm ) ;
02544       }
02550 
02556 
02557       if( 0 != pincerRodHere() )
02558       {
02559          // Make hierarchy of rods, envelopes, blocks, shims, and cutouts
02560 
02561          DDSolid rodSolid ( DDSolidFactory::box( pincerRodName() ,
02562                                                  pincerEnvWidth()/2.,  
02563                                                  pincerEnvHeight()/2.,
02564                                                  ilyLength/2   ) ) ;
02565          const DDLogicalPart rodLog ( pincerRodName(), pincerRodMat(), rodSolid ) ;
02566 
02567          DDSolid envSolid ( DDSolidFactory::box( pincerEnvName() ,
02568                                                  pincerEnvWidth()/2.,  
02569                                                  pincerEnvHeight()/2.,
02570                                                  pincerEnvLength()/2   ) ) ;
02571          const DDLogicalPart envLog ( pincerEnvName(), pincerEnvMat(), envSolid ) ;
02572          const std::vector<double>& envParms ( envSolid.parameters() ) ;
02573 
02574          DDSolid blkSolid ( DDSolidFactory::box( pincerBlkName() ,
02575                                                  pincerEnvWidth()/2.,  
02576                                                  pincerEnvHeight()/2.,
02577                                                  pincerBlkLength()/2   ) ) ;
02578          const DDLogicalPart blkLog ( pincerBlkName(), pincerBlkMat(), blkSolid ) ;
02579          const std::vector<double>& blkParms ( blkSolid.parameters() ) ;
02580          cpv.position( blkLog,
02581                 pincerEnvName(), 
02582                 copyOne,
02583                 DDTranslation(0,0, pincerEnvLength()/2 - pincerBlkLength()/2 ),
02584                 DDRotation() ) ;
02585 
02586          DDSolid cutSolid ( DDSolidFactory::box( pincerCutName() ,
02587                                                  pincerCutWidth()/2.,  
02588                                                  pincerCutHeight()/2.,
02589                                                  pincerBlkLength()/2   ) ) ;
02590          const DDLogicalPart cutLog ( pincerCutName(), pincerCutMat(), cutSolid ) ;
02591          const std::vector<double>& cutParms ( cutSolid.parameters() ) ;
02592          cpv.position( cutLog,
02593                 pincerBlkName(), 
02594                 copyOne,
02595                 DDTranslation( +blkParms[0] - cutParms[0] - pincerShim1Width() + pincerShim2Width(),
02596                                -blkParms[1] + cutParms[1],     0  ),
02597                 DDRotation() ) ;
02598 
02599          DDSolid shim2Solid ( DDSolidFactory::box( pincerShim2Name() ,
02600                                                    pincerShim2Width()/2.,  
02601                                                    pincerShimHeight()/2.,
02602                                                    pincerBlkLength()/2   ) ) ;
02603          const DDLogicalPart shim2Log ( pincerShim2Name(), pincerShimMat(), shim2Solid ) ;
02604          const std::vector<double>& shim2Parms ( shim2Solid.parameters() ) ;
02605          cpv.position( shim2Log,
02606                 pincerCutName(), 
02607                 copyOne,
02608                 DDTranslation( +cutParms[0] - shim2Parms[0],
02609                                -cutParms[1] + shim2Parms[1],     0  ),
02610                 DDRotation() ) ;
02611 
02612          DDSolid shim1Solid ( DDSolidFactory::box( pincerShim1Name() ,
02613                                                    pincerShim1Width()/2.,  
02614                                                    pincerShimHeight()/2.,
02615                                                    (pincerEnvLength()-
02616                                                     pincerBlkLength())/2   ) ) ;
02617 
02618          const DDLogicalPart shim1Log ( pincerShim1Name(), pincerShimMat(), shim1Solid ) ;
02619          const std::vector<double>& shim1Parms ( shim1Solid.parameters() ) ;
02620          cpv.position( shim1Log,
02621                 pincerEnvName(), 
02622                 copyOne,
02623                 DDTranslation( +envParms[0] - shim1Parms[0],
02624                                -envParms[1] + shim1Parms[1],
02625                                -envParms[2] + shim1Parms[2] ),
02626                 DDRotation() ) ;
02627 
02628          for( unsigned int iEnv ( 0 ) ; iEnv != vecPincerEnvZOff().size() ; ++iEnv )
02629          {
02630             cpv.position( envLog,
02631                    pincerRodName(), 
02632                    1+iEnv, 
02633                    DDTranslation(0,0, -ilyLength/2. + vecPincerEnvZOff()[iEnv] - pincerEnvLength()/2. ),
02634                    DDRotation() ) ;
02635          }
02636 
02637          // Place the rods
02638 //       const double radius ( fawRadOff() - pincerEnvHeight()/2 -1*mm ) ;
02639          const double radius ( ilyRMin - pincerEnvHeight()/2 - 1*mm ) ;
02640 
02641          const DDName        xilyName    ( ddname( ilyName() +
02642                                                    int_to_string(vecIlyMat().size()-1) ) ) ;
02643 
02644          for( unsigned int iRod ( 0 ) ; iRod != vecPincerRodAzimuth().size() ; ++iRod )
02645          {
02646            const DDTranslation rodTra ( radius*cos(vecPincerRodAzimuth()[iRod]) ,
02647                                         radius*sin(vecPincerRodAzimuth()[iRod]) ,
02648                                         0 ) ;
02649            
02650            cpv.position( rodLog,
02651                   xilyName, 
02652                   1+iRod, 
02653                   rodTra,
02654                   myrot( pincerRodName().name() + int_to_string(iRod),
02655                          CLHEP::HepRotationZ( 90*deg + vecPincerRodAzimuth()[iRod] ) ) ) ;
02656          }
02657       }
02663 
02664       }
02665    } 
02666 
02667    LogDebug("EcalGeom") << "******** DDEcalBarrelAlgo test: end it..." ;
02668 }
02669 
02671 DDRotation
02672 DDEcalBarrelAlgo::myrot( const std::string&      s,
02673                          const CLHEP::HepRotation& r ) const 
02674 {
02675   return DDrot( ddname( m_idNameSpace + ":" + s ), new DDRotationMatrix( r.xx(), r.xy(), r.xz(), r.yx(), r.yy(), r.yz(), r.zx(), r.zy(), r.zz() ) ) ; 
02676 }
02677 
02678  
02679 DDMaterial
02680 DDEcalBarrelAlgo::ddmat( const std::string& s ) const
02681 {
02682    return DDMaterial( ddname( s ) ) ; 
02683 }
02684 
02685 DDName
02686 DDEcalBarrelAlgo::ddname( const std::string& s ) const
02687 { 
02688    const pair<std::string,std::string> temp ( DDSplit(s) ) ;
02689    if ( temp.second == "" ) {
02690      return DDName( temp.first,
02691                     m_idNameSpace ) ;
02692    } else {
02693      return DDName( temp.first, temp.second );
02694    } 
02695 }  
02696 
02697 DDSolid    
02698 DDEcalBarrelAlgo::mytrap( const std::string& s,
02699                           const EcalTrapezoidParameters& t ) const
02700 {
02701    return DDSolidFactory::trap( ddname( s ),
02702                                 t.dz(), 
02703                                 t.theta(), 
02704                                 t.phi(), 
02705                                 t.h1(), 
02706                                 t.bl1(), 
02707                                 t.tl1(),
02708                                 t.alp1(), 
02709                                 t.h2(), 
02710                                 t.bl2(), 
02711                                 t.tl2(), 
02712                                 t.alp2()         ) ;
02713 }
02714 
02715 void 
02716 DDEcalBarrelAlgo::web( unsigned int        iWeb,
02717                        double              bWeb,
02718                        double              BWeb,
02719                        double              LWeb,
02720                        double              theta,
02721                        const HepGeom::Point3D<double> &   corner,
02722                        const DDLogicalPart logPar,
02723                        double&             zee,
02724                        double              side,
02725                        double              front,
02726                        double              delta,
02727                        DDCompactView&      cpv  )
02728 {
02729    const unsigned int copyOne (1) ;
02730 
02731    const double LWebx ( vecWebLength()[iWeb] ) ;
02732 
02733    const double BWebx ( bWeb + ( BWeb - bWeb )*LWebx/LWeb ) ;
02734 
02735    const double thick ( vecWebPlTh()[iWeb] + vecWebClrTh()[iWeb] ) ;
02736    const Trap trapWebClr (
02737       BWebx/2,        // A/2 
02738       bWeb/2,        // a/2
02739       bWeb/2,        // b/2
02740       thick/2,       // H/2
02741       thick/2,       // h/2
02742       LWebx/2,        // L/2
02743       90*deg,        // alfa1
02744       bWeb - BWebx ,  // x15
02745       0              // y15
02746       ) ;
02747    const DDName        webClrDDName ( webClrName() + int_to_string( iWeb ) ) ;
02748    const DDSolid       webClrSolid  ( mytrap( webClrDDName.name(), trapWebClr ) ) ;
02749    const DDLogicalPart webClrLog    ( webClrDDName, webClrMat(), webClrSolid ) ;
02750             
02751    const Trap trapWebPl (
02752       trapWebClr.A()/2,                     // A/2 
02753       trapWebClr.a()/2,                     // a/2
02754       trapWebClr.b()/2,                     // b/2
02755       vecWebPlTh()[iWeb]/2,                 // H/2
02756       vecWebPlTh()[iWeb]/2,                 // h/2
02757       trapWebClr.L()/2.,                    // L/2
02758       90*deg,                               // alfa1
02759       trapWebClr.b() - trapWebClr.B() ,     // x15
02760       0                                     // y15
02761       ) ;
02762    const DDName        webPlDDName  ( webPlName() + int_to_string( iWeb ) ) ;
02763    const DDSolid       webPlSolid   ( mytrap( webPlDDName.fullname(), trapWebPl ) ) ;
02764    const DDLogicalPart webPlLog     ( webPlDDName, webPlMat(), webPlSolid ) ;
02765 
02766    cpv.position( webPlLog,     // place plate inside clearance volume
02767           webClrDDName, 
02768           copyOne, 
02769           DDTranslation(0,0,0),
02770           DDRotation() ) ;
02771 
02772    const Trap::VertexList vWeb ( trapWebClr.vertexList() ) ;
02773 
02774    zee += trapWebClr.h()/sin(theta) ;
02775 
02776    const double beta ( theta + delta ) ;
02777 
02778    const double zWeb ( zee - front*cos(beta) + side*sin(beta) ) ;
02779    const double yWeb ( front*sin(beta) + side*cos(beta) ) ;
02780 
02781    const Pt3D wedge3 ( corner + Pt3D( 0, -yWeb, zWeb ) ) ;
02782    const Pt3D wedge2 ( wedge3 + Pt3D( 0,
02783                                       trapWebClr.h()*cos(theta),
02784                                       -trapWebClr.h()*sin(theta)  ) ) ;
02785    const Pt3D wedge1 ( wedge3 + Pt3D( trapWebClr.a(), 0, 0 ) ) ;
02786 
02787    LogDebug("EcalGeom")<<"trap1="<<vWeb[0]<<", trap2="<<vWeb[2]<<", trap3="<<vWeb[3] ;
02788 
02789    LogDebug("EcalGeom")<<"wedge1="<<wedge1<<", wedge2="<<wedge2<<", wedge3="<<wedge3 ;
02790 
02791    const Tf3D tForm ( vWeb[0], vWeb[2], vWeb[3],
02792                       wedge1,   wedge2, wedge3    ) ;
02793    
02794    if( 0 != webHere() )
02795       cpv.position( webClrLog,
02796              logPar, 
02797              copyOne, 
02798              DDTranslation(tForm.getTranslation().x(), tForm.getTranslation().y(), tForm.getTranslation().z()),
02799              myrot( webClrLog.name().name() + int_to_string( iWeb ),
02800                     tForm.getRotation() ) ) ;
02801 }