CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
BeamSpotAnalyzer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Validation/RecoVertex
4 // Class: AnotherBeamSpotAnalyzer
5 //
13 //
14 // Original Author: Andrea Venturi
15 // Created: Mon Oct 27 17:37:53 CET 2008
16 //
17 //
18 
19 
20 // system include files
21 #include <memory>
22 
23 // user include files
24 
25 #include <vector>
26 #include <map>
27 #include <limits>
28 
31 
35 
37 
39 
42 
43 
44 //
45 // class decleration
46 //
47 
49  public:
52 
53 
54 private:
55  virtual void beginJob() ;
56  virtual void analyze(const edm::Event&, const edm::EventSetup&);
57  virtual void beginRun(const edm::Run&, const edm::EventSetup&);
58  virtual void endRun(const edm::Run&, const edm::EventSetup&);
59  virtual void endJob() ;
60 
61  // ----------member data ---------------------------
62 
65 
66 
67 };
68 
69 //
70 // constants, enums and typedefs
71 //
72 
73 //
74 // static data member definitions
75 //
76 
77 //
78 // constructors and destructor
79 //
81  : _bshm(iConfig.getParameter<edm::ParameterSet>("bsHistogramMakerPSet"), consumesCollector())
82  , _recoBeamSpotToken(consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("bsCollection")))
83 {
84  //now do what ever initialization is needed
85 
86  //
87 
88  _bshm.book();
89 
90 }
91 
92 
94 {
95 
96  // do anything here that needs to be done at desctruction time
97  // (e.g. close files, deallocate resources etc.)
98 
99 }
100 
101 
102 //
103 // member functions
104 //
105 
106 // ------------ method called to for each event ------------
107 void
109 {
110 
111  // get BS
112 
114  iEvent.getByToken(_recoBeamSpotToken,bs);
115  _bshm.fill(iEvent.orbitNumber(),*bs);
116 
117 }
118 
119 
120 // ------------ method called once each job just before starting event loop ------------
121 void
123 { }
124 
125 void
127 
128  _bshm.beginRun(iRun.run());
129 
130 }
131 
132 void
134 
135 }
136 // ------------ method called once each job just after ending the event loop ------------
137 void
139 }
140 
141 
142 //define this as a plug-in
virtual void endRun(const edm::Run &, const edm::EventSetup &)
RunNumber_t run() const
Definition: RunBase.h:42
void book(const std::string dirname="")
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
virtual void analyze(const edm::Event &, const edm::EventSetup &)
void beginRun(const unsigned int nrun)
int iEvent
Definition: GenABIO.cc:230
void fill(const unsigned int orbit, const reco::BeamSpot &bs)
BeamSpotHistogramMaker _bshm
AnotherBeamSpotAnalyzer(const edm::ParameterSet &)
int orbitNumber() const
Definition: EventBase.h:67
virtual void beginRun(const edm::Run &, const edm::EventSetup &)
Definition: Run.h:43
edm::EDGetTokenT< reco::BeamSpot > _recoBeamSpotToken