CMS 3D CMS Logo

GeneratorSmearedProducer.cc
Go to the documentation of this file.
6 
11 
12 #include <memory>
13 
14 namespace edm {
15  class ParameterSet;
17  class Event;
18  class EventSetup;
19  class HepMCProduct;
20 } // namespace edm
21 
23 public:
25 
26  void produce(edm::StreamID, edm::Event& e, edm::EventSetup const& c) const override;
27  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
28 
29 private:
32 };
33 
35  : newToken_(consumes<edm::HepMCProduct>(ps.getUntrackedParameter<edm::InputTag>("currentTag"))),
36  oldToken_(consumes<edm::HepMCProduct>(ps.getUntrackedParameter<edm::InputTag>("previousTag"))) {
37  // This producer produces a HepMCProduct, a copy of the original one
38  // It is used for backwaerd compatibility
39  produces<edm::HepMCProduct>();
40 }
41 
43  edm::Handle<edm::HepMCProduct> theHepMCProduct;
44  bool found = iEvent.getByToken(newToken_, theHepMCProduct);
45  if (!found) {
46  found = iEvent.getByToken(oldToken_, theHepMCProduct);
47  }
48  if (found) {
49  std::unique_ptr<edm::HepMCProduct> theCopy(new edm::HepMCProduct(*theHepMCProduct));
50  iEvent.put(std::move(theCopy));
51  }
52 }
53 
56  desc.addUntracked<edm::InputTag>("currentTag", edm::InputTag("VtxSmeared"));
57  desc.addUntracked<edm::InputTag>("previousTag", edm::InputTag("generator"));
58  descriptions.add("generatorSmeared", desc);
59 }
60 
GeneratorSmearedProducer(edm::ParameterSet const &p)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const edm::EDGetTokenT< edm::HepMCProduct > newToken_
int iEvent
Definition: GenABIO.cc:224
const edm::EDGetTokenT< edm::HepMCProduct > oldToken_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void produce(edm::StreamID, edm::Event &e, edm::EventSetup const &c) const override
HLT enums.
def move(src, dest)
Definition: eostools.py:511