CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
BeamConditionsMonitor.cc
Go to the documentation of this file.
1 /*
2  * \file BeamConditionsMonitor.cc
3  * \author Geng-yuan Jeng/UC Riverside
4  * Francisco Yumiceva/FNAL
5  * $Date: 2010/07/20 20:23:27 $
6  * $Revision: 1.9 $
7  *
8  */
9 
17 #include <numeric>
18 #include <math.h>
19 #include <TMath.h>
20 #include <iostream>
21 #include "TStyle.h"
22 
23 using namespace std;
24 using namespace edm;
25 
26 //
27 // constructors and destructor
28 //
30  countEvt_(0),countLumi_(0) {
31 
32  parameters_ = ps;
33  monitorName_ = parameters_.getUntrackedParameter<string>("monitorName","YourSubsystemName");
35  debug_ = parameters_.getUntrackedParameter<bool>("Debug");
36 
38 
39  if (monitorName_ != "" ) monitorName_ = monitorName_+"/" ;
40 }
41 
42 
44 }
45 
46 
47 //--------------------------------------------------------
49 
50  // book some histograms here
51  // create and cd into new folder
52  dbe_->setCurrentFolder(monitorName_+"Conditions");
53 
54  h_x0_lumi = dbe_->book1D("x0_lumi_cond","x coordinate of beam spot vs lumi (Cond)",10,0,10);
55  h_x0_lumi->setAxisTitle("Lumisection",1);
56  h_x0_lumi->setAxisTitle("x_{0} (cm)",2);
57  h_x0_lumi->getTH1()->SetOption("E1");
58 
59  h_y0_lumi = dbe_->book1D("y0_lumi_cond","y coordinate of beam spot vs lumi (Cond)",10,0,10);
60  h_y0_lumi->setAxisTitle("Lumisection",1);
61  h_y0_lumi->setAxisTitle("y_{0} (cm)",2);
62  h_y0_lumi->getTH1()->SetOption("E1");
63 
64 }
65 
66 //--------------------------------------------------------
67 void BeamConditionsMonitor::beginRun(const edm::Run& r, const EventSetup& context) {
68 }
69 
70 //--------------------------------------------------------
72  const EventSetup& context) {
73  countLumi_++;
74 }
75 
76 // ----------------------------------------------------------
77 void BeamConditionsMonitor::analyze(const Event& iEvent, const EventSetup& iSetup ) {
78 
79  countEvt_++;
80  ESHandle< BeamSpotObjects > beamhandle;
81  iSetup.get<BeamSpotObjectsRcd>().get(beamhandle);
82  condBeamSpot = *beamhandle;
83 
84 }
85 
86 
87 //--------------------------------------------------------
89  const EventSetup& iSetup) {
90 
91  LogInfo("BeamConditions") << "[BeamConditionsMonitor]:" << condBeamSpot << endl;
94 
95 }
96 //--------------------------------------------------------
97 void BeamConditionsMonitor::endRun(const Run& r, const EventSetup& context) {
98 }
99 //--------------------------------------------------------
101 }
102 
T getUntrackedParameter(std::string const &, T const &) const
double GetY() const
get Y beam position
void beginRun(const edm::Run &r, const edm::EventSetup &c)
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:717
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
double GetYError() const
get Y beam position Error
void ShiftFillLast(double y, double ye=0., int32_t xscale=1)
int iEvent
Definition: GenABIO.cc:243
TH1 * getTH1(void) const
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context)
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
edm::ParameterSet parameters_
void endRun(const edm::Run &r, const edm::EventSetup &c)
double GetX() const
get X beam position
double GetXError() const
get X beam position Error
BeamConditionsMonitor(const edm::ParameterSet &)
const T & get() const
Definition: EventSetup.h:55
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void analyze(const edm::Event &e, const edm::EventSetup &c)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
Definition: Run.h:33