CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/CondTools/Geometry/plugins/DTRecoIdealDBLoader.cc

Go to the documentation of this file.
00001 #include "DTRecoIdealDBLoader.h"
00002 
00003 #include <Geometry/DTGeometryBuilder/src/DTGeometryParsFromDD.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/DTRecoGeometryRcd.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 DTRecoIdealDBLoader::DTRecoIdealDBLoader(const edm::ParameterSet& iConfig) : label_()
00030 {
00031   std::cout<<"DTRecoIdealDBLoader::DTRecoIdealDBLoader"<<std::endl;
00032 }
00033 
00034 DTRecoIdealDBLoader::~DTRecoIdealDBLoader()
00035 {
00036   std::cout<<"DTRecoIdealDBLoader::~DTRecoIdealDBLoader"<<std::endl;
00037 }
00038 
00039 void
00040 DTRecoIdealDBLoader::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("DTRecoIdealDBLoader")<<"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   DTGeometryParsFromDD dtgp;
00056 
00057   dtgp.build( &cpv, *pMNDC, *rig );
00058 
00059   if ( mydbservice->isNewTagRequest("DTRecoGeometryRcd") ) {
00060     mydbservice->createNewIOV<RecoIdealGeometry>(rig
00061                                                  , mydbservice->beginOfTime()
00062                                                  , mydbservice->endOfTime()
00063                                                  , "DTRecoGeometryRcd");
00064   } else {
00065     edm::LogError("DTRecoIdealDBLoader")<<"DTRecoGeometryRcd Tag is already present.";
00066   }
00067 }