CMS 3D CMS Logo

NTuplingDevice.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: NTuplingDevice
4 // Class: NTuplingDevice
5 //
13 //
14 // Original Author: Jean-Roch Vlimant
15 // Created: Sun May 11 21:12:46 CEST 2008
16 //
17 //
18 
19 
20 // system include files
21 #include <memory>
22 
23 // user include files
26 
29 
31 
33 
34 //
35 // class decleration
36 //
37 
39  public:
40  explicit NTuplingDevice(const edm::ParameterSet&);
41  ~NTuplingDevice() override;
42 
43  private:
44  void beginJob() override ;
45  void produce(edm::Event&, const edm::EventSetup&) override;
46  void endJob() override ;
47 
48  // ----------member data ---------------------------
50 };
51 
52 //
53 // constants, enums and typedefs
54 //
55 
56 //
57 // static data member definitions
58 //
59 
60 //
61 // constructors and destructor
62 //
64 {
65  //this Ntupler can work with the InputTagDistributor, but should not be configured as such.
66  edm::ParameterSet ntPset = iConfig.getParameter<edm::ParameterSet>("Ntupler");
67  std::string ntuplerName=ntPset.getParameter<std::string>("ComponentName");
68  ntupler_ = NTuplerFactory::get()->create(ntuplerName, ntPset);
69 
70  //register the leaves from the ntupler
71  ntupler_->registerleaves(this);
72 
73  //put a dummy product if the ntupler does not output on edm
74  produces<double>("dummy");
75 }
76 
77 
79 
80 // ------------ method called to produce the data ------------
81 void
83 {
84  ntupler_->fill(iEvent);
85  iEvent.put(std::make_unique<double>(0.),"dummy");
86 }
87 
88 // ------------ method called once each job just before starting event loop ------------
89 void
91 {
92 }
93 
94 // ------------ method called once each job just after ending the event loop ------------
95 void
97 }
98 
99 //define this as a plug-in
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
void beginJob() override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
NTuplingDevice(const edm::ParameterSet &)
void produce(edm::Event &, const edm::EventSetup &) override
~NTuplingDevice() override
int iEvent
Definition: GenABIO.cc:230
NTupler * ntupler_
void endJob() override
virtual void fill(edm::Event &iEvent)=0
T get(const Candidate &c)
Definition: component.h:55