CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/Geometry/HcalEventSetup/src/HcalDDDGeometryEP.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    HcalDDDGeometryEP
00004 // Class:      HcalDDDGeometryEP
00005 // 
00013 //
00014 // Original Author:  Sunanda Banerjee
00015 //         Created:  Thu Oct 20 11:35:27 CDT 2006
00016 // $Id: HcalDDDGeometryEP.cc,v 1.7 2012/10/29 07:32:07 mansj Exp $
00017 //
00018 //
00019 
00020 #include "Geometry/HcalEventSetup/interface/HcalDDDGeometryEP.h"
00021 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00022 
00023 //#define DebugLog
00024 //
00025 // constants, enums and typedefs
00026 //
00027 
00028 //
00029 // static data member definitions
00030 //
00031 
00032 //
00033 // constructors and destructor
00034 //
00035 
00036 HcalDDDGeometryEP::HcalDDDGeometryEP(const edm::ParameterSet& ps ) :
00037    m_loader ( 0 ) ,
00038    m_cpv    ( 0 ) ,
00039    m_applyAlignment( ps.getUntrackedParameter<bool>("applyAlignment", false) ){
00040 
00041    //the following line is needed to tell the framework what
00042    // data is being produced
00043    setWhatProduced( this,
00044                     &HcalDDDGeometryEP::produceAligned,
00045                     dependsOn( &HcalDDDGeometryEP::idealRecordCallBack ),
00046                     "HCAL");
00047 
00048 // diable
00049 //   setWhatProduced( this,
00050 //                  &HcalDDDGeometryEP::produceIdeal,
00051 //                  edm::es::Label( "HCAL" ) );
00052 }
00053 
00054 
00055 HcalDDDGeometryEP::~HcalDDDGeometryEP() { 
00056    delete m_loader ;
00057 }
00058 
00059 
00060 //
00061 // member functions
00062 //
00063 
00064 // ------------ method called to produce the data  ------------
00065 HcalDDDGeometryEP::ReturnType
00066 HcalDDDGeometryEP::produceIdeal(const IdealGeometryRecord& iRecord) {
00067    idealRecordCallBack( iRecord ) ;
00068 
00069    edm::LogInfo("HCAL") << "Using default HCAL topology" ;
00070    edm::ESHandle<HcalTopology> topology ;
00071    iRecord.get( topology ) ;
00072 
00073    assert( 0 == m_loader ) ;
00074    m_loader = new HcalDDDGeometryLoader(*m_cpv); 
00075 #ifdef DebugLog
00076    LogDebug("HCalGeom")<<"HcalDDDGeometryEP:Initialize HcalDDDGeometryLoader";
00077 #endif
00078    ReturnType pC ( m_loader->load(*topology) ) ;
00079 
00080    return pC ;
00081 }
00082 
00083 HcalDDDGeometryEP::ReturnType
00084 HcalDDDGeometryEP::produceAligned(const HcalGeometryRecord& iRecord) {
00085    //now do what ever other initialization is needed
00086    assert( 0 != m_cpv ) ;
00087 
00088    edm::LogInfo("HCAL") << "Using default HCAL topology" ;
00089    edm::ESHandle<HcalTopology> topology ;
00090    iRecord.get( topology ) ;
00091 
00092    if( 0 == m_loader ) m_loader = new HcalDDDGeometryLoader(*m_cpv); 
00093 #ifdef DebugLog
00094    LogDebug("HCalGeom")<<"HcalDDDGeometryEP:Initialize HcalDDDGeometryLoader";
00095 #endif
00096 
00097    ReturnType pC ( m_loader->load(*topology) ) ;
00098 
00099    return pC ;
00100 }
00101 
00102 void
00103 HcalDDDGeometryEP::idealRecordCallBack( const IdealGeometryRecord& iRecord ) {
00104    edm::ESTransientHandle<DDCompactView> pDD;
00105    iRecord.get( pDD );
00106    m_cpv = &(*pDD) ;
00107 }
00108 
00109