CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/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.6 2010/03/25 22:08:44 case 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    assert( 0 == m_loader ) ;
00070    m_loader = new HcalDDDGeometryLoader(*m_cpv); 
00071 #ifdef DebugLog
00072    LogDebug("HCalGeom")<<"HcalDDDGeometryEP:Initialize HcalDDDGeometryLoader";
00073 #endif
00074    ReturnType pC ( m_loader->load() ) ;
00075 
00076    return pC ;
00077 }
00078 
00079 HcalDDDGeometryEP::ReturnType
00080 HcalDDDGeometryEP::produceAligned(const HcalGeometryRecord& iRecord) {
00081    //now do what ever other initialization is needed
00082    assert( 0 != m_cpv ) ;
00083    if( 0 == m_loader ) m_loader = new HcalDDDGeometryLoader(*m_cpv); 
00084 #ifdef DebugLog
00085    LogDebug("HCalGeom")<<"HcalDDDGeometryEP:Initialize HcalDDDGeometryLoader";
00086 #endif
00087 
00088    ReturnType pC ( m_loader->load() ) ;
00089 
00090    return pC ;
00091 }
00092 
00093 void
00094 HcalDDDGeometryEP::idealRecordCallBack( const IdealGeometryRecord& iRecord ) {
00095    edm::ESTransientHandle<DDCompactView> pDD;
00096    iRecord.get( pDD );
00097    m_cpv = &(*pDD) ;
00098 }
00099 
00100