CMS 3D CMS Logo

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