CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/CondTools/Geometry/plugins/RPCRecoIdealDBLoader.cc

Go to the documentation of this file.
00001 #include "RPCRecoIdealDBLoader.h"
00002 
00003 #include <Geometry/RPCGeometryBuilder/src/RPCGeometryParsFromDD.h>
00004 
00005 #include "FWCore/ServiceRegistry/interface/Service.h"
00006 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00007 #include "FWCore/Framework/interface/Event.h"
00008 #include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
00009 #include "FWCore/Framework/interface/EventSetup.h"
00010 #include "FWCore/Framework/interface/ESTransientHandle.h"
00011 #include "FWCore/Framework/interface/ESHandle.h"
00012 #include "CondFormats/GeometryObjects/interface/RecoIdealGeometry.h"
00013 #include "Geometry/Records/interface/RPCRecoGeometryRcd.h"
00014 #include "Geometry/Records/interface/MuonGeometryRecord.h"
00015 
00016 #include "DetectorDescription/Core/interface/DDCompactView.h"
00017 
00018 #include "Geometry/Records/interface/MuonNumberingRecord.h"
00019 #include "Geometry/MuonNumbering/interface/MuonDDDConstants.h"
00020 
00021 #include <iostream>
00022 #include <string>
00023 #include <vector>
00024 #include <map>
00025 #include <sstream>
00026 #include <algorithm>
00027 using namespace std;
00028 
00029 RPCRecoIdealDBLoader::RPCRecoIdealDBLoader(const edm::ParameterSet& iConfig) : label_()
00030 {
00031   std::cout<<"RPCRecoIdealDBLoader::RPCRecoIdealDBLoader"<<std::endl;
00032 }
00033 
00034 RPCRecoIdealDBLoader::~RPCRecoIdealDBLoader()
00035 {
00036   std::cout<<"RPCRecoIdealDBLoader::~RPCRecoIdealDBLoader"<<std::endl;
00037 }
00038 
00039 void
00040 RPCRecoIdealDBLoader::beginRun( const edm::Run&, edm::EventSetup const& es) 
00041 {
00042   RecoIdealGeometry* rig = new RecoIdealGeometry;
00043   edm::Service<cond::service::PoolDBOutputService> mydbservice;
00044   if( !mydbservice.isAvailable() ){
00045     edm::LogError("RPCRecoIdealDBLoader")<<"PoolDBOutputService unavailable";
00046     return;
00047   }
00048 
00049   edm::ESTransientHandle<DDCompactView> pDD;
00050   edm::ESHandle<MuonDDDConstants> pMNDC;
00051   es.get<IdealGeometryRecord>().get(label_, pDD );
00052   es.get<MuonNumberingRecord>().get( pMNDC );
00053 
00054   const DDCompactView& cpv = *pDD;
00055   RPCGeometryParsFromDD rpcpd;
00056 
00057   rpcpd.build( &cpv, *pMNDC, *rig );
00058 
00059   if ( mydbservice->isNewTagRequest("RPCRecoGeometryRcd") ) {
00060     mydbservice->createNewIOV<RecoIdealGeometry>(rig
00061                                                  , mydbservice->beginOfTime()
00062                                                  , mydbservice->endOfTime()
00063                                                  , "RPCRecoGeometryRcd");
00064   } else {
00065     edm::LogError("RPCRecoIdealDBLoader")<<"RPCRecoGeometryRcd Tag is already present.";
00066   }
00067 }