CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
BeamMonitor.h
Go to the documentation of this file.
1 #ifndef BeamMonitor_H
2 #define BeamMonitor_H
3 
10 // C++
11 #include <string>
12 #include <memory>
13 // CMS
28 #include <fstream>
29 
30 //
31 // class declaration
32 //
33 
34 class BeamMonitor : public DQMOneEDAnalyzer<edm::one::WatchLuminosityBlocks> {
35 public:
37 
38 protected:
39  // BeginRun
40  void dqmBeginRun(edm::Run const&, edm::EventSetup const&) override;
41 
42  void bookHistograms(DQMStore::IBooker& i, const edm::Run& r, const edm::EventSetup& c) override;
43 
44  void analyze(const edm::Event& e, const edm::EventSetup& c) override;
45 
46  void beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& context) override;
47 
48  void endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& c) override;
49  // EndRun
50  void dqmEndRun(const edm::Run& r, const edm::EventSetup& c) override;
51 
52 private:
53  void FitAndFill(const edm::LuminosityBlock& lumiSeg, int&, int&, int&);
54  void RestartFitting();
55  void scrollTH1(TH1*, std::time_t);
56  bool testScroll(std::time_t&, std::time_t&);
57  void formatFitTime(char*, const std::time_t&);
58  std::string getGMTstring(const std::time_t&);
59 
60  const int dxBin_;
61  const double dxMin_;
62  const double dxMax_;
63 
64  const int vxBin_;
65  const double vxMin_;
66  const double vxMax_;
67 
68  const int phiBin_;
69  const double phiMin_;
70  const double phiMax_;
71 
72  const int dzBin_;
73  const double dzMin_;
74  const double dzMax_;
76  std::string recordName_; // output BeamSpotOnline Record name
82  int DBloggerReturn_; // DB logger return value
83 
84  int fitNLumi_;
89  bool debug_;
91  std::vector<std::string> jetTrigger_;
92 
93  std::unique_ptr<BeamFitter> theBeamFitter;
94 
95  int countEvt_; //counter
96  int countLumi_; //counter
101  int lastlumi_; // previous LS processed
102  int nextlumi_; // next LS of Fit
103  std::time_t refBStime[2];
104  std::time_t refPVtime[2];
105  unsigned int nthBSTrk_;
107  int nFits_;
108  double deltaSigCut_;
109  unsigned int min_Ntrks_;
110  double maxZ_;
111  unsigned int minNrVertices_;
112  double minVtxNdf_;
113  double minVtxWgt_;
114 
119 
122 
125  // ----------member data ---------------------------
126 
127  // std::vector<BSTrkParameters> fBSvector;
130 
131  // MonitorElements:
157  std::vector<MonitorElement*> hs;
158 
159  // The histo of the primary vertex for DQM gui
160  std::map<int, std::vector<float> > mapPVx, mapPVy, mapPVz;
161  std::map<int, std::vector<int> > mapNPV;
162  //keep track of beginLuminosity block and time
163  std::map<int, int> mapBeginBSLS, mapBeginPVLS;
164  std::map<int, std::time_t> mapBeginBSTime, mapBeginPVTime;
165  //these maps are needed to keep track of size of theBSvector and pvStore
166  std::map<int, std::size_t> mapLSBSTrkSize;
167  std::map<int, size_t> mapLSPVStoreSize;
168  //to correct the cutFlot Table
169  std::map<int, TH1F> mapLSCF;
170 
171  // Summary:
172  Float_t reportSummary_;
173  Float_t summarySum_;
174  Float_t summaryContent_[3];
179  // variables for beam fit
180 
181  //
182  std::time_t tmpTime;
183  std::time_t startTime;
184  std::time_t refTime;
186  // Current run
187  int frun;
188  int lastNZbin; // last non zero bin of time histos
189 };
190 
191 #endif
192 
193 // Local Variables:
194 // show-trailing-whitespace: t
195 // truncate-lines: t
196 // End:
BeamMonitor(const edm::ParameterSet &)
Definition: BeamMonitor.cc:101
edm::EDGetTokenT< edm::TriggerResults > hltSrc_
Definition: BeamMonitor.h:80
const double phiMax_
Definition: BeamMonitor.h:70
std::unique_ptr< BeamFitter > theBeamFitter
Definition: BeamMonitor.h:93
unsigned int minNrVertices_
Definition: BeamMonitor.h:111
int nFitElements_
Definition: BeamMonitor.h:106
const edm::EventSetup & c
std::time_t refBStime[2]
Definition: BeamMonitor.h:103
MonitorElement * reportSummary
Definition: BeamMonitor.h:175
void bookHistograms(DQMStore::IBooker &i, const edm::Run &r, const edm::EventSetup &c) override
Definition: BeamMonitor.cc:221
int endLumiOfPVFit_
Definition: BeamMonitor.h:100
int resetFitNLumi_
Definition: BeamMonitor.h:86
MonitorElement * h_nVtx
Definition: BeamMonitor.h:149
const double dzMin_
Definition: BeamMonitor.h:73
double minVtxWgt_
Definition: BeamMonitor.h:113
MonitorElement * cutFlowTable
Definition: BeamMonitor.h:178
MonitorElement * h_PVz[2]
Definition: BeamMonitor.h:153
bool testScroll(std::time_t &, std::time_t &)
std::map< int, std::vector< float > > mapPVx
Definition: BeamMonitor.h:160
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Definition: BeamMonitor.cc:663
std::string recordName_
Definition: BeamMonitor.h:76
MonitorElement * h_PVxz
Definition: BeamMonitor.h:154
double minVtxNdf_
Definition: BeamMonitor.h:112
bool processed_
Definition: BeamMonitor.h:120
edm::EDGetTokenT< reco::VertexCollection > pvSrc_
Definition: BeamMonitor.h:79
const double phiMin_
Definition: BeamMonitor.h:69
edm::TimeValue_t ftimestamp
Definition: BeamMonitor.h:185
int nLS_for_upload_
Definition: BeamMonitor.h:124
const int dxBin_
Definition: BeamMonitor.h:60
std::vector< MonitorElement * > hs
Definition: BeamMonitor.h:157
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c) override
Definition: BeamMonitor.cc:800
int DBloggerReturn_
Definition: BeamMonitor.h:82
MonitorElement * h_sigmaZ0
Definition: BeamMonitor.h:148
MonitorElement * h_nTrk_lumi
Definition: BeamMonitor.h:132
std::map< int, std::size_t > mapLSBSTrkSize
Definition: BeamMonitor.h:166
const int vxBin_
Definition: BeamMonitor.h:64
MonitorElement * fitResults
Definition: BeamMonitor.h:142
std::vector< std::string > jetTrigger_
Definition: BeamMonitor.h:91
int fitPVNLumi_
Definition: BeamMonitor.h:85
MonitorElement * h_sigmaY0
Definition: BeamMonitor.h:147
std::map< int, std::vector< float > > mapPVz
Definition: BeamMonitor.h:160
std::map< int, std::time_t > mapBeginPVTime
Definition: BeamMonitor.h:164
std::map< int, std::vector< int > > mapNPV
Definition: BeamMonitor.h:161
std::map< int, std::time_t > mapBeginBSTime
Definition: BeamMonitor.h:164
const double dzMax_
Definition: BeamMonitor.h:74
MonitorElement * h_y0
Definition: BeamMonitor.h:144
int intervalInSec_
Definition: BeamMonitor.h:88
const double dxMin_
Definition: BeamMonitor.h:61
int countGapLumi_
Definition: BeamMonitor.h:118
edm::EDGetTokenT< reco::TrackCollection > tracksLabel_
Definition: BeamMonitor.h:78
MonitorElement * h_vy_dz
Definition: BeamMonitor.h:139
std::string getGMTstring(const std::time_t &)
Definition: BeamMonitor.cc:91
Float_t reportSummary_
Definition: BeamMonitor.h:172
MonitorElement * h_PVyz
Definition: BeamMonitor.h:155
std::time_t refTime
Definition: BeamMonitor.h:184
void formatFitTime(char *, const std::time_t &)
Definition: BeamMonitor.cc:43
MonitorElement * pvResults
Definition: BeamMonitor.h:156
int endLumiOfBSFit_
Definition: BeamMonitor.h:98
std::time_t refPVtime[2]
Definition: BeamMonitor.h:104
MonitorElement * h_nVtx_lumi
Definition: BeamMonitor.h:133
void RestartFitting()
reco::BeamSpot refBS
Definition: BeamMonitor.h:128
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
Definition: BeamMonitor.cc:214
unsigned long long TimeValue_t
Definition: Timestamp.h:28
std::map< int, TH1F > mapLSCF
Definition: BeamMonitor.h:169
MonitorElement * h_nVtx_lumi_all
Definition: BeamMonitor.h:134
double maxZ_
Definition: BeamMonitor.h:110
std::time_t startTime
Definition: BeamMonitor.h:183
const int phiBin_
Definition: BeamMonitor.h:68
void FitAndFill(const edm::LuminosityBlock &lumiSeg, int &, int &, int &)
Definition: BeamMonitor.cc:819
Float_t summaryContent_[3]
Definition: BeamMonitor.h:174
MonitorElement * h_sigmaX0
Definition: BeamMonitor.h:146
bool StartAverage_
Definition: BeamMonitor.h:116
edm::EDGetTokenT< reco::BeamSpot > bsSrc_
Definition: BeamMonitor.h:77
reco::BeamSpot preBS
Definition: BeamMonitor.h:129
const double dxMax_
Definition: BeamMonitor.h:62
MonitorElement * h_nVtx_st
Definition: BeamMonitor.h:150
const double vxMin_
Definition: BeamMonitor.h:65
MonitorElement * h_PVy[2]
Definition: BeamMonitor.h:152
int beginLumiOfPVFit_
Definition: BeamMonitor.h:99
MonitorElement * reportSummaryContents[3]
Definition: BeamMonitor.h:176
MonitorElement * h_x0
Definition: BeamMonitor.h:143
MonitorElement * h_trk_z0
Definition: BeamMonitor.h:136
const double vxMax_
Definition: BeamMonitor.h:66
int resetPVNLumi_
Definition: BeamMonitor.h:87
std::map< int, int > mapBeginBSLS
Definition: BeamMonitor.h:163
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context) override
Definition: BeamMonitor.cc:532
Float_t summarySum_
Definition: BeamMonitor.h:173
MonitorElement * h_trkPt
Definition: BeamMonitor.h:140
MonitorElement * h_vx_dz
Definition: BeamMonitor.h:138
int nAnalyzedLS_
Definition: BeamMonitor.h:123
MonitorElement * h_z0
Definition: BeamMonitor.h:145
const int dzBin_
Definition: BeamMonitor.h:72
bool useLockRecords_
Definition: BeamMonitor.h:121
unsigned int nthBSTrk_
Definition: BeamMonitor.h:105
unsigned int min_Ntrks_
Definition: BeamMonitor.h:109
edm::Service< cond::service::OnlineDBOutputService > onlineDbService_
Definition: BeamMonitor.h:81
bool resetHistos_
Definition: BeamMonitor.h:115
double deltaSigCut_
Definition: BeamMonitor.h:108
std::time_t tmpTime
Definition: BeamMonitor.h:182
int firstAverageFit_
Definition: BeamMonitor.h:117
void dqmEndRun(const edm::Run &r, const edm::EventSetup &c) override
MonitorElement * h_PVx[2]
Definition: BeamMonitor.h:151
std::map< int, int > mapBeginPVLS
Definition: BeamMonitor.h:163
int beginLumiOfBSFit_
Definition: BeamMonitor.h:97
MonitorElement * h_trkVz
Definition: BeamMonitor.h:141
std::string monitorName_
Definition: BeamMonitor.h:75
std::map< int, std::vector< float > > mapPVy
Definition: BeamMonitor.h:160
MonitorElement * h_d0_phi0
Definition: BeamMonitor.h:135
Definition: Run.h:45
MonitorElement * h_vx_vy
Definition: BeamMonitor.h:137
int countLumi_
Definition: BeamMonitor.h:96
void scrollTH1(TH1 *, std::time_t)
MonitorElement * reportSummaryMap
Definition: BeamMonitor.h:177
bool onlineMode_
Definition: BeamMonitor.h:90
std::map< int, size_t > mapLSPVStoreSize
Definition: BeamMonitor.h:167