00001 #ifndef EcalSimAlgos_ESElectronicsSim_h 00002 #define EcalSimAlgos_ESElectronicsSim_h 1 00003 00004 #include "CalibFormats/CaloObjects/interface/CaloSamples.h" 00005 #include "DataFormats/EcalDigi/interface/ESDataFrame.h" 00006 #include "DataFormats/EcalDigi/interface/ESSample.h" 00007 #include "CondFormats/ESObjects/interface/ESPedestals.h" 00008 #include "CondFormats/ESObjects/interface/ESIntercalibConstants.h" 00009 00010 #include<vector> 00011 00012 class ESElectronicsSim 00013 { 00014 public: 00015 00016 enum {MAXADC = 4095}; 00017 enum {MINADC = 0}; 00018 00019 ESElectronicsSim (bool addNoise); 00020 virtual ~ESElectronicsSim(); 00021 00022 void setGain (const int gain) { gain_ = gain; } 00023 void setPedestals(const ESPedestals* peds) { peds_ = peds; } 00024 void setMIPs(const ESIntercalibConstants* mips) { mips_ = mips; } 00025 void setMIPToGeV (const double MIPToGeV) { MIPToGeV_ = MIPToGeV; } 00026 00027 virtual void analogToDigital(const CaloSamples& cs, ESDataFrame& df) const; 00028 virtual void digitalToAnalog(const ESDataFrame& df, CaloSamples& cs) const; 00029 00031 void newEvent() {} 00032 00033 private : 00034 00035 bool addNoise_; 00036 int gain_; 00037 const ESPedestals *peds_; 00038 const ESIntercalibConstants *mips_; 00039 double MIPToGeV_; 00040 00041 std::vector<ESSample> encode(const CaloSamples& timeframe) const; 00042 double decode(const ESSample & sample, const DetId & detId) const; 00043 00044 } ; 00045 00046 00047 #endif