CMS 3D CMS Logo

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

Go to the documentation of this file.
00001 #include "XMLGeometryBuilder.h"
00002 
00003 #include "FWCore/MessageLogger/interface/MessageLogger.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/ESHandle.h"
00011 #include "CondFormats/Common/interface/FileBlob.h"
00012 #include "Geometry/Records/interface/GeometryFileRcd.h"
00013 
00014 
00015 #include <iostream>
00016 #include <string>
00017 #include <vector>
00018 #include <fstream>
00019 
00020 XMLGeometryBuilder::XMLGeometryBuilder(const edm::ParameterSet& iConfig)
00021 {
00022   fname = iConfig.getUntrackedParameter<std::string>("XMLFileName","test.xml");
00023   zip = iConfig.getUntrackedParameter<bool>("ZIP",true);
00024 }
00025 
00026 XMLGeometryBuilder::~XMLGeometryBuilder()
00027 {
00028 
00029 }
00030 
00031 void
00032 XMLGeometryBuilder::beginJob() 
00033 {
00034   std::cout<<"XMLGeometryBuilder::beginJob"<<std::endl;
00035   edm::Service<cond::service::PoolDBOutputService> mydbservice;
00036   if( !mydbservice.isAvailable() ){
00037     edm::LogError("XMLGeometryBuilder")<<"PoolDBOutputService unavailable";
00038     return;
00039   }
00040 
00041   FileBlob* pgf= new FileBlob(fname,zip);
00042 
00043   if ( mydbservice->isNewTagRequest("GeometryFileRcd") ) {
00044     mydbservice->createNewIOV<FileBlob>( pgf,mydbservice->beginOfTime(),mydbservice->endOfTime(),"GeometryFileRcd");
00045   } else {
00046     edm::LogError("XMLGeometryBuilder")<<"GeometryFileRcd Tag already exist";
00047   }
00048 }
00049