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");
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 //--------------------------------------------------------
60 
61 //--------------------------------------------------------
63  countLumi_++;
64 }
65 
66 // ----------------------------------------------------------
68  countEvt_++;
70 }
71 
72 //--------------------------------------------------------
74  LogInfo("BeamConditions") << "[BeamConditionsMonitor]:" << condBeamSpot << endl;
77 }
78 //--------------------------------------------------------
80 //--------------------------------------------------------
82 
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c) override
void setCurrentFolder(std::string const &fullpath) override
Definition: DQMStore.h:646
T getUntrackedParameter(std::string const &, T const &) const
DQM_DEPRECATED void ShiftFillLast(double y, double ye=0., int32_t xscale=1)
int iEvent
Definition: GenABIO.cc:224
void beginRun(const edm::Run &r, const edm::EventSetup &c) override
void endRun(const edm::Run &r, const edm::EventSetup &c) override
double x() const
get X beam position
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
bool getData(T &iHolder) const
Definition: EventSetup.h:122
edm::ParameterSet parameters_
Log< level::Info, false > LogInfo
double y() const
get Y beam position
double xError() const
get X beam position Error
BeamConditionsMonitor(const edm::ParameterSet &)
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context) override
virtual TH1 * getTH1() const
HLT enums.
edm::ESGetToken< BeamSpotObjects, BeamSpotObjectsRcd > beamSpotToken_
void analyze(const edm::Event &e, const edm::EventSetup &c) override
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
double yError() const
get Y beam position Error
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)