00001 #include "Geometry/CaloGeometry/interface/PreshowerStrip.h"
00002
00003 #include "DataFormats/EcalDetId/interface/ESDetId.h"
00004 #include "Geometry/EcalAlgo/interface/EcalPreshowerGeometry.h"
00005
00006 #include "Geometry/CaloEventSetup/interface/CaloGeometryLoader.h"
00007 #include "Geometry/CaloEventSetup/interface/CaloGeometryLoader.icc"
00008
00009 template class CaloGeometryLoader< EcalPreshowerGeometry > ;
00010
00011 #include "DetectorDescription/Core/interface/DDFilteredView.h"
00012
00013
00014
00015 #include <iostream>
00016 #include <vector>
00017
00018 using namespace std;
00019
00020 typedef CaloGeometryLoader< EcalPreshowerGeometry > EcalPGL ;
00021
00022
00023 template <>
00024 unsigned int
00025 EcalPGL::whichTransform( const DetId& id ) const
00026 {
00027 return 0 ;
00028 }
00029
00030
00031 template <>
00032 void
00033 EcalPGL::fillGeom( EcalPreshowerGeometry* geom ,
00034 const EcalPGL::ParmVec& pv ,
00035 const HepTransform3D& tr ,
00036 const DetId& id )
00037 {
00038 if( geom->parMgr() == 0 ) geom->allocatePar( 2, pv.size() ) ;
00039
00040 std::vector<float> vv ;
00041 vv.reserve( pv.size() ) ;
00042 for( unsigned int i ( 0 ) ; i != pv.size() ; ++i )
00043 {
00044 vv.push_back( CaloCellGeometry::k_ScaleFromDDDtoGeant*pv[i] ) ;
00045 }
00046 const float* pP ( CaloCellGeometry::getParmPtr( vv,
00047 geom->parMgr(),
00048 geom->parVecVec() ) ) ;
00049
00050 const HepPoint3D ctr ( tr*HepPoint3D(0,0,0) ) ;
00051
00052 const GlobalPoint refPoint ( ctr.x(), ctr.y(), ctr.z() ) ;
00053
00054 PreshowerStrip* cell ( new PreshowerStrip( refPoint,
00055 geom->cornersMgr(),
00056 pP ) ) ;
00057
00058 geom->addCell( id, cell );
00059 }
00060
00061 template <>
00062 void
00063 EcalPGL::extraStuff( EcalPreshowerGeometry* geom )
00064 {
00065 typedef CaloSubdetectorGeometry::CellCont Cont ;
00066 unsigned int n1 ( 0 ) ;
00067 unsigned int n2 ( 0 ) ;
00068 float z1 ( 0 ) ;
00069 float z2 ( 0 ) ;
00070 const Cont& con ( geom->cellGeometries() ) ;
00071 for( Cont::const_iterator i ( con.begin() ) ; i != con.end() ; ++i )
00072 {
00073 const ESDetId esid ( i->first ) ;
00074 if( 1 == esid.plane() )
00075 {
00076 z1 += fabs( i->second->getPosition().z() ) ;
00077 ++n1 ;
00078 }
00079 if( 2 == esid.plane() )
00080 {
00081 z2 += fabs( i->second->getPosition().z() ) ;
00082 ++n2 ;
00083 }
00084
00085
00086
00087 }
00088 assert( 0 != n1 && 0 != n2 ) ;
00089 z1 /= (1.*n1) ;
00090 z2 /= (1.*n2) ;
00091 assert( 0 != z1 && 0 != z2 ) ;
00092 geom->setzPlanes( z1, z2 ) ;
00093 }
00094
00095 template <>
00096 void
00097 EcalPGL::fillNamedParams( DDFilteredView fv ,
00098 EcalPreshowerGeometry* geom )
00099 {
00100
00101 }
00102