CMS 3D CMS Logo

CollectionAdder.h
Go to the documentation of this file.
1 #ifndef PhysicsTools_UtilAlgos_CollectionAdder_h
2 #define PhysicsTools_UtilAlgos_CollectionAdder_h
3 /* \class CollectionAdder<C>
4  *
5  * \author Luca Lista, INFN
6  *
7  * \version $Id: CollectionAdder.h,v 1.3 2010/02/20 20:55:17 wmtan Exp $
8  */
15 
16 template <typename C>
18 public:
19  typedef C collection;
21  : srcTokens_(edm::vector_transform(cfg.template getParameter<std::vector<edm::InputTag>>("src"),
22  [this](edm::InputTag const& tag) { return consumes<collection>(tag); })) {
23  produces<collection>();
24  }
25 
26 private:
27  std::vector<edm::EDGetTokenT<collection>> srcTokens_;
28  void produce(edm::Event& evt, const edm::EventSetup&) override {
29  std::unique_ptr<collection> coll(new collection);
30  typename collection::Filler filler(*coll);
31  for (size_t i = 0; i < srcTokens_.size(); ++i) {
33  evt.getByToken(srcTokens_[i], src);
34  *coll += *src;
35  }
36  evt.put(std::move(coll));
37  }
38 };
39 
40 #endif
Handle.h
mps_fire.i
i
Definition: mps_fire.py:355
EDProducer.h
edm
HLT enums.
Definition: AlignableModifier.h:19
CollectionAdder::srcTokens_
std::vector< edm::EDGetTokenT< collection > > srcTokens_
Definition: CollectionAdder.h:27
watchdog.const
const
Definition: watchdog.py:83
edm::Handle
Definition: AssociativeIterator.h:50
CollectionAdder::CollectionAdder
CollectionAdder(const edm::ParameterSet &cfg)
Definition: CollectionAdder.h:20
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
CollectionAdder::collection
C collection
Definition: CollectionAdder.h:19
edm::vector_transform
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
TrackRefitter_38T_cff.src
src
Definition: TrackRefitter_38T_cff.py:24
Event.h
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:132
edm::EventSetup
Definition: EventSetup.h:57
svgfig.template
def template(fileName, svg, replaceme="REPLACEME")
Definition: svgfig.py:521
InputTag.h
looper.cfg
cfg
Definition: looper.py:297
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
gen::C
C
Definition: PomwigHadronizer.cc:76
CollectionAdder::produce
void produce(edm::Event &evt, const edm::EventSetup &) override
Definition: CollectionAdder.h:28
transform.h
edm::EDProducer
Definition: EDProducer.h:36
ParameterSet.h
edm::Event
Definition: Event.h:73
CollectionAdder
Definition: CollectionAdder.h:17