CMS 3D CMS Logo

EcalEndcapGeometryLoaderFromDDD.cc

Go to the documentation of this file.
00001 #include "Geometry/CaloGeometry/interface/TruncatedPyramid.h"
00002 
00003 #include "Geometry/EcalAlgo/interface/EcalEndcapGeometry.h"
00004 
00005 #include "Geometry/CaloEventSetup/interface/CaloGeometryLoader.h"
00006 #include "Geometry/CaloEventSetup/interface/CaloGeometryLoader.icc"
00007 
00008 template class CaloGeometryLoader< EcalEndcapGeometry > ;
00009 
00010 #include "DetectorDescription/Core/interface/DDFilteredView.h"
00011 //#include "DetectorDescription/Core/interface/DDInit.h"
00012 
00013 
00014 #include <iostream>
00015 #include <vector>
00016 
00017 using namespace std;
00018 
00019 typedef CaloGeometryLoader< EcalEndcapGeometry > EcalEGL ;
00020 
00021 
00022 template <>
00023 unsigned int 
00024 EcalEGL::whichTransform( const DetId& id ) const
00025 {
00026    const EEDetId eeid ( id ) ;
00027    const int ix ( eeid.ix() ) ;
00028    return ( ix/51 + ( eeid.zside()<0 ? 0 : 2 ) ) ;
00029 }
00030 
00031 template <>
00032 void 
00033 EcalEGL::fillGeom( EcalEndcapGeometry*     geom ,
00034                    const EcalEGL::ParmVec& pv ,
00035                    const HepTransform3D&   tr ,
00036                    const DetId&            id     )
00037 {
00038    CaloCellGeometry::CornersVec corners ( geom->cornersMgr() ) ;
00039    corners.resize() ;
00040 
00041    TruncatedPyramid::createCorners( pv, tr, corners ) ;
00042 
00043    TruncatedPyramid* cell ( new TruncatedPyramid( corners ) ) ;
00044 
00045    geom->addCell( id, cell );
00046 }
00047 
00048 template <>
00049 void 
00050 EcalEGL::extraStuff( EcalEndcapGeometry* geom )
00051 {
00052    geom->initialize();
00053 }
00054 
00055 template <>
00056 void 
00057 EcalEGL::fillNamedParams( DDFilteredView      fv,
00058                           EcalEndcapGeometry* geom )
00059 {
00060    bool doSubDets = fv.firstChild();
00061    while (doSubDets)
00062    {
00063       DDsvalues_type sv ( fv.mergedSpecifics() ) ;
00064             
00065       //ncrys
00066       DDValue valNcrys("ncrys");
00067       if( DDfetch( &sv, valNcrys ) ) 
00068       {
00069          const vector<double>& fvec = valNcrys.doubles();
00070 
00071          // this parameter can only appear once
00072          assert(fvec.size() == 1);
00073          geom->setNumberOfCrystalPerModule((int)fvec[0]);
00074       }
00075       else 
00076          continue;
00077 
00078       //nmods
00079       DDValue valNmods("nmods");
00080       if( DDfetch( &sv, valNmods ) ) 
00081       {
00082          const vector<double>& fmvec = valNmods.doubles() ;
00083 
00084          // there can only be one such value
00085          assert(fmvec.size() == 1);
00086          geom->setNumberOfModules((int)fmvec[0]);
00087       }
00088             
00089       break;
00090 
00091       doSubDets = fv.nextSibling(); // go to next layer
00092    }
00093 }

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