CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/Geometry/EcalCommonData/src/DDEcalEndcapAlgo.cc

Go to the documentation of this file.
00001 
00003 // File: DDEcalEndcapAlgo.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/Core/interface/DDLogicalPart.h"
00012 #include "DetectorDescription/Core/interface/DDSolid.h"
00013 #include "DetectorDescription/Core/interface/DDCurrentNamespace.h"
00014 #include "Geometry/EcalCommonData/interface/DDEcalEndcapAlgo.h"
00015 #include "CLHEP/Units/GlobalSystemOfUnits.h"
00016 
00017 #include <CLHEP/Geometry/Transform3D.h>
00018 
00019 // Header files for endcap supercrystal geometry
00020 #include "Geometry/EcalCommonData/interface/DDEcalEndcapTrap.h"
00021 
00022 
00023 namespace std{} using namespace std;
00024 
00025 DDEcalEndcapAlgo::DDEcalEndcapAlgo() :
00026    m_idNameSpace   ( "" ),
00027    m_EEMat         ( "" ),
00028    m_EEzOff        ( 0 ),
00029    m_EEQuaName     ( "" ),
00030    m_EEQuaMat      ( "" ),
00031    m_EECrysMat     ( "" ),
00032    m_EEWallMat     ( "" ),
00033    m_EECrysLength  ( 0 ) ,
00034    m_EECrysRear    ( 0 ) ,
00035    m_EECrysFront   ( 0 ) ,
00036    m_EESCELength   ( 0 ) ,
00037    m_EESCERear     ( 0 ) ,
00038    m_EESCEFront    ( 0 ) ,
00039    m_EESCALength   ( 0 ) ,
00040    m_EESCARear     ( 0 ) ,
00041    m_EESCAFront    ( 0 ) ,
00042    m_EESCAWall     ( 0 ) ,
00043    m_EESCHLength   ( 0 ) ,
00044    m_EESCHSide     ( 0 ) ,
00045    m_EEnSCTypes    ( 0 ) ,
00046    m_vecEESCProf   (),
00047    m_EEnColumns    ( 0 ),
00048    m_vecEEShape    (),
00049    m_EEnSCCutaway  ( 0 ) ,
00050    m_vecEESCCutaway (),
00051    m_EEnSCquad     ( 0 ) ,
00052    m_vecEESCCtrs(),
00053    m_EEnCRSC       ( 0 ) ,
00054    m_vecEECRCtrs(),
00055    m_cutParms      ( 0 ),
00056    m_cutBoxName    ( "" ),
00057    m_envName    ( "" ),
00058    m_alvName    ( "" ),
00059    m_intName    ( "" ),
00060    m_cryName    ( "" ),
00061    m_PFhalf     ( 0 ) ,
00062    m_PFfifth    ( 0 ) ,
00063    m_PF45       ( 0 ) ,
00064    m_vecEESCLims (),
00065    m_iLength    ( 0 ) ,
00066    m_iXYOff     ( 0 ) 
00067 {
00068    edm::LogInfo("EcalGeom") << "DDEcalEndcapAlgo info: Creating an instance" ;
00069 }
00070 
00071 DDEcalEndcapAlgo::~DDEcalEndcapAlgo() {}
00072 
00073 
00074 
00075 
00076 void DDEcalEndcapAlgo::initialize(const DDNumericArguments      & nArgs,
00077                                   const DDVectorArguments       & vArgs,
00078                                   const DDMapArguments          & mArgs,
00079                                   const DDStringArguments       & sArgs,
00080                                   const DDStringVectorArguments & vsArgs) {
00081 
00082 //   edm::LogInfo("EcalGeom") << "DDEcalEndcapAlgo info: Initialize" ;
00083    m_idNameSpace = DDCurrentNamespace::ns();
00084    // TRICK!
00085    m_idNameSpace = parent().name().ns();
00086    // barrel parent volume
00087    m_EEMat      = sArgs["EEMat"  ] ;
00088    m_EEzOff     = nArgs["EEzOff"   ] ;
00089 
00090    m_EEQuaName  = sArgs["EEQuaName" ] ;
00091    m_EEQuaMat   = sArgs["EEQuaMat"  ] ;
00092    m_EECrysMat  = sArgs["EECrysMat" ] ;
00093    m_EEWallMat  = sArgs["EEWallMat" ] ;
00094    m_EECrysLength = nArgs["EECrysLength" ] ;
00095    m_EECrysRear   = nArgs["EECrysRear" ] ;
00096    m_EECrysFront  = nArgs["EECrysFront" ] ;
00097    m_EESCELength = nArgs["EESCELength" ] ;
00098    m_EESCERear   = nArgs["EESCERear" ] ;
00099    m_EESCEFront  = nArgs["EESCEFront" ] ;
00100    m_EESCALength = nArgs["EESCALength" ] ;
00101    m_EESCARear   = nArgs["EESCARear" ] ;
00102    m_EESCAFront  = nArgs["EESCAFront" ] ;
00103    m_EESCAWall   = nArgs["EESCAWall" ] ;
00104    m_EESCHLength = nArgs["EESCHLength" ] ;
00105    m_EESCHSide   = nArgs["EESCHSide" ] ;
00106    m_EEnSCTypes  = nArgs["EEnSCTypes"];
00107    m_EEnColumns  = nArgs["EEnColumns"];
00108    m_EEnSCCutaway  = nArgs["EEnSCCutaway"];
00109    m_EEnSCquad  = nArgs["EEnSCquad"];
00110    m_EEnCRSC    = nArgs["EEnCRSC"];
00111    m_vecEESCProf = vArgs["EESCProf"];
00112    m_vecEEShape = vArgs["EEShape"];
00113    m_vecEESCCutaway = vArgs["EESCCutaway"];
00114    m_vecEESCCtrs = vArgs["EESCCtrs"];
00115    m_vecEECRCtrs = vArgs["EECRCtrs"];
00116 
00117    m_cutBoxName  = sArgs["EECutBoxName" ] ;
00118 
00119    m_envName  = sArgs["EEEnvName" ] ;
00120    m_alvName  = sArgs["EEAlvName" ] ;
00121    m_intName  = sArgs["EEIntName" ] ;
00122    m_cryName  = sArgs["EECryName" ] ;
00123    
00124    m_PFhalf   = nArgs["EEPFHalf" ] ;
00125    m_PFfifth  = nArgs["EEPFFifth" ] ;
00126    m_PF45     = nArgs["EEPF45" ] ;
00127 
00128    m_vecEESCLims = vArgs["EESCLims"];
00129 
00130    m_iLength = nArgs["EEiLength" ] ;
00131 
00132    m_iXYOff  = nArgs["EEiXYOff" ] ;
00133 
00134    
00135 //   edm::LogInfo("EcalGeom") << "DDEcalEndcapAlgo info: end initialize" ;
00136 }
00137 
00139 // DDEcalEndcapAlgo methods...
00141 
00142 
00143 DDRotation
00144 DDEcalEndcapAlgo::myrot( const std::string&      s,
00145                          const DDRotationMatrix& r ) const 
00146 {
00147    return DDrot( ddname( m_idNameSpace + ":" + s ), new DDRotationMatrix( r ) ) ; 
00148 }
00149 /*
00150 DDRotation
00151 DDEcalBarrelAlgo::myrot( const std::string&      s,
00152                          const CLHEP::HepRotation& r ) const 
00153 {
00154   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() ) ) ; 
00155 }*/
00156  
00157 DDMaterial
00158 DDEcalEndcapAlgo::ddmat( const std::string& s ) const
00159 {
00160    return DDMaterial( ddname( s ) ) ; 
00161 }
00162 
00163 DDName
00164 DDEcalEndcapAlgo::ddname( const std::string& s ) const
00165 { 
00166    const pair<std::string,std::string> temp ( DDSplit(s) ) ;
00167    if ( temp.second == "" ) {
00168      return DDName( temp.first,
00169                     m_idNameSpace ) ;
00170    } else {
00171      return DDName( temp.first, temp.second );
00172    } 
00173 }
00174 
00175 //-------------------- Endcap SC geometry methods ---------------------
00176 
00177 void 
00178 DDEcalEndcapAlgo::execute( DDCompactView& cpv ) 
00179 {
00180 //  Position supercrystals in EE Quadrant
00181 //  Version:    1.00
00182 //  Created:    30 July 2007
00183 //  Last Mod:   
00184 //---------------------------------------------------------------------
00185 
00186 //********************************* cutbox for trimming edge SCs
00187    const double cutWid ( eeSCERear()/sqrt(2.) ) ;
00188    const DDSolid eeCutBox ( DDSolidFactory::box(
00189                                cutBoxName(), 
00190                                cutWid,  
00191                                cutWid,  
00192                                eeSCELength()/sqrt(2.) ) ) ;
00193    m_cutParms = &eeCutBox.parameters() ;
00194 //**************************************************************
00195 
00196 //** fill supercrystal front and rear center positions from xml input
00197    for( unsigned int iC ( 0 ) ; iC != (unsigned int) eenSCquad() ; ++iC )
00198    {
00199       const unsigned int iOff ( 8*iC ) ;
00200       const unsigned int ix ( (unsigned int) eevecEESCCtrs()[ iOff + 0 ] ) ;
00201       const unsigned int iy ( (unsigned int) eevecEESCCtrs()[ iOff + 1 ] ) ;
00202 
00203       assert( ix > 0 && ix < 11 && iy >0 && iy < 11 ) ;
00204 
00205       m_scrFCtr[ ix - 1 ][ iy - 1 ] = DDTranslation( eevecEESCCtrs()[ iOff + 2 ] ,
00206                                                      eevecEESCCtrs()[ iOff + 4 ] ,
00207                                                      eevecEESCCtrs()[ iOff + 6 ]  ) ;
00208 
00209       m_scrRCtr[ ix - 1 ][ iy - 1 ] = DDTranslation( eevecEESCCtrs()[ iOff + 3 ] ,
00210                                                      eevecEESCCtrs()[ iOff + 5 ] ,
00211                                                      eevecEESCCtrs()[ iOff + 7 ]  ) ;
00212    }
00213 
00214 //** fill crystal front and rear center positions from xml input
00215    for( unsigned int iC ( 0 ) ; iC != 25 ; ++iC )
00216    {
00217       const unsigned int iOff ( 8*iC ) ;
00218       const unsigned int ix ( (unsigned int) eevecEECRCtrs()[ iOff + 0 ] ) ;
00219       const unsigned int iy ( (unsigned int) eevecEECRCtrs()[ iOff + 1 ] ) ;
00220 
00221       assert( ix > 0 && ix < 6 && iy >0 && iy < 6 ) ;
00222 
00223       m_cryFCtr[ ix - 1 ][ iy - 1 ] = DDTranslation( eevecEECRCtrs()[ iOff + 2 ] ,
00224                                                      eevecEECRCtrs()[ iOff + 4 ] ,
00225                                                      eevecEECRCtrs()[ iOff + 6 ]  ) ;
00226 
00227       m_cryRCtr[ ix - 1 ][ iy - 1 ] = DDTranslation( eevecEECRCtrs()[ iOff + 3 ] ,
00228                                                      eevecEECRCtrs()[ iOff + 5 ] ,
00229                                                      eevecEECRCtrs()[ iOff + 7 ]  ) ;
00230    }
00231 
00232    EECreateCR() ; // make a single crystal just once here
00233 
00234    for( unsigned int isc ( 0 ); isc<eenSCTypes() ; ++isc ) 
00235    {
00236       EECreateSC( isc+1, cpv );
00237    }
00238 
00239    const std::vector<double>& colLimits ( eevecEEShape() );
00240 //** Loop over endcap columns
00241    for( int icol = 1; icol<=int(eenColumns()); icol++ )
00242    {
00243 //**  Loop over SCs in column, using limits from xml input
00244       for( int irow = int(colLimits[2*icol-2]);
00245            irow <= int(colLimits[2*icol-1]) ; ++irow )
00246       {
00247          if( vecEESCLims()[0] <= icol &&
00248              vecEESCLims()[1] >= icol &&
00249              vecEESCLims()[2] <= irow &&
00250              vecEESCLims()[3] >= irow    )
00251          {
00252            // Find SC type (complete or partial) for this location
00253             const unsigned int isctype ( EEGetSCType( icol, irow ) );
00254 
00255             // Create SC as a DDEcalEndcapTrap object and calculate rotation and
00256             // translation required to position it in the endcap.
00257             DDEcalEndcapTrap scrys( 1, eeSCEFront(), eeSCERear(), eeSCELength() ) ;
00258 
00259             scrys.moveto( scrFCtr( icol, irow ),
00260                           scrRCtr( icol, irow ) );
00261             scrys.translate( DDTranslation( 0., 0., -eezOff() ) ) ;
00262 
00263             DDName rname ( envName( isctype ).name()
00264                            + int_to_string( icol ) + "R" + int_to_string( irow ) ) ;
00265 /*
00266          edm::LogInfo("EcalGeom") << "Quadrant, SC col/row " 
00267                                   << eeQuaName() << " " << icol << " / " << irow << std::endl
00268                                   << "   Limits " << int(colLimits[2*icol-2]) << "->" << int(colLimits[2*icol-1]) << std::endl
00269                                   << "   SC type = " << isctype << std::endl
00270                                   << "   Zoff, Scz = " << eezOff() << " " << sc1.z() << std::endl
00271                                   << "   Rotation " << rname << " " << scrys.rotation() << std::endl
00272                                   << "   Position " << sccentre << std::endl;
00273 */
00274             // Position SC in endcap
00275             cpv.position( envName( isctype ), 
00276                           eeQuaName(),
00277                           100*isctype + 10*(icol-1) + (irow-1),
00278                           scrys.centrePos(),
00279                           myrot( rname.fullname(), scrys.rotation() ) ) ;
00280          }
00281       }
00282    }
00283 }
00284 
00285 
00286 void
00287 DDEcalEndcapAlgo::EECreateSC( const unsigned int iSCType ,
00288                               DDCompactView&     cpv       )
00289 { //  EECreateSCType   Create SC logical volume of the given type
00290 
00291    DDRotation noRot ;
00292 
00293    DDLogicalPart eeSCELog;
00294    DDLogicalPart eeSCALog;
00295    DDLogicalPart eeSCILog;
00296    
00297 //   edm::LogInfo("EcalGeom") << "EECreateSC: Creating SC envelope" << std::endl;
00298 
00299    const string anum ( int_to_string(iSCType) ) ;
00300 
00301    const double eFront ( 0.5*eeSCEFront() ) ;
00302    const double eRear  ( 0.5*eeSCERear()  ) ;
00303    const double eAng   ( atan((eeSCERear()-eeSCEFront())/(sqrt(2.)*eeSCELength())) ) ;
00304    const double ffived ( 45*deg ) ;
00305    const double zerod  (  0*deg ) ;
00306    DDSolid eeSCEnv   ( DDSolidFactory::trap(
00307                           ( 1 == iSCType ? envName( iSCType ) : addTmp( envName( iSCType ) ) ),
00308                           0.5*eeSCELength(),
00309                           eAng,
00310                           ffived,
00311                           eFront,
00312                           eFront,
00313                           eFront,
00314                           zerod,
00315                           eRear, 
00316                           eRear, 
00317                           eRear, 
00318                           zerod                 ) );
00319 
00320    const double aFront ( 0.5*eeSCAFront() ) ;
00321    const double aRear  ( 0.5*eeSCARear()  ) ;
00322    const double aAng   ( atan((eeSCARear()-eeSCAFront())/(sqrt(2.)*eeSCALength())) ) ;
00323    const DDSolid eeSCAlv ( DDSolidFactory::trap(
00324                               ( 1== iSCType ? alvName( iSCType ) : addTmp( alvName( iSCType ) ) ),
00325                               0.5*eeSCALength(),
00326                               aAng,
00327                               ffived,
00328                               aFront,
00329                               aFront,
00330                               aFront,
00331                               zerod,
00332                               aRear,
00333                               aRear,
00334                               aRear,
00335                               zerod                     ) );
00336 
00337    const double dwall   ( eeSCAWall()    ) ;
00338    const double iFront  ( aFront - dwall ) ;
00339    const double iRear   ( iFront ) ; //aRear  - dwall ) ;
00340    const double iLen    ( iLength() ) ; //0.075*eeSCALength() ) ;
00341    const DDSolid eeSCInt ( DDSolidFactory::trap(
00342                               ( 1==iSCType ? intName( iSCType ) : addTmp( intName( iSCType ) ) ),
00343                               iLen/2.,
00344                               atan((eeSCARear()-eeSCAFront())/(sqrt(2.)*eeSCALength())),
00345                               ffived,
00346                               iFront,
00347                               iFront,
00348                               iFront,
00349                               zerod,
00350                               iRear,
00351                               iRear,
00352                               iRear,
00353                               zerod                     ) );
00354 
00355    const double dz  ( -0.5*( eeSCELength() - eeSCALength() ) ) ;
00356    const double dxy (  0.5* dz * (eeSCERear() - eeSCEFront())/eeSCELength() ) ;
00357    const double zIOff (  -( eeSCALength() - iLen )/2. ) ;
00358    const double xyIOff ( iXYOff() ) ;
00359 
00360    if( 1 == iSCType ) // standard SC in this block
00361    {
00362       eeSCELog = DDLogicalPart( envName( iSCType ), eeMat(),     eeSCEnv   );
00363       eeSCALog = DDLogicalPart( alvName( iSCType ), eeWallMat(), eeSCAlv   );
00364       eeSCILog = DDLogicalPart( intName( iSCType ), eeMat(),     eeSCInt   );
00365    }
00366    else // partial SCs this block: create subtraction volumes as appropriate
00367    {
00368       const double half  ( (*m_cutParms)[0] - eePFHalf() *eeCrysRear() ) ;
00369       const double fifth ( (*m_cutParms)[0] + eePFFifth()*eeCrysRear() ) ;
00370       const double fac   ( eePF45() ) ;
00371 
00372       const double zmm ( 0*mm ) ;
00373       
00374       DDTranslation cutTra ( 2 == iSCType ?       DDTranslation(        zmm,       half, zmm ) :
00375                              ( 3 == iSCType ?     DDTranslation(       half,        zmm, zmm ) :
00376                                ( 4 == iSCType ?   DDTranslation(        zmm,     -fifth, zmm ) :
00377                                  ( 5 == iSCType ? DDTranslation(  -half*fac,  -half*fac, zmm ) :
00378                                    DDTranslation(                    -fifth,        zmm,  zmm ) ) ) ) ) ;
00379 
00380       const CLHEP::HepRotationZ cutm ( ffived ) ;
00381 
00382       DDRotation cutRot ( 5 != iSCType ? noRot : myrot( "EECry5Rot", 
00383                                                         DDRotationMatrix( cutm.xx(), cutm.xy(), cutm.xz(),
00384                                                                           cutm.yx(), cutm.yy(), cutm.yz(),
00385                                                                           cutm.zx(), cutm.zy(), cutm.zz() ) ) ) ;
00386 
00387       DDSolid eeCutEnv   ( DDSolidFactory::subtraction( envName( iSCType ),
00388                                                         addTmp( envName( iSCType ) ),
00389                                                         cutBoxName(), 
00390                                                         cutTra,
00391                                                         cutRot ) ) ;
00392 
00393       const DDTranslation extra ( dxy, dxy, dz ) ;
00394 
00395       DDSolid eeCutAlv   ( DDSolidFactory::subtraction( alvName( iSCType ),
00396                                                         addTmp( alvName( iSCType ) ),
00397                                                         cutBoxName(), 
00398                                                         cutTra - extra,
00399                                                         cutRot ) ) ;
00400 
00401       const double mySign ( iSCType < 4 ? +1. : -1. ) ;
00402       
00403       const DDTranslation extraI ( xyIOff + mySign*2*mm, 
00404                                    xyIOff + mySign*2*mm, zIOff ) ;
00405 
00406       DDSolid eeCutInt   ( DDSolidFactory::subtraction( intName( iSCType ),
00407                                                         addTmp( intName( iSCType ) ),
00408                                                         cutBoxName(), 
00409                                                         cutTra - extraI,
00410                                                         cutRot ) ) ;
00411       
00412       eeSCELog = DDLogicalPart( envName( iSCType ), eeMat()    , eeCutEnv ) ;
00413       eeSCALog = DDLogicalPart( alvName( iSCType ), eeWallMat(), eeCutAlv   ) ;
00414       eeSCILog = DDLogicalPart( intName( iSCType ), eeMat()    , eeCutInt   ) ;
00415    }
00416 
00417 
00418    cpv.position( eeSCALog, envName( iSCType ), iSCType*100 + 1, DDTranslation( dxy,    dxy,    dz   ), noRot );
00419    cpv.position( eeSCILog, alvName( iSCType ), iSCType*100 + 1, DDTranslation( xyIOff, xyIOff, zIOff), noRot );
00420 
00421    DDTranslation croffset( 0., 0., 0.) ;
00422    EEPositionCRs( alvName( iSCType ), croffset, iSCType, cpv ) ;
00423 
00424 }
00425 
00426 unsigned int 
00427 DDEcalEndcapAlgo::EEGetSCType( const unsigned int iCol, 
00428                                const unsigned int iRow )
00429 {
00430    unsigned int iType = 1;
00431    for( unsigned int ii = 0; ii < (unsigned int)( eenSCCutaway() ) ; ++ii ) 
00432    {
00433       if( ( eevecEESCCutaway()[ 3*ii     ] == iCol ) &&
00434           ( eevecEESCCutaway()[ 3*ii + 1 ] == iRow )    )
00435       {
00436          iType = int(eevecEESCCutaway()[3*ii+2]);
00437 //       edm::LogInfo("EcalGeom") << "EEGetSCType: col, row, type = " 
00438 //                                << iCol << " " << iRow << " " << iType << std::endl;
00439       }
00440    }
00441    return iType;
00442 }
00443 
00444 void
00445 DDEcalEndcapAlgo::EECreateCR() 
00446 {
00447    //  EECreateCR   Create endcap crystal logical volume
00448 
00449 //   edm::LogInfo("EcalGeom") << "EECreateCR:  = " << std::endl;
00450 
00451    DDSolid EECRSolid (DDSolidFactory::trap(
00452                          cryName(),
00453                          0.5*eeCrysLength(),
00454                          atan((eeCrysRear()-eeCrysFront())/(sqrt(2.)*eeCrysLength())),
00455                          45.*deg,
00456                          0.5*eeCrysFront(),0.5*eeCrysFront(),0.5*eeCrysFront(),0.*deg,
00457                          0.5*eeCrysRear(), 0.5*eeCrysRear(), 0.5*eeCrysRear(),0.*deg     ) );
00458 
00459    DDLogicalPart part ( cryName(), eeCrysMat(), EECRSolid ) ;
00460 }
00461 
00462 void 
00463 DDEcalEndcapAlgo::EEPositionCRs( const DDName        pName, 
00464                                  const DDTranslation offset, 
00465                                  const int           iSCType,
00466                                  DDCompactView&      cpv      ) 
00467 {
00468   //  EEPositionCRs Position crystals within parent supercrystal interior volume
00469 
00470 //   edm::LogInfo("EcalGeom") << "EEPositionCRs called " << std::endl;
00471 
00472    static const unsigned int ncol ( 5 ) ;
00473 
00474    if( iSCType > 0             &&
00475        iSCType <= eenSCTypes()    ) 
00476    {
00477       const unsigned int icoffset ( ( iSCType - 1 )*ncol - 1 ) ;
00478       
00479       // Loop over columns of SC
00480       for( unsigned int icol ( 1 ); icol <= ncol ; ++icol ) 
00481       {
00482         // Get column limits for this SC type from xml input
00483          const int ncrcol ( (int) eevecEESCProf()[ icoffset + icol ] ) ;
00484 
00485          const int imin ( 0 < ncrcol ?      1 : ( 0 > ncrcol ? ncol + ncrcol + 1 : 0 ) ) ;
00486          const int imax ( 0 < ncrcol ? ncrcol : ( 0 > ncrcol ? ncol              : 0 ) ) ;
00487 
00488          if( imax>0 ) 
00489          {
00490            // Loop over crystals in this row
00491             for( int irow ( imin ); irow <= imax ; ++irow ) 
00492             {
00493 //             edm::LogInfo("EcalGeom") << " type, col, row " << iSCType 
00494 //                                      << " " << icol << " " << irow << std::endl;
00495 
00496                // Create crystal as a DDEcalEndcapTrap object and calculate rotation and
00497                // translation required to position it in the SC.
00498                DDEcalEndcapTrap crystal( 1, eeCrysFront(), eeCrysRear(), eeCrysLength() ) ;
00499 
00500                crystal.moveto( cryFCtr( icol, irow ) ,
00501                                cryRCtr( icol, irow )   );
00502 
00503                DDName rname ( "EECrRoC" + int_to_string( icol ) + "R" + int_to_string( irow ) ) ;
00504 
00505                cpv.position( cryName(),
00506                              pName,
00507                              100*iSCType + 10*( icol - 1 ) + ( irow - 1 ),
00508                              crystal.centrePos(),
00509                              myrot( rname.fullname(), crystal.rotation() ) ) ;
00510             }
00511          }
00512       }
00513    }
00514 }
00515