test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GeneratorSmearedProducer.cc
Go to the documentation of this file.
7 
9 #include <memory>
10 
12  newToken_(consumes<edm::HepMCProduct>(ps.getUntrackedParameter<edm::InputTag>("currentTag"))),
13  oldToken_(consumes<edm::HepMCProduct>(ps.getUntrackedParameter<edm::InputTag>("previousTag"))) {
14 
15  // This producer produces a HepMCProduct, a copy of the original one
16  // It is used for backwaerd compatibility
17  produces<edm::HepMCProduct>();
18 }
19 
21  edm::Handle<edm::HepMCProduct> theHepMCProduct;
22  bool found = iEvent.getByToken(newToken_,theHepMCProduct);
23  if (!found) {
24  found = iEvent.getByToken(oldToken_,theHepMCProduct);
25  }
26  if (found) {
27  std::unique_ptr<edm::HepMCProduct> theCopy(new edm::HepMCProduct(*theHepMCProduct));
28  iEvent.put(std::move(theCopy));
29  }
30 }
31 
34  desc.addUntracked<edm::InputTag>("currentTag", edm::InputTag("VtxSmeared"));
35  desc.addUntracked<edm::InputTag>("previousTag", edm::InputTag("generator"));
36  descriptions.add("generatorSmeared", desc);
37 }
edm::EDGetTokenT< edm::HepMCProduct > newToken_
GeneratorSmearedProducer(edm::ParameterSet const &p)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
int iEvent
Definition: GenABIO.cc:230
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
def move
Definition: eostools.py:510
edm::EDGetTokenT< edm::HepMCProduct > oldToken_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
virtual void produce(edm::Event &e, edm::EventSetup const &c) override