Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-05-05 01:48:36

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