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 
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 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
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:579
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const edm::EDGetTokenT< edm::HepMCProduct > newToken_
int iEvent
Definition: GenABIO.cc:230
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