CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/CalibFormats/CastorObjects/interface/CastorDbService.h

Go to the documentation of this file.
00001 
00002 //
00003 // F.Ratnikov (UMd), Aug. 9, 2005
00004 // Adapted for CASTOR by L. Mundim
00005 //
00006 
00007 #ifndef CastorDbService_h
00008 #define CastorDbService_h
00009 
00010 #include <memory>
00011 #include <map>
00012 
00013 #include "DataFormats/HcalDetId/interface/HcalGenericDetId.h"
00014 #include "CalibFormats/CastorObjects/interface/CastorChannelCoder.h"
00015 #include "CalibFormats/CastorObjects/interface/QieShape.h"
00016 #include "CalibFormats/CastorObjects/interface/CastorCoder.h"
00017 #include "CalibFormats/CastorObjects/interface/CastorCalibrationsSet.h"
00018 #include "CalibFormats/CastorObjects/interface/CastorCalibrationWidthsSet.h"
00019 
00020 #include "FWCore/Framework/interface/ModuleFactory.h"
00021 #include "FWCore/Framework/interface/ESProducer.h"
00022 
00023 #include "CondFormats/CastorObjects/interface/AllObjects.h"
00024 
00025 class CastorCalibrations;
00026 class CastorCalibrationWidths;
00027 
00028 class CastorDbService {
00029  public:
00030   CastorDbService (const edm::ParameterSet&);
00031 
00032   const CastorCalibrations& getCastorCalibrations(const HcalGenericDetId& fId) const 
00033   { return mCalibSet.getCalibrations(fId); }
00034   const CastorCalibrationWidths& getCastorCalibrationWidths(const HcalGenericDetId& fId) const 
00035   { return mCalibWidthSet.getCalibrationWidths(fId); }
00036 
00037   const CastorPedestal* getPedestal (const HcalGenericDetId& fId) const;
00038   const CastorPedestalWidth* getPedestalWidth (const HcalGenericDetId& fId) const;
00039   const CastorGain* getGain (const HcalGenericDetId& fId) const;
00040   const CastorGainWidth* getGainWidth (const HcalGenericDetId& fId) const;
00041   const CastorQIECoder* getCastorCoder (const HcalGenericDetId& fId) const;
00042   const CastorQIEShape* getCastorShape () const;
00043   const CastorElectronicsMap* getCastorMapping () const;
00044   const CastorChannelStatus* getCastorChannelStatus (const HcalGenericDetId& fId) const;
00045 
00046   void setData (const CastorPedestals* fItem) {mPedestals = fItem; buildCalibrations(); }
00047   void setData (const CastorPedestalWidths* fItem) {mPedestalWidths = fItem; buildCalibWidths(); }
00048   void setData (const CastorGains* fItem) {mGains = fItem; buildCalibrations(); }
00049   void setData (const CastorGainWidths* fItem) {mGainWidths = fItem; }
00050   void setData (const CastorQIEData* fItem) {mQIEData = fItem; }
00051   void setData (const CastorChannelQuality* fItem) {mChannelQuality = fItem;}
00052   void setData (const CastorElectronicsMap* fItem) {mElectronicsMap = fItem;}
00053 
00054  private:
00055   bool makeCastorCalibration (const HcalGenericDetId& fId, CastorCalibrations* fObject, 
00056                             bool pedestalInADC) const;
00057   void buildCalibrations();
00058   bool makeCastorCalibrationWidth (const HcalGenericDetId& fId, CastorCalibrationWidths* fObject, 
00059                                  bool pedestalInADC) const;
00060   void buildCalibWidths();
00061   mutable reco::castor::QieShape* mQieShapeCache;
00062   const CastorPedestals* mPedestals;
00063   const CastorPedestalWidths* mPedestalWidths;
00064   const CastorGains* mGains;
00065   const CastorGainWidths* mGainWidths;
00066   const CastorQIEData* mQIEData;
00067   const CastorChannelQuality* mChannelQuality;
00068   const CastorElectronicsMap* mElectronicsMap;
00069   CastorCalibrationsSet mCalibSet;
00070   CastorCalibrationWidthsSet mCalibWidthSet;
00071 };
00072 
00073 #endif