CMS 3D CMS Logo

ModifiedObjectProducer.h
Go to the documentation of this file.
1 #ifndef __PhysicsTools_PatAlgos_ModifiedObjectProducer_h__
2 #define __PhysicsTools_PatAlgos_ModifiedObjectProducer_h__
3 
5 
11 
12 #include <memory>
13 
14 namespace pat {
15 
16  template<class T>
18  public:
19  typedef std::vector<T> Collection;
21 
23  //set our input source
24  src_ = consumes<edm::View<T> >(conf.getParameter<edm::InputTag>("src"));
25  //setup modifier
27  const edm::ParameterSet& mod_config =
28  conf.getParameter<edm::ParameterSet>("modifierConfig");
29  modifier_.reset( new Modifier(mod_config) );
30  modifier_->setConsumes(sumes);
31  //declare products
32  produces<Collection>();
33  }
35 
37  modifier_->setEventContent(evs);
38  }
39 
40  void produce(edm::Event& evt,const edm::EventSetup& evs) final {
42  auto output = std::make_unique<Collection>();
43 
44  evt.getByToken(src_,input);
45  output->reserve(input->size());
46 
47  modifier_->setEvent(evt);
48 
49  for( auto itr = input->begin(); itr != input->end(); ++itr ) {
50  output->push_back(*itr);
51  T& obj = output->back();
52  modifier_->modify(obj);
53  }
54 
55  evt.put(std::move(output));
56  }
57 
58  private:
60  std::unique_ptr<Modifier> modifier_;
61  };
62 }
63 
64 #endif
T getParameter(std::string const &) const
std::unique_ptr< Modifier > modifier_
void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &evs) final
ModifiedObjectProducer(const edm::ParameterSet &conf)
static std::string const input
Definition: EdmProvDump.cc:44
Definition: HeavyIon.h:7
edm::EDGetTokenT< edm::View< T > > src_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
void produce(edm::Event &evt, const edm::EventSetup &evs) final
pat::ObjectModifier< T > Modifier
long double T
def move(src, dest)
Definition: eostools.py:510