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,
25  edm::EventSetup const& iSetup,
26  std::vector<PileupSummaryInfo> const& ps,
27  int bunchSpacing) override;
28 
29  private:
32  std::string collectionDM_; // secondary name to be given to new digis
33 
34  std::unique_ptr<PCrossingFrame<T> > merged_;
35  };
36 
37  template <typename T>
39  edm::ProducesCollector producesCollector,
41  : signalToken_(iC.consumes<CrossingFrame<T> >(ps.getParameter<edm::InputTag>("labelSig"))),
42  pileupTag_(ps.getParameter<edm::InputTag>("pileInputTag")),
43  collectionDM_(ps.getParameter<std::string>("collectionDM")) {
44  producesCollector.produces<PCrossingFrame<T> >(
45  collectionDM_); // TODO: this is needed only to store the pointed-to objects, do we really need it?
46  producesCollector.produces<CrossingFrame<T> >(collectionDM_);
47  }
48 
49  template <typename T>
52  iEvent.getByToken(signalToken_, hcf);
53 
54  const auto& cf = *hcf;
55  if (!cf.getPileups().empty()) {
56  throw cms::Exception("LogicError") << "Got CrossingFrame from signal with pileup content?";
57  }
58 
59  merged_ = std::make_unique<PCrossingFrame<T> >(cf); // for signal we just copy
60  }
61 
62  template <typename T>
65  pep.getByLabel(pileupTag_, hcf);
66 
67  const auto& cf = *hcf;
68  if (!cf.getSignals().empty()) {
69  throw cms::Exception("LogicError") << "Got PCrossingFrame from pileup with signal content?";
70  }
71 
72  merged_->setAllExceptSignalFrom(cf);
73  }
74 
75  template <typename T>
77  edm::EventSetup const& iSetup,
78  std::vector<PileupSummaryInfo> const& ps,
79  int bunchSpacing) {
80  auto orphanHandle = iEvent.put(std::move(merged_), collectionDM_);
81  const auto& pcf = *orphanHandle;
82 
83  const auto bx = pcf.getBunchRange();
84  auto cf = std::make_unique<CrossingFrame<T> >(
85  bx.first, bx.second, pcf.getBunchSpace(), pcf.getSubDet(), pcf.getMaxNbSources());
86  cf->addSignals(&(pcf.getSignals()), pcf.getEventID());
87  cf->setPileups(pcf.getPileups());
88  iEvent.put(std::move(cf), collectionDM_);
89  }
90 } // namespace edm
91 
94 
edm::PreMixingCrossingFrameWorker::addSignals
void addSignals(edm::Event const &iEvent, edm::EventSetup const &iSetup) override
Definition: PreMixingCrossingFrameWorker.cc:50
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
CrossingFrame.h
PCrossingFrame
Definition: CrossingFrame.h:27
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
PileUpEventPrincipal
Definition: PileUpEventPrincipal.h:19
edm::Handle
Definition: AssociativeIterator.h:50
ProducesCollector.h
edm::PreMixingCrossingFrameWorker::~PreMixingCrossingFrameWorker
~PreMixingCrossingFrameWorker() override=default
CrossingFrame
Definition: CrossingFrame.h:37
PSimHit.h
HLTEgPhaseIITestSequence_cff.bunchSpacing
bunchSpacing
Definition: HLTEgPhaseIITestSequence_cff.py:1574
PreMixingWorker.h
EventPrincipal.h
edm::PreMixingCrossingFrameWorker::put
void put(edm::Event &iEvent, edm::EventSetup const &iSetup, std::vector< PileupSummaryInfo > const &ps, int bunchSpacing) override
Definition: PreMixingCrossingFrameWorker.cc:76
edm::PreMixingCrossingFrameWorker::merged_
std::unique_ptr< PCrossingFrame< T > > merged_
Definition: PreMixingCrossingFrameWorker.cc:34
PileUpEventPrincipal.h
edm::ParameterSet
Definition: ParameterSet.h:47
edm::PreMixingCrossingFrameWorker::signalToken_
edm::EDGetTokenT< CrossingFrame< T > > signalToken_
Definition: PreMixingCrossingFrameWorker.cc:30
Event.h
PCrossingFrame.h
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::ProducesCollector::produces
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
Definition: ProducesCollector.h:52
edm::EventSetup
Definition: EventSetup.h:58
edm::PreMixingCrossingFrameWorker::collectionDM_
std::string collectionDM_
Definition: PreMixingCrossingFrameWorker.cc:32
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
PreMixingWorkerFactory.h
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
edm::ProducesCollector
Definition: ProducesCollector.h:43
edm::PreMixingCrossingFrameWorker::initializeEvent
void initializeEvent(edm::Event const &iEvent, edm::EventSetup const &iSetup) override
Definition: PreMixingCrossingFrameWorker.cc:21
T
long double T
Definition: Basic3DVectorLD.h:48
Exception
Definition: hltDiff.cc:245
DEFINE_PREMIXING_WORKER
#define DEFINE_PREMIXING_WORKER(TYPE)
Definition: PreMixingWorkerFactory.h:16
edm::PreMixingCrossingFrameWorker::addPileups
void addPileups(PileUpEventPrincipal const &pep, edm::EventSetup const &iSetup) override
Definition: PreMixingCrossingFrameWorker.cc:63
edm::PreMixingCrossingFrameWorker
Definition: PreMixingCrossingFrameWorker.cc:16
PreMixingWorker
Definition: PreMixingWorker.h:14
edm::PreMixingCrossingFrameWorker::pileupTag_
edm::InputTag pileupTag_
Definition: PreMixingCrossingFrameWorker.cc:31
ConsumesCollector.h
edm::PreMixingCrossingFrameWorker::PreMixingCrossingFrameWorker
PreMixingCrossingFrameWorker(const edm::ParameterSet &ps, edm::ProducesCollector, edm::ConsumesCollector &&iC)
Definition: PreMixingCrossingFrameWorker.cc:38
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