CMS 3D CMS Logo

ProducerUsingCollector.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: FWCore/Integration
4 // Class: ProducerUsingCollector
5 //
12 // Original Author: W. David Dagenhart
13 // Created: 26 September 2019
14 
15 #include "DataFormats/TestObjects/interface/ToyProducts.h"
28 
29 namespace edmtest {
30 
32  public:
34  void putEventProducts(edm::Event&) const;
35  void putBeginRunProducts(edm::Run&) const;
36  void putEndRunProducts(edm::Run&) const;
39 
40  private:
49  };
50 
52  : eventToken_(producesCollector.produces<IntProduct>()),
53  eventWithInstanceToken_(producesCollector.produces<IntProduct>("event")),
54  eventWithTransitionToken_(producesCollector.produces<UInt64Product, edm::Transition::Event>()),
55  eventUsingTypeIDToken_(producesCollector.produces(edm::TypeID(typeid(IntProduct)), "eventOther")),
56  brToken_(producesCollector.produces<IntProduct, edm::Transition::BeginRun>("beginRun")),
57  blToken_(producesCollector.produces<edm::Transition::BeginLuminosityBlock>(edm::TypeID(typeid(IntProduct)),
58  "beginLumi")) {
59  edm::ProducesCollector copy(producesCollector);
60  erToken_ = copy.produces<IntProduct, edm::Transition::EndRun>("endRun");
61 
62  copy = producesCollector;
63  edm::ProducesCollector copy2(producesCollector);
64  copy2 = std::move(copy);
65  elToken_ = copy.produces<edm::Transition::EndLuminosityBlock>(edm::TypeID(typeid(IntProduct)), "endLumi");
66  }
67 
69  event.emplace(eventToken_, 1);
70  event.emplace(eventWithInstanceToken_, 2);
71  event.emplace(eventWithTransitionToken_, 3);
72  event.put(eventUsingTypeIDToken_, std::make_unique<IntProduct>(4));
73  }
74 
76 
78 
80  luminosityBlock.put(blToken_, std::make_unique<IntProduct>(7));
81  }
82 
84  luminosityBlock.put(elToken_, std::make_unique<IntProduct>(8));
85  }
86 
87  class ProducerUsingCollector : public edm::global::EDProducer<edm::BeginRunProducer,
88  edm::EndRunProducer,
89  edm::EndLuminosityBlockProducer,
90  edm::BeginLuminosityBlockProducer> {
91  public:
93 
94  ~ProducerUsingCollector() override;
95 
96  void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override;
97 
98  void globalBeginRunProduce(edm::Run&, edm::EventSetup const&) const override;
99 
100  void globalEndRunProduce(edm::Run&, edm::EventSetup const&) const override;
101 
103 
105 
107 
108  private:
110  };
111 
112  ProducerUsingCollector::ProducerUsingCollector(edm::ParameterSet const&) : helper_(producesCollector()) {}
113 
115 
118  }
119 
121  edm::EventSetup const&) const {
123  }
124 
127  }
128 
131  }
132 
135  }
136 
139  descriptions.addDefault(desc);
140  }
141 
142 } // namespace edmtest
edm::EDPutTokenT< UInt64Product > eventWithTransitionToken_
void globalBeginLuminosityBlockProduce(edm::LuminosityBlock &, edm::EventSetup const &) const override
static void fillDescriptions(edm::ConfigurationDescriptions &)
ProducerHelperUsingCollector(edm::ProducesCollector &&)
void globalBeginRunProduce(edm::Run &, edm::EventSetup const &) const override
edm::EDPutTokenT< IntProduct > erToken_
void globalEndRunProduce(edm::Run &, edm::EventSetup const &) const override
void putEndLumiProducts(edm::LuminosityBlock &) const
edm::EDPutTokenT< IntProduct > eventToken_
void produce(edm::StreamID, edm::Event &, edm::EventSetup const &) const override
void addDefault(ParameterSetDescription const &psetDescription)
void put(std::unique_ptr< PROD > product)
Put a new product.
Transition
Definition: Transition.h:12
ProducerHelperUsingCollector helper_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::EDPutTokenT< IntProduct > brToken_
edm::EDPutTokenT< IntProduct > eventWithInstanceToken_
ProducerUsingCollector(edm::ParameterSet const &)
HLT enums.
void globalEndLuminosityBlockProduce(edm::LuminosityBlock &, edm::EventSetup const &) const override
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1
Definition: Run.h:45
void putBeginLumiProducts(edm::LuminosityBlock &) const