CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/CondTools/Geometry/plugins/CSCRecoIdealDBLoader.cc

Go to the documentation of this file.
00001 #include "CSCRecoIdealDBLoader.h"
00002 
00003 #include <Geometry/CSCGeometryBuilder/src/CSCGeometryParsFromDD.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 "CondFormats/GeometryObjects/interface/CSCRecoDigiParameters.h"
00014 #include "Geometry/Records/interface/CSCRecoGeometryRcd.h"
00015 #include "Geometry/Records/interface/CSCRecoDigiParametersRcd.h"
00016 #include "Geometry/Records/interface/MuonGeometryRecord.h"
00017 
00018 #include "DetectorDescription/Core/interface/DDCompactView.h"
00019 
00020 #include "Geometry/Records/interface/MuonNumberingRecord.h"
00021 #include "Geometry/MuonNumbering/interface/MuonDDDConstants.h"
00022 
00023 #include <iostream>
00024 #include <string>
00025 #include <vector>
00026 #include <map>
00027 #include <sstream>
00028 #include <algorithm>
00029 
00030 CSCRecoIdealDBLoader::CSCRecoIdealDBLoader(const edm::ParameterSet& iConfig) : label_()
00031 {
00032   std::cout<<"CSCRecoIdealDBLoader::CSCRecoIdealDBLoader"<<std::endl;
00033 }
00034 
00035 CSCRecoIdealDBLoader::~CSCRecoIdealDBLoader()
00036 {
00037   std::cout<<"CSCRecoIdealDBLoader::~CSCRecoIdealDBLoader"<<std::endl;
00038 }
00039 
00040 void
00041 CSCRecoIdealDBLoader::beginRun( const edm::Run&, edm::EventSetup const& es) 
00042 {
00043   std::cout<<"CSCRecoIdealDBLoader::beginRun"<<std::endl;
00044   RecoIdealGeometry* rig = new RecoIdealGeometry;
00045   CSCRecoDigiParameters* rdp = new CSCRecoDigiParameters;
00046   edm::Service<cond::service::PoolDBOutputService> mydbservice;
00047   if( !mydbservice.isAvailable() ){
00048     edm::LogError("CSCRecoIdealDBLoader")<<"PoolDBOutputService unavailable";
00049     return;
00050   }
00051 
00052   edm::ESTransientHandle<DDCompactView> pDD;
00053   edm::ESHandle<MuonDDDConstants> pMNDC;
00054   es.get<IdealGeometryRecord>().get(label_, pDD );
00055   es.get<MuonNumberingRecord>().get( pMNDC );
00056 
00057   const DDCompactView& cpv = *pDD;
00058   CSCGeometryParsFromDD cscgp;
00059 
00060   cscgp.build( &cpv, *pMNDC, *rig, *rdp );
00061 
00062   if ( mydbservice->isNewTagRequest("CSCRecoGeometryRcd") ) {
00063     mydbservice->createNewIOV<RecoIdealGeometry>(rig
00064                                                  , mydbservice->beginOfTime()
00065                                                  , mydbservice->endOfTime()
00066                                                  , "CSCRecoGeometryRcd");
00067   } else {
00068     edm::LogError("CSCRecoIdealDBLoader")<<"CSCRecoGeometryRcd Tag is already present.";
00069   }
00070   if ( mydbservice->isNewTagRequest("CSCRecoDigiParametersRcd") ) {
00071     mydbservice->createNewIOV<CSCRecoDigiParameters>(rdp
00072                                                      , mydbservice->beginOfTime()
00073                                                      , mydbservice->endOfTime()
00074                                                      , "CSCRecoDigiParametersRcd");
00075   } else {
00076     edm::LogError("CSCRecoIdealDBLoader")<<"CSCRecoDigiParametersRcd Tag is already present.";
00077   }
00078 
00079 }