Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:28:32

0001 #ifndef EcalSimAlgos_ESElectronicsSim_h
0002 #define EcalSimAlgos_ESElectronicsSim_h 1
0003 
0004 #include "CalibFormats/CaloObjects/interface/CaloSamples.h"
0005 #include "DataFormats/EcalDigi/interface/ESDataFrame.h"
0006 #include "DataFormats/EcalDigi/interface/ESSample.h"
0007 #include "CondFormats/ESObjects/interface/ESPedestals.h"
0008 #include "CondFormats/ESObjects/interface/ESIntercalibConstants.h"
0009 
0010 #include <vector>
0011 
0012 namespace CLHEP {
0013   class HepRandomEngine;
0014 }
0015 
0016 class ESElectronicsSim {
0017 public:
0018   enum { MAXADC = 4095 };
0019   enum { MINADC = 0 };
0020 
0021   ESElectronicsSim(bool addNoise);
0022   virtual ~ESElectronicsSim();
0023 
0024   void setGain(const int gain) { gain_ = gain; }
0025   void setPedestals(const ESPedestals* peds) { peds_ = peds; }
0026   void setMIPs(const ESIntercalibConstants* mips) { mips_ = mips; }
0027   void setMIPToGeV(const double MIPToGeV) { MIPToGeV_ = MIPToGeV; }
0028 
0029   virtual void analogToDigital(CLHEP::HepRandomEngine*, const CaloSamples& cs, ESDataFrame& df) const;
0030   virtual void digitalToAnalog(const ESDataFrame& df, CaloSamples& cs) const;
0031 
0032   ///  anything that needs to be done once per event
0033   void newEvent(CLHEP::HepRandomEngine*) {}
0034 
0035 private:
0036   bool addNoise_;
0037   int gain_;
0038   const ESPedestals* peds_;
0039   const ESIntercalibConstants* mips_;
0040   double MIPToGeV_;
0041 
0042   std::vector<ESSample> encode(const CaloSamples& timeframe, CLHEP::HepRandomEngine*) const;
0043   double decode(const ESSample& sample, const DetId& detId) const;
0044 };
0045 
0046 #endif