00001 00002 // 00003 // F.Ratnikov (UMd), Aug. 9, 2005 00004 // 00005 00006 #ifndef HcalDbService_h 00007 #define HcalDbService_h 00008 00009 #include <memory> 00010 #include <map> 00011 00012 #include "DataFormats/HcalDetId/interface/HcalGenericDetId.h" 00013 #include "CalibFormats/HcalObjects/interface/HcalChannelCoder.h" 00014 #include "CalibFormats/HcalObjects/interface/QieShape.h" 00015 #include "CalibFormats/HcalObjects/interface/HcalCoder.h" 00016 #include "CalibFormats/HcalObjects/interface/HcalCalibrationsSet.h" 00017 #include "CalibFormats/HcalObjects/interface/HcalCalibrationWidthsSet.h" 00018 00019 #include "FWCore/Framework/interface/ModuleFactory.h" 00020 #include "FWCore/Framework/interface/ESProducer.h" 00021 00022 #include "CondFormats/HcalObjects/interface/AllObjects.h" 00023 00024 class HcalCalibrations; 00025 class HcalCalibrationWidths; 00026 00027 class HcalDbService { 00028 public: 00029 HcalDbService (const edm::ParameterSet&); 00030 00031 const HcalCalibrations& getHcalCalibrations(const HcalGenericDetId& fId) const; 00032 const HcalCalibrationWidths& getHcalCalibrationWidths(const HcalGenericDetId& fId) const; 00033 00034 const HcalPedestal* getPedestal (const HcalGenericDetId& fId) const; 00035 const HcalPedestalWidth* getPedestalWidth (const HcalGenericDetId& fId) const; 00036 const HcalGain* getGain (const HcalGenericDetId& fId) const; 00037 const HcalGainWidth* getGainWidth (const HcalGenericDetId& fId) const; 00038 const HcalQIECoder* getHcalCoder (const HcalGenericDetId& fId) const; 00039 const HcalQIEShape* getHcalShape () const; 00040 const HcalElectronicsMap* getHcalMapping () const; 00041 const HcalRespCorr* getHcalRespCorr (const HcalGenericDetId& fId) const; 00042 const HcalTimeCorr* getHcalTimeCorr (const HcalGenericDetId& fId) const; 00043 const HcalL1TriggerObject* getHcalL1TriggerObject (const HcalGenericDetId& fId) const; 00044 const HcalChannelStatus* getHcalChannelStatus (const HcalGenericDetId& fId) const; 00045 const HcalZSThreshold* getHcalZSThreshold (const HcalGenericDetId& fId) const; 00046 const HcalLUTCorr* getHcalLUTCorr (const HcalGenericDetId& fId) const; 00047 const HcalPFCorr* getHcalPFCorr (const HcalGenericDetId& fId) const; 00048 const HcalLutMetadata* getHcalLutMetadata () const; 00049 00050 void setData (const HcalPedestals* fItem) {mPedestals = fItem; mUpdateCalibrations = true; } 00051 void setData (const HcalPedestalWidths* fItem) {mPedestalWidths = fItem; mUpdateCalibWidths = true; } 00052 void setData (const HcalGains* fItem) {mGains = fItem; mUpdateCalibrations = true; } 00053 void setData (const HcalGainWidths* fItem) {mGainWidths = fItem; mUpdateCalibWidths = true; } 00054 void setData (const HcalQIEData* fItem) {mQIEData = fItem; mUpdateCalibrations = true; mUpdateCalibWidths = true; } 00055 void setData (const HcalChannelQuality* fItem) {mChannelQuality = fItem;} 00056 void setData (const HcalElectronicsMap* fItem) {mElectronicsMap = fItem;} 00057 void setData (const HcalRespCorrs* fItem) {mRespCorrs = fItem; mUpdateCalibrations = true; } 00058 void setData (const HcalTimeCorrs* fItem) {mTimeCorrs = fItem; mUpdateCalibrations = true; } 00059 void setData (const HcalZSThresholds* fItem) {mZSThresholds = fItem;} 00060 void setData (const HcalL1TriggerObjects* fItem) {mL1TriggerObjects = fItem;} 00061 void setData (const HcalLUTCorrs* fItem) {mLUTCorrs = fItem; mUpdateCalibrations = true; } 00062 void setData (const HcalPFCorrs* fItem) {mPFCorrs = fItem; } 00063 void setData (const HcalLutMetadata* fItem) {mLutMetadata = fItem;} 00064 00065 private: 00066 bool makeHcalCalibration (const HcalGenericDetId& fId, HcalCalibrations* fObject, 00067 bool pedestalInADC) const; 00068 void buildCalibrations() const; 00069 bool makeHcalCalibrationWidth (const HcalGenericDetId& fId, HcalCalibrationWidths* fObject, 00070 bool pedestalInADC) const; 00071 void buildCalibWidths() const; 00072 const HcalPedestals* mPedestals; 00073 const HcalPedestalWidths* mPedestalWidths; 00074 const HcalGains* mGains; 00075 const HcalGainWidths* mGainWidths; 00076 mutable QieShape* mQieShapeCache; 00077 const HcalQIEData* mQIEData; 00078 const HcalChannelQuality* mChannelQuality; 00079 const HcalElectronicsMap* mElectronicsMap; 00080 const HcalRespCorrs* mRespCorrs; 00081 const HcalZSThresholds* mZSThresholds; 00082 const HcalL1TriggerObjects* mL1TriggerObjects; 00083 const HcalTimeCorrs* mTimeCorrs; 00084 const HcalLUTCorrs* mLUTCorrs; 00085 const HcalPFCorrs* mPFCorrs; 00086 const HcalLutMetadata* mLutMetadata; 00087 // bool mPedestalInADC; 00088 mutable HcalCalibrationsSet mCalibSet; 00089 mutable HcalCalibrationWidthsSet mCalibWidthSet; 00090 mutable bool mUpdateCalibrations, mUpdateCalibWidths; 00091 }; 00092 00093 #endif