CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/SimCalorimetry/EcalSimAlgos/interface/EBHitResponse.h

Go to the documentation of this file.
00001 #ifndef EcalSimAlgos_EBHitResponse_h
00002 #define EcalSimAlgos_EBHitResponse_h
00003 
00004 #include "CalibFormats/CaloObjects/interface/CaloTSamples.h"
00005 #include "SimCalorimetry/EcalSimAlgos/interface/EcalHitResponse.h"
00006 #include "CondFormats/EcalObjects/interface/EcalIntercalibConstantsMC.h"
00007 
00008 class APDSimParameters ;
00009 
00010 class EBHitResponse : public EcalHitResponse
00011 {
00012    public:
00013 
00014       typedef CaloTSamples<float,10> EBSamples ;
00015 
00016       typedef std::vector<double> VecD ;
00017 
00018       enum { kNOffsets = 2000 } ;
00019 
00020       EBHitResponse( const CaloVSimParameterMap* parameterMap , 
00021                      const CaloVShape*           shape        ,
00022                      bool                        apdOnly      ,
00023                      const APDSimParameters*     apdPars      , 
00024                      const CaloVShape*           apdShape       ) ;
00025 
00026       virtual ~EBHitResponse() ;
00027 
00028       virtual bool keepBlank() const { return false ; }
00029 
00030       void setIntercal( const EcalIntercalibConstantsMC* ical ) ;
00031 
00032       const VecD& offsets() const { return m_timeOffVec ; }
00033 
00034       virtual void add( const PCaloHit&  hit ) ;
00035 
00036       virtual void initializeHits() ;
00037 
00038       virtual void finalizeHits() ;
00039 
00040       virtual void run( MixCollection<PCaloHit>& hits ) ;
00041 
00042       virtual unsigned int samplesSize() const ;
00043 
00044       virtual EcalSamples* operator[]( unsigned int i ) ;
00045 
00046       virtual const EcalSamples* operator[]( unsigned int i ) const ;
00047 
00048    protected:
00049 
00050       virtual unsigned int samplesSizeAll() const ;
00051 
00052       virtual EcalSamples* vSamAll( unsigned int i ) ;
00053 
00054       virtual const EcalSamples* vSamAll( unsigned int i ) const ;
00055 
00056       virtual EcalSamples* vSam( unsigned int i ) ;
00057 
00058       void putAPDSignal( const DetId& detId, double npe, double time ) ;
00059 
00060    private:
00061 
00062       const double nonlFunc( double enr ) const {
00063          return ( pelo > enr ? pext :
00064                   ( pehi > enr ? nonlFunc1( enr ) : 
00065                     pfac*atan( log10( enr - pehi + 0.00001 ) ) + poff ) ) ; }
00066 
00067       const double nonlFunc1( double energy ) const {
00068          const double enr ( log10(energy) ) ;
00069          const double enr2 ( enr*enr ) ;
00070          const double enr3 ( enr2*enr ) ;
00071          return ( pcub*enr3 + pqua*enr2 + plin*enr + pcon ) ; }
00072 
00073       const APDSimParameters* apdParameters() const ;
00074       const CaloVShape*       apdShape()      const ;
00075 
00076       double apdSignalAmplitude( const PCaloHit& hit ) const ;
00077 
00078       void findIntercalibConstant( const DetId& detId, 
00079                                    double&      icalconst ) const ;
00080 
00081       const bool                       m_apdOnly  ;
00082       const APDSimParameters*          m_apdPars  ;
00083       const CaloVShape*                m_apdShape ;
00084       const EcalIntercalibConstantsMC* m_intercal ;
00085 
00086       std::vector<double> m_timeOffVec ;
00087 
00088       std::vector<double> m_apdNpeVec ;
00089       std::vector<double> m_apdTimeVec ;
00090 
00091       const double pcub, pqua, plin, pcon, pelo, pehi, pasy, pext, poff, pfac ;
00092 
00093       std::vector<EBSamples> m_vSam ;
00094 };
00095 #endif
00096 
00097