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");
33  usesResource("DQMStore");
35 
36  if (!monitorName_.empty())
37  monitorName_ = monitorName_ + "/";
38 }
39 
41 
42 //--------------------------------------------------------
44  // book some histograms here
45  // create and cd into new folder
46  dbe_->setCurrentFolder(monitorName_ + "Conditions");
47 
48  h_x0_lumi = dbe_->book1D("x0_lumi_cond", "x coordinate of beam spot vs lumi (Cond)", 10, 0, 10);
49  h_x0_lumi->setAxisTitle("Lumisection", 1);
50  h_x0_lumi->setAxisTitle("x_{0} (cm)", 2);
51  h_x0_lumi->getTH1()->SetOption("E1");
52 
53  h_y0_lumi = dbe_->book1D("y0_lumi_cond", "y coordinate of beam spot vs lumi (Cond)", 10, 0, 10);
54  h_y0_lumi->setAxisTitle("Lumisection", 1);
55  h_y0_lumi->setAxisTitle("y_{0} (cm)", 2);
56  h_y0_lumi->getTH1()->SetOption("E1");
57 }
58 
59 //--------------------------------------------------------
61 
62 //--------------------------------------------------------
64  countLumi_++;
65 }
66 
67 // ----------------------------------------------------------
69  countEvt_++;
71 }
72 
73 //--------------------------------------------------------
75  LogInfo("BeamConditions") << "[BeamConditionsMonitor]:" << condBeamSpot << endl;
78 }
79 //--------------------------------------------------------
81 //--------------------------------------------------------
83 
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)