Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:29:26

0001 #ifndef SimCalorimetry_EcalSimAlgos_EcalLiteDTUCoder_h
0002 #define SimCalorimetry_EcalSimAlgos_EcalLiteDTUCoder_h
0003 
0004 #include "CalibFormats/CaloObjects/interface/CaloTSamples.h"
0005 #include "CondFormats/EcalObjects/interface/EcalLiteDTUPedestals.h"
0006 #include "CondFormats/EcalObjects/interface/EcalIntercalibConstantsMC.h"
0007 #include "CondFormats/EcalObjects/interface/EcalCATIAGainRatios.h"
0008 #include "SimCalorimetry/EcalSimAlgos/interface/EcalCorrelatedNoiseMatrix.h"
0009 #include "DataFormats/EcalDigi/interface/EcalConstants.h"
0010 
0011 template <typename M>
0012 class CorrelatedNoisifier;
0013 class EcalLiteDTUSample;
0014 class EcalDataFrame_Ph2;
0015 class DetId;
0016 class EcalLiteDTUPed;
0017 
0018 #include <vector>
0019 
0020 namespace CLHEP {
0021   class HepRandomEngine;
0022 }
0023 
0024 class EcalLiteDTUCoder {
0025 public:
0026   typedef CaloTSamples<float, ecalPh2::sampleSize> EcalSamples;
0027 
0028   typedef CorrelatedNoisifier<EcalCorrMatrix_Ph2> Noisifier;
0029 
0030   /// ctor
0031   EcalLiteDTUCoder(bool addNoise, bool PreMix1, Noisifier* ebCorrNoise0, Noisifier* ebCorrNoise1 = nullptr);
0032 
0033   /// dtor
0034   virtual ~EcalLiteDTUCoder();
0035 
0036   /// can be fetched every event from the EventSetup
0037   void setPedestals(const EcalLiteDTUPedestalsMap* pedestals);
0038 
0039   void setGainRatios(float gainRatios);
0040 
0041   void setFullScaleEnergy(double EBscale);
0042 
0043   void setIntercalibConstants(const EcalIntercalibConstantsMC* ical);
0044 
0045   /// from EcalSamples to EcalDataFrame_Ph2
0046   virtual void analogToDigital(CLHEP::HepRandomEngine*, const EcalSamples& clf, EcalDataFrame_Ph2& df) const;
0047 
0048 private:
0049   /// limit on the energy scale due to the electronics range
0050   double fullScaleEnergy(const DetId& did) const;
0051 
0052   /// produce the pulse-shape
0053   void encode(const EcalSamples& ecalSamples, EcalDataFrame_Ph2& df, CLHEP::HepRandomEngine*) const;
0054 
0055   void findPedestal(const DetId& detId, int gainId, double& pedestal, double& width) const;
0056 
0057   void findGains(const DetId& detId, float theGains[]) const;
0058 
0059   void findIntercalibConstant(const DetId& detId, double& icalconst) const;
0060 
0061   const EcalLiteDTUPedestalsMap* m_peds;
0062 
0063   float m_gainRatios;  // the electronics gains
0064 
0065   const EcalIntercalibConstantsMC* m_intercals;  //record specific for simulation of gain variation in MC
0066 
0067   double m_maxEneEB;  // max attainable energy in the ecal barrel
0068 
0069   bool m_addNoise;  // whether add noise to the pedestals and the gains
0070   bool m_PreMix1;   // Follow necessary steps for PreMixing input
0071 
0072   const Noisifier* m_ebCorrNoise[ecalPh2::NGAINS];
0073 };
0074 
0075 #endif