CMS 3D CMS Logo

FakeBeamMonitor.h
Go to the documentation of this file.
1 #ifndef FakeBeamMonitor_H
2 #define FakeBeamMonitor_H
3 
11 // C++
12 #include <string>
13 #include <memory>
14 // CMS
27 #include <fstream>
28 #include "TRandom3.h"
29 
30 //
31 // class declaration
32 //
33 
34 class FakeBeamMonitor : public DQMOneEDAnalyzer<edm::one::WatchLuminosityBlocks> {
35 public:
37  ~FakeBeamMonitor() override;
38 
39 protected:
40  //BeginRun
41  void dqmBeginRun(edm::Run const&, edm::EventSetup const&) override;
42 
43  void bookHistograms(DQMStore::IBooker& i, const edm::Run& r, const edm::EventSetup& c) override;
44 
45  void analyze(const edm::Event& e, const edm::EventSetup& c) override;
46 
47  void beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& context) override;
48 
49  void endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& c) override;
50  // EndRun
51  void dqmEndRun(const edm::Run& r, const edm::EventSetup& c) override;
52 
53 private:
54  void FitAndFill(const edm::LuminosityBlock& lumiSeg, int&, int&, int&);
55  void RestartFitting();
56  void scrollTH1(TH1*, std::time_t);
57  bool testScroll(std::time_t&, std::time_t&);
58  void formatFitTime(char*, const std::time_t&);
59  std::string getGMTstring(const std::time_t&);
60 
61  const int dxBin_;
62  const double dxMin_;
63  const double dxMax_;
64 
65  const int vxBin_;
66  const double vxMin_;
67  const double vxMax_;
68 
69  const int phiBin_;
70  const double phiMin_;
71  const double phiMax_;
72 
73  const int dzBin_;
74  const double dzMin_;
75  const double dzMax_;
77  std::string recordName_; // output BeamSpotOnline Record name
79  int DBloggerReturn_; // DB logger return value
80 
81  int fitNLumi_;
86  bool debug_;
88 
89  int countEvt_; //counter
90  int countLumi_; //counter
95  int lastlumi_; // previous LS processed
96  int nextlumi_; // next LS of Fit
97  std::time_t refBStime[2];
98  std::time_t refPVtime[2];
99  unsigned int nthBSTrk_;
101  int nFits_;
102  double deltaSigCut_;
103  unsigned int min_Ntrks_;
104  double maxZ_;
105  unsigned int minNrVertices_;
106  double minVtxNdf_;
107  double minVtxWgt_;
108 
113 
116  // ----------member data ---------------------------
117 
118  // std::vector<BSTrkParameters> fBSvector;
121 
122  // MonitorElements:
148  std::vector<MonitorElement*> hs;
149 
150  // The histo of the primary vertex for DQM gui
151  std::map<int, std::vector<float> > mapPVx, mapPVy, mapPVz;
152  std::map<int, std::vector<int> > mapNPV;
153  //keep track of beginLuminosity block and time
154  std::map<int, int> mapBeginBSLS, mapBeginPVLS;
155  std::map<int, std::time_t> mapBeginBSTime, mapBeginPVTime;
156  //these maps are needed to keep track of size of theBSvector and pvStore
157  std::map<int, std::size_t> mapLSBSTrkSize;
158  std::map<int, size_t> mapLSPVStoreSize;
159  //to correct the cutFlot Table
160  std::map<int, TH1F> mapLSCF;
161 
162  // Summary:
163  Float_t reportSummary_;
164  Float_t summarySum_;
165  Float_t summaryContent_[3];
170  // variables for beam fit
171 
172  //
173  std::time_t tmpTime;
174  std::time_t startTime;
175  std::time_t refTime;
177  // Current run
178  int frun;
179  int lastNZbin; // last non zero bin of time histos
180 
181  TRandom3* rndm_;
182 };
183 
184 #endif
185 
186 // Local Variables:
187 // show-trailing-whitespace: t
188 // truncate-lines: t
189 // End:
MonitorElement * pvResults
std::map< int, size_t > mapLSPVStoreSize
MonitorElement * h_z0
std::vector< MonitorElement * > hs
const double phiMax_
MonitorElement * h_nTrk_lumi
MonitorElement * h_sigmaY0
const double vxMax_
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
void FitAndFill(const edm::LuminosityBlock &lumiSeg, int &, int &, int &)
MonitorElement * cutFlowTable
MonitorElement * h_vy_dz
const double phiMin_
std::string getGMTstring(const std::time_t &)
const double dxMin_
void dqmEndRun(const edm::Run &r, const edm::EventSetup &c) override
std::map< int, std::time_t > mapBeginPVTime
unsigned int nthBSTrk_
FakeBeamMonitor(const edm::ParameterSet &)
bool testScroll(std::time_t &, std::time_t &)
std::map< int, std::size_t > mapLSBSTrkSize
MonitorElement * reportSummary
MonitorElement * h_nVtx_lumi_all
Float_t summaryContent_[3]
std::time_t refBStime[2]
std::map< int, std::vector< int > > mapNPV
const double vxMin_
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context) override
MonitorElement * h_PVz[2]
MonitorElement * h_trkPt
unsigned int minNrVertices_
edm::Service< cond::service::OnlineDBOutputService > onlineDbService_
std::time_t refPVtime[2]
MonitorElement * h_nVtx
MonitorElement * h_trkVz
void formatFitTime(char *, const std::time_t &)
const double dzMin_
std::time_t startTime
MonitorElement * h_sigmaZ0
std::string monitorName_
MonitorElement * h_x0
std::map< int, std::vector< float > > mapPVy
std::map< int, std::vector< float > > mapPVz
void bookHistograms(DQMStore::IBooker &i, const edm::Run &r, const edm::EventSetup &c) override
MonitorElement * h_d0_phi0
const double dxMax_
unsigned long long TimeValue_t
Definition: Timestamp.h:28
std::map< int, std::vector< float > > mapPVx
std::map< int, std::time_t > mapBeginBSTime
MonitorElement * h_sigmaX0
edm::TimeValue_t ftimestamp
std::map< int, int > mapBeginPVLS
void scrollTH1(TH1 *, std::time_t)
~FakeBeamMonitor() override
MonitorElement * h_trk_z0
std::time_t refTime
MonitorElement * reportSummaryContents[3]
MonitorElement * h_nVtx_lumi
MonitorElement * h_vx_vy
MonitorElement * h_vx_dz
std::map< int, TH1F > mapLSCF
const double dzMax_
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c) override
MonitorElement * h_PVy[2]
std::string recordName_
MonitorElement * h_y0
MonitorElement * h_PVxz
reco::BeamSpot preBS
MonitorElement * h_nVtx_st
std::time_t tmpTime
std::map< int, int > mapBeginBSLS
void analyze(const edm::Event &e, const edm::EventSetup &c) override
MonitorElement * reportSummaryMap
MonitorElement * h_PVyz
MonitorElement * h_PVx[2]
reco::BeamSpot refBS
unsigned int min_Ntrks_
MonitorElement * fitResults
Definition: Run.h:45