CMS 3D CMS Logo

ModifiedObjectProducer.cc
Go to the documentation of this file.
13 
14 #include <memory>
15 
16 namespace pat {
17 
18  template <class T>
20  public:
21  typedef std::vector<T> Collection;
23 
25  //set our input source
26  src_ = consumes<edm::View<T> >(conf.getParameter<edm::InputTag>("src"));
27  //setup modifier
28  const edm::ParameterSet& mod_config = conf.getParameter<edm::ParameterSet>("modifierConfig");
29  modifier_ = std::make_unique<Modifier>(mod_config, consumesCollector());
30  //declare products
31  produces<Collection>();
32  }
34 
35  void produce(edm::Event& evt, const edm::EventSetup& evs) final {
36  modifier_->setEventContent(evs);
37 
38  auto output = std::make_unique<Collection>();
39 
40  auto input = evt.getHandle(src_);
41  output->reserve(input->size());
42 
43  modifier_->setEvent(evt);
44 
45  for (auto const& itr : *input) {
46  output->push_back(itr);
47  T& obj = output->back();
48  modifier_->modify(obj);
49  }
50 
51  evt.put(std::move(output));
52  }
53 
54  private:
56  std::unique_ptr<Modifier> modifier_;
57  };
58 } // namespace pat
59 
66 
pat::ModifiedObjectProducer::Modifier
pat::ObjectModifier< T > Modifier
Definition: ModifiedObjectProducer.cc:22
pat::ModifiedObjectProducer
Definition: ModifiedObjectProducer.cc:19
ObjectModifier.h
input
static const std::string input
Definition: EdmProvDump.cc:48
pat::ModifiedObjectProducer::ModifiedObjectProducer
ModifiedObjectProducer(const edm::ParameterSet &conf)
Definition: ModifiedObjectProducer.cc:24
ModifiedPhotonProducer
pat::ModifiedObjectProducer< pat::Photon > ModifiedPhotonProducer
Definition: ModifiedObjectProducer.cc:62
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
edm::EDGetTokenT
Definition: EDGetToken.h:33
Muon.h
Photon.h
EDProducer.h
pat::ModifiedObjectProducer::~ModifiedObjectProducer
~ModifiedObjectProducer() override
Definition: ModifiedObjectProducer.cc:33
Tau.h
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
pat::ModifiedObjectProducer::Collection
std::vector< T > Collection
Definition: ModifiedObjectProducer.cc:21
ModifiedGsfElectronProducer
pat::ModifiedObjectProducer< reco::GsfElectron > ModifiedGsfElectronProducer
Definition: ModifiedObjectProducer.cc:60
GsfElectron.h
ModifiedElectronProducer
pat::ModifiedObjectProducer< pat::Electron > ModifiedElectronProducer
Definition: ModifiedObjectProducer.cc:61
pat::ObjectModifier
Definition: ObjectModifier.h:9
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
pat::ModifiedObjectProducer::src_
edm::EDGetTokenT< edm::View< T > > src_
Definition: ModifiedObjectProducer.cc:55
edm::stream::EDProducer
Definition: EDProducer.h:36
edm::EventSetup
Definition: EventSetup.h:58
pat
Definition: HeavyIon.h:7
pat::ModifiedObjectProducer::produce
void produce(edm::Event &evt, const edm::EventSetup &evs) final
Definition: ModifiedObjectProducer.cc:35
Jet.h
InputTag.h
eostools.move
def move(src, dest)
Definition: eostools.py:511
T
long double T
Definition: Basic3DVectorLD.h:48
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ModifiedJetProducer
pat::ModifiedObjectProducer< pat::Jet > ModifiedJetProducer
Definition: ModifiedObjectProducer.cc:65
Electron.h
pat::ModifiedObjectProducer::modifier_
std::unique_ptr< Modifier > modifier_
Definition: ModifiedObjectProducer.cc:56
View.h
ModifiedMuonProducer
pat::ModifiedObjectProducer< pat::Muon > ModifiedMuonProducer
Definition: ModifiedObjectProducer.cc:63
ParameterSet.h
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
ModifiedTauProducer
pat::ModifiedObjectProducer< pat::Tau > ModifiedTauProducer
Definition: ModifiedObjectProducer.cc:64