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 
33  dbe_ = Service<DQMStore>().operator->();
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 
ESHandle.h
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
BeamConditionsMonitor::beginRun
void beginRun(const edm::Run &r, const edm::EventSetup &c) override
Definition: BeamConditionsMonitor.cc:59
edm::Run
Definition: Run.h:45
BeamConditionsMonitor::bsSrc_
edm::InputTag bsSrc_
Definition: BeamConditionsMonitor.h:58
edm
HLT enums.
Definition: AlignableModifier.h:19
BeamConditionsMonitor::analyze
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Definition: BeamConditionsMonitor.cc:67
BeamConditionsMonitor::h_y0_lumi
MonitorElement * h_y0_lumi
Definition: BeamConditionsMonitor.h:71
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
BeamConditionsMonitor::parameters_
edm::ParameterSet parameters_
Definition: BeamConditionsMonitor.h:56
BeamConditionsMonitor::endRun
void endRun(const edm::Run &r, const edm::EventSetup &c) override
Definition: BeamConditionsMonitor.cc:81
BeamConditionsMonitor::endLuminosityBlock
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c) override
Definition: BeamConditionsMonitor.cc:75
MakerMacros.h
BeamConditionsMonitor::dbe_
DQMStore * dbe_
Definition: BeamConditionsMonitor.h:61
BeamConditionsMonitor::condBeamSpot
BeamSpotObjects condBeamSpot
Definition: BeamConditionsMonitor.h:67
BeamSpotObjectsRcd.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
BeamConditionsMonitor::BeamConditionsMonitor
BeamConditionsMonitor(const edm::ParameterSet &)
Definition: BeamConditionsMonitor.cc:27
Service.h
BeamConditionsMonitor::~BeamConditionsMonitor
~BeamConditionsMonitor() override
Definition: BeamConditionsMonitor.cc:39
dqm::impl::MonitorElement::ShiftFillLast
DQM_DEPRECATED void ShiftFillLast(double y, double ye=0., int32_t xscale=1)
Definition: MonitorElement.cc:256
edm::ESHandle
Definition: DTSurvey.h:22
BeamConditionsMonitor::endJob
void endJob() override
Definition: BeamConditionsMonitor.cc:83
BeamConditionsMonitor::monitorName_
std::string monitorName_
Definition: BeamConditionsMonitor.h:57
dqm::implementation::DQMStore::setCurrentFolder
void setCurrentFolder(std::string const &fullpath) override
Definition: DQMStore.h:569
dqm::legacy::MonitorElement::getTH1
virtual TH1 * getTH1() const
Definition: MonitorElement.h:475
BeamSpotObjects::GetXError
double GetXError() const
get X beam position Error
Definition: BeamSpotObjects.h:85
edm::ParameterSet
Definition: ParameterSet.h:47
BeamSpotObjects::GetY
double GetY() const
get Y beam position
Definition: BeamSpotObjects.h:69
edm::Service
Definition: Service.h:30
BeamConditionsMonitor::beginLuminosityBlock
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context) override
Definition: BeamConditionsMonitor.cc:62
iEvent
int iEvent
Definition: GenABIO.cc:224
BeamSpotObjectsRcd
Definition: BeamSpotObjectsRcd.h:24
edm::EventSetup
Definition: EventSetup.h:58
BeamConditionsMonitor::h_x0_lumi
MonitorElement * h_x0_lumi
Definition: BeamConditionsMonitor.h:70
get
#define get
BeamConditionsMonitor::debug_
bool debug_
Definition: BeamConditionsMonitor.h:59
alignCSCRings.r
r
Definition: alignCSCRings.py:93
BeamSpotObjects::GetYError
double GetYError() const
get Y beam position Error
Definition: BeamSpotObjects.h:87
std
Definition: JetResolutionObject.h:76
EventSetup.h
BeamConditionsMonitor::countLumi_
int countLumi_
Definition: BeamConditionsMonitor.h:64
BeamConditionsMonitor::beginJob
void beginJob() override
Definition: BeamConditionsMonitor.cc:42
edm::Event
Definition: Event.h:73
BeamConditionsMonitor
Definition: BeamConditionsMonitor.h:26
IOVSyncValue.h
BeamConditionsMonitor::countEvt_
int countEvt_
Definition: BeamConditionsMonitor.h:63
BeamSpotObjects::GetX
double GetX() const
get X beam position
Definition: BeamSpotObjects.h:67
dqm::impl::MonitorElement::setAxisTitle
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
Definition: MonitorElement.cc:800
edm::InputTag
Definition: InputTag.h:15
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
BeamConditionsMonitor.h