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 // $Id: NTuplingDevice.cc,v 1.3 2009/05/11 14:29:49 llista Exp $
17 //
18 //
19 
20 
21 // system include files
22 #include <memory>
23 
24 // user include files
27 
30 
32 
34 
35 //
36 // class decleration
37 //
38 
40  public:
41  explicit NTuplingDevice(const edm::ParameterSet&);
43 
44  private:
45  virtual void beginJob() ;
46  virtual void produce(edm::Event&, const edm::EventSetup&);
47  virtual void endJob() ;
48 
49  // ----------member data ---------------------------
51 };
52 
53 //
54 // constants, enums and typedefs
55 //
56 
57 //
58 // static data member definitions
59 //
60 
61 //
62 // constructors and destructor
63 //
65 {
66  //this Ntupler can work with the InputTagDistributor, but should not be configured as such.
67  edm::ParameterSet ntPset = iConfig.getParameter<edm::ParameterSet>("Ntupler");
68  std::string ntuplerName=ntPset.getParameter<std::string>("ComponentName");
69  ntupler_ = NTuplerFactory::get()->create(ntuplerName, ntPset);
70 
71  //register the leaves from the ntupler
72  ntupler_->registerleaves(this);
73 
74  //put a dummy product if the ntupler does not output on edm
75  produces<double>("dummy");
76 }
77 
78 
80 
81 // ------------ method called to produce the data ------------
82 void
84 {
85  ntupler_->fill(iEvent);
86  std::auto_ptr<double> v(new double(0));
87  iEvent.put(v,"dummy");
88 }
89 
90 // ------------ method called once each job just before starting event loop ------------
91 void
93 {
94 }
95 
96 // ------------ method called once each job just after ending the event loop ------------
97 void
99 }
100 
101 //define this as a plug-in
T getParameter(std::string const &) const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
virtual void beginJob()
NTuplingDevice(const edm::ParameterSet &)
int iEvent
Definition: GenABIO.cc:243
NTupler * ntupler_
virtual void endJob()
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
virtual void produce(edm::Event &, const edm::EventSetup &)
virtual void fill(edm::Event &iEvent)=0
mathSSE::Vec4< T > v
T get(const Candidate &c)
Definition: component.h:56