CMS 3D CMS Logo

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  *
6  */
7 
15 #include <numeric>
16 #include <cmath>
17 #include <TMath.h>
18 #include <iostream>
19 #include "TStyle.h"
20 
21 using namespace std;
22 using namespace edm;
23 
24 //
25 // constructors and destructor
26 //
27 BeamConditionsMonitor::BeamConditionsMonitor(const ParameterSet& ps) : countEvt_(0), countLumi_(0) {
28  parameters_ = ps;
29  monitorName_ = parameters_.getUntrackedParameter<string>("monitorName", "YourSubsystemName");
31  debug_ = parameters_.getUntrackedParameter<bool>("Debug");
32 
34 
35  if (!monitorName_.empty())
36  monitorName_ = monitorName_ + "/";
37 }
38 
40 
41 //--------------------------------------------------------
43  // book some histograms here
44  // create and cd into new folder
45  dbe_->setCurrentFolder(monitorName_ + "Conditions");
46 
47  h_x0_lumi = dbe_->book1D("x0_lumi_cond", "x coordinate of beam spot vs lumi (Cond)", 10, 0, 10);
48  h_x0_lumi->setAxisTitle("Lumisection", 1);
49  h_x0_lumi->setAxisTitle("x_{0} (cm)", 2);
50  h_x0_lumi->getTH1()->SetOption("E1");
51 
52  h_y0_lumi = dbe_->book1D("y0_lumi_cond", "y coordinate of beam spot vs lumi (Cond)", 10, 0, 10);
53  h_y0_lumi->setAxisTitle("Lumisection", 1);
54  h_y0_lumi->setAxisTitle("y_{0} (cm)", 2);
55  h_y0_lumi->getTH1()->SetOption("E1");
56 }
57 
58 //--------------------------------------------------------
59 void BeamConditionsMonitor::beginRun(const edm::Run& r, const EventSetup& context) {}
60 
61 //--------------------------------------------------------
63  countLumi_++;
64 }
65 
66 // ----------------------------------------------------------
68  countEvt_++;
69  ESHandle<BeamSpotObjects> beamhandle;
70  iSetup.get<BeamSpotObjectsRcd>().get(beamhandle);
71  condBeamSpot = *beamhandle;
72 }
73 
74 //--------------------------------------------------------
76  LogInfo("BeamConditions") << "[BeamConditionsMonitor]:" << condBeamSpot << endl;
79 }
80 //--------------------------------------------------------
81 void BeamConditionsMonitor::endRun(const Run& r, const EventSetup& context) {}
82 //--------------------------------------------------------
84 
T getUntrackedParameter(std::string const &, T const &) const
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c) override
double GetY() const
get Y beam position
double GetYError() const
get Y beam position Error
DQM_DEPRECATED void ShiftFillLast(double y, double ye=0., int32_t xscale=1)
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void beginRun(const edm::Run &r, const edm::EventSetup &c) override
void endRun(const edm::Run &r, const edm::EventSetup &c) override
edm::ParameterSet parameters_
double GetX() const
get X beam position
double GetXError() const
get X beam position Error
BeamConditionsMonitor(const edm::ParameterSet &)
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context) override
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:639
HLT enums.
T get() const
Definition: EventSetup.h:73
void analyze(const edm::Event &e, const edm::EventSetup &c) override
MonitorElement * book1D(char_string const &name, char_string const &title, int const nchX, double const lowX, double const highX)
Book 1D histogram.
Definition: DQMStore.cc:1121
virtual TH1 * getTH1() const
Definition: Run.h:45
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)