Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:57:33

0001 // -*- C++ -*-
0002 //
0003 // Package:    WriteEcalMiscalibConstantsMC
0004 // Class:      WriteEcalMiscalibConstantsMC
0005 //
0006 /**\class WriteEcalMiscalibConstantsMC WriteEcalMiscalibConstantsMC.cc CalibCalorimetry/WriteEcalMiscalibConstantsMC/src/WriteEcalMiscalibConstantsMC.cc
0007 
0008  Description: <one line class summary>
0009 
0010  Implementation:
0011      <Notes on implementation>
0012 */
0013 //
0014 // Original Author:  Stephanie BEAUCERON
0015 //         Created:  Tue May 15 16:23:21 CEST 2007
0016 //
0017 //
0018 
0019 // user include files
0020 #include "FWCore/Framework/interface/EventSetup.h"
0021 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0022 
0023 // DB includes
0024 #include "FWCore/ServiceRegistry/interface/Service.h"
0025 #include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
0026 
0027 // user include files
0028 //this one
0029 #include "CalibCalorimetry/CaloMiscalibTools/interface/WriteEcalMiscalibConstantsMC.h"
0030 
0031 //
0032 // static data member definitions
0033 //
0034 
0035 //
0036 // constructors and destructor
0037 //
0038 WriteEcalMiscalibConstantsMC::WriteEcalMiscalibConstantsMC(const edm::ParameterSet& iConfig)
0039     : newTagRequest_(iConfig.getParameter<std::string>("NewTagRequest")), intercalibConstsToken_(esConsumes()) {}
0040 
0041 WriteEcalMiscalibConstantsMC::~WriteEcalMiscalibConstantsMC() {}
0042 
0043 //
0044 // member functions
0045 //
0046 
0047 // ------------ method called to for each event  ------------
0048 void WriteEcalMiscalibConstantsMC::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0049   using namespace edm;
0050   // Intercalib constants
0051   const EcalIntercalibConstantsMC* Mcal = &iSetup.getData(intercalibConstsToken_);
0052 
0053   edm::Service<cond::service::PoolDBOutputService> poolDbService;
0054   if (poolDbService.isAvailable()) {
0055     if (poolDbService->isNewTagRequest(newTagRequest_)) {
0056       edm::LogVerbatim("WriteEcalMiscalibConstantsMC") << "Creating a new IOV";
0057       poolDbService->createOneIOV<const EcalIntercalibConstantsMC>(*Mcal, poolDbService->beginOfTime(), newTagRequest_);
0058       edm::LogVerbatim("WriteEcalMiscalibConstantsMC") << "Done";
0059     } else {
0060       edm::LogVerbatim("WriteEcalMiscalibConstantsMC") << "Old IOV";
0061       poolDbService->appendOneIOV<const EcalIntercalibConstantsMC>(*Mcal, poolDbService->currentTime(), newTagRequest_);
0062     }
0063   }
0064 }
0065 
0066 // ------------ method called once each job just before starting event loop  ------------
0067 void WriteEcalMiscalibConstantsMC::beginJob() {}
0068 
0069 // ------------ method called once each job just after ending the event loop  ------------
0070 void WriteEcalMiscalibConstantsMC::endJob() { edm::LogVerbatim("WriteEcalMiscalibConstantsMC") << "Here is the end"; }