File indexing completed on 2024-04-06 12:30:33
0001
0002
0003
0004
0005
0006
0007 #include "DataMixingHcalDigiWorkerProd.h"
0008 #include "FWCore/Framework/interface/ConsumesCollector.h"
0009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0010 #include "FWCore/Utilities/interface/EDMException.h"
0011
0012 #include "FWCore/Framework/interface/Event.h"
0013 #include "FWCore/ServiceRegistry/interface/Service.h"
0014 #include "FWCore/Utilities/interface/RandomNumberGenerator.h"
0015
0016 using namespace std;
0017 namespace edm {
0018
0019 DataMixingHcalDigiWorkerProd::DataMixingHcalDigiWorkerProd(const edm::ParameterSet &ps,
0020 edm::ConsumesCollector &&iC,
0021 const edm::ESGetToken<HcalDbService, HcalDbRecord> &tok)
0022 : HBHEPileInputTag_(ps.getParameter<edm::InputTag>("HBHEPileInputTag")),
0023 HOPileInputTag_(ps.getParameter<edm::InputTag>("HOPileInputTag")),
0024 HFPileInputTag_(ps.getParameter<edm::InputTag>("HFPileInputTag")),
0025 ZDCPileInputTag_(ps.getParameter<edm::InputTag>("ZDCPileInputTag")),
0026 QIE10PileInputTag_(ps.getParameter<edm::InputTag>("QIE10PileInputTag")),
0027 QIE11PileInputTag_(ps.getParameter<edm::InputTag>("QIE11PileInputTag")),
0028 tokDB_(tok),
0029 label_(ps.getParameter<std::string>("Label")) {
0030
0031 tok_hbhe_ = iC.consumes<HBHEDigitizerTraits::DigiCollection>(HBHEPileInputTag_);
0032 tok_ho_ = iC.consumes<HODigitizerTraits::DigiCollection>(HOPileInputTag_);
0033 tok_hf_ = iC.consumes<HFDigitizerTraits::DigiCollection>(HFPileInputTag_);
0034 tok_zdc_ = iC.consumes<ZDCDigitizerTraits::DigiCollection>(ZDCPileInputTag_);
0035 tok_qie10_ = iC.consumes<HcalQIE10DigitizerTraits::DigiCollection>(QIE10PileInputTag_);
0036 tok_qie11_ = iC.consumes<HcalQIE11DigitizerTraits::DigiCollection>(QIE11PileInputTag_);
0037
0038 theHBHESignalGenerator = HBHESignalGenerator(HBHEPileInputTag_, tok_hbhe_);
0039 theHOSignalGenerator = HOSignalGenerator(HOPileInputTag_, tok_ho_);
0040 theHFSignalGenerator = HFSignalGenerator(HFPileInputTag_, tok_hf_);
0041 theZDCSignalGenerator = ZDCSignalGenerator(ZDCPileInputTag_, tok_zdc_);
0042 theQIE10SignalGenerator = QIE10SignalGenerator(QIE10PileInputTag_, tok_qie10_);
0043 theQIE11SignalGenerator = QIE11SignalGenerator(QIE11PileInputTag_, tok_qie11_);
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054 HBHEDigiCollectionDM_ = ps.getParameter<std::string>("HBHEDigiCollectionDM");
0055 HODigiCollectionDM_ = ps.getParameter<std::string>("HODigiCollectionDM");
0056 HFDigiCollectionDM_ = ps.getParameter<std::string>("HFDigiCollectionDM");
0057 ZDCDigiCollectionDM_ = ps.getParameter<std::string>("ZDCDigiCollectionDM");
0058 QIE10DigiCollectionDM_ = ps.getParameter<std::string>("QIE10DigiCollectionDM");
0059 QIE11DigiCollectionDM_ = ps.getParameter<std::string>("QIE11DigiCollectionDM");
0060
0061
0062
0063 myHcalDigitizer_ = new HcalDigiProducer(ps, iC);
0064
0065 myHcalDigitizer_->setHBHENoiseSignalGenerator(&theHBHESignalGenerator);
0066 myHcalDigitizer_->setHFNoiseSignalGenerator(&theHFSignalGenerator);
0067 myHcalDigitizer_->setHONoiseSignalGenerator(&theHOSignalGenerator);
0068 myHcalDigitizer_->setZDCNoiseSignalGenerator(&theZDCSignalGenerator);
0069 myHcalDigitizer_->setQIE10NoiseSignalGenerator(&theQIE10SignalGenerator);
0070 myHcalDigitizer_->setQIE11NoiseSignalGenerator(&theQIE11SignalGenerator);
0071 }
0072
0073
0074 DataMixingHcalDigiWorkerProd::~DataMixingHcalDigiWorkerProd() { delete myHcalDigitizer_; }
0075
0076 void DataMixingHcalDigiWorkerProd::beginRun(const edm::Run &run, const edm::EventSetup &ES) {
0077 myHcalDigitizer_->beginRun(run, ES);
0078 }
0079
0080 void DataMixingHcalDigiWorkerProd::initializeEvent(const edm::Event &e, const edm::EventSetup &ES) {
0081 myHcalDigitizer_->initializeEvent(e, ES);
0082 }
0083
0084 void DataMixingHcalDigiWorkerProd::addHcalSignals(const edm::Event &e, const edm::EventSetup &ES) {
0085 myHcalDigitizer_->accumulate(e, ES);
0086
0087 }
0088
0089 void DataMixingHcalDigiWorkerProd::addHcalPileups(const int bcr,
0090 const EventPrincipal *ep,
0091 unsigned int eventNr,
0092 const edm::EventSetup &ES,
0093 edm::ModuleCallingContext const *mcc) {
0094 LogDebug("DataMixingHcalDigiWorkerProd")
0095 << "\n===============> adding pileups from event " << ep->id() << " for bunchcrossing " << bcr;
0096
0097 theHBHESignalGenerator.initializeEvent(ep, &ES, tokDB_);
0098 theHOSignalGenerator.initializeEvent(ep, &ES, tokDB_);
0099 theHFSignalGenerator.initializeEvent(ep, &ES, tokDB_);
0100 theZDCSignalGenerator.initializeEvent(ep, &ES, tokDB_);
0101 theQIE10SignalGenerator.initializeEvent(ep, &ES, tokDB_);
0102 theQIE11SignalGenerator.initializeEvent(ep, &ES, tokDB_);
0103
0104
0105
0106 theHBHESignalGenerator.fill(mcc);
0107 theHOSignalGenerator.fill(mcc);
0108 theHFSignalGenerator.fill(mcc);
0109 theQIE10SignalGenerator.fill(mcc);
0110 theQIE11SignalGenerator.fill(mcc);
0111 }
0112
0113 void DataMixingHcalDigiWorkerProd::putHcal(edm::Event &e, const edm::EventSetup &ES) {
0114
0115
0116
0117
0118
0119
0120
0121 myHcalDigitizer_->finalizeEvent(e, ES);
0122 }
0123
0124 }