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 
17 #include <numeric>
18 #include <cmath>
19 #include <TMath.h>
20 #include <iostream>
21 #include "TStyle.h"
22 
23 using namespace std;
24 using namespace edm;
25 
26 //
27 // constructors and destructor
28 //
30  bsSrc_{ps.getUntrackedParameter<InputTag>("beamSpot")}
31 
32  {
33 
34  monitorName_ = ps.getUntrackedParameter<string>("monitorName","YourSubsystemName");
35 
36  if (!monitorName_.empty() ) monitorName_ = monitorName_+"/" ;
37 }
38 
39 
40 //--------------------------------------------------------
42  beamcond::RunCache& cache) const {
43 
44  // book some histograms here
45  // create and cd into new folder
46  i.setCurrentFolder(monitorName_+"Conditions");
47 
48  cache.h_x0_lumi = i.book1D("x0_lumi_cond","x coordinate of beam spot vs lumi (Cond)",10,0,10);
49  cache.h_x0_lumi.setAxisTitle("Lumisection",1);
50  cache.h_x0_lumi.setAxisTitle("x_{0} (cm)",2);
51  cache.h_x0_lumi.setOption("E1");
52 
53  cache.h_y0_lumi = i.book1D("y0_lumi_cond","y coordinate of beam spot vs lumi (Cond)",10,0,10);
54  cache.h_y0_lumi.setAxisTitle("Lumisection",1);
55  cache.h_y0_lumi.setAxisTitle("y_{0} (cm)",2);
56  cache.h_y0_lumi.setOption("E1");
57 
58 }
59 
60 
61 std::shared_ptr<void>
63  const edm::EventSetup& c) const {
64  ESHandle< BeamSpotObjects > beamhandle;
65  c.get<BeamSpotObjectsRcd>().get(beamhandle);
66  auto const& condBeamSpot = *beamhandle;
67 
68  auto cache = runCache(lumiSeg.getRun().index() );
69  LogInfo("BeamConditions") << "[BeamConditionsMonitor]:" << condBeamSpot << endl;
70  cache->h_x0_lumi.shiftFillLast( condBeamSpot.GetX(), condBeamSpot.GetXError(), 1 );
71  cache->h_y0_lumi.shiftFillLast( condBeamSpot.GetY(), condBeamSpot.GetYError(), 1 );
72 
73  return std::shared_ptr<void>{};
74 }
75 
76 // ----------------------------------------------------------
78  beamcond::RunCache const&) const {
79 
80 }
81 
82 
83 //--------------------------------------------------------
85  const EventSetup& iSetup) const {
86 
87 
88 }
89 
T getUntrackedParameter(std::string const &, T const &) const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
void setOption(const char *option)
ConcurrentMonitorElement h_x0_lumi
int iEvent
Definition: GenABIO.cc:230
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
void globalEndLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) const override
ConcurrentMonitorElement book1D(Args &&...args)
Definition: DQMStore.h:160
RunIndex index() const
Definition: Run.cc:24
def cache(function)
void setAxisTitle(std::string const &title, int axis=1)
void bookHistograms(DQMStore::ConcurrentBooker &i, const edm::Run &r, const edm::EventSetup &c, beamcond::RunCache &) const override
BeamConditionsMonitor(const edm::ParameterSet &)
HLT enums.
T get() const
Definition: EventSetup.h:68
ConcurrentMonitorElement h_y0_lumi
std::shared_ptr< void > globalBeginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c) const override
void dqmAnalyze(const edm::Event &e, const edm::EventSetup &c, beamcond::RunCache const &) const override
Definition: Run.h:44
Run const & getRun() const