CMS 3D CMS Logo

PreMixingMuonWorker.h
Go to the documentation of this file.
1 #ifndef SimGeneral_PreMixingModule_PreMixingMuonWorker_h
2 #define SimGeneral_PreMixingModule_PreMixingMuonWorker_h
3 
10 
13 
14 template <typename DigiCollection>
16 public:
18  edm::ProducesCollector producesCollector,
20  : PreMixingMuonWorker(ps, producesCollector, iC) {}
22  ~PreMixingMuonWorker() override = default;
23 
24  void initializeEvent(edm::Event const& iEvent, edm::EventSetup const& iSetup) override {}
25  void addSignals(edm::Event const& iEvent, edm::EventSetup const& iSetup) override;
26  void addPileups(PileUpEventPrincipal const& pep, edm::EventSetup const& iSetup) override;
28  edm::EventSetup const& iSetup,
29  std::vector<PileupSummaryInfo> const& ps,
30  int bunchSpacing) override {
31  put(iEvent);
32  }
33 
34  void put(edm::Event& iEvent);
35 
36 private:
39  std::string collectionDM_; // secondary name to be given to new digis
40 
41  std::unique_ptr<DigiCollection> accumulated_;
42 };
43 
44 template <typename DigiCollection>
46  edm::ProducesCollector producesCollector,
48  : signalToken_(iC.consumes<DigiCollection>(ps.getParameter<edm::InputTag>("digiTagSig"))),
49  pileupTag_(ps.getParameter<edm::InputTag>("pileInputTag")),
50  collectionDM_(ps.getParameter<std::string>("collectionDM")) {
51  producesCollector.produces<DigiCollection>(collectionDM_);
52 }
53 
54 template <typename DigiCollection>
57  iEvent.getByToken(signalToken_, digis);
58 
59  accumulated_ = std::make_unique<DigiCollection>(*digis); // for signal we can just copy
60 }
61 
62 template <typename DigiCollection>
65  pep.getByLabel(pileupTag_, digis);
66  for (const auto& elem : *digis) {
67  accumulated_->put(elem.second, elem.first);
68  }
69 }
70 
71 template <typename DigiCollection>
73  iEvent.put(std::move(accumulated_), collectionDM_);
74 }
75 
76 #endif
Handle.h
PreMixingMuonWorker::collectionDM_
std::string collectionDM_
Definition: PreMixingMuonWorker.h:39
MessageLogger.h
edm::EDGetTokenT< DigiCollection >
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89353
PreMixingMuonWorker::pileupTag_
edm::InputTag pileupTag_
Definition: PreMixingMuonWorker.h:38
PileUpEventPrincipal
Definition: PileUpEventPrincipal.h:19
edm::Handle
Definition: AssociativeIterator.h:50
ProducesCollector.h
PreMixingMuonWorker::~PreMixingMuonWorker
~PreMixingMuonWorker() override=default
HLTEgPhaseIITestSequence_cff.bunchSpacing
bunchSpacing
Definition: HLTEgPhaseIITestSequence_cff.py:1574
PreMixingWorker.h
PileUpEventPrincipal.h
PreMixingMuonWorker::addPileups
void addPileups(PileUpEventPrincipal const &pep, edm::EventSetup const &iSetup) override
Definition: PreMixingMuonWorker.h:63
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
PreMixingMuonWorker
Definition: PreMixingMuonWorker.h:15
PreMixingMuonWorker::addSignals
void addSignals(edm::Event const &iEvent, edm::EventSetup const &iSetup) override
Definition: PreMixingMuonWorker.h:55
edm::ParameterSet
Definition: ParameterSet.h:47
PreMixingMuonWorker::accumulated_
std::unique_ptr< DigiCollection > accumulated_
Definition: PreMixingMuonWorker.h:41
Event.h
iEvent
int iEvent
Definition: GenABIO.cc:224
PreMixingMuonWorker::PreMixingMuonWorker
PreMixingMuonWorker(const edm::ParameterSet &ps, edm::ProducesCollector producesCollector, edm::ConsumesCollector &&iC)
Definition: PreMixingMuonWorker.h:17
edm::ProducesCollector::produces
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
Definition: ProducesCollector.h:52
edm::EventSetup
Definition: EventSetup.h:57
siStripShotFilter_cfi.DigiCollection
DigiCollection
Definition: siStripShotFilter_cfi.py:6
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
edm::ProducesCollector
Definition: ProducesCollector.h:43
PreMixingMuonWorker::put
void put(edm::Event &iEvent, edm::EventSetup const &iSetup, std::vector< PileupSummaryInfo > const &ps, int bunchSpacing) override
Definition: PreMixingMuonWorker.h:27
PreMixingMuonWorker::signalToken_
edm::EDGetTokenT< DigiCollection > signalToken_
Definition: PreMixingMuonWorker.h:37
PreMixingMuonWorker::initializeEvent
void initializeEvent(edm::Event const &iEvent, edm::EventSetup const &iSetup) override
Definition: PreMixingMuonWorker.h:24
PreMixingWorker
Definition: PreMixingWorker.h:14
ConsumesCollector.h
ParameterSet.h
PileUpEventPrincipal::getByLabel
bool getByLabel(edm::InputTag const &tag, edm::Handle< T > &result) const
Definition: PileUpEventPrincipal.h:33
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:45