CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_8_patch3/src/CalibCalorimetry/CaloMiscalibTools/plugins/WriteEcalMiscalibConstantsMC.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    WriteEcalMiscalibConstantsMC
00004 // Class:      WriteEcalMiscalibConstantsMC
00005 // 
00013 //
00014 // Original Author:  Stephanie BEAUCERON
00015 //         Created:  Tue May 15 16:23:21 CEST 2007
00016 // $Id: WriteEcalMiscalibConstantsMC.cc,v 1.2 2009/12/17 20:59:29 wmtan Exp $
00017 //
00018 //
00019 
00020 
00021 // system include files
00022 
00023 // user include files
00024 
00025 
00026 
00027 
00028 #include "FWCore/Framework/interface/ESHandle.h"
00029 #include "FWCore/Framework/interface/EventSetup.h"
00030 
00031 // DB includes
00032 #include "FWCore/ServiceRegistry/interface/Service.h"
00033 #include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
00034 
00035 // user include files
00036 #include "CondFormats/EcalObjects/interface/EcalIntercalibConstantsMC.h"
00037 #include "CondFormats/DataRecord/interface/EcalIntercalibConstantsMCRcd.h"
00038 //For Checks
00039 
00040 //this one
00041 #include "CalibCalorimetry/CaloMiscalibTools/interface/WriteEcalMiscalibConstantsMC.h"
00042 
00043 //
00044 // static data member definitions
00045 //
00046 
00047 //
00048 // constructors and destructor
00049 //
00050 WriteEcalMiscalibConstantsMC::WriteEcalMiscalibConstantsMC(const edm::ParameterSet& iConfig)
00051 {
00052    //now do what ever initialization is needed
00053   newTagRequest_ = iConfig.getParameter< std::string > ("NewTagRequest");
00054 
00055 
00056 }
00057 
00058 
00059 WriteEcalMiscalibConstantsMC::~WriteEcalMiscalibConstantsMC()
00060 {
00061  
00062    // do anything here that needs to be done at desctruction time
00063    // (e.g. close files, deallocate resources etc.)
00064 
00065 }
00066 
00067 
00068 //
00069 // member functions
00070 //
00071 
00072 // ------------ method called to for each event  ------------
00073 void
00074 WriteEcalMiscalibConstantsMC::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00075 {
00076    using namespace edm;
00077   // Intercalib constants
00078    edm::ESHandle<EcalIntercalibConstantsMC> pIcal;
00079    iSetup.get<EcalIntercalibConstantsMCRcd>().get(pIcal);
00080    const EcalIntercalibConstantsMC* Mcal = pIcal.product();
00081 
00082   edm::Service<cond::service::PoolDBOutputService> poolDbService;
00083   if( poolDbService.isAvailable() ){
00084     if ( poolDbService->isNewTagRequest(newTagRequest_) ){
00085       std::cout<<" Creating a  new one "<<std::endl;
00086       poolDbService->createNewIOV<const EcalIntercalibConstantsMC>( Mcal, poolDbService->beginOfTime(), poolDbService->endOfTime(),newTagRequest_);
00087       std::cout<<"Done" << std::endl;
00088     }else{
00089       std::cout<<"Old One "<<std::endl;
00090        poolDbService->appendSinceTime<const EcalIntercalibConstantsMC>( Mcal, poolDbService->currentTime(),newTagRequest_);
00091     }
00092   }  
00093 }
00094 
00095 
00096 // ------------ method called once each job just before starting event loop  ------------
00097 void 
00098 WriteEcalMiscalibConstantsMC::beginJob()
00099 {
00100 }
00101 
00102 // ------------ method called once each job just after ending the event loop  ------------
00103 void 
00104 
00105 WriteEcalMiscalibConstantsMC::endJob() {
00106   std::cout << "Here is the end" << std::endl; 
00107 }
00108