CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_8_patch3/src/Geometry/TrackerNumberingBuilder/plugins/TrackerGeometricDetESModule.cc

Go to the documentation of this file.
00001 #include "Geometry/TrackerNumberingBuilder/plugins/TrackerGeometricDetESModule.h"
00002 #include "Geometry/TrackerNumberingBuilder/plugins/DDDCmsTrackerContruction.h"
00003 #include "CondFormats/GeometryObjects/interface/PGeometricDet.h"
00004 #include "CondFormats/GeometryObjects/interface/PGeometricDetExtra.h"
00005 #include "Geometry/Records/interface/IdealGeometryRecord.h"
00006 #include "Geometry/Records/interface/PGeometricDetExtraRcd.h"
00007 #include "DetectorDescription/Core/interface/DDCompactView.h"
00008 #include "DetectorDescription/Core/interface/DDSolid.h"
00009 #include "DetectorDescription/Core/interface/DDMaterial.h"
00010 #include "ExtractStringFromDDD.h"
00011 #include "CondDBCmsTrackerConstruction.h"
00012 
00013 #include "FWCore/Framework/interface/EventSetup.h"
00014 #include "FWCore/Framework/interface/ESHandle.h"
00015 #include "FWCore/Framework/interface/ESTransientHandle.h"
00016 #include "FWCore/Framework/interface/ModuleFactory.h"
00017 #include "FWCore/Framework/interface/ESProducer.h"
00018 
00019 
00020 #include <memory>
00021 
00022 using namespace edm;
00023 
00024 TrackerGeometricDetESModule::TrackerGeometricDetESModule(const edm::ParameterSet & p) 
00025   : fromDDD_(p.getParameter<bool>("fromDDD")) 
00026 {
00027   setWhatProduced(this);
00028 }
00029 
00030 TrackerGeometricDetESModule::~TrackerGeometricDetESModule() {}
00031 
00032 std::auto_ptr<GeometricDet> 
00033 TrackerGeometricDetESModule::produce(const IdealGeometryRecord & iRecord){ 
00034   if(fromDDD_){
00035 
00036     edm::ESTransientHandle<DDCompactView> cpv;
00037     iRecord.get( cpv );
00038     
00039     DDDCmsTrackerContruction theDDDCmsTrackerContruction;
00040     return std::auto_ptr<GeometricDet> (const_cast<GeometricDet*>(theDDDCmsTrackerContruction.construct(&(*cpv))));
00041 
00042   }else{
00043 
00044     edm::ESHandle<PGeometricDet> pgd;
00045     iRecord.get( pgd );
00046     
00047     CondDBCmsTrackerConstruction cdbtc;
00048     return std::auto_ptr<GeometricDet> ( const_cast<GeometricDet*>(cdbtc.construct( *pgd )) );
00049   }
00050 }
00051 
00052 DEFINE_FWK_EVENTSETUP_MODULE(TrackerGeometricDetESModule);