00001 #ifndef SimCalorimetry_EcalSimProducers_EcalDigiProducer_h 00002 #define SimCalorimetry_EcalSimProducers_EcalDigiProducer_h 00003 00004 #include "SimCalorimetry/EcalSimAlgos/interface/APDShape.h" 00005 #include "SimCalorimetry/EcalSimAlgos/interface/EBShape.h" 00006 #include "SimCalorimetry/EcalSimAlgos/interface/EEShape.h" 00007 #include "SimCalorimetry/EcalSimAlgos/interface/ESShape.h" 00008 #include "DataFormats/Math/interface/Error.h" 00009 #include "SimGeneral/NoiseGenerators/interface/CorrelatedNoisifier.h" 00010 #include "SimCalorimetry/EcalSimAlgos/interface/EcalCorrelatedNoiseMatrix.h" 00011 #include "SimCalorimetry/EcalSimAlgos/interface/ESElectronicsSim.h" 00012 00013 #include "SimCalorimetry/CaloSimAlgos/interface/CaloTDigitizer.h" 00014 #include "SimCalorimetry/EcalSimAlgos/interface/EcalTDigitizer.h" 00015 #include "SimCalorimetry/EcalSimAlgos/interface/EcalDigitizerTraits.h" 00016 #include "SimGeneral/MixingModule/interface/DigiAccumulatorMixMod.h" 00017 00018 00019 #include <vector> 00020 00021 typedef EcalTDigitizer<EBDigitizerTraits> EBDigitizer ; 00022 typedef EcalTDigitizer<EEDigitizerTraits> EEDigitizer ; 00023 typedef CaloTDigitizer<ESOldDigitizerTraits> ESOldDigitizer ; 00024 00025 class ESDigitizer ; 00026 00027 class APDSimParameters ; 00028 class EBHitResponse ; 00029 class EEHitResponse ; 00030 class ESHitResponse ; 00031 class CaloHitResponse ; 00032 class EcalSimParameterMap ; 00033 class EcalCoder ; 00034 class EcalElectronicsSim ; 00035 class ESElectronicsSim ; 00036 class ESElectronicsSimFast ; 00037 class CaloGeometry ; 00038 class EBDigiCollection ; 00039 class EEDigiCollection ; 00040 class ESDigiCollection ; 00041 class PileUpEventPrincipal ; 00042 00043 namespace edm { 00044 class EDProducer; 00045 class Event; 00046 class EventSetup; 00047 template<typename T> class Handle; 00048 class ParameterSet; 00049 } 00050 00051 class EcalDigiProducer : public DigiAccumulatorMixMod { 00052 public: 00053 00054 EcalDigiProducer( const edm::ParameterSet& params , edm::EDProducer& mixMod); 00055 virtual ~EcalDigiProducer(); 00056 00057 virtual void initializeEvent(edm::Event const& e, edm::EventSetup const& c); 00058 virtual void accumulate(edm::Event const& e, edm::EventSetup const& c); 00059 virtual void accumulate(PileUpEventPrincipal const& e, edm::EventSetup const& c); 00060 virtual void finalizeEvent(edm::Event& e, edm::EventSetup const& c); 00061 00062 private: 00063 00064 virtual void cacheEBDigis( const EBDigiCollection* ebDigiPtr ) const { } 00065 virtual void cacheEEDigis( const EEDigiCollection* eeDigiPtr ) const { } 00066 00067 typedef edm::Handle<std::vector<PCaloHit> > HitsHandle; 00068 void accumulateCaloHits(HitsHandle const& ebHandle, HitsHandle const& eeHandle, HitsHandle const& esHandle, int bunchCrossing); 00069 00070 void checkGeometry(const edm::EventSetup& eventSetup) ; 00071 00072 void updateGeometry() ; 00073 00074 void checkCalibrations(const edm::Event& event, const edm::EventSetup& eventSetup) ; 00075 00076 const APDShape m_APDShape ; 00077 const EBShape m_EBShape ; 00078 const EEShape m_EEShape ; 00079 ESShape m_ESShape ; // no const because gain must be set 00080 00081 const std::string m_EBdigiCollection ; 00082 const std::string m_EEdigiCollection ; 00083 const std::string m_ESdigiCollection ; 00084 const std::string m_hitsProducerTag ; 00085 00086 bool m_useLCcorrection; 00087 00088 const bool m_apdSeparateDigi ; 00089 00090 const double m_EBs25notCont ; 00091 const double m_EEs25notCont ; 00092 00093 const unsigned int m_readoutFrameSize ; 00094 protected: 00095 const EcalSimParameterMap* m_ParameterMap ; 00096 private: 00097 const std::string m_apdDigiTag ; 00098 const APDSimParameters* m_apdParameters ; 00099 00100 EBHitResponse* m_APDResponse ; 00101 protected: 00102 EBHitResponse* m_EBResponse ; 00103 EEHitResponse* m_EEResponse ; 00104 private: 00105 ESHitResponse* m_ESResponse ; 00106 CaloHitResponse* m_ESOldResponse ; 00107 00108 const bool m_addESNoise ; 00109 00110 const bool m_doFastES ; 00111 00112 ESElectronicsSim* m_ESElectronicsSim ; 00113 ESOldDigitizer* m_ESOldDigitizer ; 00114 ESElectronicsSimFast* m_ESElectronicsSimFast ; 00115 ESDigitizer* m_ESDigitizer ; 00116 00117 EBDigitizer* m_APDDigitizer ; 00118 EBDigitizer* m_BarrelDigitizer ; 00119 EEDigitizer* m_EndcapDigitizer ; 00120 00121 EcalElectronicsSim* m_ElectronicsSim ; 00122 EcalCoder* m_Coder ; 00123 00124 EcalElectronicsSim* m_APDElectronicsSim ; 00125 EcalCoder* m_APDCoder ; 00126 00127 const CaloGeometry* m_Geometry ; 00128 00129 CorrelatedNoisifier<EcalCorrMatrix>* m_EBCorrNoise[3] ; 00130 CorrelatedNoisifier<EcalCorrMatrix>* m_EECorrNoise[3] ; 00131 }; 00132 00133 #endif