00001 // -*- C++ -*- 00002 // 00003 // Package: CaloTPGTranscoderULUTs 00004 // Class: CaloTPGTranscoderULUTs 00005 // 00013 // 00014 // Original Author: Jeremiah Mans 00015 // Created: Fri Sep 15 11:49:44 CDT 2006 00016 // $Id: CaloTPGTranscoderULUTs.cc,v 1.2 2008/01/22 18:49:54 muzaffar Exp $ 00017 // 00018 // 00019 00020 00021 // system include files 00022 #include <memory> 00023 00024 // user include files 00025 00026 #include "FWCore/Framework/interface/SourceFactory.h" 00027 #include "FWCore/Framework/interface/ESProducer.h" 00028 #include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h" 00029 00030 #include "CalibCalorimetry/CaloTPG/src/CaloTPGTranscoderULUT.h" 00031 #include "CalibFormats/CaloTPG/interface/CaloTPGRecord.h" 00032 #include "FWCore/Framework/interface/ValidityInterval.h" 00033 #include "FWCore/MessageLogger/interface/MessageLogger.h" 00034 00035 00036 // 00037 // class decleration 00038 // 00039 00040 class CaloTPGTranscoderULUTs : public edm::ESProducer, 00041 public edm::EventSetupRecordIntervalFinder { 00042 public: 00043 CaloTPGTranscoderULUTs(const edm::ParameterSet&); 00044 ~CaloTPGTranscoderULUTs(); 00045 00046 typedef std::auto_ptr<CaloTPGTranscoder> ReturnType; 00047 00048 ReturnType produce(const CaloTPGRecord&); 00049 00050 void setIntervalFor(const edm::eventsetup::EventSetupRecordKey& iKey, const edm::IOVSyncValue& iTime, edm::ValidityInterval& oInterval ) { 00051 oInterval = edm::ValidityInterval (edm::IOVSyncValue::beginOfTime(), edm::IOVSyncValue::endOfTime()); //infinite 00052 } 00053 private: 00054 // ----------member data --------------------------- 00055 edm::FileInPath hfilename1_; 00056 edm::FileInPath hfilename2_; 00057 }; 00058 00059 // 00060 // constants, enums and typedefs 00061 // 00062 00063 // 00064 // static data member definitions 00065 // 00066 00067 // 00068 // constructors and destructor 00069 // 00070 CaloTPGTranscoderULUTs::CaloTPGTranscoderULUTs(const edm::ParameterSet& iConfig) : 00071 hfilename1_(iConfig.getParameter<edm::FileInPath>("hcalLUT1")), 00072 hfilename2_(iConfig.getParameter<edm::FileInPath>("hcalLUT2")) 00073 { 00074 //the following line is needed to tell the framework what 00075 // data is being produced 00076 setWhatProduced(this); 00077 findingRecord<CaloTPGRecord>(); 00078 00079 //now do what ever other initialization is needed 00080 } 00081 00082 00083 CaloTPGTranscoderULUTs::~CaloTPGTranscoderULUTs() 00084 { 00085 00086 // do anything here that needs to be done at desctruction time 00087 // (e.g. close files, deallocate resources etc.) 00088 00089 } 00090 00091 00092 // 00093 // member functions 00094 // 00095 00096 // ------------ method called to produce the data ------------ 00097 CaloTPGTranscoderULUTs::ReturnType 00098 CaloTPGTranscoderULUTs::produce(const CaloTPGRecord& iRecord) 00099 { 00100 using namespace edm::es; 00101 edm::LogInfo("Level1") << "Using " << hfilename1_.fullPath() << " & " << hfilename2_.fullPath() 00102 << " for CaloTPGTranscoderULUTs HCAL initialization"; 00103 std::auto_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT(hfilename1_.fullPath(), hfilename2_.fullPath())); 00104 00105 return pTCoder ; 00106 } 00107 00108 //define this as a plug-in 00109 DEFINE_FWK_EVENTSETUP_SOURCE(CaloTPGTranscoderULUTs);