00001 #ifndef EcalSimAlgos_EcalHitResponse_h 00002 #define EcalSimAlgos_EcalHitResponse_h 00003 00004 #include "CalibFormats/CaloObjects/interface/CaloTSamplesBase.h" 00005 #include "DataFormats/DetId/interface/DetId.h" 00006 #include "SimDataFormats/CrossingFrame/interface/MixCollection.h" 00007 #include "SimDataFormats/CaloHit/interface/PCaloHit.h" 00008 #include "CalibCalorimetry/EcalLaserCorrection/interface/EcalLaserDbService.h" 00009 #include "DataFormats/Provenance/interface/Timestamp.h" 00010 00011 #include<vector> 00012 00013 typedef unsigned long long TimeValue_t; 00014 00015 class CaloVShape ; 00016 class CaloVSimParameterMap ; 00017 class CaloVHitCorrection ; 00018 class CaloVHitFilter ; 00019 class CaloSimParameters ; 00020 class CaloSubdetectorGeometry ; 00021 class CaloVPECorrection ; 00022 namespace CLHEP 00023 { 00024 class RandPoissonQ ; 00025 class RandGaussQ ; 00026 class HepRandomEngine ; 00027 } 00028 00029 class EcalHitResponse 00030 { 00031 public: 00032 00033 typedef CaloTSamplesBase<float> EcalSamples ; 00034 00035 typedef std::vector< unsigned int > VecInd ; 00036 00037 enum { BUNCHSPACE = 25 } ; 00038 00039 EcalHitResponse( const CaloVSimParameterMap* parameterMap , 00040 const CaloVShape* shape ) ; 00041 00042 virtual ~EcalHitResponse() ; 00043 00044 void setBunchRange( int minBunch , 00045 int maxBunch ) ; 00046 00047 void setGeometry( const CaloSubdetectorGeometry* geometry ) ; 00048 00049 void setPhaseShift( double phaseShift ) ; 00050 00051 void setHitFilter( const CaloVHitFilter* filter) ; 00052 00053 void setHitCorrection( const CaloVHitCorrection* hitCorrection) ; 00054 00055 void setPECorrection( const CaloVPECorrection* peCorrection ) ; 00056 00057 void setEventTime(const edm::TimeValue_t& iTime); 00058 00059 void setLaserConstants(const EcalLaserDbService* laser, bool& useLCcorrection); 00060 00061 void add( const EcalSamples* pSam ) ; 00062 00063 virtual void add( const PCaloHit& hit ) ; 00064 00065 virtual void initializeHits() ; 00066 00067 virtual void finalizeHits() ; 00068 00069 virtual void run( MixCollection<PCaloHit>& hits ) ; 00070 00071 virtual unsigned int samplesSize() const = 0 ; 00072 00073 virtual EcalSamples* operator[]( unsigned int i ) = 0; 00074 00075 virtual const EcalSamples* operator[]( unsigned int i ) const = 0; 00076 00077 const EcalSamples* findDetId( const DetId& detId ) const ; 00078 00079 bool withinBunchRange(int bunchCrossing) const ; 00080 00081 protected: 00082 00083 virtual unsigned int samplesSizeAll() const = 0 ; 00084 00085 virtual EcalSamples* vSam( unsigned int i ) = 0 ; 00086 00087 virtual EcalSamples* vSamAll( unsigned int i ) = 0 ; 00088 00089 virtual const EcalSamples* vSamAll( unsigned int i ) const = 0 ; 00090 00091 virtual void putAnalogSignal( const PCaloHit& inputHit) ; 00092 00093 double findLaserConstant(const DetId& detId) const; 00094 00095 EcalSamples* findSignal( const DetId& detId ) ; 00096 00097 double analogSignalAmplitude( const DetId& id, float energy ) const; 00098 00099 double timeOfFlight( const DetId& detId ) const ; 00100 00101 double phaseShift() const ; 00102 00103 CLHEP::RandPoissonQ* ranPois() const ; 00104 00105 CLHEP::RandGaussQ* ranGauss() const ; 00106 00107 void blankOutUsedSamples() ; 00108 00109 const CaloSimParameters* params( const DetId& detId ) const ; 00110 00111 const CaloVShape* shape() const ; 00112 00113 const CaloSubdetectorGeometry* geometry() const ; 00114 00115 int minBunch() const ; 00116 00117 int maxBunch() const ; 00118 00119 VecInd& index() ; 00120 00121 const VecInd& index() const ; 00122 00123 const CaloVHitFilter* hitFilter() const ; 00124 00125 private: 00126 00127 const CaloVSimParameterMap* m_parameterMap ; 00128 const CaloVShape* m_shape ; 00129 const CaloVHitCorrection* m_hitCorrection ; 00130 const CaloVPECorrection* m_PECorrection ; 00131 const CaloVHitFilter* m_hitFilter ; 00132 const CaloSubdetectorGeometry* m_geometry ; 00133 const EcalLaserDbService* m_lasercals ; 00134 00135 mutable CLHEP::RandPoissonQ* m_RandPoisson ; 00136 mutable CLHEP::RandGaussQ* m_RandGauss ; 00137 00138 int m_minBunch ; 00139 int m_maxBunch ; 00140 double m_phaseShift ; 00141 00142 edm::TimeValue_t m_iTime; 00143 bool m_useLCcorrection; 00144 00145 VecInd m_index ; 00146 }; 00147 00148 #endif