CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/Geometry/RPCGeometryBuilder/plugins/RPCGeometryESModule.cc

Go to the documentation of this file.
00001 
00007 #include "Geometry/RPCGeometryBuilder/plugins/RPCGeometryESModule.h"
00008 #include "Geometry/RPCGeometryBuilder/src/RPCGeometryBuilderFromDDD.h"
00009 #include "Geometry/RPCGeometryBuilder/src/RPCGeometryBuilderFromCondDB.h"
00010 
00011 #include <Geometry/Records/interface/IdealGeometryRecord.h>
00012 #include <Geometry/MuonNumbering/interface/MuonDDDConstants.h>
00013 #include <DetectorDescription/Core/interface/DDCompactView.h>
00014 
00015 #include "Geometry/Records/interface/RPCRecoGeometryRcd.h"
00016 #include "CondFormats/GeometryObjects/interface/RecoIdealGeometry.h"
00017 
00018 #include <FWCore/Framework/interface/EventSetup.h>
00019 #include "FWCore/Framework/interface/ESTransientHandle.h"
00020 #include <FWCore/Framework/interface/ESHandle.h>
00021 #include <FWCore/Framework/interface/ModuleFactory.h>
00022 #include <FWCore/Framework/interface/ESProducer.h>
00023 
00024 #include <memory>
00025 
00026 using namespace edm;
00027 
00028 RPCGeometryESModule::RPCGeometryESModule(const edm::ParameterSet & p){
00029   comp11 = p.getUntrackedParameter<bool>("compatibiltyWith11",true);
00030   // Find out if using the DDD or CondDB Geometry source.
00031   useDDD = p.getUntrackedParameter<bool>("useDDD",true);
00032   setWhatProduced(this);
00033 
00034 }
00035 
00036 
00037 RPCGeometryESModule::~RPCGeometryESModule(){}
00038 
00039 
00040 boost::shared_ptr<RPCGeometry>
00041 RPCGeometryESModule::produce(const MuonGeometryRecord & record) {
00042   if(useDDD){
00043     edm::ESTransientHandle<DDCompactView> cpv;
00044     record.getRecord<IdealGeometryRecord>().get(cpv);
00045     edm::ESHandle<MuonDDDConstants> mdc;
00046     record.getRecord<MuonNumberingRecord>().get(mdc);
00047     RPCGeometryBuilderFromDDD builder(comp11);
00048     return boost::shared_ptr<RPCGeometry>(builder.build(&(*cpv), *mdc));
00049   }else{
00050     edm::ESHandle<RecoIdealGeometry> rigrpc;
00051     record.getRecord<RPCRecoGeometryRcd>().get(rigrpc);
00052     RPCGeometryBuilderFromCondDB builder(comp11);
00053     return boost::shared_ptr<RPCGeometry>(builder.build(*rigrpc));
00054   }
00055 
00056 }
00057 
00058 DEFINE_FWK_EVENTSETUP_MODULE(RPCGeometryESModule);