CMS 3D CMS Logo

HLXMonitor.cc
Go to the documentation of this file.
1 /*
2  Author: Adam Hunt
3  email: ahunt@princeton.edu
4 */
7 
8 // STL Headers
9 
10 #include <TSystem.h>
11 #include <cmath>
12 #include <iomanip>
13 
14 using std::cout;
15 using std::endl;
16 
18  NUM_HLX = iConfig.getUntrackedParameter<unsigned int>("numHlx", 36);
19  NUM_BUNCHES = iConfig.getUntrackedParameter<unsigned int>("numBunches", 3564);
20  MAX_LS = iConfig.getUntrackedParameter<unsigned int>("maximumNumLS", 480);
21  listenPort = iConfig.getUntrackedParameter<unsigned int>("SourcePort", 51001);
22  OutputFilePrefix = iConfig.getUntrackedParameter<std::string>("outputFile", "lumi");
23  OutputDir = iConfig.getUntrackedParameter<std::string>("outputDir", " data");
24  SavePeriod = iConfig.getUntrackedParameter<unsigned int>("SavePeriod", 10);
25  NBINS = iConfig.getUntrackedParameter<unsigned int>("NBINS",
26  297); // 12 BX per bin
27  XMIN = iConfig.getUntrackedParameter<double>("XMIN", 0);
28  XMAX = iConfig.getUntrackedParameter<double>("XMAX", 3564);
29  Style = iConfig.getUntrackedParameter<std::string>("Style", "BX");
30  AquireMode = iConfig.getUntrackedParameter<unsigned int>("AquireMode", 0);
31  Accumulate = iConfig.getUntrackedParameter<bool>("Accumulate", true); // all
32  TriggerBX = iConfig.getUntrackedParameter<unsigned int>("TriggerBX", 50);
33  MinLSBeforeSave = iConfig.getUntrackedParameter<unsigned int>("MinLSBeforeSave", 1);
34  reconnTime = iConfig.getUntrackedParameter<unsigned int>("ReconnectionTime", 5);
35  DistribIP1 = iConfig.getUntrackedParameter<std::string>("PrimaryHLXDAQIP", "vmepcs2f17-18");
36  DistribIP2 = iConfig.getUntrackedParameter<std::string>("SecondaryHLXDAQIP", "vmepcs2f17-19");
37 
38  eventInfoFolderHLX_ = iConfig.getUntrackedParameter<std::string>("eventInfoFolderHLX", "EventInfoHLX");
39  eventInfoFolder_ = iConfig.getUntrackedParameter<std::string>("eventInfoFolder", "EventInfo");
40  subSystemName_ = iConfig.getUntrackedParameter<std::string>("subSystemName", "HLX");
41 
42  // Set the lumi section counter
43  lsBinOld = 0;
44  previousSection = 0;
45  lumiSectionCount = 0;
53 
54  // HLX Config info
55  set1BelowIndex = 0;
56  set1BetweenIndex = 1;
57  set1AboveIndex = 2;
58  set2BelowIndex = 3;
59  set2BetweenIndex = 4;
60  set2AboveIndex = 5;
61 
62  runNumLength = 9;
63  secNumLength = 8;
64 
65  if (NUM_HLX > 36)
66  NUM_HLX = 36;
67 
68  if (NUM_BUNCHES > 3564)
69  NUM_BUNCHES = 3564;
70 
71  if (XMAX <= XMIN) {
72  XMIN = 0;
73  if (XMAX <= 0)
74  XMAX = 3564;
75  }
76 
77  if ((Style == "History") || (NBINS == 0)) {
78  NBINS = (unsigned int)(XMAX - XMIN);
79  }
80 
81  monitorName_ = iConfig.getUntrackedParameter<std::string>("monitorName", "HLX");
82  // cout << "Monitor name = " << monitorName_ << endl;
83  prescaleEvt_ = iConfig.getUntrackedParameter<int>("prescaleEvt", -1);
84  // cout << "===>DQM event prescale = " << prescaleEvt_ << " events "<< endl;
85 
86  unsigned int HLXHFMapTemp[] = {31, 32, 33, 34, 35, 18, // s2f07 hf-
87  13, 14, 15, 16, 17, 0, // s2f07 hf+
88  25, 26, 27, 28, 29, 30, // s2f05 hf-
89  7, 8, 9, 10, 11, 12, // s2f05 hf+
90  19, 20, 21, 22, 23, 24, // s2f02 hf-
91  1, 2, 3, 4, 5, 6}; // s2f02 hf+
92 
93  currentRunEnded_ = true;
94  runNumber_ = 0;
95  expectedNibbles_ = 0;
96 
97  for (int iHLX = 0; iHLX < 36; ++iHLX) {
98  HLXHFMap[iHLX] = HLXHFMapTemp[iHLX];
99  // std::cout << "At " << iHLX << " Wedge " << HLXHFMap[iHLX] << std::endl;
100  totalNibbles_[iHLX] = 0;
101  }
102 
103  num4NibblePerLS_ = 16.0;
104 
105  connectHLXTCP(); // this was originally done in beginJob()
106 }
107 
109  HLXTCP.Disconnect();
110  EndRun();
111 }
112 
113 // Method called once each job just before starting event loop
116  int errorCode = HLXTCP.SetPort(listenPort);
117  cout << "SetPort: " << listenPort << " Success: " << errorCode << endl;
118  errorCode = HLXTCP.SetMode(AquireMode);
119  cout << "AquireMode: " << AquireMode << " Success: " << errorCode << endl;
120 
121  while (HLXTCP.IsConnected() == false) {
123  if (HLXTCP.Connect() != 1) {
124  std::cout << "Failed to connect to " << DistribIP1 << "." << std::endl;
125  sleep(1);
126  std::cout << "Trying " << DistribIP2 << std::endl;
128  if (HLXTCP.Connect() == 1)
129  break;
130  std::cout << "Failed to connect to " << DistribIP2 << "." << std::endl;
131  std::cout << " Reconnect in " << reconnTime << " seconds." << std::endl;
132  sleep(reconnTime);
133  }
134  }
135  if (HLXTCP.IsConnected() == true) {
136  std::cout << "Successfully connected." << std::endl;
137  }
138 }
139 
140 // ------------ Setup the monitoring elements ---------------
142  SetupHists(iBooker);
143  SetupEventInfo(iBooker);
144 }
145 
147  iBooker.setCurrentFolder(monitorName_ + "/HFPlus");
148 
149  for (unsigned int iWedge = 0; iWedge < 18 && iWedge < NUM_HLX; ++iWedge) {
150  std::ostringstream tempStreamer;
151  tempStreamer << std::dec << std::setw(2) << std::setfill('0') << (iWedge + 1);
152 
153  std::ostringstream wedgeNum;
154  wedgeNum << std::dec << (iWedge % 18) + 1;
155 
156  iBooker.setCurrentFolder(monitorName_ + "/HFPlus/Wedge" + tempStreamer.str());
157 
158  Set1Below[iWedge] =
159  iBooker.book1D("Set1_Below", "HF+ Wedge " + wedgeNum.str() + ": Below Threshold 1 - Set 1", NBINS, XMIN, XMAX);
160  Set1Between[iWedge] = iBooker.book1D(
161  "Set1_Between", "HF+ Wedge " + wedgeNum.str() + ": Between Threshold 1 & 2 - Set 1", NBINS, XMIN, XMAX);
162  Set1Above[iWedge] =
163  iBooker.book1D("Set1_Above", "HF+ Wedge " + wedgeNum.str() + ": Above Threshold 2 - Set 1", NBINS, XMIN, XMAX);
164  Set2Below[iWedge] =
165  iBooker.book1D("Set2_Below", "HF+ Wedge " + wedgeNum.str() + ": Below Threshold 1 - Set 2", NBINS, XMIN, XMAX);
166  Set2Between[iWedge] = iBooker.book1D(
167  "Set2_Between", "HF+ Wedge " + wedgeNum.str() + ": Between Threshold 1 & 2 - Set 2", NBINS, XMIN, XMAX);
168  Set2Above[iWedge] =
169  iBooker.book1D("Set2_Above", "HF+ Wedge " + wedgeNum.str() + ": Above Threshold 2 - Set 2", NBINS, XMIN, XMAX);
170  ETSum[iWedge] = iBooker.book1D("ETSum", "HF+ Wedge " + wedgeNum.str() + ": Transverse Energy", NBINS, XMIN, XMAX);
171  }
172 
173  if (NUM_HLX > 17) {
174  iBooker.setCurrentFolder(monitorName_ + "/HFMinus");
175 
176  for (unsigned int iWedge = 18; iWedge < NUM_HLX; ++iWedge) {
177  std::ostringstream tempStreamer;
178  tempStreamer << std::dec << std::setw(2) << std::setfill('0') << (iWedge + 1);
179 
180  std::ostringstream wedgeNum;
181  wedgeNum << std::dec << (iWedge % 18) + 1;
182 
183  iBooker.setCurrentFolder(monitorName_ + "/HFMinus/Wedge" + tempStreamer.str());
184  Set1Below[iWedge] = iBooker.book1D(
185  "Set1_Below", "HF- Wedge " + wedgeNum.str() + ": Below Threshold 1 - Set 1", NBINS, XMIN, XMAX);
186  Set1Between[iWedge] = iBooker.book1D(
187  "Set1_Between", "HF- Wedge " + wedgeNum.str() + ": Between Threshold 1 & 2 - Set 1", NBINS, XMIN, XMAX);
188  Set1Above[iWedge] = iBooker.book1D(
189  "Set1_Above", "HF- Wedge " + wedgeNum.str() + ": Above Threshold 2 - Set 1", NBINS, XMIN, XMAX);
190  Set2Below[iWedge] = iBooker.book1D(
191  "Set2_Below", "HF- Wedge " + wedgeNum.str() + ": Below Threshold 1 - Set 2", NBINS, XMIN, XMAX);
192  Set2Between[iWedge] = iBooker.book1D(
193  "Set2_Between", "HF- Wedge " + wedgeNum.str() + ": Between Threshold 1 & 2 - Set 2", NBINS, XMIN, XMAX);
194  Set2Above[iWedge] = iBooker.book1D(
195  "Set2_Above", "HF- Wedge " + wedgeNum.str() + ": Above Threshold 2 - Set 2", NBINS, XMIN, XMAX);
196  ETSum[iWedge] = iBooker.book1D("ETSum", "HF- Wedge " + wedgeNum.str() + ": Transverse Energy", NBINS, XMIN, XMAX);
197  }
198  }
199 
200  if (!Accumulate) {
201  for (unsigned int iWedge = 0; iWedge < NUM_HLX; ++iWedge) {
202  Set1Below[iWedge]->setResetMe(true);
203  Set1Between[iWedge]->setResetMe(true);
204  Set1Above[iWedge]->setResetMe(true);
205  Set2Below[iWedge]->setResetMe(true);
206  Set2Between[iWedge]->setResetMe(true);
207  Set2Above[iWedge]->setResetMe(true);
208  ETSum[iWedge]->setResetMe(true);
209  }
210  }
211 
212  if (Style == "BX") {
213  OccXAxisTitle = "Bunch Crossing";
214  OccYAxisTitle = "Tower Occupancy";
215  EtXAxisTitle = "Bunch Crossing";
216  EtYAxisTitle = "E_{T} Sum";
217  } else if (Style == "Distribution") {
218  OccXAxisTitle = "Tower Occupancy";
219  OccYAxisTitle = "Count";
220  EtXAxisTitle = "E_{T} Sum";
221  EtYAxisTitle = "Count";
222  }
223 
224  for (unsigned int iWedge = 0; iWedge < NUM_HLX; ++iWedge) {
225  Set1Below[iWedge]->setAxisTitle(OccXAxisTitle, 1);
226  Set1Below[iWedge]->setAxisTitle(OccYAxisTitle, 2);
229  Set1Above[iWedge]->setAxisTitle(OccXAxisTitle, 1);
230  Set1Above[iWedge]->setAxisTitle(OccYAxisTitle, 2);
231  Set2Below[iWedge]->setAxisTitle(OccXAxisTitle, 1);
232  Set2Below[iWedge]->setAxisTitle(OccYAxisTitle, 2);
235  Set2Above[iWedge]->setAxisTitle(OccXAxisTitle, 1);
236  Set2Above[iWedge]->setAxisTitle(OccYAxisTitle, 2);
237  ETSum[iWedge]->setAxisTitle(EtXAxisTitle, 1);
238  ETSum[iWedge]->setAxisTitle(EtYAxisTitle, 2);
239  }
240 
241  // Comparison Histograms
242 
243  iBooker.setCurrentFolder(monitorName_ + "/HFCompare");
244 
245  std::string CompXTitle = "HF Wedge";
246  std::string CompEtSumYTitle = "E_{T} Sum per active tower";
247  std::string CompOccYTitle = "Occupancy per active tower";
248 
249  HFCompareEtSum = iBooker.book1D("HFCompareEtSum", "E_{T} Sum", NUM_HLX, 0, NUM_HLX);
250  HFCompareEtSum->setAxisTitle(CompXTitle, 1);
251  HFCompareEtSum->setAxisTitle(CompEtSumYTitle, 2);
252 
254  iBooker.book1D("HFCompareOccBelowSet1", "Occupancy Below Threshold 1 - Set 1", NUM_HLX, 0, NUM_HLX);
255  HFCompareOccBelowSet1->setAxisTitle(CompXTitle, 1);
256  HFCompareOccBelowSet1->setAxisTitle(CompOccYTitle, 2);
257 
259  iBooker.book1D("HFCompareOccBetweenSet1", "Occupancy Between Threshold 1 & 2 - Set 1", NUM_HLX, 0, NUM_HLX);
260  HFCompareOccBetweenSet1->setAxisTitle(CompXTitle, 1);
261  HFCompareOccBetweenSet1->setAxisTitle(CompOccYTitle, 2);
262 
264  iBooker.book1D("HFCompareOccAboveSet1", "Occupancy Above Threshold 2 - Set 1", NUM_HLX, 0, NUM_HLX);
265  HFCompareOccAboveSet1->setAxisTitle(CompXTitle, 1);
266  HFCompareOccAboveSet1->setAxisTitle(CompOccYTitle, 2);
267 
269  iBooker.book1D("HFCompareOccBelowSet2", "Occupancy Below Threshold 1 - Set 2", NUM_HLX, 0, NUM_HLX);
270  HFCompareOccBelowSet2->setAxisTitle(CompXTitle, 1);
271  HFCompareOccBelowSet2->setAxisTitle(CompOccYTitle, 2);
272 
274  iBooker.book1D("HFCompareOccBetweenSet2", "Occupancy Between Threshold 1 & 2 - Set 2", NUM_HLX, 0, NUM_HLX);
275  HFCompareOccBetweenSet2->setAxisTitle(CompXTitle, 1);
276  HFCompareOccBetweenSet2->setAxisTitle(CompOccYTitle, 2);
277 
279  iBooker.book1D("HFCompareOccAboveSet2", "Occupancy Above Threshold 2 - Set 2", NUM_HLX, 0, NUM_HLX);
280  HFCompareOccAboveSet2->setAxisTitle(CompXTitle, 1);
281  HFCompareOccAboveSet2->setAxisTitle(CompOccYTitle, 2);
282 
283  // Average Histograms
284 
285  iBooker.setCurrentFolder(monitorName_ + "/Average");
286 
287  int OccBins = 10000; // This does absolutely nothing.
288  double OccMin = 0;
289  double OccMax = 0; // If min and max are zero, no bounds on the data are set.
290 
291  int EtSumBins = 10000; // This does absolutely nothing. The Variable is not
292  // used in the function.
293  double EtSumMin = 0;
294  double EtSumMax = 0; // If min and max are zero, no bounds on the data are set.
295 
296  std::string errorOpt = "i";
297 
298  std::string AvgXTitle = "HF Wedge";
299  std::string AvgEtSumYTitle = "Average E_{T} Sum";
300  std::string AvgOccYTitle = "Average Tower Occupancy";
301 
302  AvgEtSum = iBooker.bookProfile("AvgEtSum", "Average E_{T} Sum", NUM_HLX, 0, NUM_HLX, EtSumBins, EtSumMin, EtSumMax);
303  AvgEtSum->setAxisTitle(AvgXTitle, 1);
304  AvgEtSum->setAxisTitle(AvgEtSumYTitle, 2);
305 
306  AvgOccBelowSet1 = iBooker.bookProfile("AvgOccBelowSet1",
307  "Average Occupancy Below Threshold 1 - Set1",
308  NUM_HLX,
309  0,
310  NUM_HLX,
311  OccBins,
312  OccMin,
313  OccMax,
314  errorOpt.c_str());
315  AvgOccBelowSet1->setAxisTitle(AvgXTitle, 1);
316  AvgOccBelowSet1->setAxisTitle(AvgOccYTitle, 2);
317 
318  AvgOccBetweenSet1 = iBooker.bookProfile("AvgOccBetweenSet1",
319  "Average Occupancy Between Threhold 1 & 2 - Set1",
320  NUM_HLX,
321  0,
322  NUM_HLX,
323  OccBins,
324  OccMin,
325  OccMax,
326  errorOpt.c_str());
327  AvgOccBetweenSet1->setAxisTitle(AvgXTitle, 1);
328  AvgOccBetweenSet1->setAxisTitle(AvgOccYTitle, 2);
329 
330  AvgOccAboveSet1 = iBooker.bookProfile("AvgOccAboveSet1",
331  "Average Occupancy Above Threshold 2 - Set1",
332  NUM_HLX,
333  0,
334  NUM_HLX,
335  OccBins,
336  OccMin,
337  OccMax,
338  errorOpt.c_str());
339  AvgOccAboveSet1->setAxisTitle(AvgXTitle, 1);
340  AvgOccAboveSet1->setAxisTitle(AvgOccYTitle, 2);
341 
342  AvgOccBelowSet2 = iBooker.bookProfile("AvgOccBelowSet2",
343  "Average Occupancy Below Threshold 1 - Set2",
344  NUM_HLX,
345  0,
346  NUM_HLX,
347  OccBins,
348  OccMin,
349  OccMax,
350  errorOpt.c_str());
351  AvgOccBelowSet2->setAxisTitle(AvgXTitle, 1);
352  AvgOccBelowSet2->setAxisTitle(AvgOccYTitle, 2);
353 
354  AvgOccBetweenSet2 = iBooker.bookProfile("AvgOccBetweenSet2",
355  "Average Occupancy Between Threshold 1 & 2 - Set2",
356  NUM_HLX,
357  0,
358  NUM_HLX,
359  OccBins,
360  OccMin,
361  OccMax,
362  errorOpt.c_str());
363  AvgOccBetweenSet2->setAxisTitle(AvgXTitle, 1);
364  AvgOccBetweenSet2->setAxisTitle(AvgOccYTitle, 2);
365 
366  AvgOccAboveSet2 = iBooker.bookProfile("AvgOccAboveSet2",
367  "Average Occupancy Above Threshold 2 - Set2",
368  NUM_HLX,
369  0,
370  NUM_HLX,
371  OccBins,
372  OccMin,
373  OccMax,
374  errorOpt.c_str());
375  AvgOccAboveSet2->setAxisTitle(AvgXTitle, 1);
376  AvgOccAboveSet2->setAxisTitle(AvgOccYTitle, 2);
377 
378  // Luminosity Histograms
379  iBooker.setCurrentFolder(monitorName_ + "/Luminosity");
380 
381  std::string LumiXTitle = "Bunch Crossing";
382  std::string LumiEtSumYTitle = "Luminosity: E_{T} Sum";
383  std::string LumiOccYTitle = "Luminosity: Occupancy";
384 
385  LumiAvgEtSum = iBooker.bookProfile(
386  "LumiAvgEtSum", "Average Luminosity ", int(XMAX - XMIN), XMIN, XMAX, EtSumBins, EtSumMin, EtSumMax);
387  LumiAvgEtSum->setAxisTitle(LumiXTitle, 1);
388  LumiAvgEtSum->setAxisTitle(LumiEtSumYTitle, 2);
389 
390  LumiAvgOccSet1 = iBooker.bookProfile(
391  "LumiAvgOccSet1", "Average Luminosity - Set 1", int(XMAX - XMIN), XMIN, XMAX, OccBins, OccMax, OccMin);
392  LumiAvgOccSet1->setAxisTitle(LumiXTitle, 1);
393  LumiAvgOccSet1->setAxisTitle(LumiOccYTitle, 2);
394 
395  LumiAvgOccSet2 = iBooker.bookProfile(
396  "LumiAvgOccSet2", "Average Luminosity - Set 2", int(XMAX - XMIN), XMIN, XMAX, OccBins, OccMax, OccMin);
397  LumiAvgOccSet2->setAxisTitle(LumiXTitle, 1);
398  LumiAvgOccSet2->setAxisTitle(LumiOccYTitle, 2);
399 
400  LumiInstantEtSum = iBooker.book1D("LumiInstantEtSum", "Instantaneous Luminosity ", int(XMAX - XMIN), XMIN, XMAX);
401  LumiInstantEtSum->setAxisTitle(LumiXTitle, 1);
402  LumiInstantEtSum->setAxisTitle(LumiEtSumYTitle, 2);
403 
405  iBooker.book1D("LumiInstantOccSet1", "Instantaneous Luminosity - Set 1", int(XMAX - XMIN), XMIN, XMAX);
406  LumiInstantOccSet1->setAxisTitle(LumiXTitle, 1);
407  LumiInstantOccSet1->setAxisTitle(LumiOccYTitle, 2);
408 
410  iBooker.book1D("LumiInstantOccSet2", "Instantaneous Luminosity - Set 2", int(XMAX - XMIN), XMIN, XMAX);
411  LumiInstantOccSet2->setAxisTitle(LumiXTitle, 1);
412  LumiInstantOccSet2->setAxisTitle(LumiOccYTitle, 2);
413 
414  LumiIntegratedEtSum = iBooker.book1D("LumiIntegratedEtSum", "Integrated Luminosity ", int(XMAX - XMIN), XMIN, XMAX);
415  LumiIntegratedEtSum->setAxisTitle(LumiXTitle, 1);
416  LumiIntegratedEtSum->setAxisTitle(LumiEtSumYTitle, 2);
417 
419  iBooker.book1D("LumiIntegratedOccSet1", "Integrated Luminosity - Set 1", int(XMAX - XMIN), XMIN, XMAX);
420  LumiIntegratedOccSet1->setAxisTitle(LumiXTitle, 1);
421  LumiIntegratedOccSet1->setAxisTitle(LumiOccYTitle, 2);
422 
424  iBooker.book1D("LumiIntegratedOccSet2", "Integrated Luminosity - Set 2", int(XMAX - XMIN), XMIN, XMAX);
425  LumiIntegratedOccSet2->setAxisTitle(LumiXTitle, 1);
426  LumiIntegratedOccSet2->setAxisTitle(LumiOccYTitle, 2);
427 
428  // Sanity check sum histograms
429  iBooker.setCurrentFolder(monitorName_ + "/CheckSums");
430 
431  std::string sumXTitle = "HF Wedge";
432  std::string sumYTitle = "Occupancy Sum (Below+Above+Between)";
433 
434  SumAllOccSet1 =
435  iBooker.bookProfile("SumAllOccSet1", "Occupancy Check - Set 1", NUM_HLX, 0, NUM_HLX, OccBins, OccMax, OccMin);
436  SumAllOccSet1->setAxisTitle(sumXTitle, 1);
437  SumAllOccSet1->setAxisTitle(sumYTitle, 2);
438 
439  SumAllOccSet2 =
440  iBooker.bookProfile("SumAllOccSet2", "Occupancy Check - Set 2", NUM_HLX, 0, NUM_HLX, OccBins, OccMax, OccMin);
441  SumAllOccSet2->setAxisTitle(sumXTitle, 1);
442  SumAllOccSet2->setAxisTitle(sumYTitle, 2);
443 
444  MissingDQMDataCheck = iBooker.book1D("MissingDQMDataCheck", "Missing Data Count", 1, 0, 1);
446  MissingDQMDataCheck->setAxisTitle("Number Missing Nibbles", 2);
447 
448  // Signal & Background monitoring histograms
449  iBooker.setCurrentFolder(monitorName_ + "/SigBkgLevels");
450 
451  MaxInstLumiBX1 = iBooker.book1D("MaxInstLumiBX1", "Max Instantaneous Luminosity BX: 1st", 10000, -1e-5, 0.01);
452  MaxInstLumiBX1->setAxisTitle("Max Inst. L (10^{30}cm^{-2}s^{-1})", 1);
453  MaxInstLumiBX1->setAxisTitle("Entries", 2);
454  MaxInstLumiBX2 = iBooker.book1D("MaxInstLumiBX2", "Max Instantaneous Luminosity BX: 2nd", 10000, -1e-5, 0.01);
455  MaxInstLumiBX2->setAxisTitle("Max Inst. L (10^{30}cm^{-2}s^{-1})", 1);
456  MaxInstLumiBX2->setAxisTitle("Entries", 2);
457  MaxInstLumiBX3 = iBooker.book1D("MaxInstLumiBX3", "Max Instantaneous Luminosity BX: 3rd", 10000, -1e-5, 0.01);
458  MaxInstLumiBX3->setAxisTitle("Max Inst. L (10^{30}cm^{-2}s^{-1})", 1);
459  MaxInstLumiBX3->setAxisTitle("Entries", 2);
460  MaxInstLumiBX4 = iBooker.book1D("MaxInstLumiBX4", "Max Instantaneous Luminosity BX: 4th", 10000, -1e-5, 0.01);
461  MaxInstLumiBX4->setAxisTitle("Max Inst. L (10^{30}cm^{-2}s^{-1})", 1);
462  MaxInstLumiBX4->setAxisTitle("Entries", 2);
463 
464  MaxInstLumiBXNum1 = iBooker.book1D("MaxInstLumiBXNum1", "BX Number of Max: 1st", 3564, 0, 3564);
466  MaxInstLumiBXNum1->setAxisTitle("Num Time Max", 2);
467  MaxInstLumiBXNum2 = iBooker.book1D("MaxInstLumiBXNum2", "BX Number of Max: 2nd", 3564, 0, 3564);
469  MaxInstLumiBXNum2->setAxisTitle("Num Time Max", 2);
470  MaxInstLumiBXNum3 = iBooker.book1D("MaxInstLumiBXNum3", "BX Number of Max: 3rd", 3564, 0, 3564);
472  MaxInstLumiBXNum3->setAxisTitle("Num Time Max", 2);
473  MaxInstLumiBXNum4 = iBooker.book1D("MaxInstLumiBXNum4", "BX Number of Max: 4th", 3564, 0, 3564);
475  MaxInstLumiBXNum4->setAxisTitle("Num Time Max", 2);
476 
477  // History histograms
478  iBooker.setCurrentFolder(monitorName_ + "/HistoryRaw");
479 
480  std::string HistXTitle = "Time (LS)";
481  std::string RecentHistXTitle = "Time (LS/16)";
482  std::string HistEtSumYTitle = "Average E_{T} Sum";
483  std::string HistOccYTitle = "Average Occupancy";
484  std::string HistLumiYTitle = "Luminosity";
485  std::string HistLumiErrorYTitle = "Luminosity Error (%)";
486  std::string BXvsTimeXTitle = "Time (LS)";
487  std::string BXvsTimeYTitle = "BX";
488 
489  // Et Sum histories
490  HistAvgEtSumHFP = iBooker.bookProfile(
491  "HistAvgEtSumHFP", "Average Et Sum: HF+", MAX_LS, 0.5, (double)MAX_LS + 0.5, EtSumBins, EtSumMin, EtSumMax);
492  HistAvgEtSumHFP->setAxisTitle(HistXTitle, 1);
493  HistAvgEtSumHFP->setAxisTitle(HistEtSumYTitle, 2);
494 
495  HistAvgEtSumHFM = iBooker.bookProfile(
496  "HistAvgEtSumHFM", "Average Et Sum: HF-", MAX_LS, 0.5, (double)MAX_LS + 0.5, EtSumBins, EtSumMin, EtSumMax);
497  HistAvgEtSumHFM->setAxisTitle(HistXTitle, 1);
498  HistAvgEtSumHFM->setAxisTitle(HistEtSumYTitle, 2);
499 
500  // Tower Occupancy Histories
501  HistAvgOccBelowSet1HFP = iBooker.bookProfile("HistAvgOccBelowSet1HFP",
502  "Average Occ Set1Below: HF+",
503  MAX_LS,
504  0.5,
505  (double)MAX_LS + 0.5,
506  OccBins,
507  OccMin,
508  OccMax);
509  HistAvgOccBelowSet1HFP->setAxisTitle(HistXTitle, 1);
510  HistAvgOccBelowSet1HFP->setAxisTitle(HistOccYTitle, 2);
511 
512  HistAvgOccBelowSet1HFM = iBooker.bookProfile("HistAvgOccBelowSet1HFM",
513  "Average Occ Set1Below: HF-",
514  MAX_LS,
515  0.5,
516  (double)MAX_LS + 0.5,
517  OccBins,
518  OccMin,
519  OccMax);
520  HistAvgOccBelowSet1HFM->setAxisTitle(HistXTitle, 1);
521  HistAvgOccBelowSet1HFM->setAxisTitle(HistOccYTitle, 2);
522 
523  HistAvgOccBetweenSet1HFP = iBooker.bookProfile("HistAvgOccBetweenSet1HFP",
524  "Average Occ Set1Between: HF+",
525  MAX_LS,
526  0.5,
527  (double)MAX_LS + 0.5,
528  OccBins,
529  OccMin,
530  OccMax);
531  HistAvgOccBetweenSet1HFP->setAxisTitle(HistXTitle, 1);
532  HistAvgOccBetweenSet1HFP->setAxisTitle(HistOccYTitle, 2);
533 
534  HistAvgOccBetweenSet1HFM = iBooker.bookProfile("HistAvgOccBetweenSet1HFM",
535  "Average Occ Set1Between: HF-",
536  MAX_LS,
537  0.5,
538  (double)MAX_LS + 0.5,
539  OccBins,
540  OccMin,
541  OccMax);
542  HistAvgOccBetweenSet1HFM->setAxisTitle(HistXTitle, 1);
543  HistAvgOccBetweenSet1HFM->setAxisTitle(HistOccYTitle, 2);
544 
545  HistAvgOccAboveSet1HFP = iBooker.bookProfile("HistAvgOccAboveSet1HFP",
546  "Average Occ Set1Above: HF+",
547  MAX_LS,
548  0.5,
549  (double)MAX_LS + 0.5,
550  OccBins,
551  OccMin,
552  OccMax);
553  HistAvgOccAboveSet1HFP->setAxisTitle(HistXTitle, 1);
554  HistAvgOccAboveSet1HFP->setAxisTitle(HistOccYTitle, 2);
555 
556  HistAvgOccAboveSet1HFM = iBooker.bookProfile("HistAvgOccAboveSet1HFM",
557  "Average Occ Set1Above: HF-",
558  MAX_LS,
559  0.5,
560  (double)MAX_LS + 0.5,
561  OccBins,
562  OccMin,
563  OccMax);
564  HistAvgOccAboveSet1HFM->setAxisTitle(HistXTitle, 1);
565  HistAvgOccAboveSet1HFM->setAxisTitle(HistOccYTitle, 2);
566 
567  HistAvgOccBelowSet2HFP = iBooker.bookProfile("HistAvgOccBelowSet2HFP",
568  "Average Occ Set2Below: HF+",
569  MAX_LS,
570  0.5,
571  (double)MAX_LS + 0.5,
572  OccBins,
573  OccMin,
574  OccMax);
575  HistAvgOccBelowSet2HFP->setAxisTitle(HistXTitle, 1);
576  HistAvgOccBelowSet2HFP->setAxisTitle(HistOccYTitle, 2);
577 
578  HistAvgOccBelowSet2HFM = iBooker.bookProfile("HistAvgOccBelowSet2HFM",
579  "Average Occ Set2Below: HF-",
580  MAX_LS,
581  0.5,
582  (double)MAX_LS + 0.5,
583  OccBins,
584  OccMin,
585  OccMax);
586  HistAvgOccBelowSet2HFM->setAxisTitle(HistXTitle, 1);
587  HistAvgOccBelowSet2HFM->setAxisTitle(HistOccYTitle, 2);
588 
589  HistAvgOccBetweenSet2HFP = iBooker.bookProfile("HistAvgOccBetweenSet2HFP",
590  "Average Occ Set2Between: HF+",
591  MAX_LS,
592  0.5,
593  (double)MAX_LS + 0.5,
594  OccBins,
595  OccMin,
596  OccMax);
597  HistAvgOccBetweenSet2HFP->setAxisTitle(HistXTitle, 1);
598  HistAvgOccBetweenSet2HFP->setAxisTitle(HistOccYTitle, 2);
599 
600  HistAvgOccBetweenSet2HFM = iBooker.bookProfile("HistAvgOccBetweenSet2HFM",
601  "Average Occ Set2Between: HF-",
602  MAX_LS,
603  0.5,
604  (double)MAX_LS + 0.5,
605  OccBins,
606  OccMin,
607  OccMax);
608  HistAvgOccBetweenSet2HFM->setAxisTitle(HistXTitle, 1);
609  HistAvgOccBetweenSet2HFM->setAxisTitle(HistOccYTitle, 2);
610 
611  HistAvgOccAboveSet2HFP = iBooker.bookProfile("HistAvgOccAboveSet2HFP",
612  "Average Occ Set2Above: HF+",
613  MAX_LS,
614  0.5,
615  (double)MAX_LS + 0.5,
616  OccBins,
617  OccMin,
618  OccMax);
619  HistAvgOccAboveSet2HFP->setAxisTitle(HistXTitle, 1);
620  HistAvgOccAboveSet2HFP->setAxisTitle(HistOccYTitle, 2);
621 
622  HistAvgOccAboveSet2HFM = iBooker.bookProfile("HistAvgOccAboveSet2HFM",
623  "Average Occ Set2Above: HF-",
624  MAX_LS,
625  0.5,
626  (double)MAX_LS + 0.5,
627  OccBins,
628  OccMin,
629  OccMax);
630  HistAvgOccAboveSet2HFM->setAxisTitle(HistXTitle, 1);
631  HistAvgOccAboveSet2HFM->setAxisTitle(HistOccYTitle, 2);
632 
633  // Et Sum histories
634  BXvsTimeAvgEtSumHFP = iBooker.book2D("BXvsTimeAvgEtSumHFP",
635  "Average Et Sum: HF+",
636  MAX_LS,
637  0.5,
638  (double)MAX_LS + 0.5,
639  NBINS,
640  (double)XMIN,
641  (double)XMAX);
642  BXvsTimeAvgEtSumHFP->setAxisTitle(BXvsTimeXTitle, 1);
643  BXvsTimeAvgEtSumHFP->setAxisTitle(BXvsTimeYTitle, 2);
644 
645  BXvsTimeAvgEtSumHFM = iBooker.book2D("BXvsTimeAvgEtSumHFM",
646  "Average Et Sum: HF-",
647  MAX_LS,
648  0.5,
649  (double)MAX_LS + 0.5,
650  NBINS,
651  (double)XMIN,
652  (double)XMAX);
653  BXvsTimeAvgEtSumHFM->setAxisTitle(BXvsTimeXTitle, 1);
654  BXvsTimeAvgEtSumHFM->setAxisTitle(BXvsTimeYTitle, 2);
655 
656  iBooker.setCurrentFolder(monitorName_ + "/HistoryLumi");
657 
658  // Lumi Histories
659  HistAvgLumiEtSum = iBooker.bookProfile("HistAvgLumiEtSum",
660  "Average Instant Luminosity: Et Sum",
661  MAX_LS,
662  0.5,
663  (double)MAX_LS + 0.5,
664  EtSumBins,
665  EtSumMin,
666  EtSumMax);
667  HistAvgLumiEtSum->setAxisTitle(HistXTitle, 1);
668  HistAvgLumiEtSum->setAxisTitle(HistLumiYTitle, 2);
669 
670  HistAvgLumiOccSet1 = iBooker.bookProfile("HistAvgLumiOccSet1",
671  "Average Instant Luminosity: Occ Set1",
672  MAX_LS,
673  0.5,
674  (double)MAX_LS + 0.5,
675  OccBins,
676  OccMin,
677  OccMax);
678  HistAvgLumiOccSet1->setAxisTitle(HistXTitle, 1);
679  HistAvgLumiOccSet1->setAxisTitle(HistLumiYTitle, 2);
680 
681  HistAvgLumiOccSet2 = iBooker.bookProfile("HistAvgLumiOccSet2",
682  "Average Instant Luminosity: Occ Set2",
683  MAX_LS,
684  0.5,
685  (double)MAX_LS + 0.5,
686  OccBins,
687  OccMin,
688  OccMax);
689  HistAvgLumiOccSet2->setAxisTitle(HistXTitle, 1);
690  HistAvgLumiOccSet2->setAxisTitle(HistLumiYTitle, 2);
691 
693  iBooker.book1D("HistInstantLumiEtSum", "Instant Luminosity: Et Sum", MAX_LS, 0.5, (double)MAX_LS + 0.5);
694  HistInstantLumiEtSum->setAxisTitle(HistXTitle, 1);
695  HistInstantLumiEtSum->setAxisTitle(HistLumiYTitle, 2);
696 
698  iBooker.book1D("HistInstantLumiOccSet1", "Instant Luminosity: Occ Set1", MAX_LS, 0.5, (double)MAX_LS + 0.5);
699  HistInstantLumiOccSet1->setAxisTitle(HistXTitle, 1);
700  HistInstantLumiOccSet1->setAxisTitle(HistLumiYTitle, 2);
701 
703  iBooker.book1D("HistInstantLumiOccSet2", "Instant Luminosity: Occ Set2", MAX_LS, 0.5, (double)MAX_LS + 0.5);
704  HistInstantLumiOccSet2->setAxisTitle(HistXTitle, 1);
705  HistInstantLumiOccSet2->setAxisTitle(HistLumiYTitle, 2);
706 
708  iBooker.book1D("HistInstantLumiEtSumError", "Luminosity Error: Et Sum", MAX_LS, 0.5, (double)MAX_LS + 0.5);
709  HistInstantLumiEtSumError->setAxisTitle(HistXTitle, 1);
710  HistInstantLumiEtSumError->setAxisTitle(HistLumiErrorYTitle, 2);
711 
713  iBooker.book1D("HistInstantLumiOccSet1Error", "Luminosity Error: Occ Set1", MAX_LS, 0.5, (double)MAX_LS + 0.5);
715  HistInstantLumiOccSet1Error->setAxisTitle(HistLumiErrorYTitle, 2);
716 
718  iBooker.book1D("HistInstantLumiOccSet2Error", "Luminosity Error: Occ Set2", MAX_LS, 0.5, (double)MAX_LS + 0.5);
720  HistInstantLumiOccSet2Error->setAxisTitle(HistLumiErrorYTitle, 2);
721 
723  iBooker.book1D("HistIntegratedLumiEtSum", "Integrated Luminosity: Et Sum", MAX_LS, 0.5, (double)MAX_LS + 0.5);
724  HistIntegratedLumiEtSum->setAxisTitle(HistXTitle, 1);
725  HistIntegratedLumiEtSum->setAxisTitle(HistLumiYTitle, 2);
726 
728  iBooker.book1D("HistIntegratedLumiOccSet1", "Integrated Luminosity: Occ Set1", MAX_LS, 0.5, (double)MAX_LS + 0.5);
729  HistIntegratedLumiOccSet1->setAxisTitle(HistXTitle, 1);
730  HistIntegratedLumiOccSet1->setAxisTitle(HistLumiYTitle, 2);
731 
733  iBooker.book1D("HistIntegratedLumiOccSet2", "Integrated Luminosity: Occ Set2", MAX_LS, 0.5, (double)MAX_LS + 0.5);
734  HistIntegratedLumiOccSet2->setAxisTitle(HistXTitle, 1);
735  HistIntegratedLumiOccSet2->setAxisTitle(HistLumiYTitle, 2);
736 
737  iBooker.setCurrentFolder(monitorName_ + "/RecentHistoryLumi");
738 
739  // Lumi Recent Histories (past 128 short sections)
741  iBooker.book1D("RecentInstantLumiEtSum", "Instant Luminosity: Et Sum", 128, 0.5, (double)128 + 0.5);
742  RecentInstantLumiEtSum->setAxisTitle(RecentHistXTitle, 1);
743  RecentInstantLumiEtSum->setAxisTitle(HistLumiYTitle, 2);
744 
746  iBooker.book1D("RecentInstantLumiOccSet1", "Instant Luminosity: Occ Set1", 128, 0.5, (double)128 + 0.5);
747  RecentInstantLumiOccSet1->setAxisTitle(RecentHistXTitle, 1);
748  RecentInstantLumiOccSet1->setAxisTitle(HistLumiYTitle, 2);
749 
751  iBooker.book1D("RecentInstantLumiOccSet2", "Instant Luminosity: Occ Set2", 128, 0.5, (double)128 + 0.5);
752  RecentInstantLumiOccSet2->setAxisTitle(RecentHistXTitle, 1);
753  RecentInstantLumiOccSet2->setAxisTitle(HistLumiYTitle, 2);
754 
756  iBooker.book1D("RecentIntegratedLumiEtSum", "Integrated Luminosity: Et Sum", 128, 0.5, (double)128 + 0.5);
757  RecentIntegratedLumiEtSum->setAxisTitle(RecentHistXTitle, 1);
758  RecentIntegratedLumiEtSum->setAxisTitle(HistLumiYTitle, 2);
759 
761  iBooker.book1D("RecentIntegratedLumiOccSet1", "Integrated Luminosity: Occ Set1", 128, 0.5, (double)128 + 0.5);
762  RecentIntegratedLumiOccSet1->setAxisTitle(RecentHistXTitle, 1);
763  RecentIntegratedLumiOccSet1->setAxisTitle(HistLumiYTitle, 2);
764 
766  iBooker.book1D("RecentIntegratedLumiOccSet2", "Integrated Luminosity: Occ Set2", 128, 0.5, (double)128 + 0.5);
767  RecentIntegratedLumiOccSet2->setAxisTitle(RecentHistXTitle, 1);
768  RecentIntegratedLumiOccSet2->setAxisTitle(HistLumiYTitle, 2);
769 }
770 
772  using std::string;
773 
774  string currentfolder = subSystemName_ + "/" + eventInfoFolderHLX_;
775  // cout << "currentfolder " << currentfolder << endl;
776 
777  iBooker.setCurrentFolder(currentfolder);
778 
779  pEvent_ = 0;
780  evtRateCount_ = 0;
781  gettimeofday(&currentTime_, nullptr);
783  evtRateWindow_ = 0.5;
784 
785  // Event specific contents
786  runId_ = iBooker.bookInt("iRun");
787  lumisecId_ = iBooker.bookInt("iLumiSection");
788 
789  eventId_ = iBooker.bookInt("iEvent");
790  eventId_->Fill(-1);
791  eventTimeStamp_ = iBooker.bookFloat("eventTimeStamp");
792 
793  iBooker.setCurrentFolder(currentfolder);
794  // Process specific contents
795  processTimeStamp_ = iBooker.bookFloat("processTimeStamp");
797  processLatency_ = iBooker.bookFloat("processLatency");
798  processTimeStamp_->Fill(-1);
799  processEvents_ = iBooker.bookInt("processedEvents");
801  processEventRate_ = iBooker.bookFloat("processEventRate");
802  processEventRate_->Fill(-1);
803  nUpdates_ = iBooker.bookInt("processUpdates");
804  nUpdates_->Fill(-1);
805 
806  // Static Contents
807  processId_ = iBooker.bookInt("processID");
808  processId_->Fill(gSystem->GetPid());
809  processStartTimeStamp_ = iBooker.bookFloat("processStartTimeStamp");
811  runStartTimeStamp_ = iBooker.bookFloat("runStartTimeStamp");
812  hostName_ = iBooker.bookString("hostName", gSystem->HostName());
813  processName_ = iBooker.bookString("processName", subSystemName_);
814  workingDir_ = iBooker.bookString("workingDir", gSystem->pwd());
815  cmsswVer_ = iBooker.bookString("CMSSW_Version", edm::getReleaseVersion());
816 
817  // Go to the standard EventInfo folder (in the case online case where this
818  // is different).
819  currentfolder = subSystemName_ + "/" + eventInfoFolder_;
820  iBooker.setCurrentFolder(currentfolder);
821 
822  reportSummary_ = iBooker.bookFloat("reportSummary");
823  reportSummaryMap_ = iBooker.book2D("reportSummaryMap", "reportSummaryMap", 18, 0., 18., 2, -1.5, 1.5);
824 
825  currentfolder = subSystemName_ + "/" + eventInfoFolderHLX_;
826  iBooker.setCurrentFolder(currentfolder);
827 
828  TH2F *summaryHist = reportSummaryMap_->getTH2F();
829  summaryHist->GetYaxis()->SetBinLabel(1, "HF-");
830  summaryHist->GetYaxis()->SetBinLabel(2, "HF+");
831  summaryHist->GetXaxis()->SetTitle("Wedge #");
832 
833  // Fill the report summary objects with default values, since these will only
834  // be filled at the change of run.
835  reportSummary_->Fill(1.0);
836 
837  for (unsigned int iHLX = 0; iHLX < NUM_HLX; ++iHLX) {
838  unsigned int iWedge = HLXHFMap[iHLX] + 1;
839  unsigned int iEta = 2;
840  if (iWedge >= 19) {
841  iEta = 1;
842  iWedge -= 18;
843  }
844  reportSummaryMap_->setBinContent(iWedge, iEta, 1.0);
845  }
846 }
847 
848 // ------------ method called to for each event ------------
850  using namespace edm;
851 
852  while (HLXTCP.IsConnected() == false) {
854  if (HLXTCP.Connect() != 1) {
855  std::cout << "Failed to connect to " << DistribIP1 << "." << std::endl;
856  sleep(1);
857  std::cout << "Trying " << DistribIP2 << std::endl;
859  if (HLXTCP.Connect() == 1)
860  break;
861  std::cout << "Failed to connect to " << DistribIP2 << "." << std::endl;
862  std::cout << " Reconnect in " << reconnTime << " seconds." << std::endl;
863  sleep(reconnTime);
864  }
865  }
866  if (HLXTCP.IsConnected() == true) {
867  std::cout << "Successfully connected." << std::endl;
868  }
869 
871  // If this is the first time through, set the runNumber ...
873  if (!currentRunEnded_ && runNumber_ != 0) {
874  EndRun();
875  }
877  currentRunEnded_ = false;
878  // std::cout << "Run number is: " << runNumber_ << std::endl;
879  timeval startruntime;
880  gettimeofday(&startruntime, nullptr);
881  runStartTimeStamp_->Fill(getUTCtime(&startruntime));
882  }
883 
884  // Fill the monitoring histograms
887  FillEventInfo(lumiSection, iEvent);
889 
890  cout << "Run: " << lumiSection.hdr.runNumber << " Section: " << lumiSection.hdr.sectionNumber
891  << " Orbit: " << lumiSection.hdr.startOrbit << endl;
892  cout << "Et Lumi: " << lumiSection.lumiSummary.InstantETLumi << endl;
893  cout << "Occ Lumi 1: " << lumiSection.lumiSummary.InstantOccLumi[0] << endl;
894  cout << "Occ Lumi 2: " << lumiSection.lumiSummary.InstantOccLumi[1] << endl;
895  } else {
896  HLXTCP.Disconnect();
897  EndRun();
898  }
899 }
900 
903 
904  // Do some things that should be done at the end of the run ...
905  expectedNibbles_ = 0;
906  for (unsigned int iHLX = 0; iHLX < NUM_HLX; ++iHLX)
907  totalNibbles_[iHLX] = 0;
908 
909  std::cout << "** Here in end run **" << std::endl;
910  runNumber_ = 0;
911  currentRunEnded_ = true;
918  sectionInstantNorm = 0;
919  lsBinOld = 0;
920  lumiSectionCount = 0;
921  previousSection = 0;
922 }
923 
925  // Check for missing data
926  if (previousSection != (section.hdr.sectionNumber - 1)) {
927  double weight = (double)(section.hdr.sectionNumber - previousSection - 1);
928  // std::cout << "Filling missing data! " << weight << std::endl;
929  MissingDQMDataCheck->Fill(0.5, weight);
930  }
932 
933  int lsBin = int(lumiSectionCount / num4NibblePerLS_);
934  int lsBinBX = int(lumiSectionCount / num4NibblePerLS_);
938 
939  int fillBin = lumiSectionCount + 1;
940  if (fillBin > 128) {
941  // If we are already more than 2 LS's in, move everything back by one bin
942  // and fill the last bin with the new value.
943  for (int iBin = 1; iBin < 128; ++iBin) {
950  }
951  fillBin = 128;
952  }
953 
960 
961  double recentOldBinContent = RecentIntegratedLumiEtSum->getBinContent(fillBin - 1);
962  if (fillBin == 1)
963  recentOldBinContent = 0;
964  double recentNewBinContent = recentOldBinContent + section.lumiSummary.InstantETLumi;
965  RecentIntegratedLumiEtSum->setBinContent(fillBin, recentNewBinContent);
966  recentOldBinContent = RecentIntegratedLumiOccSet1->getBinContent(fillBin - 1);
967  if (fillBin == 1)
968  recentOldBinContent = 0;
969  recentNewBinContent = recentOldBinContent + section.lumiSummary.InstantOccLumi[0];
970  RecentIntegratedLumiOccSet1->setBinContent(fillBin, recentNewBinContent);
971  recentOldBinContent = RecentIntegratedLumiOccSet2->getBinContent(fillBin - 1);
972  if (fillBin == 1)
973  recentOldBinContent = 0;
974  recentNewBinContent = recentOldBinContent + section.lumiSummary.InstantOccLumi[0];
975  RecentIntegratedLumiOccSet2->setBinContent(fillBin, recentNewBinContent);
976 
977  double recentOldBinError = RecentIntegratedLumiEtSum->getBinError(fillBin - 1);
978  if (fillBin == 1)
979  recentOldBinError = 0;
980  double recentNewBinError = sqrt(recentOldBinError * recentOldBinError +
982  RecentIntegratedLumiEtSum->setBinError(fillBin, recentNewBinError);
983  recentOldBinError = RecentIntegratedLumiOccSet1->getBinError(fillBin - 1);
984  if (fillBin == 1)
985  recentOldBinError = 0;
986  recentNewBinError = sqrt(recentOldBinError * recentOldBinError +
988  RecentIntegratedLumiOccSet1->setBinError(fillBin, recentNewBinError);
989  recentOldBinError = RecentIntegratedLumiOccSet2->getBinError(fillBin - 1);
990  if (fillBin == 1)
991  recentOldBinError = 0;
992  recentNewBinError = sqrt(recentOldBinError * recentOldBinError +
994  RecentIntegratedLumiOccSet2->setBinError(fillBin, recentNewBinError);
995 
996  if (lsBinOld != lsBin) {
1003 
1004  double etDenom = fabs(sectionInstantSumEt);
1005  if (etDenom < 1e-10)
1006  etDenom = 1e-10;
1007  double occ1Denom = fabs(sectionInstantSumOcc1);
1008  if (occ1Denom < 1e-10)
1009  occ1Denom = 1e-10;
1010  double occ2Denom = fabs(sectionInstantSumOcc2);
1011  if (occ2Denom < 1e-10)
1012  occ2Denom = 1e-10;
1013  double etError = 100.0 * sqrt(sectionInstantErrSumEt) / etDenom;
1014  double occ1Error = 100.0 * sqrt(sectionInstantErrSumOcc1) / occ1Denom;
1015  double occ2Error = 100.0 * sqrt(sectionInstantErrSumOcc2) / occ2Denom;
1019 
1020  double histOldBinContent = HistIntegratedLumiEtSum->getBinContent(lsBinOld);
1021  if (lsBinOld == 0)
1022  histOldBinContent = 0;
1023  double histNewBinContent = histOldBinContent + sectionInstantSumEt;
1024  HistIntegratedLumiEtSum->setBinContent(lsBin, histNewBinContent);
1025  histOldBinContent = HistIntegratedLumiOccSet1->getBinContent(lsBinOld);
1026  if (lsBinOld == 0)
1027  histOldBinContent = 0;
1028  histNewBinContent = histOldBinContent + sectionInstantSumOcc1;
1029  HistIntegratedLumiOccSet1->setBinContent(lsBin, histNewBinContent);
1030  histOldBinContent = HistIntegratedLumiOccSet2->getBinContent(lsBinOld);
1031  if (lsBinOld == 0)
1032  histOldBinContent = 0;
1033  histNewBinContent = histOldBinContent + sectionInstantSumOcc2;
1034  HistIntegratedLumiOccSet2->setBinContent(lsBin, histNewBinContent);
1035 
1036  double histOldBinError = HistIntegratedLumiEtSum->getBinError(lsBinOld);
1037  if (lsBinOld == 0)
1038  histOldBinError = 0;
1039  double histNewBinError = sqrt(histOldBinError * histOldBinError + sectionInstantErrSumEt);
1040  HistIntegratedLumiEtSum->setBinError(lsBin, histNewBinError);
1041  histOldBinError = HistIntegratedLumiOccSet1->getBinError(lsBinOld);
1042  if (lsBinOld == 0)
1043  histOldBinError = 0;
1044  histNewBinError = sqrt(histOldBinError * histOldBinError + sectionInstantErrSumOcc1);
1045  HistIntegratedLumiOccSet1->setBinError(lsBin, histNewBinError);
1046  histOldBinError = HistIntegratedLumiOccSet2->getBinError(lsBinOld);
1047  if (lsBinOld == 0)
1048  histOldBinError = 0;
1049  histNewBinError = sqrt(histOldBinError * histOldBinError + sectionInstantErrSumOcc2);
1050  HistIntegratedLumiOccSet2->setBinError(lsBin, histNewBinError);
1051 
1052  sectionInstantSumEt = 0;
1054  sectionInstantSumOcc1 = 0;
1056  sectionInstantSumOcc2 = 0;
1058  sectionInstantNorm = 0;
1059  lsBinOld = lsBin;
1060  }
1061 
1069 
1070  for (int iHLX = 0; iHLX < (int)NUM_HLX; ++iHLX) {
1071  unsigned int utotal1 = 0;
1072  unsigned int utotal2 = 0;
1073  unsigned int iWedge = HLXHFMap[iHLX];
1074  if (section.occupancy[iHLX].hdr.numNibbles != 0) {
1075  // Don't include the last one hundred BX in the average.
1076  for (unsigned int iBX = 0; iBX < NUM_BUNCHES; ++iBX) {
1077  // Normalize to number of towers
1078  unsigned int norm[2] = {0, 0};
1079  norm[0] += section.occupancy[iHLX].data[set1BelowIndex][iBX];
1080  norm[0] += section.occupancy[iHLX].data[set1BetweenIndex][iBX];
1081  norm[0] += section.occupancy[iHLX].data[set1AboveIndex][iBX];
1082  if (norm[0] == 0)
1083  norm[0] = 1;
1084  norm[1] += section.occupancy[iHLX].data[set2BelowIndex][iBX];
1085  norm[1] += section.occupancy[iHLX].data[set2BetweenIndex][iBX];
1086  norm[1] += section.occupancy[iHLX].data[set2AboveIndex][iBX];
1087  if (norm[1] == 0)
1088  norm[1] = 1;
1089 
1090  double normEt = section.etSum[iHLX].data[iBX] / (double)(norm[0] + norm[1]);
1091  double normOccSet1Below = (double)section.occupancy[iHLX].data[set1BelowIndex][iBX] / (double)norm[0];
1092  double normOccSet1Between = (double)section.occupancy[iHLX].data[set1BetweenIndex][iBX] / (double)norm[0];
1093  double normOccSet1Above = (double)section.occupancy[iHLX].data[set1AboveIndex][iBX] / (double)norm[0];
1094  double normOccSet2Below = (double)section.occupancy[iHLX].data[set2BelowIndex][iBX] / (double)norm[1];
1095  double normOccSet2Between = (double)section.occupancy[iHLX].data[set2BetweenIndex][iBX] / (double)norm[1];
1096  double normOccSet2Above = (double)section.occupancy[iHLX].data[set2AboveIndex][iBX] / (double)norm[1];
1097 
1098  // Averages & check sum
1099  if (iBX < NUM_BUNCHES - 100) {
1100  AvgEtSum->Fill(iWedge, normEt);
1101 
1102  AvgOccBelowSet1->Fill(iWedge, normOccSet1Below);
1103  AvgOccBetweenSet1->Fill(iWedge, normOccSet1Between);
1104  AvgOccAboveSet1->Fill(iWedge, normOccSet1Above);
1105 
1106  AvgOccBelowSet2->Fill(iWedge, normOccSet2Below);
1107  AvgOccBetweenSet2->Fill(iWedge, normOccSet2Between);
1108  AvgOccAboveSet2->Fill(iWedge, normOccSet2Above);
1109 
1110  if (iWedge < 18) {
1111  HistAvgEtSumHFP->Fill(lsBin, normEt);
1112  HistAvgOccBelowSet1HFP->Fill(lsBin, normOccSet1Below);
1113  HistAvgOccBetweenSet1HFP->Fill(lsBin, normOccSet1Between);
1114  HistAvgOccAboveSet1HFP->Fill(lsBin, normOccSet1Above);
1115  HistAvgOccBelowSet2HFP->Fill(lsBin, normOccSet2Below);
1116  HistAvgOccBetweenSet2HFP->Fill(lsBin, normOccSet2Between);
1117  HistAvgOccAboveSet2HFP->Fill(lsBin, normOccSet2Above);
1118 
1119  if (iBX >= (XMIN - 1) && iBX <= (XMAX - 1))
1120  BXvsTimeAvgEtSumHFP->Fill(lsBinBX, iBX, normEt / (num4NibblePerLS_ * 18.0 * 12.0));
1121  } else {
1122  HistAvgEtSumHFM->Fill(lsBin, normEt);
1123  HistAvgOccBelowSet1HFM->Fill(lsBin, normOccSet1Below);
1124  HistAvgOccBetweenSet1HFM->Fill(lsBin, normOccSet1Between);
1125  HistAvgOccAboveSet1HFM->Fill(lsBin, normOccSet1Above);
1126  HistAvgOccBelowSet2HFM->Fill(lsBin, normOccSet2Below);
1127  HistAvgOccBetweenSet2HFM->Fill(lsBin, normOccSet2Between);
1128  HistAvgOccAboveSet2HFM->Fill(lsBin, normOccSet2Above);
1129 
1130  if (iBX >= (XMIN - 1) && iBX <= (XMAX - 1))
1131  BXvsTimeAvgEtSumHFM->Fill(lsBinBX, iBX, normEt / (num4NibblePerLS_ * 18.0 * 12.0));
1132  }
1133 
1134  utotal1 += section.occupancy[iHLX].data[set1BelowIndex][iBX];
1135  utotal1 += section.occupancy[iHLX].data[set1BetweenIndex][iBX];
1136  utotal1 += section.occupancy[iHLX].data[set1AboveIndex][iBX];
1137 
1138  utotal2 += section.occupancy[iHLX].data[set2BelowIndex][iBX];
1139  utotal2 += section.occupancy[iHLX].data[set2BetweenIndex][iBX];
1140  utotal2 += section.occupancy[iHLX].data[set2AboveIndex][iBX];
1141  }
1142 
1143  if (Style == "BX") {
1144  // Get the correct bin ...
1145  TH1F *Set1BelowHist = Set1Below[iWedge]->getTH1F();
1146  int iBin = Set1BelowHist->FindBin((float)iBX);
1147 
1148  // Adjust the old bin content to make the new, unnormalize and
1149  // renormalize
1150  if (lumiSectionCount > 0) {
1151  double oldNormOccSet1Below = (Set1Below[iWedge]->getBinContent(iBin)) * (double)(lumiSectionCount);
1152  normOccSet1Below += oldNormOccSet1Below;
1153  normOccSet1Below /= (double)(lumiSectionCount + 1);
1154  double oldNormOccSet2Below = (Set2Below[iWedge]->getBinContent(iBin)) * (double)(lumiSectionCount);
1155  normOccSet2Below += oldNormOccSet2Below;
1156  normOccSet2Below /= (double)(lumiSectionCount + 1);
1157 
1158  double oldNormOccSet1Between = (Set1Between[iWedge]->getBinContent(iBin)) * (double)(lumiSectionCount);
1159  normOccSet1Between += oldNormOccSet1Between;
1160  normOccSet1Between /= (double)(lumiSectionCount + 1);
1161  double oldNormOccSet2Between = (Set2Between[iWedge]->getBinContent(iBin)) * (double)(lumiSectionCount);
1162  normOccSet2Between += oldNormOccSet2Between;
1163  normOccSet2Between /= (double)(lumiSectionCount + 1);
1164 
1165  double oldNormOccSet1Above = (Set1Above[iWedge]->getBinContent(iBin)) * (double)(lumiSectionCount);
1166  normOccSet1Above += oldNormOccSet1Above;
1167  normOccSet1Above /= (double)(lumiSectionCount + 1);
1168  double oldNormOccSet2Above = (Set2Above[iWedge]->getBinContent(iBin)) * (double)(lumiSectionCount);
1169  normOccSet2Above += oldNormOccSet2Above;
1170  normOccSet2Above /= (double)(lumiSectionCount + 1);
1171 
1172  double oldNormEt = ETSum[iWedge]->getBinContent(iBin) * (double)(lumiSectionCount);
1173  normEt += oldNormEt;
1174  normEt /= (double)(lumiSectionCount + 1);
1175  }
1176  Set1Below[iWedge]->setBinContent(iBin, normOccSet1Below);
1177  Set1Between[iWedge]->setBinContent(iBin, normOccSet1Between);
1178  Set1Above[iWedge]->setBinContent(iBin, normOccSet1Above);
1179  Set2Below[iWedge]->setBinContent(iBin, normOccSet2Below);
1180  Set2Between[iWedge]->setBinContent(iBin, normOccSet2Between);
1181  Set2Above[iWedge]->setBinContent(iBin, normOccSet2Above);
1182  ETSum[iWedge]->setBinContent(iBin, normEt);
1183  } else if (Style == "Dist") {
1184  Set1Below[iWedge]->Fill(normOccSet1Below);
1185  Set1Between[iWedge]->Fill(normOccSet1Between);
1186  Set1Above[iWedge]->Fill(normOccSet1Above);
1187  Set2Below[iWedge]->Fill(normOccSet2Below);
1188  Set2Between[iWedge]->Fill(normOccSet2Between);
1189  Set2Above[iWedge]->Fill(normOccSet2Above);
1190  ETSum[iWedge]->Fill(normEt);
1191  }
1192  }
1193 
1194  // Get the number of towers per wedge per BX (assuming non-zero numbers)
1195  double total1 = 0;
1196  double total2 = 0;
1197  if ((NUM_BUNCHES - 100) > 0) {
1198  total1 = (double)utotal1 / (double)(NUM_BUNCHES - 100);
1199  total2 = (double)utotal2 / (double)(NUM_BUNCHES - 100);
1200  }
1201  if (section.hdr.numOrbits > 0) {
1202  total1 = total1 / (double)section.hdr.numOrbits;
1203  total2 = total2 / (double)section.hdr.numOrbits;
1204  }
1205 
1206  SumAllOccSet1->Fill(iWedge, total1);
1207  SumAllOccSet2->Fill(iWedge, total2);
1208  }
1209  }
1210 
1211  double max[4] = {-1000.0, -1000.0, -1000.0, -1000.0};
1212  int bxmax[4] = {-1, -1, -1, -1};
1213  for (unsigned int iBX = 0; iBX < NUM_BUNCHES; ++iBX) {
1214  LumiAvgEtSum->Fill(iBX, section.lumiDetail.ETLumi[iBX]);
1215  LumiAvgOccSet1->Fill(iBX, section.lumiDetail.OccLumi[0][iBX]);
1216  LumiAvgOccSet2->Fill(iBX, section.lumiDetail.OccLumi[1][iBX]);
1217 
1218  if (section.lumiDetail.OccLumi[0][iBX] > max[0]) {
1219  max[3] = max[2];
1220  bxmax[3] = bxmax[2];
1221  max[2] = max[1];
1222  bxmax[2] = bxmax[1];
1223  max[1] = max[0];
1224  bxmax[1] = bxmax[0];
1225  max[0] = section.lumiDetail.OccLumi[0][iBX];
1226  bxmax[0] = iBX;
1227  } else if (section.lumiDetail.OccLumi[0][iBX] > max[1]) {
1228  max[3] = max[2];
1229  bxmax[3] = bxmax[2];
1230  max[2] = max[1];
1231  bxmax[2] = bxmax[1];
1232  max[1] = section.lumiDetail.OccLumi[0][iBX];
1233  bxmax[1] = iBX;
1234  } else if (section.lumiDetail.OccLumi[0][iBX] > max[2]) {
1235  max[3] = max[2];
1236  bxmax[3] = bxmax[2];
1237  max[2] = section.lumiDetail.OccLumi[0][iBX];
1238  bxmax[2] = iBX;
1239  } else if (section.lumiDetail.OccLumi[0][iBX] > max[3]) {
1240  max[3] = section.lumiDetail.OccLumi[0][iBX];
1241  bxmax[3] = iBX;
1242  }
1243 
1244  int iBin = iBX - (int)XMIN + 1;
1245  if (iBin <= int(XMAX - XMIN) && iBin >= 1) {
1246  LumiInstantEtSum->setBinContent(iBin, section.lumiDetail.ETLumi[iBX]);
1247  LumiInstantOccSet1->setBinContent(iBin, section.lumiDetail.OccLumi[0][iBX]);
1248  LumiInstantOccSet2->setBinContent(iBin, section.lumiDetail.OccLumi[1][iBX]);
1249  LumiInstantEtSum->setBinError(iBin, section.lumiDetail.ETLumiErr[iBX]);
1250  LumiInstantOccSet1->setBinError(iBin, section.lumiDetail.OccLumiErr[0][iBX]);
1251  LumiInstantOccSet2->setBinError(iBin, section.lumiDetail.OccLumiErr[1][iBX]);
1252 
1253  double oldBinContent = LumiIntegratedEtSum->getBinContent(iBin);
1254  if (lumiSectionCount == 0)
1255  oldBinContent = 0;
1256  double newBinContent = oldBinContent + section.lumiDetail.ETLumi[iBX];
1257  LumiIntegratedEtSum->setBinContent(iBin, newBinContent);
1258  oldBinContent = LumiIntegratedOccSet1->getBinContent(iBin);
1259  if (lumiSectionCount == 0)
1260  oldBinContent = 0;
1261  newBinContent = oldBinContent + section.lumiDetail.OccLumi[0][iBX];
1262  LumiIntegratedOccSet1->setBinContent(iBin, newBinContent);
1263  oldBinContent = LumiIntegratedOccSet2->getBinContent(iBin);
1264  if (lumiSectionCount == 0)
1265  oldBinContent = 0;
1266  newBinContent = oldBinContent + section.lumiDetail.OccLumi[1][iBX];
1267  LumiIntegratedOccSet2->setBinContent(iBin, newBinContent);
1268 
1269  double oldBinError = LumiIntegratedEtSum->getBinError(iBin);
1270  if (lumiSectionCount == 0)
1271  oldBinError = 0;
1272  double newBinError =
1273  sqrt(oldBinError * oldBinError + section.lumiDetail.ETLumiErr[iBX] * section.lumiDetail.ETLumiErr[iBX]);
1274  LumiIntegratedEtSum->setBinError(iBin, newBinError);
1275  oldBinError = LumiIntegratedOccSet1->getBinError(iBin);
1276  if (lumiSectionCount == 0)
1277  oldBinError = 0;
1278  newBinError = sqrt(oldBinError * oldBinError +
1279  section.lumiDetail.OccLumiErr[0][iBX] * section.lumiDetail.OccLumiErr[0][iBX]);
1280  LumiIntegratedOccSet1->setBinError(iBin, newBinError);
1281  oldBinError = LumiIntegratedOccSet1->getBinError(iBin);
1282  if (lumiSectionCount == 0)
1283  oldBinError = 0;
1284  newBinError = sqrt(oldBinError * oldBinError +
1285  section.lumiDetail.OccLumiErr[1][iBX] * section.lumiDetail.OccLumiErr[1][iBX]);
1286  LumiIntegratedOccSet2->setBinError(iBin, newBinError);
1287  }
1288  }
1289 
1290  // Now fill the maximum hists, but ordered by BX, so that
1291  // collision BX's or satellite BX's will always appear in the
1292  // same histogram.
1293  int flag = 1;
1294  for (int iM = 0; (iM < 4) && flag; ++iM) {
1295  flag = 0;
1296  for (int iN = 0; iN < 3; ++iN) {
1297  if (bxmax[iN + 1] < bxmax[iN]) {
1298  int tmp = bxmax[iN];
1299  bxmax[iN] = bxmax[iN + 1];
1300  bxmax[iN + 1] = tmp;
1301 
1302  double tmp2 = max[iN];
1303  max[iN] = max[iN + 1];
1304  max[iN + 1] = tmp2;
1305  flag = 1;
1306  }
1307  }
1308  }
1309 
1310  // 0.9e1 = Conversion constant for occ1 at 900GeV COM.
1311  MaxInstLumiBX1->Fill(max[0] * 0.9e1);
1312  MaxInstLumiBXNum1->Fill(bxmax[0]);
1313  MaxInstLumiBX2->Fill(max[1] * 0.9e1);
1314  MaxInstLumiBXNum2->Fill(bxmax[1]);
1315  MaxInstLumiBX3->Fill(max[2] * 0.9e1);
1316  MaxInstLumiBXNum3->Fill(bxmax[2]);
1317  MaxInstLumiBX4->Fill(max[3] * 0.9e1);
1318  MaxInstLumiBXNum4->Fill(bxmax[3]);
1319 
1320  TH1F *tmpHist = MaxInstLumiBX1->getTH1F();
1321  double minX = tmpHist->GetBinLowEdge(1);
1322  double maxX = tmpHist->GetBinLowEdge(tmpHist->GetNbinsX() + 1);
1323 
1324  int inum4NibblePerLS = (int)num4NibblePerLS_;
1325  if (lumiSectionCount % inum4NibblePerLS == 0) {
1326  double mean1 = MaxInstLumiBX1->getMean();
1327  double rms1 = MaxInstLumiBX1->getRMS();
1328  if (rms1 > 0 && mean1 - 5 * rms1 > minX && mean1 + 5 * rms1 < maxX)
1329  MaxInstLumiBX1->setAxisRange(mean1 - 5 * rms1, mean1 + 5 * rms1);
1330 
1331  double mean2 = MaxInstLumiBX2->getMean();
1332  double rms2 = MaxInstLumiBX2->getRMS();
1333  if (rms2 > 0 && mean2 - 5 * rms2 > minX && mean2 + 5 * rms2 < maxX)
1334  MaxInstLumiBX2->setAxisRange(mean2 - 5 * rms2, mean2 + 5 * rms2);
1335 
1336  double mean3 = MaxInstLumiBX3->getMean();
1337  double rms3 = MaxInstLumiBX3->getRMS();
1338  if (rms3 > 0 && mean3 - 5 * rms3 > minX && mean3 + 5 * rms3 < maxX)
1339  MaxInstLumiBX3->setAxisRange(mean3 - 5 * rms3, mean3 + 5 * rms3);
1340 
1341  double mean4 = MaxInstLumiBX4->getMean();
1342  double rms4 = MaxInstLumiBX4->getRMS();
1343  if (rms4 > 0 && mean4 - 5 * rms4 > minX && mean4 + 5 * rms4 < maxX)
1344  MaxInstLumiBX4->setAxisRange(mean4 - 5 * rms4, mean4 + 5 * rms4);
1345  }
1346 
1347  // Add one to the section count (usually short sections)
1348  ++lumiSectionCount;
1349 }
1350 
1352  for (unsigned int iHLX = 0; iHLX < NUM_HLX; ++iHLX) {
1353  unsigned int iWedge = HLXHFMap[iHLX];
1354 
1355  if (section.occupancy[iHLX].hdr.numNibbles != 0) {
1356  float nActvTwrsSet1 = section.occupancy[iHLX].data[set1AboveIndex][TriggerBX] +
1357  section.occupancy[iHLX].data[set1BetweenIndex][TriggerBX] +
1358  section.occupancy[iHLX].data[set1BelowIndex][TriggerBX];
1359 
1360  float nActvTwrsSet2 = section.occupancy[iHLX].data[set2AboveIndex][TriggerBX] +
1361  section.occupancy[iHLX].data[set2BetweenIndex][TriggerBX] +
1362  section.occupancy[iHLX].data[set2BelowIndex][TriggerBX];
1363 
1364  float total = nActvTwrsSet1 + nActvTwrsSet2;
1365 
1366  if (total > 0) {
1367  float tempData = section.etSum[iHLX].data[TriggerBX] / total;
1368  // cout << "Filling HFCompare Et sum " << tempData << endl;
1369  HFCompareEtSum->Fill(iWedge, tempData);
1370  }
1371 
1372  if (nActvTwrsSet1 > 0) {
1373  float tempData = (float)section.occupancy[iHLX].data[set1BelowIndex][TriggerBX] / nActvTwrsSet1;
1374  HFCompareOccBelowSet1->Fill(iWedge, tempData);
1375 
1376  tempData = (float)section.occupancy[iHLX].data[set1BetweenIndex][TriggerBX] / nActvTwrsSet1;
1377  HFCompareOccBetweenSet1->Fill(iWedge, tempData);
1378 
1379  tempData = (float)section.occupancy[iHLX].data[set1AboveIndex][TriggerBX] / nActvTwrsSet1;
1380  HFCompareOccAboveSet1->Fill(iWedge, tempData);
1381  }
1382 
1383  if (nActvTwrsSet2 > 0) {
1384  float tempData = (float)section.occupancy[iHLX].data[set2BelowIndex][TriggerBX] / nActvTwrsSet2;
1385  HFCompareOccBelowSet2->Fill(iWedge, tempData);
1386 
1387  tempData = (float)section.occupancy[iHLX].data[set2BetweenIndex][TriggerBX] / nActvTwrsSet2;
1388  HFCompareOccBetweenSet2->Fill(iWedge, tempData);
1389 
1390  tempData = (float)section.occupancy[iHLX].data[set2AboveIndex][TriggerBX] / nActvTwrsSet2;
1391  HFCompareOccAboveSet2->Fill(iWedge, tempData);
1392  }
1393  }
1394  }
1395 }
1396 
1398  // New run .. set the run number and fill run summaries ...
1399  // std::cout << "Run number " << runNumber_ << " Section hdr run number "
1400  // << section.hdr.runNumber << std::endl;
1401 
1402  runId_->Fill(section.hdr.runNumber);
1403  lumisecId_->Fill((int)(section.hdr.sectionNumber / num4NibblePerLS_) + 1);
1404 
1405  // Update the total nibbles & the expected number
1406  expectedNibbles_ += section.hdr.numOrbits / 4096;
1407  for (unsigned int iHLX = 0; iHLX < NUM_HLX; ++iHLX) {
1408  unsigned int iWedge = HLXHFMap[iHLX] + 1;
1409  totalNibbles_[iWedge - 1] += section.occupancy[iHLX].hdr.numNibbles;
1410  }
1411 
1412  eventId_->Fill(e.id().event());
1413  eventTimeStamp_->Fill(e.time().value() / (double)0xffffffff);
1414 
1415  pEvent_++;
1416  evtRateCount_++;
1418 
1420  gettimeofday(&currentTime_, nullptr);
1423 
1425  if (time >= (evtRateWindow_ * 60.0)) {
1426  processEventRate_->Fill((float)evtRateCount_ / time);
1427  evtRateCount_ = 0;
1429  }
1430 }
1431 
1433  // Run summary - Loop over the HLX's and fill the map,
1434  // also calculate the overall quality.
1435  float overall = 0.0;
1436  for (unsigned int iHLX = 0; iHLX < NUM_HLX; ++iHLX) {
1437  unsigned int iWedge = HLXHFMap[iHLX] + 1;
1438  unsigned int iEta = 2;
1439  float frac = 0.0;
1440  if (expectedNibbles_ > 0)
1441  frac = (float)totalNibbles_[iWedge - 1] / (float)expectedNibbles_;
1442  if (iWedge >= 19) {
1443  iEta = 1;
1444  iWedge -= 18;
1445  }
1446  reportSummaryMap_->setBinContent(iWedge, iEta, frac);
1447  overall += frac;
1448  }
1449 
1450  overall /= (float)NUM_HLX;
1451  if (overall > 1.0)
1452  overall = 0.0;
1453  // std::cout << "Filling report summary! Main. " << overall << std::endl;
1454  reportSummary_->Fill(overall);
1455 }
1456 
1457 double HLXMonitor::getUTCtime(timeval *a, timeval *b) {
1458  double deltaT = (*a).tv_sec * 1000.0 + (*a).tv_usec / 1000.0;
1459  if (b != nullptr)
1460  deltaT = (*b).tv_sec * 1000.0 + (*b).tv_usec / 1000.0 - deltaT;
1461  return deltaT / 1000.0;
1462 }
1463 
1464 // define this as a plug-in
double sectionInstantSumEt
Definition: HLXMonitor.h:260
MonitorElement * HistAvgOccBetweenSet1HFP
Definition: HLXMonitor.h:131
MonitorElement * HFCompareOccAboveSet1
Definition: HLXMonitor.h:86
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
Definition: DQMStore.cc:239
EventNumber_t event() const
Definition: EventID.h:40
MonitorElement * Set2Between[36]
Definition: HLXMonitor.h:79
MonitorElement * processLatency_
The UTC time of the last event.
Definition: HLXMonitor.h:182
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * HistInstantLumiOccSet1
Definition: HLXMonitor.h:148
std::string OutputDir
Definition: HLXMonitor.h:212
MonitorElement * HFCompareOccAboveSet2
Definition: HLXMonitor.h:89
MonitorElement * RecentIntegratedLumiOccSet2
Definition: HLXMonitor.h:162
MonitorElement * MaxInstLumiBX4
Definition: HLXMonitor.h:119
unsigned int totalNibbles_[36]
Definition: HLXMonitor.h:253
MonitorElement * processTimeStamp_
The UTC time of the first event processed.
Definition: HLXMonitor.h:181
void FillReportSummary()
Definition: HLXMonitor.cc:1432
void SetupHists(DQMStore::IBooker &)
Definition: HLXMonitor.cc:146
unsigned int HLXHFMap[36]
Definition: HLXMonitor.h:255
int SetPort(unsigned short int)
Definition: TCPReceiver.cc:179
MonitorElement * HistAvgLumiOccSet2
Definition: HLXMonitor.h:146
unsigned int secNumLength
Definition: HLXMonitor.h:241
MonitorElement * HistAvgOccBelowSet2HFM
Definition: HLXMonitor.h:136
void EndRun()
Definition: HLXMonitor.cc:901
MonitorElement * RecentIntegratedLumiEtSum
Definition: HLXMonitor.h:160
double XMAX
Definition: HLXMonitor.h:208
MonitorElement * LumiIntegratedEtSum
Definition: HLXMonitor.h:106
MonitorElement * SumAllOccSet1
Definition: HLXMonitor.h:111
MonitorElement * LumiInstantOccSet2
Definition: HLXMonitor.h:105
MonitorElement * bookFloat(TString const &name)
Definition: DQMStore.cc:233
MonitorElement * AvgOccBetweenSet2
Definition: HLXMonitor.h:96
int prescaleEvt_
Definition: HLXMonitor.h:223
MonitorElement * AvgOccBelowSet1
Definition: HLXMonitor.h:92
MonitorElement * HistAvgEtSumHFM
Definition: HLXMonitor.h:128
MonitorElement * AvgOccAboveSet2
Definition: HLXMonitor.h:97
MonitorElement * HistAvgEtSumHFP
Definition: HLXMonitor.h:127
MonitorElement * HistAvgOccAboveSet1HFP
Definition: HLXMonitor.h:133
MonitorElement * LumiInstantEtSum
Definition: HLXMonitor.h:103
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:418
std::string OccYAxisTitle
Definition: HLXMonitor.h:244
MonitorElement * LumiAvgOccSet2
Definition: HLXMonitor.h:102
MonitorElement * cmsswVer_
Current working directory of the job.
Definition: HLXMonitor.h:189
MonitorElement * HistInstantLumiOccSet2Error
Definition: HLXMonitor.h:152
unsigned int NUM_HLX
Definition: HLXMonitor.h:215
virtual double getBinError(int binx) const
get uncertainty on content of bin (1-D) - See TH1::GetBinError for details
MonitorElement * processEventRate_
Time elapsed since the last event.
Definition: HLXMonitor.h:183
unsigned int runNumber_
Definition: HLXMonitor.h:251
int lsBinOld
Definition: HLXMonitor.h:259
MonitorElement * MissingDQMDataCheck
Definition: HLXMonitor.h:113
Definition: weight.py:1
MonitorElement * HistInstantLumiOccSet2
Definition: HLXMonitor.h:149
MonitorElement * LumiInstantOccSet1
Definition: HLXMonitor.h:104
MonitorElement * HistAvgOccAboveSet1HFM
Definition: HLXMonitor.h:134
float evtRateWindow_
Definition: HLXMonitor.h:271
std::string OutputFilePrefix
Definition: HLXMonitor.h:211
MonitorElement * LumiIntegratedOccSet1
Definition: HLXMonitor.h:107
double sectionInstantErrSumEt
Definition: HLXMonitor.h:261
double sectionInstantErrSumOcc2
Definition: HLXMonitor.h:265
unsigned int set2AboveIndex
Definition: HLXMonitor.h:234
MonitorElement * Set1Below[36]
Definition: HLXMonitor.h:75
void SetIP(std::string IP)
Definition: TCPReceiver.cc:219
int evtRateCount_
Definition: HLXMonitor.h:272
double XMIN
Definition: HLXMonitor.h:208
std::string EtYAxisTitle
Definition: HLXMonitor.h:246
std::string eventInfoFolderHLX_
Definition: HLXMonitor.h:236
MonitorElement * HistInstantLumiEtSumError
Definition: HLXMonitor.h:150
std::string DistribIP2
Definition: HLXMonitor.h:227
void Fill(long long x)
MonitorElement * eventId_
UTC time of the run start.
Definition: HLXMonitor.h:171
int listenPort
Definition: HLXMonitor.h:207
MonitorElement * processId_
Number of collector updates (TBD)
Definition: HLXMonitor.h:179
MonitorElement * MaxInstLumiBX1
Definition: HLXMonitor.h:116
MonitorElement * reportSummaryMap_
Definition: HLXMonitor.h:197
unsigned int MAX_LS
Definition: HLXMonitor.h:217
int iEvent
Definition: GenABIO.cc:224
MonitorElement * HistAvgOccBelowSet1HFP
Definition: HLXMonitor.h:129
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
MonitorElement * HFCompareEtSum
Definition: HLXMonitor.h:83
double getUTCtime(timeval *a, timeval *b=0)
Definition: HLXMonitor.cc:1457
MonitorElement * runStartTimeStamp_
Definition: HLXMonitor.h:170
virtual void setAxisRange(double xmin, double xmax, int axis=1)
set x-, y- or z-axis range (axis=1, 2, 3 respectively)
MonitorElement * Set1Between[36]
Definition: HLXMonitor.h:76
unsigned int set2BetweenIndex
Definition: HLXMonitor.h:233
double sectionInstantSumOcc1
Definition: HLXMonitor.h:262
timeval lastUpdateTime_
Definition: HLXMonitor.h:269
unsigned int set2BelowIndex
Definition: HLXMonitor.h:232
T sqrt(T t)
Definition: SSEVec.h:19
double sectionInstantSumOcc2
Definition: HLXMonitor.h:264
MonitorElement * HistIntegratedLumiOccSet1
Definition: HLXMonitor.h:154
MonitorElement * RecentInstantLumiOccSet1
Definition: HLXMonitor.h:158
MonitorElement * HistIntegratedLumiOccSet2
Definition: HLXMonitor.h:155
MonitorElement * BXvsTimeAvgEtSumHFM
Definition: HLXMonitor.h:142
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, char const *option="s")
Definition: DQMStore.cc:333
MonitorElement * HistAvgOccBetweenSet2HFM
Definition: HLXMonitor.h:138
void connectHLXTCP()
Definition: HLXMonitor.cc:114
MonitorElement * AvgOccAboveSet1
Definition: HLXMonitor.h:94
MonitorElement * HistInstantLumiOccSet1Error
Definition: HLXMonitor.h:151
HCAL_HLX::LUMI_SECTION lumiSection
Definition: HLXMonitor.h:248
MonitorElement * hostName_
of event processed so far
Definition: HLXMonitor.h:186
MonitorElement * HFCompareOccBelowSet1
Definition: HLXMonitor.h:84
unsigned int NBINS
Definition: HLXMonitor.h:209
MonitorElement * ETSum[36]
Definition: HLXMonitor.h:81
MonitorElement * Set2Below[36]
Definition: HLXMonitor.h:78
MonitorElement * MaxInstLumiBXNum2
Definition: HLXMonitor.h:122
Definition: Style.py:1
MonitorElement * MaxInstLumiBX2
Definition: HLXMonitor.h:117
MonitorElement * SumAllOccSet2
Definition: HLXMonitor.h:112
virtual double getBinContent(int binx) const
get content of bin (1-D)
std::string monitorName_
Definition: HLXMonitor.h:222
MonitorElement * AvgEtSum
Definition: HLXMonitor.h:91
MonitorElement * nUpdates_
These MEs are either static or updated upon each analyze() call.
Definition: HLXMonitor.h:178
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: HLXMonitor.cc:849
MonitorElement * HistAvgOccAboveSet2HFM
Definition: HLXMonitor.h:140
OCCUPANCY_SECTION occupancy[36]
bool Accumulate
Definition: HLXMonitor.h:210
MonitorElement * LumiAvgEtSum
Definition: HLXMonitor.h:100
MonitorElement * eventTimeStamp_
Definition: HLXMonitor.h:173
MonitorElement * BXvsTimeAvgEtSumHFP
Definition: HLXMonitor.h:141
MonitorElement * HistAvgOccBetweenSet1HFM
Definition: HLXMonitor.h:132
MonitorElement * RecentIntegratedLumiOccSet1
Definition: HLXMonitor.h:161
unsigned int TriggerBX
Definition: HLXMonitor.h:219
MonitorElement * MaxInstLumiBXNum4
Definition: HLXMonitor.h:124
std::string getReleaseVersion()
unsigned int NUM_BUNCHES
Definition: HLXMonitor.h:216
MonitorElement * HistAvgLumiOccSet1
Definition: HLXMonitor.h:145
MonitorElement * HistAvgOccAboveSet2HFP
Definition: HLXMonitor.h:139
unsigned int MinLSBeforeSave
Definition: HLXMonitor.h:220
MonitorElement * HistAvgOccBelowSet1HFM
Definition: HLXMonitor.h:130
MonitorElement * RecentInstantLumiOccSet2
Definition: HLXMonitor.h:159
virtual double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
MonitorElement * Set2Above[36]
Definition: HLXMonitor.h:80
MonitorElement * HistAvgLumiEtSum
Definition: HLXMonitor.h:144
MonitorElement * HistIntegratedLumiEtSum
Definition: HLXMonitor.h:153
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
TCPReceiver HLXTCP
Definition: HLXMonitor.h:73
MonitorElement * HistAvgOccBelowSet2HFP
Definition: HLXMonitor.h:135
MonitorElement * processEvents_
Definition: HLXMonitor.h:185
double sectionInstantNorm
Definition: HLXMonitor.h:266
MonitorElement * MaxInstLumiBXNum3
Definition: HLXMonitor.h:123
virtual double getRMS(int axis=1) const
get RMS of histogram along x, y or z axis (axis=1, 2, 3 respectively)
MonitorElement * MaxInstLumiBX3
Definition: HLXMonitor.h:118
double sectionInstantErrSumOcc1
Definition: HLXMonitor.h:263
unsigned int previousSection
Definition: HLXMonitor.h:257
std::string subSystemName_
Definition: HLXMonitor.h:238
bool currentRunEnded_
Definition: HLXMonitor.h:250
double b
Definition: hdecay.h:118
MonitorElement * processName_
Hostname of the local machine.
Definition: HLXMonitor.h:187
void FillEventInfo(const LUMI_SECTION &, const edm::Event &e)
Definition: HLXMonitor.cc:1397
unsigned int runNumLength
Definition: HLXMonitor.h:240
timeval lastAvgTime_
Definition: HLXMonitor.h:269
int ReceiveLumiSection(HCAL_HLX::LUMI_SECTION &localSection)
Definition: TCPReceiver.cc:87
MonitorElement * Set1Above[36]
Definition: HLXMonitor.h:77
int SavePeriod
Definition: HLXMonitor.h:214
MonitorElement * processStartTimeStamp_
The PID associated with this job.
Definition: HLXMonitor.h:180
~HLXMonitor() override
Definition: HLXMonitor.cc:108
unsigned int expectedNibbles_
Definition: HLXMonitor.h:252
int SetMode(unsigned char)
Definition: TCPReceiver.cc:199
MonitorElement * MaxInstLumiBXNum1
Definition: HLXMonitor.h:121
MonitorElement * AvgOccBelowSet2
Definition: HLXMonitor.h:95
edm::EventID id() const
Definition: EventBase.h:59
HLT enums.
HLXMonitor(const edm::ParameterSet &)
Definition: HLXMonitor.cc:17
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Definition: DQMStore.cc:266
double num4NibblePerLS_
Definition: HLXMonitor.h:276
double a
Definition: hdecay.h:119
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: HLXMonitor.cc:141
std::string OccXAxisTitle
Definition: HLXMonitor.h:243
MonitorElement * HistInstantLumiEtSum
Definition: HLXMonitor.h:147
MonitorElement * runId_
Definition: HLXMonitor.h:169
unsigned int AquireMode
Definition: HLXMonitor.h:218
MonitorElement * HFCompareOccBetweenSet2
Definition: HLXMonitor.h:88
unsigned int set1BelowIndex
Definition: HLXMonitor.h:229
MonitorElement * bookString(TString const &name, TString const &value)
Definition: DQMStore.cc:235
unsigned int lumiSectionCount
Definition: HLXMonitor.h:258
std::string eventInfoFolder_
Definition: HLXMonitor.h:237
MonitorElement * LumiIntegratedOccSet2
Definition: HLXMonitor.h:108
MonitorElement * HFCompareOccBelowSet2
Definition: HLXMonitor.h:87
MonitorElement * HFCompareOccBetweenSet1
Definition: HLXMonitor.h:85
void FillHistograms(const LUMI_SECTION &)
Definition: HLXMonitor.cc:924
virtual void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
timeval currentTime_
Definition: HLXMonitor.h:269
MonitorElement * LumiAvgOccSet1
Definition: HLXMonitor.h:101
std::string DistribIP1
Definition: HLXMonitor.h:226
MonitorElement * workingDir_
DQM "name" of the job (eg, Hcal or DT)
Definition: HLXMonitor.h:188
tmp
align.sh
Definition: createJobs.py:716
MonitorElement * AvgOccBetweenSet1
Definition: HLXMonitor.h:93
MonitorElement * RecentInstantLumiEtSum
Definition: HLXMonitor.h:157
TimeValue_t value() const
Definition: Timestamp.h:45
edm::Timestamp time() const
Definition: EventBase.h:60
MonitorElement * reportSummary_
Definition: HLXMonitor.h:196
MonitorElement * HistAvgOccBetweenSet2HFP
Definition: HLXMonitor.h:137
MonitorElement * bookInt(TString const &name)
Definition: DQMStore.cc:231
unsigned int set1AboveIndex
Definition: HLXMonitor.h:231
std::string EtXAxisTitle
Definition: HLXMonitor.h:245
MonitorElement * lumisecId_
Definition: HLXMonitor.h:172
unsigned int reconnTime
Definition: HLXMonitor.h:225
void SetupEventInfo(DQMStore::IBooker &)
Definition: HLXMonitor.cc:771
Definition: Run.h:45
unsigned int set1BetweenIndex
Definition: HLXMonitor.h:230
void FillHistoHFCompare(const LUMI_SECTION &)
Definition: HLXMonitor.cc:1351
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)