CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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&);
42 
43  private:
44  virtual void beginJob() override ;
45  virtual void produce(edm::Event&, const edm::EventSetup&) override;
46  virtual 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  std::auto_ptr<double> v(new double(0));
86  iEvent.put(v,"dummy");
87 }
88 
89 // ------------ method called once each job just before starting event loop ------------
90 void
92 {
93 }
94 
95 // ------------ method called once each job just after ending the event loop ------------
96 void
98 }
99 
100 //define this as a plug-in
T getParameter(std::string const &) const
virtual void beginJob() override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
NTuplingDevice(const edm::ParameterSet &)
virtual void produce(edm::Event &, const edm::EventSetup &) override
int iEvent
Definition: GenABIO.cc:230
NTupler * ntupler_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
virtual void endJob() override
virtual void fill(edm::Event &iEvent)=0
T get(const Candidate &c)
Definition: component.h:55