CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/src/CalibTracker/SiStripESProducers/plugins/fake/SiStripTemplateFakeESSource.h

Go to the documentation of this file.
00001 #ifndef CalibTracker_SiStripESProducers_SiStripTemplateFakeESSource
00002 #define CalibTracker_SiStripESProducers_SiStripTemplateFakeESSource
00003 
00004 // system include files
00005 #include <memory>
00006 #include "boost/shared_ptr.hpp"
00007 
00008 // user include files
00009 #include "FWCore/Framework/interface/ModuleFactory.h"
00010 #include "FWCore/Framework/interface/ESProducer.h"
00011 #include "FWCore/ServiceRegistry/interface/Service.h"
00012 
00013 #include "FWCore/Framework/interface/ESHandle.h"
00014 
00015 #include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h"
00016 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00017 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00018 
00019 //
00020 // class declaration
00021 //
00022 
00023 template< typename TObject , typename TRecord, typename TService>
00024 class SiStripTemplateFakeESSource : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder  {
00025  public:
00026   SiStripTemplateFakeESSource(const edm::ParameterSet&);
00027   ~SiStripTemplateFakeESSource(){};
00028   
00029   
00030   std::auto_ptr<TObject> produce(const TRecord&);
00031   
00032 private:
00033   
00034   void setIntervalFor( const edm::eventsetup::EventSetupRecordKey&,
00035                        const edm::IOVSyncValue& iov,
00036                        edm::ValidityInterval& iValidity);
00037   
00038   SiStripTemplateFakeESSource( const SiStripTemplateFakeESSource& );
00039   const SiStripTemplateFakeESSource& operator=( const SiStripTemplateFakeESSource& );
00040 };
00041 
00042 template< typename TObject , typename TRecord, typename TService>
00043 SiStripTemplateFakeESSource<TObject,TRecord,TService>::SiStripTemplateFakeESSource(const edm::ParameterSet& iConfig)
00044 {
00045   setWhatProduced(this);
00046   findingRecord<TRecord>();
00047 }
00048 
00049 template< typename TObject , typename TRecord, typename TService>
00050 std::auto_ptr<TObject> SiStripTemplateFakeESSource<TObject,TRecord,TService>::produce(const TRecord& iRecord)
00051 {
00052   edm::Service<TService> condObjBuilder;
00053   TObject *obj=0; 
00054   condObjBuilder->getObj(obj);
00055   std::auto_ptr<TObject> ptr(obj);
00056   return ptr;
00057 }
00058 
00059 template< typename TObject , typename TRecord, typename TService>
00060 void SiStripTemplateFakeESSource<TObject,TRecord,TService>::setIntervalFor( const edm::eventsetup::EventSetupRecordKey&,
00061                                                          const edm::IOVSyncValue& iov,
00062                                                          edm::ValidityInterval& iValidity){
00063   edm::ValidityInterval infinity( iov.beginOfTime(), iov.endOfTime() );
00064   iValidity = infinity;
00065 }
00066 
00067 
00068 #endif