File indexing completed on 2024-04-06 12:29:33
0001 #ifndef SimCalorimetry_HcalTestBeam_HcalTBDigiProducer_h
0002 #define SimCalorimetry_HcalTestBeam_HcalTBDigiProducer_h
0003
0004 #include "CalibFormats/HcalObjects/interface/HcalDbRecord.h"
0005 #include "FWCore/Framework/interface/Event.h"
0006 #include "FWCore/Framework/interface/EventSetup.h"
0007 #include "FWCore/Framework/interface/ESWatcher.h"
0008 #include "FWCore/Framework/interface/FrameworkfwdMostUsed.h"
0009 #include "FWCore/Framework/interface/ProducesCollector.h"
0010 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0011 #include "Geometry/Records/interface/CaloGeometryRecord.h"
0012 #include "SimCalorimetry/CaloSimAlgos/interface/CaloHitResponse.h"
0013 #include "SimCalorimetry/CaloSimAlgos/interface/CaloTDigitizer.h"
0014 #include "SimCalorimetry/HcalSimAlgos/interface/HcalAmplifier.h"
0015 #include "SimCalorimetry/HcalSimAlgos/interface/HcalCoderFactory.h"
0016 #include "SimCalorimetry/HcalSimAlgos/interface/HcalDigitizerTraits.h"
0017 #include "SimCalorimetry/HcalSimAlgos/interface/HcalElectronicsSim.h"
0018 #include "SimCalorimetry/HcalSimAlgos/interface/HcalHitFilter.h"
0019 #include "SimCalorimetry/HcalSimAlgos/interface/HcalShape.h"
0020 #include "SimCalorimetry/HcalSimAlgos/interface/HcalTimeSlewSim.h"
0021 #include "SimCalorimetry/HcalTestBeam/interface/HcalTBSimParameterMap.h"
0022 #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h"
0023 #include "SimGeneral/MixingModule/interface/DigiAccumulatorMixMod.h"
0024 #include "SimCalorimetry/HcalSimAlgos/interface/HcalSimParameters.h"
0025
0026 #include <memory>
0027 #include <string>
0028 #include <vector>
0029
0030 class PEcalTBInfo;
0031
0032 namespace CLHEP {
0033 class HepRandomEngine;
0034 }
0035
0036 class HcalTBDigiProducer : public DigiAccumulatorMixMod {
0037 public:
0038 explicit HcalTBDigiProducer(const edm::ParameterSet &ps, edm::ProducesCollector, edm::ConsumesCollector &iC);
0039 ~HcalTBDigiProducer() override;
0040
0041 void initializeEvent(edm::Event const &e, edm::EventSetup const &c) override;
0042 void accumulate(edm::Event const &e, edm::EventSetup const &c) override;
0043 void accumulate(PileUpEventPrincipal const &e, edm::EventSetup const &c, edm::StreamID const &) override;
0044 void finalizeEvent(edm::Event &e, edm::EventSetup const &c) override;
0045
0046 private:
0047 void accumulateCaloHits(edm::Handle<std::vector<PCaloHit>> const &hits, int bunchCrossing);
0048
0049
0050 void sortHits(const edm::PCaloHitContainer &hits);
0051
0052
0053 void checkGeometry(const edm::EventSetup &eventSetup);
0054 void updateGeometry();
0055
0056 void setPhaseShift(const DetId &detId);
0057
0058 const HcalTimeSlew *hcalTimeSlew_delay_;
0059
0060 private:
0061
0062 typedef CaloTDigitizer<HBHEDigitizerTraits> HBHEDigitizer;
0063 typedef CaloTDigitizer<HODigitizerTraits> HODigitizer;
0064
0065 const double tunePhaseShift;
0066 const std::string ecalTBInfoLabel;
0067
0068 HcalTBSimParameterMap *theParameterMap;
0069 HcalSimParameterMap *paraMap;
0070 CaloVShape *theHcalShape;
0071 CaloVShape *theHcalIntegratedShape;
0072
0073 CaloHitResponse *theHBHEResponse;
0074 CaloHitResponse *theHOResponse;
0075
0076 HcalAmplifier *theAmplifier;
0077 HcalCoderFactory *theCoderFactory;
0078 HcalElectronicsSim *theElectronicsSim;
0079
0080 HBHEHitFilter theHBHEHitFilter;
0081 HOHitFilter theHOHitFilter;
0082
0083 HcalTimeSlewSim *theTimeSlewSim;
0084
0085 std::unique_ptr<HBHEDigitizer> theHBHEDigitizer;
0086 std::unique_ptr<HODigitizer> theHODigitizer;
0087
0088 const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> geometryToken_;
0089 const edm::ESGetToken<HcalDbService, HcalDbRecord> conditionsToken_;
0090 const edm::ESGetToken<HcalTimeSlew, HcalTimeSlewRecord> hcalTimeSlew_delay_token_;
0091 edm::ESWatcher<CaloGeometryRecord> geometryWatcher_;
0092 const edm::EDGetTokenT<std::vector<PCaloHit>> hcalToken_;
0093 edm::EDGetTokenT<PEcalTBInfo> theEcalTBToken_;
0094 const CaloGeometry *theGeometry;
0095 std::vector<DetId> hbheCells;
0096 std::vector<DetId> hoCells;
0097
0098 std::vector<PCaloHit> theHBHEHits, theHOHits;
0099
0100 double thisPhaseShift;
0101
0102 bool doPhaseShift;
0103
0104 CLHEP::HepRandomEngine *randomEngine_ = nullptr;
0105 };
0106
0107 #endif