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 00021 void setGain (const int gain) { gain_ = gain; } 00022 void setPedestals(const ESPedestals* peds) { peds_ = peds; } 00023 void setMIPs(const ESIntercalibConstants* mips) { mips_ = mips; } 00024 void setMIPToGeV (const double MIPToGeV) { MIPToGeV_ = MIPToGeV; } 00025 00026 virtual void analogToDigital(const CaloSamples& cs, ESDataFrame& df) const; 00027 virtual void digitalToAnalog(const ESDataFrame& df, CaloSamples& cs) const; 00028 00030 void newEvent() {} 00031 00032 private : 00033 00034 bool addNoise_; 00035 int gain_; 00036 const ESPedestals *peds_; 00037 const ESIntercalibConstants *mips_; 00038 double MIPToGeV_; 00039 00040 std::vector<ESSample> encode(const CaloSamples& timeframe) const; 00041 double decode(const ESSample & sample, const DetId & detId) const; 00042 00043 } ; 00044 00045 00046 #endif