Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // Package:    WriteEcalMiscalibConstants
0004 // Class:      WriteEcalMiscalibConstants
0005 //
0006 /**\class WriteEcalMiscalibConstants WriteEcalMiscalibConstants.cc CalibCalorimetry/WriteEcalMiscalibConstants/src/WriteEcalMiscalibConstants.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/WriteEcalMiscalibConstants.h"
0030 
0031 //
0032 // static data member definitions
0033 //
0034 
0035 //
0036 // constructors and destructor
0037 //
0038 WriteEcalMiscalibConstants::WriteEcalMiscalibConstants(const edm::ParameterSet& iConfig)
0039     : newTagRequest_(iConfig.getParameter<std::string>("NewTagRequest")), intercalibConstsToken_(esConsumes()) {}
0040 
0041 WriteEcalMiscalibConstants::~WriteEcalMiscalibConstants() {}
0042 
0043 //
0044 // member functions
0045 //
0046 
0047 // ------------ method called to for each event  ------------
0048 void WriteEcalMiscalibConstants::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0049   using namespace edm;
0050   // Intercalib constants
0051   const EcalIntercalibConstants* Mcal = &iSetup.getData(intercalibConstsToken_);
0052 
0053   edm::Service<cond::service::PoolDBOutputService> poolDbService;
0054   if (poolDbService.isAvailable()) {
0055     if (poolDbService->isNewTagRequest(newTagRequest_)) {
0056       edm::LogVerbatim("WriteEcalMiscalibConstants") << "Creating a new IOV";
0057       poolDbService->createOneIOV<const EcalIntercalibConstants>(*Mcal, poolDbService->beginOfTime(), newTagRequest_);
0058       edm::LogVerbatim("WriteEcalMiscalibConstants") << "Done";
0059     } else {
0060       edm::LogVerbatim("WriteEcalMiscalibConstants") << "Old IOV";
0061       poolDbService->appendOneIOV<const EcalIntercalibConstants>(*Mcal, poolDbService->currentTime(), newTagRequest_);
0062     }
0063   }
0064 }
0065 
0066 // ------------ method called once each job just before starting event loop  ------------
0067 void WriteEcalMiscalibConstants::beginJob() {}
0068 
0069 // ------------ method called once each job just after ending the event loop  ------------
0070 void WriteEcalMiscalibConstants::endJob() { edm::LogVerbatim("WriteEcalMiscalibConstants") << "Here is the end"; }