File indexing completed on 2024-04-06 12:29:27
0001 #ifndef SimCalorimetry_EcalSimProducers_EcalDigiProducer_Ph2_h
0002 #define SimCalorimetry_EcalSimProducers_EcalDigiProducer_Ph2_h
0003
0004 #include "SimCalorimetry/EcalSimAlgos/interface/APDShape.h"
0005 #include "SimCalorimetry/EcalSimAlgos/interface/ComponentShapeCollection.h"
0006 #include "SimCalorimetry/EcalSimAlgos/interface/EBShape.h"
0007 #include "DataFormats/Math/interface/Error.h"
0008 #include "FWCore/Framework/interface/ProducesCollector.h"
0009 #include "SimGeneral/NoiseGenerators/interface/CorrelatedNoisifier.h"
0010 #include "SimCalorimetry/EcalSimAlgos/interface/EcalCorrelatedNoiseMatrix.h"
0011 #include "SimCalorimetry/CaloSimAlgos/interface/CaloTDigitizer.h"
0012 #include "SimCalorimetry/EcalSimAlgos/interface/EcalTDigitizer.h"
0013 #include "SimCalorimetry/EcalSimAlgos/interface/EcalDigitizerTraits.h"
0014 #include "SimGeneral/MixingModule/interface/DigiAccumulatorMixMod.h"
0015 #include "SimCalorimetry/EcalSimAlgos/interface/EBHitResponse.h"
0016 #include "CondFormats/DataRecord/interface/EcalLiteDTUPedestalsRcd.h"
0017 #include "CondFormats/EcalObjects/interface/EcalLiteDTUPedestals.h"
0018 #include "CalibCalorimetry/EcalLaserCorrection/interface/EcalLaserDbRecord.h"
0019 #include "CondFormats/DataRecord/interface/EcalADCToGeVConstantRcd.h"
0020 #include "CondFormats/EcalObjects/interface/EcalADCToGeVConstant.h"
0021 #include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h"
0022 #include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h"
0023 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0024 #include "Geometry/Records/interface/CaloGeometryRecord.h"
0025 #include "SimDataFormats/CaloHit/interface/PCaloHit.h"
0026
0027 #include <vector>
0028
0029 class APDSimParameters;
0030 class ComponentSimParameterMap;
0031 class CaloHitResponse;
0032 class EcalSimParameterMap;
0033 class EcalLiteDTUCoder;
0034
0035 class EcalBaseSignalGenerator;
0036 class CaloGeometry;
0037 class EBDigiCollectionPh2;
0038 class PileUpEventPrincipal;
0039
0040 namespace edm {
0041 class ConsumesCollector;
0042 class ProducerBase;
0043 class Event;
0044 class EventSetup;
0045 template <typename T>
0046 class Handle;
0047 class ParameterSet;
0048 class StreamID;
0049 }
0050
0051 namespace CLHEP {
0052 class HepRandomEngine;
0053 }
0054
0055 class EcalDigiProducer_Ph2 : public DigiAccumulatorMixMod {
0056 public:
0057 typedef EcalTDigitizer<EBDigitizerTraits_Ph2> EBDigitizer_Ph2;
0058 typedef EBDigitizerTraits_Ph2::ElectronicsSim EcalElectronicsSim_Ph2;
0059
0060 EcalDigiProducer_Ph2(const edm::ParameterSet& params,
0061 edm::ProducesCollector producesCollector,
0062 edm::ConsumesCollector& iC);
0063 EcalDigiProducer_Ph2(const edm::ParameterSet& params, edm::ConsumesCollector& iC);
0064 ~EcalDigiProducer_Ph2() override;
0065
0066 void initializeEvent(edm::Event const& e, edm::EventSetup const& c) override;
0067 void accumulate(edm::Event const& e, edm::EventSetup const& c) override;
0068 void accumulate(PileUpEventPrincipal const& e, edm::EventSetup const& c, edm::StreamID const&) override;
0069 void finalizeEvent(edm::Event& e, edm::EventSetup const& c) override;
0070 void beginLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& setup) override;
0071
0072 void setEBNoiseSignalGenerator(EcalBaseSignalGenerator* noiseGenerator);
0073
0074 private:
0075 virtual void cacheEBDigis(const EBDigiCollectionPh2* ebDigiPtr) const {}
0076
0077 typedef edm::Handle<std::vector<PCaloHit>> HitsHandle;
0078
0079 edm::ESGetToken<EcalLiteDTUPedestalsMap, EcalLiteDTUPedestalsRcd> pedestalToken_;
0080 edm::ESGetToken<EcalLaserDbService, EcalLaserDbRecord> laserToken_;
0081 edm::ESGetToken<EcalADCToGeVConstant, EcalADCToGeVConstantRcd> agcToken_;
0082 edm::ESGetToken<EcalIntercalibConstants, EcalIntercalibConstantsRcd> icalToken_;
0083 edm::ESGetToken<CaloGeometry, CaloGeometryRecord> geom_token_;
0084 void accumulateCaloHits(HitsHandle const& ebHandle, int bunchCrossing);
0085
0086 void checkGeometry(const edm::EventSetup& eventSetup);
0087
0088 void updateGeometry();
0089
0090 void checkCalibrations(const edm::Event& event, const edm::EventSetup& eventSetup);
0091
0092 APDShape m_APDShape;
0093 ComponentShapeCollection m_ComponentShapes;
0094 EBShape m_EBShape;
0095
0096 const std::string m_EBdigiCollection;
0097 const std::string m_hitsProducerTag;
0098
0099 bool m_useLCcorrection;
0100
0101 const bool m_apdSeparateDigi;
0102 const bool m_componentSeparateDigi;
0103
0104 const double m_EBs25notCont;
0105
0106 const unsigned int m_readoutFrameSize;
0107
0108 protected:
0109 std::unique_ptr<const EcalSimParameterMap> m_ParameterMap;
0110
0111 private:
0112 const std::string m_apdDigiTag;
0113 std::unique_ptr<const APDSimParameters> m_apdParameters;
0114
0115 const std::string m_componentDigiTag;
0116 std::unique_ptr<const ComponentSimParameterMap> m_componentParameters;
0117
0118 std::unique_ptr<EBHitResponse_Ph2> m_APDResponse;
0119
0120 std::unique_ptr<EBHitResponse_Ph2> m_ComponentResponse;
0121
0122 protected:
0123 std::unique_ptr<EBHitResponse_Ph2> m_EBResponse;
0124
0125 private:
0126 const bool m_PreMix1;
0127 const bool m_PreMix2;
0128
0129 const edm::EDGetTokenT<std::vector<PCaloHit>> m_HitsEBToken;
0130
0131 std::unique_ptr<EBDigitizer_Ph2> m_APDDigitizer;
0132 std::unique_ptr<EBDigitizer_Ph2> m_ComponentDigitizer;
0133 std::unique_ptr<EBDigitizer_Ph2> m_BarrelDigitizer;
0134
0135 std::unique_ptr<EcalElectronicsSim_Ph2> m_ElectronicsSim;
0136 std::unique_ptr<EcalLiteDTUCoder> m_Coder;
0137
0138 typedef CaloTSamples<float, ecalPh2::sampleSize> EcalSamples_Ph2;
0139 std::unique_ptr<EcalElectronicsSim<EcalLiteDTUCoder, EcalSamples_Ph2, EcalDataFrame_Ph2>> m_APDElectronicsSim;
0140 std::unique_ptr<EcalLiteDTUCoder> m_APDCoder;
0141 std::unique_ptr<EcalElectronicsSim<EcalLiteDTUCoder, EcalSamples_Ph2, EcalDataFrame_Ph2>> m_ComponentElectronicsSim;
0142 std::unique_ptr<EcalLiteDTUCoder> m_ComponentCoder;
0143
0144 const CaloGeometry* m_Geometry;
0145
0146 std::array<std::unique_ptr<CorrelatedNoisifier<EcalCorrMatrix_Ph2>>, 2> m_EBCorrNoise;
0147
0148 CLHEP::HepRandomEngine* randomEngine_ = nullptr;
0149 };
0150
0151 #endif