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