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 
ConfigurationDescriptions.h
edm::StreamID
Definition: StreamID.h:30
edm::EDGetTokenT< edm::HepMCProduct >
edm
HLT enums.
Definition: AlignableModifier.h:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
GeneratorSmearedProducer::produce
void produce(edm::StreamID, edm::Event &e, edm::EventSetup const &c) const override
Definition: GeneratorSmearedProducer.cc:42
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89353
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
GeneratorSmearedProducer
Definition: GeneratorSmearedProducer.cc:22
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
edm::Handle< edm::HepMCProduct >
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
Event
GeneratorSmearedProducer::newToken_
const edm::EDGetTokenT< edm::HepMCProduct > newToken_
Definition: GeneratorSmearedProducer.cc:30
ParameterSetDescription.h
GeneratorSmearedProducer::GeneratorSmearedProducer
GeneratorSmearedProducer(edm::ParameterSet const &p)
Definition: GeneratorSmearedProducer.cc:34
EDGetToken.h
edm::global::EDProducer
Definition: EDProducer.h:32
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
ParameterSet
Definition: Functions.h:16
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:57
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
GeneratorSmearedProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: GeneratorSmearedProducer.cc:54
InputTag.h
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
ConfigurationDescriptions
GeneratorSmearedProducer::oldToken_
const edm::EDGetTokenT< edm::HepMCProduct > oldToken_
Definition: GeneratorSmearedProducer.cc:31
HepMCProduct
EventSetup
edm::HepMCProduct
Definition: HepMCProduct.h:18
ParameterSet.h
HepMCProduct.h
EDProducer.h
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37