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:
19  ~PreMixingMuonWorker() override = default;
20 
21  void initializeEvent(edm::Event const& iEvent, edm::EventSetup const& iSetup) override {}
22  void addSignals(edm::Event const& iEvent, edm::EventSetup const& iSetup) override;
23  void addPileups(PileUpEventPrincipal const& pep, edm::EventSetup const& iSetup) override;
24  void put(edm::Event& iEvent, edm::EventSetup const& iSetup, std::vector<PileupSummaryInfo> const& ps, int bunchSpacing) override {
25  put(iEvent);
26  }
27 
28  void put(edm::Event& iEvent);
29 private:
32  std::string collectionDM_; // secondary name to be given to new digis
33 
34  std::unique_ptr<DigiCollection> accumulated_;
35 };
36 
37 template <typename DigiCollection>
39  signalToken_(iC.consumes<DigiCollection>(ps.getParameter<edm::InputTag>("digiTagSig"))),
40  pileupTag_(ps.getParameter<edm::InputTag>("pileInputTag")),
41  collectionDM_(ps.getParameter<std::string>("collectionDM"))
42 {
43  producer.produces<DigiCollection>(collectionDM_);
44 }
45 
46 template <typename DigiCollection>
49  iEvent.getByToken(signalToken_, digis);
50 
51  accumulated_ = std::make_unique<DigiCollection>(*digis); // for signal we can just copy
52 }
53 
54 template <typename DigiCollection>
57  pep.getByLabel(pileupTag_, digis);
58  for(const auto& elem: *digis) {
59  accumulated_->put(elem.second, elem.first);
60  }
61 }
62 
63 template <typename DigiCollection>
66 }
67 
68 #endif
BranchAliasSetterT< ProductType > produces()
declare what type of product will make and with which optional label
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
void put(edm::Event &iEvent, edm::EventSetup const &iSetup, std::vector< PileupSummaryInfo > const &ps, int bunchSpacing) override
PreMixingMuonWorker(const edm::ParameterSet &ps, edm::ProducerBase &producer, edm::ConsumesCollector &&iC)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
void addPileups(PileUpEventPrincipal const &pep, edm::EventSetup const &iSetup) override
void initializeEvent(edm::Event const &iEvent, edm::EventSetup const &iSetup) override
std::unique_ptr< DigiCollection > accumulated_
int iEvent
Definition: GenABIO.cc:230
void addSignals(edm::Event const &iEvent, edm::EventSetup const &iSetup) override
def elem(elemtype, innerHTML='', html_class='', kwargs)
Definition: HTMLExport.py:18
edm::EDGetTokenT< DigiCollection > signalToken_
HLT enums.
bool getByLabel(edm::InputTag const &tag, edm::Handle< T > &result) const
def move(src, dest)
Definition: eostools.py:511
~PreMixingMuonWorker() override=default