CMS 3D CMS Logo

PreMixingCrossingFrameWorker.cc
Go to the documentation of this file.
7 
10 
13 
14 namespace edm {
15  template <typename T>
17  public:
19  ~PreMixingCrossingFrameWorker() 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 
26  private:
29  std::string collectionDM_; // secondary name to be given to new digis
30 
31  std::unique_ptr<PCrossingFrame<T> > merged_;
32  };
33 
34  template <typename T>
36  signalToken_(iC.consumes<CrossingFrame<T> >(ps.getParameter<edm::InputTag>("labelSig"))),
37  pileupTag_(ps.getParameter<edm::InputTag>("pileInputTag")),
38  collectionDM_(ps.getParameter<std::string>("collectionDM"))
39  {
40  producer.produces<PCrossingFrame<T> >(collectionDM_); // TODO: this is needed only to store the pointed-to objects, do we really need it?
42  }
43 
44  template <typename T>
47  iEvent.getByToken(signalToken_, hcf);
48 
49  const auto& cf = *hcf;
50  if(!cf.getPileups().empty()) {
51  throw cms::Exception("LogicError") << "Got CrossingFrame from signal with pileup content?";
52  }
53 
54  merged_ = std::make_unique<PCrossingFrame<T> >(cf); // for signal we just copy
55  }
56 
57  template <typename T>
60  pep.getByLabel(pileupTag_, hcf);
61 
62  const auto& cf = *hcf;
63  if(!cf.getSignals().empty()) {
64  throw cms::Exception("LogicError") << "Got PCrossingFrame from pileup with signal content?";
65  }
66 
67  merged_->setAllExceptSignalFrom(cf);
68  }
69 
70  template <typename T>
71  void PreMixingCrossingFrameWorker<T>::put(edm::Event& iEvent, edm::EventSetup const& iSetup, std::vector<PileupSummaryInfo> const& ps, int bunchSpacing) {
72  auto orphanHandle = iEvent.put(std::move(merged_), collectionDM_);
73  const auto& pcf = *orphanHandle;
74 
75  const auto bx = pcf.getBunchRange();
76  auto cf = std::make_unique<CrossingFrame<T> >(bx.first, bx.second, pcf.getBunchSpace(), pcf.getSubDet(), pcf.getMaxNbSources());
77  cf->addSignals(&(pcf.getSignals()), pcf.getEventID());
78  cf->setPileups(pcf.getPileups());
79  iEvent.put(std::move(cf), collectionDM_);
80  }
81 }
82 
85 
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 addSignals(edm::Event const &iEvent, edm::EventSetup const &iSetup) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
~PreMixingCrossingFrameWorker() override=default
std::unique_ptr< PCrossingFrame< T > > merged_
int iEvent
Definition: GenABIO.cc:230
void put(edm::Event &iEvent, edm::EventSetup const &iSetup, std::vector< PileupSummaryInfo > const &ps, int bunchSpacing) override
PreMixingCrossingFrameWorker(const edm::ParameterSet &ps, edm::ProducerBase &producer, edm::ConsumesCollector &&iC)
edm::EDGetTokenT< CrossingFrame< T > > signalToken_
void initializeEvent(edm::Event const &iEvent, edm::EventSetup const &iSetup) override
void addPileups(PileUpEventPrincipal const &pep, edm::EventSetup const &iSetup) override
HLT enums.
bool getByLabel(edm::InputTag const &tag, edm::Handle< T > &result) const
long double T
#define DEFINE_PREMIXING_WORKER(TYPE)
def move(src, dest)
Definition: eostools.py:511