00001 #ifndef EcalSimAlgos_ESElectronicsSimFast_h 00002 #define EcalSimAlgos_ESElectronicsSimFast_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 "CLHEP/Random/RandGeneral.h" 00008 00009 #include <vector> 00010 #include "TFile.h" 00011 00012 class ESElectronicsSimFast 00013 { 00014 public: 00015 00016 enum {MAXADC = 4095}; 00017 enum {MINADC = 0}; 00018 00019 ESElectronicsSimFast (bool addNoise, double sigma, int gain, int baseline, double MIPADC, double MIPkeV); 00020 00021 void setNoiseSigma (const double sigma); 00022 void setGain (const int gain); 00023 void setBaseline (const int baseline); 00024 void setMIPADC (const double MIPADC); 00025 void setMIPkeV (const double MIPkeV); 00026 00027 virtual void analogToDigital(const CaloSamples& cs, ESDataFrame& df, bool wasEmpty, CLHEP::RandGeneral *histoDistribution, double hInf, double hSup, double hBin) const; 00028 00029 void digitalToAnalog(const ESDataFrame& df, CaloSamples& cs) const; 00030 00032 void newEvent() {} 00033 00034 private : 00035 00036 bool addNoise_; 00037 double sigma_; 00038 int gain_; 00039 int baseline_; 00040 double MIPADC_; 00041 double MIPkeV_; 00042 00043 std::vector<ESSample> standEncode(const CaloSamples& timeframe) const; 00044 std::vector<ESSample> fastEncode(const CaloSamples& timeframe, CLHEP::RandGeneral *histoDistribution, double hInf, double hSup, double hBin) const; 00045 00046 double decode(const ESSample & sample, const DetId & detId) const; 00047 00048 } ; 00049 00050 00051 #endif