Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:30:08

0001 #include "FWCore/Framework/interface/Event.h"
0002 #include "FWCore/Framework/interface/EventPrincipal.h"
0003 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0004 #include "FWCore/Framework/interface/ConsumesCollector.h"
0005 #include "FWCore/Framework/interface/ProducesCollector.h"
0006 
0007 #include "SimGeneral/MixingModule/interface/DigiAccumulatorMixMod.h"
0008 #include "SimGeneral/MixingModule/interface/DigiAccumulatorMixModFactory.h"
0009 #include "SimGeneral/MixingModule/interface/PileUpEventPrincipal.h"
0010 
0011 #include "SimGeneral/PreMixingModule/interface/PreMixingWorker.h"
0012 #include "SimGeneral/PreMixingModule/interface/PreMixingWorkerFactory.h"
0013 
0014 class PreMixingDigiAccumulatorWorker : public PreMixingWorker {
0015 public:
0016   PreMixingDigiAccumulatorWorker(const edm::ParameterSet& ps,
0017                                  edm::ProducesCollector producesCollector,
0018                                  edm::ConsumesCollector&& iC)
0019       : accumulator_(edm::DigiAccumulatorMixModFactory::get()->makeDigiAccumulator(
0020             ps.getParameter<edm::ParameterSet>("accumulator"), producesCollector, iC)) {}
0021   ~PreMixingDigiAccumulatorWorker() override = default;
0022 
0023   void initializeEvent(const edm::Event& e, const edm::EventSetup& ES) override {
0024     accumulator_->initializeEvent(e, ES);
0025   }
0026 
0027   void initializeBunchCrossing(edm::Event const& e, edm::EventSetup const& ES, int bunchCrossing) override {
0028     accumulator_->initializeBunchCrossing(e, ES, bunchCrossing);
0029   }
0030   void finalizeBunchCrossing(edm::Event& e, edm::EventSetup const& ES, int bunchCrossing) override {
0031     accumulator_->finalizeBunchCrossing(e, ES, bunchCrossing);
0032   }
0033 
0034   void addSignals(const edm::Event& e, const edm::EventSetup& ES) override { accumulator_->accumulate(e, ES); }
0035   void addPileups(PileUpEventPrincipal const& pep, edm::EventSetup const& ES) override {
0036     accumulator_->accumulate(pep, ES, pep.principal().streamID());
0037   }
0038   void put(edm::Event& e, const edm::EventSetup& ES, std::vector<PileupSummaryInfo> const& ps, int bs) override {
0039     accumulator_->finalizeEvent(e, ES);
0040   }
0041 
0042 private:
0043   std::unique_ptr<DigiAccumulatorMixMod> accumulator_;
0044 };
0045 
0046 DEFINE_PREMIXING_WORKER(PreMixingDigiAccumulatorWorker);