CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/CalibCalorimetry/EcalLaserCorrection/plugins/EcalLaserCorrectionService.cc

Go to the documentation of this file.
00001 //
00002 // Toyoko Orimoto (Caltech), 10 July 2007
00003 //
00004 
00005 // system include files
00006 #include <iostream>
00007 #include <fstream>
00008 
00009 #include "FWCore/Framework/interface/ESHandle.h"
00010 
00011 
00012 #include "CalibCalorimetry/EcalLaserCorrection/interface/EcalLaserDbService.h"
00013 #include "CalibCalorimetry/EcalLaserCorrection/interface/EcalLaserDbRecord.h"
00014 
00015 #include "CalibCalorimetry/EcalLaserCorrection/plugins/EcalLaserCorrectionService.h"
00016 
00017 
00018 EcalLaserCorrectionService::EcalLaserCorrectionService( const edm::ParameterSet& fConfig)
00019   : ESProducer(),
00020     mService_ ( new EcalLaserDbService ())
00021     //    mDumpRequest (),
00022     //    mDumpStream(0)
00023 {
00024   //the following line is needed to tell the framework what
00025   // data is being produced
00026   //  setWhatProduced (this, (dependsOn (&EcalLaserCorrectionService::apdpnCallback)));
00027 
00028   setWhatProduced (this, (dependsOn (&EcalLaserCorrectionService::alphaCallback) &
00029                           (&EcalLaserCorrectionService::apdpnRefCallback) &
00030                           (&EcalLaserCorrectionService::apdpnCallback) )
00031                    );
00032 
00033   //now do what ever other initialization is needed
00034 
00035   //  mDumpRequest = fConfig.getUntrackedParameter <std::vector <std::string> > ("dump", std::vector<std::string>());
00036   //  if (!mDumpRequest.empty()) {
00037   //    std::string otputFile = fConfig.getUntrackedParameter <std::string> ("file", "");
00038   //    mDumpStream = otputFile.empty () ? &std::cout : new std::ofstream (otputFile.c_str());
00039   //  }
00040 }
00041 
00042 
00043 EcalLaserCorrectionService::~EcalLaserCorrectionService()
00044 {
00045  
00046    // do anything here that needs to be done at desctruction time
00047    // (e.g. close files, deallocate resources etc.)
00048   //  if (mDumpStream != &std::cout) delete mDumpStream;
00049 }
00050 
00051 
00052 //
00053 // member functions
00054 //
00055 
00056 // ------------ method called to produce the data  ------------
00057 boost::shared_ptr<EcalLaserDbService> EcalLaserCorrectionService::produce( const EcalLaserDbRecord& )
00058 {
00059   return mService_;
00060 }
00061 
00062 void EcalLaserCorrectionService::alphaCallback (const EcalLaserAlphasRcd& fRecord) {
00063   edm::ESHandle <EcalLaserAlphas> item;
00064   fRecord.get (item);
00065   mService_->setAlphaData (item.product ());
00066 }
00067 
00068 void EcalLaserCorrectionService::apdpnRefCallback (const EcalLaserAPDPNRatiosRefRcd& fRecord) {
00069   edm::ESHandle <EcalLaserAPDPNRatiosRef> item;
00070   fRecord.get (item);
00071   mService_->setAPDPNRefData (item.product ());
00072 }
00073 
00074 void EcalLaserCorrectionService::apdpnCallback (const EcalLaserAPDPNRatiosRcd& fRecord) {
00075   edm::ESHandle <EcalLaserAPDPNRatios> item;
00076   fRecord.get (item);
00077   mService_->setAPDPNData (item.product ());
00078 }