CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/RecoLocalCalo/EcalRecAlgos/plugins/EcalSeverityLevelESProducer.cc

Go to the documentation of this file.
00001 #include "boost/shared_ptr.hpp"
00002 #include "FWCore/Framework/interface/ModuleFactory.h"
00003 #include "FWCore/Framework/interface/ESProducer.h"
00004 #include "FWCore/Framework/interface/ESHandle.h"
00005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00006 #include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgoRcd.h"
00007 #include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h"
00008 #include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgo.h"
00009 
00010 /*
00011   Provide  a hook to retrieve the EcalSeverityLevelAlgo
00012   through the EventSetup 
00013  
00014   Appartently there is no smarter way to do it in CMSSW
00015 
00016   Author: Stefano Argiro
00017   $Id: EcalSeverityLevelESProducer.cc,v 1.1 2011/01/16 08:29:00 argiro Exp $
00018  */
00019 
00020 class EcalSeverityLevelESProducer : public edm::ESProducer {
00021   
00022 public:
00023   EcalSeverityLevelESProducer(const edm::ParameterSet& iConfig);
00024   
00025   typedef boost::shared_ptr<EcalSeverityLevelAlgo> ReturnType;
00026   
00027   ReturnType produce(const EcalSeverityLevelAlgoRcd& iRecord);
00028   
00029 
00030 
00031 private:
00032 
00033   void chstatusCallback(const EcalChannelStatusRcd& chs);
00034   
00035   ReturnType algo_;
00036 };
00037 
00038 EcalSeverityLevelESProducer::EcalSeverityLevelESProducer(const edm::ParameterSet& iConfig){
00039   //the following line is needed to tell the framework what
00040   // data is being produced
00041   setWhatProduced(this, 
00042                   dependsOn (&EcalSeverityLevelESProducer::chstatusCallback));
00043 
00044   algo_ = ReturnType(new EcalSeverityLevelAlgo(iConfig));
00045 }
00046 
00047 
00048 
00049 EcalSeverityLevelESProducer::ReturnType
00050 EcalSeverityLevelESProducer::produce(const EcalSeverityLevelAlgoRcd& iRecord){
00051   
00052   return algo_ ;
00053 }
00054 
00055 
00056 void 
00057 EcalSeverityLevelESProducer::chstatusCallback(const EcalChannelStatusRcd& chs){
00058   edm::ESHandle <EcalChannelStatus> h;
00059   chs.get (h);
00060   algo_->setChannelStatus(*h.product());
00061 }
00062 
00063 //define this as a plug-in
00064 DEFINE_FWK_EVENTSETUP_MODULE(EcalSeverityLevelESProducer);
00065 
00066