CMS 3D CMS Logo

EcalBarrelGeometryLoaderFromDDD.cc

Go to the documentation of this file.
00001 #include "Geometry/CaloGeometry/interface/TruncatedPyramid.h"
00002 
00003 #include "Geometry/EcalAlgo/interface/EcalBarrelGeometry.h"
00004 
00005 #include "Geometry/CaloEventSetup/interface/CaloGeometryLoader.h"
00006 #include "Geometry/CaloEventSetup/interface/CaloGeometryLoader.icc"
00007 
00008 template class CaloGeometryLoader< EcalBarrelGeometry > ;
00009 
00010 //#include "DetectorDescription/Core/interface/DDInit.h"
00011 #include "DetectorDescription/Core/interface/DDFilteredView.h"
00012 
00013 
00014 using namespace std;
00015 
00016 typedef CaloGeometryLoader< EcalBarrelGeometry > EcalBGL ;
00017 
00018 template <>
00019 unsigned int 
00020 EcalBGL::whichTransform( const DetId& id ) const
00021 {
00022    return ( EBDetId( id ).ism() - 1 ) ;
00023 }
00024 
00025 template <>
00026 void 
00027 EcalBGL::fillGeom( EcalBarrelGeometry*     geom ,
00028                    const EcalBGL::ParmVec& pv ,
00029                    const HepTransform3D&   tr ,
00030                    const DetId&            id    )
00031 {
00032    CaloCellGeometry::CornersVec corners ( geom->cornersMgr() ) ;
00033    corners.resize() ;
00034 
00035    TruncatedPyramid::createCorners( pv, tr, corners ) ;
00036 
00037    TruncatedPyramid* cell ( new TruncatedPyramid( corners ) ) ;
00038 
00039    geom->addCell( id, cell );
00040 }
00041 
00042 template <>
00043 void 
00044 EcalBGL::extraStuff( EcalBarrelGeometry* geom )
00045 {
00046    // nothing for barrel
00047 }
00048 
00049 template <>
00050 void 
00051 EcalBGL::fillNamedParams( DDFilteredView      fv,
00052                           EcalBarrelGeometry* geom )
00053 {
00054    bool doSubDets = fv.firstChild();
00055 
00056    while( doSubDets )
00057    {
00058       DDsvalues_type sv(fv.mergedSpecifics());
00059         
00060       //nxtalPhi
00061       DDValue valnPhi("nxtalPhi");
00062       if( DDfetch( &sv, valnPhi ) )
00063       {
00064          const vector<double>& fvec = valnPhi.doubles();
00065 
00066          // this parameter can only appear once
00067          assert(fvec.size() == 1);
00068          geom->setNumXtalsPhiDirection((int)fvec[0]);
00069       }
00070       else
00071          continue;
00072           
00073 
00074       DDValue valnEta("nxtalEta");
00075       if( DDfetch( &sv, valnEta ) ) 
00076       {
00077          const vector<double>& fmvec = valnEta.doubles();
00078 
00079          // there can only be one such value
00080          assert(fmvec.size() == 1);
00081             
00082          geom->setNumXtalsEtaDirection((int)fmvec[0]);
00083       }
00084       else
00085          // once we find nxtalPhi, the rest must also be defined
00086          assert( 1 == 0 );
00087 
00088       //EtaBaskets
00089       DDValue valEtaB("EtaBaskets");
00090       if( DDfetch( &sv, valEtaB ) ) 
00091       {
00092          const vector<double>& ebvec = valEtaB.doubles();
00093          assert(ebvec.size() > 0);
00094          vector<int> EtaBaskets;
00095          EtaBaskets.resize(ebvec.size());
00096          for (unsigned i = 0; i<ebvec.size(); ++i) 
00097             EtaBaskets[i] = (int) ebvec[i];
00098          geom->setEtaBaskets(EtaBaskets);
00099       }
00100       else
00101          // once we find nxtalPhi, the rest must also be defined
00102          assert( 1 == 0 );
00103 
00104       //PhiBaskets
00105       DDValue valPhi("PhiBaskets");
00106       if (DDfetch(&sv,valPhi)) 
00107       {
00108          const vector<double> & pvec = valPhi.doubles();
00109          assert(pvec.size() > 0);
00110          geom->setBasketSizeInPhi((int)pvec[0]);
00111       }
00112       else
00113          // once we find nxtalPhi, the rest must also be defined
00114          assert( 1 == 0 );
00115 
00116       break;
00117     
00118       doSubDets = fv.nextSibling(); // go to next layer
00119    }
00120 }
00121 

Generated on Tue Jun 9 17:37:23 2009 for CMSSW by  doxygen 1.5.4