Go to the documentation of this file.00001
00002 #ifndef EcalSimAlgos_EcalCoder_h
00003 #define EcalSimAlgos_EcalCoder_h 1
00004
00005 #include "CalibFormats/CaloObjects/interface/CaloTSamples.h"
00006 #include "CondFormats/EcalObjects/interface/EcalPedestals.h"
00007 #include "CondFormats/EcalObjects/interface/EcalIntercalibConstantsMC.h"
00008 #include "CondFormats/EcalObjects/interface/EcalGainRatios.h"
00009 #include "SimCalorimetry/EcalSimAlgos/interface/EcalCorrelatedNoiseMatrix.h"
00010
00011 template<typename M> class CorrelatedNoisifier ;
00012 class EcalMGPASample;
00013 class EcalDataFrame;
00014 class DetId;
00015
00016 #include<vector>
00017
00018
00019
00020
00021
00022 class EcalCoder
00023 {
00024 public:
00025
00026 typedef CaloTSamples<float,10> EcalSamples ;
00027
00028 typedef CorrelatedNoisifier<EcalCorrMatrix> Noisifier ;
00029
00030 enum { NBITS = 12 ,
00031 MAXADC = 4095 ,
00032 ADCGAINSWITCH = 4079 ,
00033 NGAINS = 3
00034 };
00035
00037 EcalCoder( bool addNoise ,
00038 Noisifier* ebCorrNoise0 ,
00039 Noisifier* eeCorrNoise0 = 0 ,
00040 Noisifier* ebCorrNoise1 = 0 ,
00041 Noisifier* eeCorrNoise1 = 0 ,
00042 Noisifier* ebCorrNoise2 = 0 ,
00043 Noisifier* eeCorrNoise2 = 0 ) ;
00045 virtual ~EcalCoder() ;
00046
00048 void setPedestals( const EcalPedestals* pedestals ) ;
00049
00050 void setGainRatios( const EcalGainRatios* gainRatios ) ;
00051
00052 void setFullScaleEnergy( double EBscale ,
00053 double EEscale ) ;
00054
00055 void setIntercalibConstants( const EcalIntercalibConstantsMC* ical ) ;
00056
00057
00059 virtual void analogToDigital( const EcalSamples& clf ,
00060 EcalDataFrame& df ) const;
00061
00062 private:
00063
00065 double fullScaleEnergy( const DetId & did ) const ;
00066
00068 void encode( const EcalSamples& ecalSamples ,
00069 EcalDataFrame& df ) const ;
00070
00071
00072
00073
00075
00076
00077
00078 void findPedestal( const DetId& detId ,
00079 int gainId ,
00080 double& pedestal ,
00081 double& width ) const ;
00082
00083 void findGains( const DetId& detId,
00084 double theGains[] ) const ;
00085
00086 void findIntercalibConstant( const DetId& detId ,
00087 double& icalconst ) const ;
00088
00089 const EcalPedestals* m_peds ;
00090
00091 const EcalGainRatios* m_gainRatios ;
00092
00093 const EcalIntercalibConstantsMC* m_intercals ;
00094
00095 double m_maxEneEB ;
00096 double m_maxEneEE ;
00097
00098 bool m_addNoise ;
00099
00100 const Noisifier* m_ebCorrNoise[3] ;
00101 const Noisifier* m_eeCorrNoise[3] ;
00102 };
00103
00104 #endif