CMS 3D CMS Logo

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  // This producer produces a HepMCProduct, a copy of the original one
15  // It is used for backwaerd compatibility
16  produces<edm::HepMCProduct>();
17 }
18 
20  edm::Handle<edm::HepMCProduct> theHepMCProduct;
21  bool found = iEvent.getByToken(newToken_, theHepMCProduct);
22  if (!found) {
23  found = iEvent.getByToken(oldToken_, theHepMCProduct);
24  }
25  if (found) {
26  std::unique_ptr<edm::HepMCProduct> theCopy(new edm::HepMCProduct(*theHepMCProduct));
27  iEvent.put(std::move(theCopy));
28  }
29 }
30 
33  desc.addUntracked<edm::InputTag>("currentTag", edm::InputTag("VtxSmeared"));
34  desc.addUntracked<edm::InputTag>("previousTag", edm::InputTag("generator"));
35  descriptions.add("generatorSmeared", desc);
36 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
GeneratorSmearedProducer(edm::ParameterSet const &p)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void produce(edm::StreamID, edm::Event &e, edm::EventSetup const &c) const override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const edm::EDGetTokenT< edm::HepMCProduct > newToken_
int iEvent
Definition: GenABIO.cc:224
const edm::EDGetTokenT< edm::HepMCProduct > oldToken_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
HLT enums.
def move(src, dest)
Definition: eostools.py:511