CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_2_9_HLT1_bphpatch4/src/SimCalorimetry/EcalSimAlgos/interface/ESElectronicsSimFast.h

Go to the documentation of this file.
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 #include "CondFormats/ESObjects/interface/ESPedestals.h"
00009 #include "CondFormats/ESObjects/interface/ESIntercalibConstants.h"
00010 
00011 #include <vector>
00012 #include "TFile.h"
00013 
00014 class ESElectronicsSimFast
00015 {
00016  public:
00017   
00018   enum {MAXADC = 4095};
00019   enum {MINADC = 0};
00020   
00021   ESElectronicsSimFast (bool addNoise);
00022 
00023   void setGain (const int gain) { gain_ = gain; }
00024   void setPedestals(const ESPedestals* peds) { peds_ = peds; } 
00025   void setMIPs(const ESIntercalibConstants* mips) { mips_ = mips; }
00026   void setMIPToGeV (const double MIPToGeV) { MIPToGeV_ = MIPToGeV; }
00027 
00028   virtual void analogToDigital(const CaloSamples& cs, ESDataFrame& df, bool wasEmpty, CLHEP::RandGeneral *histoDistribution, double hInf, double hSup, double hBin) const;
00029   
00030   void digitalToAnalog(const ESDataFrame& df, CaloSamples& cs) const; 
00031 
00033   void newEvent() {}
00034 
00035   private :
00036 
00037     bool addNoise_;
00038     int gain_;
00039     const ESPedestals *peds_;
00040     const ESIntercalibConstants *mips_;
00041     double MIPToGeV_;
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