CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/Geometry/GEMGeometryBuilder/plugins/GEMGeometryESModule.cc

Go to the documentation of this file.
00001 
00007 #include "Geometry/GEMGeometryBuilder/plugins/GEMGeometryESModule.h"
00008 #include "Geometry/GEMGeometryBuilder/src/GEMGeometryBuilderFromDDD.h"
00009 #include "Geometry/GEMGeometryBuilder/src/GEMGeometryBuilderFromCondDB.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/GEMRecoGeometryRcd.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 GEMGeometryESModule::GEMGeometryESModule(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 GEMGeometryESModule::~GEMGeometryESModule(){}
00038 
00039 
00040 boost::shared_ptr<GEMGeometry>
00041 GEMGeometryESModule::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     GEMGeometryBuilderFromDDD builder(comp11);
00048     return boost::shared_ptr<GEMGeometry>(builder.build(&(*cpv), *mdc));
00049   }else{
00050     edm::ESHandle<RecoIdealGeometry> riggem;
00051     record.getRecord<GEMRecoGeometryRcd>().get(riggem);
00052     GEMGeometryBuilderFromCondDB builder(comp11);
00053     return boost::shared_ptr<GEMGeometry>(builder.build(*riggem));
00054   }
00055 
00056 }
00057 
00058 DEFINE_FWK_EVENTSETUP_MODULE(GEMGeometryESModule);