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 //
28  countEvt_(0),countLumi_(0) {
29 
30  parameters_ = ps;
31  monitorName_ = parameters_.getUntrackedParameter<string>("monitorName","YourSubsystemName");
33  debug_ = parameters_.getUntrackedParameter<bool>("Debug");
34 
36 
37  if (monitorName_ != "" ) monitorName_ = monitorName_+"/" ;
38 }
39 
40 
42 }
43 
44 
45 //--------------------------------------------------------
47 
48  // book some histograms here
49  // create and cd into new folder
50  dbe_->setCurrentFolder(monitorName_+"Conditions");
51 
52  h_x0_lumi = dbe_->book1D("x0_lumi_cond","x coordinate of beam spot vs lumi (Cond)",10,0,10);
53  h_x0_lumi->setAxisTitle("Lumisection",1);
54  h_x0_lumi->setAxisTitle("x_{0} (cm)",2);
55  h_x0_lumi->getTH1()->SetOption("E1");
56 
57  h_y0_lumi = dbe_->book1D("y0_lumi_cond","y coordinate of beam spot vs lumi (Cond)",10,0,10);
58  h_y0_lumi->setAxisTitle("Lumisection",1);
59  h_y0_lumi->setAxisTitle("y_{0} (cm)",2);
60  h_y0_lumi->getTH1()->SetOption("E1");
61 
62 }
63 
64 //--------------------------------------------------------
65 void BeamConditionsMonitor::beginRun(const edm::Run& r, const EventSetup& context) {
66 }
67 
68 //--------------------------------------------------------
70  const EventSetup& context) {
71  countLumi_++;
72 }
73 
74 // ----------------------------------------------------------
75 void BeamConditionsMonitor::analyze(const Event& iEvent, const EventSetup& iSetup ) {
76 
77  countEvt_++;
78  ESHandle< BeamSpotObjects > beamhandle;
79  iSetup.get<BeamSpotObjectsRcd>().get(beamhandle);
80  condBeamSpot = *beamhandle;
81 
82 }
83 
84 
85 //--------------------------------------------------------
87  const EventSetup& iSetup) {
88 
89  LogInfo("BeamConditions") << "[BeamConditionsMonitor]:" << condBeamSpot << endl;
92 
93 }
94 //--------------------------------------------------------
95 void BeamConditionsMonitor::endRun(const Run& r, const EventSetup& context) {
96 }
97 //--------------------------------------------------------
99 }
100 
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
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
TH1 * getTH1() const
double GetYError() const
get Y beam position Error
void ShiftFillLast(double y, double ye=0., int32_t xscale=1)
int iEvent
Definition: GenABIO.cc:230
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 &)
const T & get() const
Definition: EventSetup.h:59
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context) override
HLT enums.
void analyze(const edm::Event &e, const edm::EventSetup &c) override
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
Definition: Run.h:43