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 (Style == "BX") {
201  OccXAxisTitle = "Bunch Crossing";
202  OccYAxisTitle = "Tower Occupancy";
203  EtXAxisTitle = "Bunch Crossing";
204  EtYAxisTitle = "E_{T} Sum";
205  } else if (Style == "Distribution") {
206  OccXAxisTitle = "Tower Occupancy";
207  OccYAxisTitle = "Count";
208  EtXAxisTitle = "E_{T} Sum";
209  EtYAxisTitle = "Count";
210  }
211 
212  for (unsigned int iWedge = 0; iWedge < NUM_HLX; ++iWedge) {
213  Set1Below[iWedge]->setAxisTitle(OccXAxisTitle, 1);
214  Set1Below[iWedge]->setAxisTitle(OccYAxisTitle, 2);
217  Set1Above[iWedge]->setAxisTitle(OccXAxisTitle, 1);
218  Set1Above[iWedge]->setAxisTitle(OccYAxisTitle, 2);
219  Set2Below[iWedge]->setAxisTitle(OccXAxisTitle, 1);
220  Set2Below[iWedge]->setAxisTitle(OccYAxisTitle, 2);
223  Set2Above[iWedge]->setAxisTitle(OccXAxisTitle, 1);
224  Set2Above[iWedge]->setAxisTitle(OccYAxisTitle, 2);
225  ETSum[iWedge]->setAxisTitle(EtXAxisTitle, 1);
226  ETSum[iWedge]->setAxisTitle(EtYAxisTitle, 2);
227  }
228 
229  // Comparison Histograms
230 
231  iBooker.setCurrentFolder(monitorName_ + "/HFCompare");
232 
233  std::string CompXTitle = "HF Wedge";
234  std::string CompEtSumYTitle = "E_{T} Sum per active tower";
235  std::string CompOccYTitle = "Occupancy per active tower";
236 
237  HFCompareEtSum = iBooker.book1D("HFCompareEtSum", "E_{T} Sum", NUM_HLX, 0, NUM_HLX);
238  HFCompareEtSum->setAxisTitle(CompXTitle, 1);
239  HFCompareEtSum->setAxisTitle(CompEtSumYTitle, 2);
240 
242  iBooker.book1D("HFCompareOccBelowSet1", "Occupancy Below Threshold 1 - Set 1", NUM_HLX, 0, NUM_HLX);
243  HFCompareOccBelowSet1->setAxisTitle(CompXTitle, 1);
244  HFCompareOccBelowSet1->setAxisTitle(CompOccYTitle, 2);
245 
247  iBooker.book1D("HFCompareOccBetweenSet1", "Occupancy Between Threshold 1 & 2 - Set 1", NUM_HLX, 0, NUM_HLX);
248  HFCompareOccBetweenSet1->setAxisTitle(CompXTitle, 1);
249  HFCompareOccBetweenSet1->setAxisTitle(CompOccYTitle, 2);
250 
252  iBooker.book1D("HFCompareOccAboveSet1", "Occupancy Above Threshold 2 - Set 1", NUM_HLX, 0, NUM_HLX);
253  HFCompareOccAboveSet1->setAxisTitle(CompXTitle, 1);
254  HFCompareOccAboveSet1->setAxisTitle(CompOccYTitle, 2);
255 
257  iBooker.book1D("HFCompareOccBelowSet2", "Occupancy Below Threshold 1 - Set 2", NUM_HLX, 0, NUM_HLX);
258  HFCompareOccBelowSet2->setAxisTitle(CompXTitle, 1);
259  HFCompareOccBelowSet2->setAxisTitle(CompOccYTitle, 2);
260 
262  iBooker.book1D("HFCompareOccBetweenSet2", "Occupancy Between Threshold 1 & 2 - Set 2", NUM_HLX, 0, NUM_HLX);
263  HFCompareOccBetweenSet2->setAxisTitle(CompXTitle, 1);
264  HFCompareOccBetweenSet2->setAxisTitle(CompOccYTitle, 2);
265 
267  iBooker.book1D("HFCompareOccAboveSet2", "Occupancy Above Threshold 2 - Set 2", NUM_HLX, 0, NUM_HLX);
268  HFCompareOccAboveSet2->setAxisTitle(CompXTitle, 1);
269  HFCompareOccAboveSet2->setAxisTitle(CompOccYTitle, 2);
270 
271  // Average Histograms
272 
273  iBooker.setCurrentFolder(monitorName_ + "/Average");
274 
275  int OccBins = 10000; // This does absolutely nothing.
276  double OccMin = 0;
277  double OccMax = 0; // If min and max are zero, no bounds on the data are set.
278 
279  int EtSumBins = 10000; // This does absolutely nothing. The Variable is not
280  // used in the function.
281  double EtSumMin = 0;
282  double EtSumMax = 0; // If min and max are zero, no bounds on the data are set.
283 
284  std::string errorOpt = "i";
285 
286  std::string AvgXTitle = "HF Wedge";
287  std::string AvgEtSumYTitle = "Average E_{T} Sum";
288  std::string AvgOccYTitle = "Average Tower Occupancy";
289 
290  AvgEtSum = iBooker.bookProfile("AvgEtSum", "Average E_{T} Sum", NUM_HLX, 0, NUM_HLX, EtSumBins, EtSumMin, EtSumMax);
291  AvgEtSum->setAxisTitle(AvgXTitle, 1);
292  AvgEtSum->setAxisTitle(AvgEtSumYTitle, 2);
293 
294  AvgOccBelowSet1 = iBooker.bookProfile("AvgOccBelowSet1",
295  "Average Occupancy Below Threshold 1 - Set1",
296  NUM_HLX,
297  0,
298  NUM_HLX,
299  OccBins,
300  OccMin,
301  OccMax,
302  errorOpt.c_str());
303  AvgOccBelowSet1->setAxisTitle(AvgXTitle, 1);
304  AvgOccBelowSet1->setAxisTitle(AvgOccYTitle, 2);
305 
306  AvgOccBetweenSet1 = iBooker.bookProfile("AvgOccBetweenSet1",
307  "Average Occupancy Between Threhold 1 & 2 - Set1",
308  NUM_HLX,
309  0,
310  NUM_HLX,
311  OccBins,
312  OccMin,
313  OccMax,
314  errorOpt.c_str());
315  AvgOccBetweenSet1->setAxisTitle(AvgXTitle, 1);
316  AvgOccBetweenSet1->setAxisTitle(AvgOccYTitle, 2);
317 
318  AvgOccAboveSet1 = iBooker.bookProfile("AvgOccAboveSet1",
319  "Average Occupancy Above Threshold 2 - Set1",
320  NUM_HLX,
321  0,
322  NUM_HLX,
323  OccBins,
324  OccMin,
325  OccMax,
326  errorOpt.c_str());
327  AvgOccAboveSet1->setAxisTitle(AvgXTitle, 1);
328  AvgOccAboveSet1->setAxisTitle(AvgOccYTitle, 2);
329 
330  AvgOccBelowSet2 = iBooker.bookProfile("AvgOccBelowSet2",
331  "Average Occupancy Below Threshold 1 - Set2",
332  NUM_HLX,
333  0,
334  NUM_HLX,
335  OccBins,
336  OccMin,
337  OccMax,
338  errorOpt.c_str());
339  AvgOccBelowSet2->setAxisTitle(AvgXTitle, 1);
340  AvgOccBelowSet2->setAxisTitle(AvgOccYTitle, 2);
341 
342  AvgOccBetweenSet2 = iBooker.bookProfile("AvgOccBetweenSet2",
343  "Average Occupancy Between Threshold 1 & 2 - Set2",
344  NUM_HLX,
345  0,
346  NUM_HLX,
347  OccBins,
348  OccMin,
349  OccMax,
350  errorOpt.c_str());
351  AvgOccBetweenSet2->setAxisTitle(AvgXTitle, 1);
352  AvgOccBetweenSet2->setAxisTitle(AvgOccYTitle, 2);
353 
354  AvgOccAboveSet2 = iBooker.bookProfile("AvgOccAboveSet2",
355  "Average Occupancy Above Threshold 2 - Set2",
356  NUM_HLX,
357  0,
358  NUM_HLX,
359  OccBins,
360  OccMin,
361  OccMax,
362  errorOpt.c_str());
363  AvgOccAboveSet2->setAxisTitle(AvgXTitle, 1);
364  AvgOccAboveSet2->setAxisTitle(AvgOccYTitle, 2);
365 
366  // Luminosity Histograms
367  iBooker.setCurrentFolder(monitorName_ + "/Luminosity");
368 
369  std::string LumiXTitle = "Bunch Crossing";
370  std::string LumiEtSumYTitle = "Luminosity: E_{T} Sum";
371  std::string LumiOccYTitle = "Luminosity: Occupancy";
372 
373  LumiAvgEtSum = iBooker.bookProfile(
374  "LumiAvgEtSum", "Average Luminosity ", int(XMAX - XMIN), XMIN, XMAX, EtSumBins, EtSumMin, EtSumMax);
375  LumiAvgEtSum->setAxisTitle(LumiXTitle, 1);
376  LumiAvgEtSum->setAxisTitle(LumiEtSumYTitle, 2);
377 
378  LumiAvgOccSet1 = iBooker.bookProfile(
379  "LumiAvgOccSet1", "Average Luminosity - Set 1", int(XMAX - XMIN), XMIN, XMAX, OccBins, OccMax, OccMin);
380  LumiAvgOccSet1->setAxisTitle(LumiXTitle, 1);
381  LumiAvgOccSet1->setAxisTitle(LumiOccYTitle, 2);
382 
383  LumiAvgOccSet2 = iBooker.bookProfile(
384  "LumiAvgOccSet2", "Average Luminosity - Set 2", int(XMAX - XMIN), XMIN, XMAX, OccBins, OccMax, OccMin);
385  LumiAvgOccSet2->setAxisTitle(LumiXTitle, 1);
386  LumiAvgOccSet2->setAxisTitle(LumiOccYTitle, 2);
387 
388  LumiInstantEtSum = iBooker.book1D("LumiInstantEtSum", "Instantaneous Luminosity ", int(XMAX - XMIN), XMIN, XMAX);
389  LumiInstantEtSum->setAxisTitle(LumiXTitle, 1);
390  LumiInstantEtSum->setAxisTitle(LumiEtSumYTitle, 2);
391 
393  iBooker.book1D("LumiInstantOccSet1", "Instantaneous Luminosity - Set 1", int(XMAX - XMIN), XMIN, XMAX);
394  LumiInstantOccSet1->setAxisTitle(LumiXTitle, 1);
395  LumiInstantOccSet1->setAxisTitle(LumiOccYTitle, 2);
396 
398  iBooker.book1D("LumiInstantOccSet2", "Instantaneous Luminosity - Set 2", int(XMAX - XMIN), XMIN, XMAX);
399  LumiInstantOccSet2->setAxisTitle(LumiXTitle, 1);
400  LumiInstantOccSet2->setAxisTitle(LumiOccYTitle, 2);
401 
402  LumiIntegratedEtSum = iBooker.book1D("LumiIntegratedEtSum", "Integrated Luminosity ", int(XMAX - XMIN), XMIN, XMAX);
403  LumiIntegratedEtSum->setAxisTitle(LumiXTitle, 1);
404  LumiIntegratedEtSum->setAxisTitle(LumiEtSumYTitle, 2);
405 
407  iBooker.book1D("LumiIntegratedOccSet1", "Integrated Luminosity - Set 1", int(XMAX - XMIN), XMIN, XMAX);
408  LumiIntegratedOccSet1->setAxisTitle(LumiXTitle, 1);
409  LumiIntegratedOccSet1->setAxisTitle(LumiOccYTitle, 2);
410 
412  iBooker.book1D("LumiIntegratedOccSet2", "Integrated Luminosity - Set 2", int(XMAX - XMIN), XMIN, XMAX);
413  LumiIntegratedOccSet2->setAxisTitle(LumiXTitle, 1);
414  LumiIntegratedOccSet2->setAxisTitle(LumiOccYTitle, 2);
415 
416  // Sanity check sum histograms
417  iBooker.setCurrentFolder(monitorName_ + "/CheckSums");
418 
419  std::string sumXTitle = "HF Wedge";
420  std::string sumYTitle = "Occupancy Sum (Below+Above+Between)";
421 
422  SumAllOccSet1 =
423  iBooker.bookProfile("SumAllOccSet1", "Occupancy Check - Set 1", NUM_HLX, 0, NUM_HLX, OccBins, OccMax, OccMin);
424  SumAllOccSet1->setAxisTitle(sumXTitle, 1);
425  SumAllOccSet1->setAxisTitle(sumYTitle, 2);
426 
427  SumAllOccSet2 =
428  iBooker.bookProfile("SumAllOccSet2", "Occupancy Check - Set 2", NUM_HLX, 0, NUM_HLX, OccBins, OccMax, OccMin);
429  SumAllOccSet2->setAxisTitle(sumXTitle, 1);
430  SumAllOccSet2->setAxisTitle(sumYTitle, 2);
431 
432  MissingDQMDataCheck = iBooker.book1D("MissingDQMDataCheck", "Missing Data Count", 1, 0, 1);
434  MissingDQMDataCheck->setAxisTitle("Number Missing Nibbles", 2);
435 
436  // Signal & Background monitoring histograms
437  iBooker.setCurrentFolder(monitorName_ + "/SigBkgLevels");
438 
439  MaxInstLumiBX1 = iBooker.book1D("MaxInstLumiBX1", "Max Instantaneous Luminosity BX: 1st", 10000, -1e-5, 0.01);
440  MaxInstLumiBX1->setAxisTitle("Max Inst. L (10^{30}cm^{-2}s^{-1})", 1);
441  MaxInstLumiBX1->setAxisTitle("Entries", 2);
442  MaxInstLumiBX2 = iBooker.book1D("MaxInstLumiBX2", "Max Instantaneous Luminosity BX: 2nd", 10000, -1e-5, 0.01);
443  MaxInstLumiBX2->setAxisTitle("Max Inst. L (10^{30}cm^{-2}s^{-1})", 1);
444  MaxInstLumiBX2->setAxisTitle("Entries", 2);
445  MaxInstLumiBX3 = iBooker.book1D("MaxInstLumiBX3", "Max Instantaneous Luminosity BX: 3rd", 10000, -1e-5, 0.01);
446  MaxInstLumiBX3->setAxisTitle("Max Inst. L (10^{30}cm^{-2}s^{-1})", 1);
447  MaxInstLumiBX3->setAxisTitle("Entries", 2);
448  MaxInstLumiBX4 = iBooker.book1D("MaxInstLumiBX4", "Max Instantaneous Luminosity BX: 4th", 10000, -1e-5, 0.01);
449  MaxInstLumiBX4->setAxisTitle("Max Inst. L (10^{30}cm^{-2}s^{-1})", 1);
450  MaxInstLumiBX4->setAxisTitle("Entries", 2);
451 
452  MaxInstLumiBXNum1 = iBooker.book1D("MaxInstLumiBXNum1", "BX Number of Max: 1st", 3564, 0, 3564);
454  MaxInstLumiBXNum1->setAxisTitle("Num Time Max", 2);
455  MaxInstLumiBXNum2 = iBooker.book1D("MaxInstLumiBXNum2", "BX Number of Max: 2nd", 3564, 0, 3564);
457  MaxInstLumiBXNum2->setAxisTitle("Num Time Max", 2);
458  MaxInstLumiBXNum3 = iBooker.book1D("MaxInstLumiBXNum3", "BX Number of Max: 3rd", 3564, 0, 3564);
460  MaxInstLumiBXNum3->setAxisTitle("Num Time Max", 2);
461  MaxInstLumiBXNum4 = iBooker.book1D("MaxInstLumiBXNum4", "BX Number of Max: 4th", 3564, 0, 3564);
463  MaxInstLumiBXNum4->setAxisTitle("Num Time Max", 2);
464 
465  // History histograms
466  iBooker.setCurrentFolder(monitorName_ + "/HistoryRaw");
467 
468  std::string HistXTitle = "Time (LS)";
469  std::string RecentHistXTitle = "Time (LS/16)";
470  std::string HistEtSumYTitle = "Average E_{T} Sum";
471  std::string HistOccYTitle = "Average Occupancy";
472  std::string HistLumiYTitle = "Luminosity";
473  std::string HistLumiErrorYTitle = "Luminosity Error (%)";
474  std::string BXvsTimeXTitle = "Time (LS)";
475  std::string BXvsTimeYTitle = "BX";
476 
477  // Et Sum histories
478  HistAvgEtSumHFP = iBooker.bookProfile(
479  "HistAvgEtSumHFP", "Average Et Sum: HF+", MAX_LS, 0.5, (double)MAX_LS + 0.5, EtSumBins, EtSumMin, EtSumMax);
480  HistAvgEtSumHFP->setAxisTitle(HistXTitle, 1);
481  HistAvgEtSumHFP->setAxisTitle(HistEtSumYTitle, 2);
482 
483  HistAvgEtSumHFM = iBooker.bookProfile(
484  "HistAvgEtSumHFM", "Average Et Sum: HF-", MAX_LS, 0.5, (double)MAX_LS + 0.5, EtSumBins, EtSumMin, EtSumMax);
485  HistAvgEtSumHFM->setAxisTitle(HistXTitle, 1);
486  HistAvgEtSumHFM->setAxisTitle(HistEtSumYTitle, 2);
487 
488  // Tower Occupancy Histories
489  HistAvgOccBelowSet1HFP = iBooker.bookProfile("HistAvgOccBelowSet1HFP",
490  "Average Occ Set1Below: HF+",
491  MAX_LS,
492  0.5,
493  (double)MAX_LS + 0.5,
494  OccBins,
495  OccMin,
496  OccMax);
497  HistAvgOccBelowSet1HFP->setAxisTitle(HistXTitle, 1);
498  HistAvgOccBelowSet1HFP->setAxisTitle(HistOccYTitle, 2);
499 
500  HistAvgOccBelowSet1HFM = iBooker.bookProfile("HistAvgOccBelowSet1HFM",
501  "Average Occ Set1Below: HF-",
502  MAX_LS,
503  0.5,
504  (double)MAX_LS + 0.5,
505  OccBins,
506  OccMin,
507  OccMax);
508  HistAvgOccBelowSet1HFM->setAxisTitle(HistXTitle, 1);
509  HistAvgOccBelowSet1HFM->setAxisTitle(HistOccYTitle, 2);
510 
511  HistAvgOccBetweenSet1HFP = iBooker.bookProfile("HistAvgOccBetweenSet1HFP",
512  "Average Occ Set1Between: HF+",
513  MAX_LS,
514  0.5,
515  (double)MAX_LS + 0.5,
516  OccBins,
517  OccMin,
518  OccMax);
519  HistAvgOccBetweenSet1HFP->setAxisTitle(HistXTitle, 1);
520  HistAvgOccBetweenSet1HFP->setAxisTitle(HistOccYTitle, 2);
521 
522  HistAvgOccBetweenSet1HFM = iBooker.bookProfile("HistAvgOccBetweenSet1HFM",
523  "Average Occ Set1Between: HF-",
524  MAX_LS,
525  0.5,
526  (double)MAX_LS + 0.5,
527  OccBins,
528  OccMin,
529  OccMax);
530  HistAvgOccBetweenSet1HFM->setAxisTitle(HistXTitle, 1);
531  HistAvgOccBetweenSet1HFM->setAxisTitle(HistOccYTitle, 2);
532 
533  HistAvgOccAboveSet1HFP = iBooker.bookProfile("HistAvgOccAboveSet1HFP",
534  "Average Occ Set1Above: HF+",
535  MAX_LS,
536  0.5,
537  (double)MAX_LS + 0.5,
538  OccBins,
539  OccMin,
540  OccMax);
541  HistAvgOccAboveSet1HFP->setAxisTitle(HistXTitle, 1);
542  HistAvgOccAboveSet1HFP->setAxisTitle(HistOccYTitle, 2);
543 
544  HistAvgOccAboveSet1HFM = iBooker.bookProfile("HistAvgOccAboveSet1HFM",
545  "Average Occ Set1Above: HF-",
546  MAX_LS,
547  0.5,
548  (double)MAX_LS + 0.5,
549  OccBins,
550  OccMin,
551  OccMax);
552  HistAvgOccAboveSet1HFM->setAxisTitle(HistXTitle, 1);
553  HistAvgOccAboveSet1HFM->setAxisTitle(HistOccYTitle, 2);
554 
555  HistAvgOccBelowSet2HFP = iBooker.bookProfile("HistAvgOccBelowSet2HFP",
556  "Average Occ Set2Below: HF+",
557  MAX_LS,
558  0.5,
559  (double)MAX_LS + 0.5,
560  OccBins,
561  OccMin,
562  OccMax);
563  HistAvgOccBelowSet2HFP->setAxisTitle(HistXTitle, 1);
564  HistAvgOccBelowSet2HFP->setAxisTitle(HistOccYTitle, 2);
565 
566  HistAvgOccBelowSet2HFM = iBooker.bookProfile("HistAvgOccBelowSet2HFM",
567  "Average Occ Set2Below: HF-",
568  MAX_LS,
569  0.5,
570  (double)MAX_LS + 0.5,
571  OccBins,
572  OccMin,
573  OccMax);
574  HistAvgOccBelowSet2HFM->setAxisTitle(HistXTitle, 1);
575  HistAvgOccBelowSet2HFM->setAxisTitle(HistOccYTitle, 2);
576 
577  HistAvgOccBetweenSet2HFP = iBooker.bookProfile("HistAvgOccBetweenSet2HFP",
578  "Average Occ Set2Between: HF+",
579  MAX_LS,
580  0.5,
581  (double)MAX_LS + 0.5,
582  OccBins,
583  OccMin,
584  OccMax);
585  HistAvgOccBetweenSet2HFP->setAxisTitle(HistXTitle, 1);
586  HistAvgOccBetweenSet2HFP->setAxisTitle(HistOccYTitle, 2);
587 
588  HistAvgOccBetweenSet2HFM = iBooker.bookProfile("HistAvgOccBetweenSet2HFM",
589  "Average Occ Set2Between: HF-",
590  MAX_LS,
591  0.5,
592  (double)MAX_LS + 0.5,
593  OccBins,
594  OccMin,
595  OccMax);
596  HistAvgOccBetweenSet2HFM->setAxisTitle(HistXTitle, 1);
597  HistAvgOccBetweenSet2HFM->setAxisTitle(HistOccYTitle, 2);
598 
599  HistAvgOccAboveSet2HFP = iBooker.bookProfile("HistAvgOccAboveSet2HFP",
600  "Average Occ Set2Above: HF+",
601  MAX_LS,
602  0.5,
603  (double)MAX_LS + 0.5,
604  OccBins,
605  OccMin,
606  OccMax);
607  HistAvgOccAboveSet2HFP->setAxisTitle(HistXTitle, 1);
608  HistAvgOccAboveSet2HFP->setAxisTitle(HistOccYTitle, 2);
609 
610  HistAvgOccAboveSet2HFM = iBooker.bookProfile("HistAvgOccAboveSet2HFM",
611  "Average Occ Set2Above: HF-",
612  MAX_LS,
613  0.5,
614  (double)MAX_LS + 0.5,
615  OccBins,
616  OccMin,
617  OccMax);
618  HistAvgOccAboveSet2HFM->setAxisTitle(HistXTitle, 1);
619  HistAvgOccAboveSet2HFM->setAxisTitle(HistOccYTitle, 2);
620 
621  // Et Sum histories
622  BXvsTimeAvgEtSumHFP = iBooker.book2D("BXvsTimeAvgEtSumHFP",
623  "Average Et Sum: HF+",
624  MAX_LS,
625  0.5,
626  (double)MAX_LS + 0.5,
627  NBINS,
628  (double)XMIN,
629  (double)XMAX);
630  BXvsTimeAvgEtSumHFP->setAxisTitle(BXvsTimeXTitle, 1);
631  BXvsTimeAvgEtSumHFP->setAxisTitle(BXvsTimeYTitle, 2);
632 
633  BXvsTimeAvgEtSumHFM = iBooker.book2D("BXvsTimeAvgEtSumHFM",
634  "Average Et Sum: HF-",
635  MAX_LS,
636  0.5,
637  (double)MAX_LS + 0.5,
638  NBINS,
639  (double)XMIN,
640  (double)XMAX);
641  BXvsTimeAvgEtSumHFM->setAxisTitle(BXvsTimeXTitle, 1);
642  BXvsTimeAvgEtSumHFM->setAxisTitle(BXvsTimeYTitle, 2);
643 
644  iBooker.setCurrentFolder(monitorName_ + "/HistoryLumi");
645 
646  // Lumi Histories
647  HistAvgLumiEtSum = iBooker.bookProfile("HistAvgLumiEtSum",
648  "Average Instant Luminosity: Et Sum",
649  MAX_LS,
650  0.5,
651  (double)MAX_LS + 0.5,
652  EtSumBins,
653  EtSumMin,
654  EtSumMax);
655  HistAvgLumiEtSum->setAxisTitle(HistXTitle, 1);
656  HistAvgLumiEtSum->setAxisTitle(HistLumiYTitle, 2);
657 
658  HistAvgLumiOccSet1 = iBooker.bookProfile("HistAvgLumiOccSet1",
659  "Average Instant Luminosity: Occ Set1",
660  MAX_LS,
661  0.5,
662  (double)MAX_LS + 0.5,
663  OccBins,
664  OccMin,
665  OccMax);
666  HistAvgLumiOccSet1->setAxisTitle(HistXTitle, 1);
667  HistAvgLumiOccSet1->setAxisTitle(HistLumiYTitle, 2);
668 
669  HistAvgLumiOccSet2 = iBooker.bookProfile("HistAvgLumiOccSet2",
670  "Average Instant Luminosity: Occ Set2",
671  MAX_LS,
672  0.5,
673  (double)MAX_LS + 0.5,
674  OccBins,
675  OccMin,
676  OccMax);
677  HistAvgLumiOccSet2->setAxisTitle(HistXTitle, 1);
678  HistAvgLumiOccSet2->setAxisTitle(HistLumiYTitle, 2);
679 
681  iBooker.book1D("HistInstantLumiEtSum", "Instant Luminosity: Et Sum", MAX_LS, 0.5, (double)MAX_LS + 0.5);
682  HistInstantLumiEtSum->setAxisTitle(HistXTitle, 1);
683  HistInstantLumiEtSum->setAxisTitle(HistLumiYTitle, 2);
684 
686  iBooker.book1D("HistInstantLumiOccSet1", "Instant Luminosity: Occ Set1", MAX_LS, 0.5, (double)MAX_LS + 0.5);
687  HistInstantLumiOccSet1->setAxisTitle(HistXTitle, 1);
688  HistInstantLumiOccSet1->setAxisTitle(HistLumiYTitle, 2);
689 
691  iBooker.book1D("HistInstantLumiOccSet2", "Instant Luminosity: Occ Set2", MAX_LS, 0.5, (double)MAX_LS + 0.5);
692  HistInstantLumiOccSet2->setAxisTitle(HistXTitle, 1);
693  HistInstantLumiOccSet2->setAxisTitle(HistLumiYTitle, 2);
694 
696  iBooker.book1D("HistInstantLumiEtSumError", "Luminosity Error: Et Sum", MAX_LS, 0.5, (double)MAX_LS + 0.5);
697  HistInstantLumiEtSumError->setAxisTitle(HistXTitle, 1);
698  HistInstantLumiEtSumError->setAxisTitle(HistLumiErrorYTitle, 2);
699 
701  iBooker.book1D("HistInstantLumiOccSet1Error", "Luminosity Error: Occ Set1", MAX_LS, 0.5, (double)MAX_LS + 0.5);
703  HistInstantLumiOccSet1Error->setAxisTitle(HistLumiErrorYTitle, 2);
704 
706  iBooker.book1D("HistInstantLumiOccSet2Error", "Luminosity Error: Occ Set2", MAX_LS, 0.5, (double)MAX_LS + 0.5);
708  HistInstantLumiOccSet2Error->setAxisTitle(HistLumiErrorYTitle, 2);
709 
711  iBooker.book1D("HistIntegratedLumiEtSum", "Integrated Luminosity: Et Sum", MAX_LS, 0.5, (double)MAX_LS + 0.5);
712  HistIntegratedLumiEtSum->setAxisTitle(HistXTitle, 1);
713  HistIntegratedLumiEtSum->setAxisTitle(HistLumiYTitle, 2);
714 
716  iBooker.book1D("HistIntegratedLumiOccSet1", "Integrated Luminosity: Occ Set1", MAX_LS, 0.5, (double)MAX_LS + 0.5);
717  HistIntegratedLumiOccSet1->setAxisTitle(HistXTitle, 1);
718  HistIntegratedLumiOccSet1->setAxisTitle(HistLumiYTitle, 2);
719 
721  iBooker.book1D("HistIntegratedLumiOccSet2", "Integrated Luminosity: Occ Set2", MAX_LS, 0.5, (double)MAX_LS + 0.5);
722  HistIntegratedLumiOccSet2->setAxisTitle(HistXTitle, 1);
723  HistIntegratedLumiOccSet2->setAxisTitle(HistLumiYTitle, 2);
724 
725  iBooker.setCurrentFolder(monitorName_ + "/RecentHistoryLumi");
726 
727  // Lumi Recent Histories (past 128 short sections)
729  iBooker.book1D("RecentInstantLumiEtSum", "Instant Luminosity: Et Sum", 128, 0.5, (double)128 + 0.5);
730  RecentInstantLumiEtSum->setAxisTitle(RecentHistXTitle, 1);
731  RecentInstantLumiEtSum->setAxisTitle(HistLumiYTitle, 2);
732 
734  iBooker.book1D("RecentInstantLumiOccSet1", "Instant Luminosity: Occ Set1", 128, 0.5, (double)128 + 0.5);
735  RecentInstantLumiOccSet1->setAxisTitle(RecentHistXTitle, 1);
736  RecentInstantLumiOccSet1->setAxisTitle(HistLumiYTitle, 2);
737 
739  iBooker.book1D("RecentInstantLumiOccSet2", "Instant Luminosity: Occ Set2", 128, 0.5, (double)128 + 0.5);
740  RecentInstantLumiOccSet2->setAxisTitle(RecentHistXTitle, 1);
741  RecentInstantLumiOccSet2->setAxisTitle(HistLumiYTitle, 2);
742 
744  iBooker.book1D("RecentIntegratedLumiEtSum", "Integrated Luminosity: Et Sum", 128, 0.5, (double)128 + 0.5);
745  RecentIntegratedLumiEtSum->setAxisTitle(RecentHistXTitle, 1);
746  RecentIntegratedLumiEtSum->setAxisTitle(HistLumiYTitle, 2);
747 
749  iBooker.book1D("RecentIntegratedLumiOccSet1", "Integrated Luminosity: Occ Set1", 128, 0.5, (double)128 + 0.5);
750  RecentIntegratedLumiOccSet1->setAxisTitle(RecentHistXTitle, 1);
751  RecentIntegratedLumiOccSet1->setAxisTitle(HistLumiYTitle, 2);
752 
754  iBooker.book1D("RecentIntegratedLumiOccSet2", "Integrated Luminosity: Occ Set2", 128, 0.5, (double)128 + 0.5);
755  RecentIntegratedLumiOccSet2->setAxisTitle(RecentHistXTitle, 1);
756  RecentIntegratedLumiOccSet2->setAxisTitle(HistLumiYTitle, 2);
757 }
758 
760  using std::string;
761 
762  string currentfolder = subSystemName_ + "/" + eventInfoFolderHLX_;
763  // cout << "currentfolder " << currentfolder << endl;
764 
765  iBooker.setCurrentFolder(currentfolder);
766 
767  pEvent_ = 0;
768  evtRateCount_ = 0;
769  gettimeofday(&currentTime_, nullptr);
771  evtRateWindow_ = 0.5;
772 
773  // Event specific contents
774  runId_ = iBooker.bookInt("iRun");
775  lumisecId_ = iBooker.bookInt("iLumiSection");
776 
777  eventId_ = iBooker.bookInt("iEvent");
778  eventId_->Fill(-1);
779  eventTimeStamp_ = iBooker.bookFloat("eventTimeStamp");
780 
781  iBooker.setCurrentFolder(currentfolder);
782  // Process specific contents
783  processTimeStamp_ = iBooker.bookFloat("processTimeStamp");
785  processLatency_ = iBooker.bookFloat("processLatency");
786  processTimeStamp_->Fill(-1);
787  processEvents_ = iBooker.bookInt("processedEvents");
789  processEventRate_ = iBooker.bookFloat("processEventRate");
790  processEventRate_->Fill(-1);
791  nUpdates_ = iBooker.bookInt("processUpdates");
792  nUpdates_->Fill(-1);
793 
794  // Static Contents
795  processId_ = iBooker.bookInt("processID");
796  processId_->Fill(gSystem->GetPid());
797  processStartTimeStamp_ = iBooker.bookFloat("processStartTimeStamp");
799  runStartTimeStamp_ = iBooker.bookFloat("runStartTimeStamp");
800  hostName_ = iBooker.bookString("hostName", gSystem->HostName());
801  processName_ = iBooker.bookString("processName", subSystemName_);
802  workingDir_ = iBooker.bookString("workingDir", gSystem->pwd());
803  cmsswVer_ = iBooker.bookString("CMSSW_Version", edm::getReleaseVersion());
804 
805  // Go to the standard EventInfo folder (in the case online case where this
806  // is different).
807  currentfolder = subSystemName_ + "/" + eventInfoFolder_;
808  iBooker.setCurrentFolder(currentfolder);
809 
810  reportSummary_ = iBooker.bookFloat("reportSummary");
811  reportSummaryMap_ = iBooker.book2D("reportSummaryMap", "reportSummaryMap", 18, 0., 18., 2, -1.5, 1.5);
812 
813  currentfolder = subSystemName_ + "/" + eventInfoFolderHLX_;
814  iBooker.setCurrentFolder(currentfolder);
815 
816  TH2F *summaryHist = reportSummaryMap_->getTH2F();
817  summaryHist->GetYaxis()->SetBinLabel(1, "HF-");
818  summaryHist->GetYaxis()->SetBinLabel(2, "HF+");
819  summaryHist->GetXaxis()->SetTitle("Wedge #");
820 
821  // Fill the report summary objects with default values, since these will only
822  // be filled at the change of run.
823  reportSummary_->Fill(1.0);
824 
825  for (unsigned int iHLX = 0; iHLX < NUM_HLX; ++iHLX) {
826  unsigned int iWedge = HLXHFMap[iHLX] + 1;
827  unsigned int iEta = 2;
828  if (iWedge >= 19) {
829  iEta = 1;
830  iWedge -= 18;
831  }
832  reportSummaryMap_->setBinContent(iWedge, iEta, 1.0);
833  }
834 }
835 
836 // ------------ method called to for each event ------------
838  using namespace edm;
839 
840  while (HLXTCP.IsConnected() == false) {
842  if (HLXTCP.Connect() != 1) {
843  std::cout << "Failed to connect to " << DistribIP1 << "." << std::endl;
844  sleep(1);
845  std::cout << "Trying " << DistribIP2 << std::endl;
847  if (HLXTCP.Connect() == 1)
848  break;
849  std::cout << "Failed to connect to " << DistribIP2 << "." << std::endl;
850  std::cout << " Reconnect in " << reconnTime << " seconds." << std::endl;
851  sleep(reconnTime);
852  }
853  }
854  if (HLXTCP.IsConnected() == true) {
855  std::cout << "Successfully connected." << std::endl;
856  }
857 
859  // If this is the first time through, set the runNumber ...
861  if (!currentRunEnded_ && runNumber_ != 0) {
862  EndRun();
863  }
865  currentRunEnded_ = false;
866  // std::cout << "Run number is: " << runNumber_ << std::endl;
867  timeval startruntime;
868  gettimeofday(&startruntime, nullptr);
869  runStartTimeStamp_->Fill(getUTCtime(&startruntime));
870  }
871 
872  // Fill the monitoring histograms
877 
878  cout << "Run: " << lumiSection.hdr.runNumber << " Section: " << lumiSection.hdr.sectionNumber
879  << " Orbit: " << lumiSection.hdr.startOrbit << endl;
880  cout << "Et Lumi: " << lumiSection.lumiSummary.InstantETLumi << endl;
881  cout << "Occ Lumi 1: " << lumiSection.lumiSummary.InstantOccLumi[0] << endl;
882  cout << "Occ Lumi 2: " << lumiSection.lumiSummary.InstantOccLumi[1] << endl;
883  } else {
884  HLXTCP.Disconnect();
885  EndRun();
886  }
887 }
888 
891 
892  // Do some things that should be done at the end of the run ...
893  expectedNibbles_ = 0;
894  for (unsigned int iHLX = 0; iHLX < NUM_HLX; ++iHLX)
895  totalNibbles_[iHLX] = 0;
896 
897  std::cout << "** Here in end run **" << std::endl;
898  runNumber_ = 0;
899  currentRunEnded_ = true;
906  sectionInstantNorm = 0;
907  lsBinOld = 0;
908  lumiSectionCount = 0;
909  previousSection = 0;
910 }
911 
913  // Check for missing data
914  if (previousSection != (section.hdr.sectionNumber - 1)) {
915  double weight = (double)(section.hdr.sectionNumber - previousSection - 1);
916  // std::cout << "Filling missing data! " << weight << std::endl;
918  }
919  previousSection = section.hdr.sectionNumber;
920 
921  int lsBin = int(lumiSectionCount / num4NibblePerLS_);
922  int lsBinBX = int(lumiSectionCount / num4NibblePerLS_);
923  HistAvgLumiEtSum->Fill(lsBin, section.lumiSummary.InstantETLumi);
924  HistAvgLumiOccSet1->Fill(lsBin, section.lumiSummary.InstantOccLumi[0]);
925  HistAvgLumiOccSet2->Fill(lsBin, section.lumiSummary.InstantOccLumi[1]);
926 
927  int fillBin = lumiSectionCount + 1;
928  if (fillBin > 128) {
929  // If we are already more than 2 LS's in, move everything back by one bin
930  // and fill the last bin with the new value.
931  for (int iBin = 1; iBin < 128; ++iBin) {
938  }
939  fillBin = 128;
940  }
941 
942  RecentInstantLumiEtSum->setBinContent(fillBin, section.lumiSummary.InstantETLumi);
943  RecentInstantLumiEtSum->setBinError(fillBin, section.lumiSummary.InstantETLumiErr);
944  RecentInstantLumiOccSet1->setBinContent(fillBin, section.lumiSummary.InstantOccLumi[0]);
945  RecentInstantLumiOccSet1->setBinError(fillBin, section.lumiSummary.InstantOccLumiErr[0]);
946  RecentInstantLumiOccSet2->setBinContent(fillBin, section.lumiSummary.InstantOccLumi[1]);
947  RecentInstantLumiOccSet2->setBinError(fillBin, section.lumiSummary.InstantOccLumiErr[1]);
948 
949  double recentOldBinContent = RecentIntegratedLumiEtSum->getBinContent(fillBin - 1);
950  if (fillBin == 1)
951  recentOldBinContent = 0;
952  double recentNewBinContent = recentOldBinContent + section.lumiSummary.InstantETLumi;
953  RecentIntegratedLumiEtSum->setBinContent(fillBin, recentNewBinContent);
954  recentOldBinContent = RecentIntegratedLumiOccSet1->getBinContent(fillBin - 1);
955  if (fillBin == 1)
956  recentOldBinContent = 0;
957  recentNewBinContent = recentOldBinContent + section.lumiSummary.InstantOccLumi[0];
958  RecentIntegratedLumiOccSet1->setBinContent(fillBin, recentNewBinContent);
959  recentOldBinContent = RecentIntegratedLumiOccSet2->getBinContent(fillBin - 1);
960  if (fillBin == 1)
961  recentOldBinContent = 0;
962  recentNewBinContent = recentOldBinContent + section.lumiSummary.InstantOccLumi[0];
963  RecentIntegratedLumiOccSet2->setBinContent(fillBin, recentNewBinContent);
964 
965  double recentOldBinError = RecentIntegratedLumiEtSum->getBinError(fillBin - 1);
966  if (fillBin == 1)
967  recentOldBinError = 0;
968  double recentNewBinError = sqrt(recentOldBinError * recentOldBinError +
969  section.lumiSummary.InstantETLumiErr * section.lumiSummary.InstantETLumiErr);
970  RecentIntegratedLumiEtSum->setBinError(fillBin, recentNewBinError);
971  recentOldBinError = RecentIntegratedLumiOccSet1->getBinError(fillBin - 1);
972  if (fillBin == 1)
973  recentOldBinError = 0;
974  recentNewBinError = sqrt(recentOldBinError * recentOldBinError +
975  section.lumiSummary.InstantOccLumiErr[0] * section.lumiSummary.InstantOccLumiErr[0]);
976  RecentIntegratedLumiOccSet1->setBinError(fillBin, recentNewBinError);
977  recentOldBinError = RecentIntegratedLumiOccSet2->getBinError(fillBin - 1);
978  if (fillBin == 1)
979  recentOldBinError = 0;
980  recentNewBinError = sqrt(recentOldBinError * recentOldBinError +
981  section.lumiSummary.InstantOccLumiErr[1] * section.lumiSummary.InstantOccLumiErr[1]);
982  RecentIntegratedLumiOccSet2->setBinError(fillBin, recentNewBinError);
983 
984  if (lsBinOld != lsBin) {
991 
992  double etDenom = fabs(sectionInstantSumEt);
993  if (etDenom < 1e-10)
994  etDenom = 1e-10;
995  double occ1Denom = fabs(sectionInstantSumOcc1);
996  if (occ1Denom < 1e-10)
997  occ1Denom = 1e-10;
998  double occ2Denom = fabs(sectionInstantSumOcc2);
999  if (occ2Denom < 1e-10)
1000  occ2Denom = 1e-10;
1001  double etError = 100.0 * sqrt(sectionInstantErrSumEt) / etDenom;
1002  double occ1Error = 100.0 * sqrt(sectionInstantErrSumOcc1) / occ1Denom;
1003  double occ2Error = 100.0 * sqrt(sectionInstantErrSumOcc2) / occ2Denom;
1007 
1008  double histOldBinContent = HistIntegratedLumiEtSum->getBinContent(lsBinOld);
1009  if (lsBinOld == 0)
1010  histOldBinContent = 0;
1011  double histNewBinContent = histOldBinContent + sectionInstantSumEt;
1012  HistIntegratedLumiEtSum->setBinContent(lsBin, histNewBinContent);
1013  histOldBinContent = HistIntegratedLumiOccSet1->getBinContent(lsBinOld);
1014  if (lsBinOld == 0)
1015  histOldBinContent = 0;
1016  histNewBinContent = histOldBinContent + sectionInstantSumOcc1;
1017  HistIntegratedLumiOccSet1->setBinContent(lsBin, histNewBinContent);
1018  histOldBinContent = HistIntegratedLumiOccSet2->getBinContent(lsBinOld);
1019  if (lsBinOld == 0)
1020  histOldBinContent = 0;
1021  histNewBinContent = histOldBinContent + sectionInstantSumOcc2;
1022  HistIntegratedLumiOccSet2->setBinContent(lsBin, histNewBinContent);
1023 
1024  double histOldBinError = HistIntegratedLumiEtSum->getBinError(lsBinOld);
1025  if (lsBinOld == 0)
1026  histOldBinError = 0;
1027  double histNewBinError = sqrt(histOldBinError * histOldBinError + sectionInstantErrSumEt);
1028  HistIntegratedLumiEtSum->setBinError(lsBin, histNewBinError);
1029  histOldBinError = HistIntegratedLumiOccSet1->getBinError(lsBinOld);
1030  if (lsBinOld == 0)
1031  histOldBinError = 0;
1032  histNewBinError = sqrt(histOldBinError * histOldBinError + sectionInstantErrSumOcc1);
1033  HistIntegratedLumiOccSet1->setBinError(lsBin, histNewBinError);
1034  histOldBinError = HistIntegratedLumiOccSet2->getBinError(lsBinOld);
1035  if (lsBinOld == 0)
1036  histOldBinError = 0;
1037  histNewBinError = sqrt(histOldBinError * histOldBinError + sectionInstantErrSumOcc2);
1038  HistIntegratedLumiOccSet2->setBinError(lsBin, histNewBinError);
1039 
1040  sectionInstantSumEt = 0;
1046  sectionInstantNorm = 0;
1047  lsBinOld = lsBin;
1048  }
1049 
1050  sectionInstantSumEt += section.lumiSummary.InstantETLumi;
1051  sectionInstantErrSumEt += section.lumiSummary.InstantETLumiErr * section.lumiSummary.InstantETLumiErr;
1052  sectionInstantSumOcc1 += section.lumiSummary.InstantOccLumi[0];
1053  sectionInstantErrSumOcc1 += section.lumiSummary.InstantOccLumiErr[0] * section.lumiSummary.InstantOccLumiErr[0];
1054  sectionInstantSumOcc2 += section.lumiSummary.InstantOccLumi[1];
1055  sectionInstantErrSumOcc2 += section.lumiSummary.InstantOccLumiErr[1] * section.lumiSummary.InstantOccLumiErr[1];
1057 
1058  for (int iHLX = 0; iHLX < (int)NUM_HLX; ++iHLX) {
1059  unsigned int utotal1 = 0;
1060  unsigned int utotal2 = 0;
1061  unsigned int iWedge = HLXHFMap[iHLX];
1062  if (section.occupancy[iHLX].hdr.numNibbles != 0) {
1063  // Don't include the last one hundred BX in the average.
1064  for (unsigned int iBX = 0; iBX < NUM_BUNCHES; ++iBX) {
1065  // Normalize to number of towers
1066  unsigned int norm[2] = {0, 0};
1067  norm[0] += section.occupancy[iHLX].data[set1BelowIndex][iBX];
1068  norm[0] += section.occupancy[iHLX].data[set1BetweenIndex][iBX];
1069  norm[0] += section.occupancy[iHLX].data[set1AboveIndex][iBX];
1070  if (norm[0] == 0)
1071  norm[0] = 1;
1072  norm[1] += section.occupancy[iHLX].data[set2BelowIndex][iBX];
1073  norm[1] += section.occupancy[iHLX].data[set2BetweenIndex][iBX];
1074  norm[1] += section.occupancy[iHLX].data[set2AboveIndex][iBX];
1075  if (norm[1] == 0)
1076  norm[1] = 1;
1077 
1078  double normEt = section.etSum[iHLX].data[iBX] / (double)(norm[0] + norm[1]);
1079  double normOccSet1Below = (double)section.occupancy[iHLX].data[set1BelowIndex][iBX] / (double)norm[0];
1080  double normOccSet1Between = (double)section.occupancy[iHLX].data[set1BetweenIndex][iBX] / (double)norm[0];
1081  double normOccSet1Above = (double)section.occupancy[iHLX].data[set1AboveIndex][iBX] / (double)norm[0];
1082  double normOccSet2Below = (double)section.occupancy[iHLX].data[set2BelowIndex][iBX] / (double)norm[1];
1083  double normOccSet2Between = (double)section.occupancy[iHLX].data[set2BetweenIndex][iBX] / (double)norm[1];
1084  double normOccSet2Above = (double)section.occupancy[iHLX].data[set2AboveIndex][iBX] / (double)norm[1];
1085 
1086  // Averages & check sum
1087  if (iBX < NUM_BUNCHES - 100) {
1088  AvgEtSum->Fill(iWedge, normEt);
1089 
1090  AvgOccBelowSet1->Fill(iWedge, normOccSet1Below);
1091  AvgOccBetweenSet1->Fill(iWedge, normOccSet1Between);
1092  AvgOccAboveSet1->Fill(iWedge, normOccSet1Above);
1093 
1094  AvgOccBelowSet2->Fill(iWedge, normOccSet2Below);
1095  AvgOccBetweenSet2->Fill(iWedge, normOccSet2Between);
1096  AvgOccAboveSet2->Fill(iWedge, normOccSet2Above);
1097 
1098  if (iWedge < 18) {
1099  HistAvgEtSumHFP->Fill(lsBin, normEt);
1100  HistAvgOccBelowSet1HFP->Fill(lsBin, normOccSet1Below);
1101  HistAvgOccBetweenSet1HFP->Fill(lsBin, normOccSet1Between);
1102  HistAvgOccAboveSet1HFP->Fill(lsBin, normOccSet1Above);
1103  HistAvgOccBelowSet2HFP->Fill(lsBin, normOccSet2Below);
1104  HistAvgOccBetweenSet2HFP->Fill(lsBin, normOccSet2Between);
1105  HistAvgOccAboveSet2HFP->Fill(lsBin, normOccSet2Above);
1106 
1107  if (iBX >= (XMIN - 1) && iBX <= (XMAX - 1))
1108  BXvsTimeAvgEtSumHFP->Fill(lsBinBX, iBX, normEt / (num4NibblePerLS_ * 18.0 * 12.0));
1109  } else {
1110  HistAvgEtSumHFM->Fill(lsBin, normEt);
1111  HistAvgOccBelowSet1HFM->Fill(lsBin, normOccSet1Below);
1112  HistAvgOccBetweenSet1HFM->Fill(lsBin, normOccSet1Between);
1113  HistAvgOccAboveSet1HFM->Fill(lsBin, normOccSet1Above);
1114  HistAvgOccBelowSet2HFM->Fill(lsBin, normOccSet2Below);
1115  HistAvgOccBetweenSet2HFM->Fill(lsBin, normOccSet2Between);
1116  HistAvgOccAboveSet2HFM->Fill(lsBin, normOccSet2Above);
1117 
1118  if (iBX >= (XMIN - 1) && iBX <= (XMAX - 1))
1119  BXvsTimeAvgEtSumHFM->Fill(lsBinBX, iBX, normEt / (num4NibblePerLS_ * 18.0 * 12.0));
1120  }
1121 
1122  utotal1 += section.occupancy[iHLX].data[set1BelowIndex][iBX];
1123  utotal1 += section.occupancy[iHLX].data[set1BetweenIndex][iBX];
1124  utotal1 += section.occupancy[iHLX].data[set1AboveIndex][iBX];
1125 
1126  utotal2 += section.occupancy[iHLX].data[set2BelowIndex][iBX];
1127  utotal2 += section.occupancy[iHLX].data[set2BetweenIndex][iBX];
1128  utotal2 += section.occupancy[iHLX].data[set2AboveIndex][iBX];
1129  }
1130 
1131  if (Style == "BX") {
1132  // Get the correct bin ...
1133  TH1F *Set1BelowHist = Set1Below[iWedge]->getTH1F();
1134  int iBin = Set1BelowHist->FindBin((float)iBX);
1135 
1136  // Adjust the old bin content to make the new, unnormalize and
1137  // renormalize
1138  if (lumiSectionCount > 0) {
1139  double oldNormOccSet1Below = (Set1Below[iWedge]->getBinContent(iBin)) * (double)(lumiSectionCount);
1140  normOccSet1Below += oldNormOccSet1Below;
1141  normOccSet1Below /= (double)(lumiSectionCount + 1);
1142  double oldNormOccSet2Below = (Set2Below[iWedge]->getBinContent(iBin)) * (double)(lumiSectionCount);
1143  normOccSet2Below += oldNormOccSet2Below;
1144  normOccSet2Below /= (double)(lumiSectionCount + 1);
1145 
1146  double oldNormOccSet1Between = (Set1Between[iWedge]->getBinContent(iBin)) * (double)(lumiSectionCount);
1147  normOccSet1Between += oldNormOccSet1Between;
1148  normOccSet1Between /= (double)(lumiSectionCount + 1);
1149  double oldNormOccSet2Between = (Set2Between[iWedge]->getBinContent(iBin)) * (double)(lumiSectionCount);
1150  normOccSet2Between += oldNormOccSet2Between;
1151  normOccSet2Between /= (double)(lumiSectionCount + 1);
1152 
1153  double oldNormOccSet1Above = (Set1Above[iWedge]->getBinContent(iBin)) * (double)(lumiSectionCount);
1154  normOccSet1Above += oldNormOccSet1Above;
1155  normOccSet1Above /= (double)(lumiSectionCount + 1);
1156  double oldNormOccSet2Above = (Set2Above[iWedge]->getBinContent(iBin)) * (double)(lumiSectionCount);
1157  normOccSet2Above += oldNormOccSet2Above;
1158  normOccSet2Above /= (double)(lumiSectionCount + 1);
1159 
1160  double oldNormEt = ETSum[iWedge]->getBinContent(iBin) * (double)(lumiSectionCount);
1161  normEt += oldNormEt;
1162  normEt /= (double)(lumiSectionCount + 1);
1163  }
1164  Set1Below[iWedge]->setBinContent(iBin, normOccSet1Below);
1165  Set1Between[iWedge]->setBinContent(iBin, normOccSet1Between);
1166  Set1Above[iWedge]->setBinContent(iBin, normOccSet1Above);
1167  Set2Below[iWedge]->setBinContent(iBin, normOccSet2Below);
1168  Set2Between[iWedge]->setBinContent(iBin, normOccSet2Between);
1169  Set2Above[iWedge]->setBinContent(iBin, normOccSet2Above);
1170  ETSum[iWedge]->setBinContent(iBin, normEt);
1171  } else if (Style == "Dist") {
1172  Set1Below[iWedge]->Fill(normOccSet1Below);
1173  Set1Between[iWedge]->Fill(normOccSet1Between);
1174  Set1Above[iWedge]->Fill(normOccSet1Above);
1175  Set2Below[iWedge]->Fill(normOccSet2Below);
1176  Set2Between[iWedge]->Fill(normOccSet2Between);
1177  Set2Above[iWedge]->Fill(normOccSet2Above);
1178  ETSum[iWedge]->Fill(normEt);
1179  }
1180  }
1181 
1182  // Get the number of towers per wedge per BX (assuming non-zero numbers)
1183  double total1 = 0;
1184  double total2 = 0;
1185  if ((NUM_BUNCHES - 100) > 0) {
1186  total1 = (double)utotal1 / (double)(NUM_BUNCHES - 100);
1187  total2 = (double)utotal2 / (double)(NUM_BUNCHES - 100);
1188  }
1189  if (section.hdr.numOrbits > 0) {
1190  total1 = total1 / (double)section.hdr.numOrbits;
1191  total2 = total2 / (double)section.hdr.numOrbits;
1192  }
1193 
1194  SumAllOccSet1->Fill(iWedge, total1);
1195  SumAllOccSet2->Fill(iWedge, total2);
1196  }
1197  }
1198 
1199  double max[4] = {-1000.0, -1000.0, -1000.0, -1000.0};
1200  int bxmax[4] = {-1, -1, -1, -1};
1201  for (unsigned int iBX = 0; iBX < NUM_BUNCHES; ++iBX) {
1202  LumiAvgEtSum->Fill(iBX, section.lumiDetail.ETLumi[iBX]);
1203  LumiAvgOccSet1->Fill(iBX, section.lumiDetail.OccLumi[0][iBX]);
1204  LumiAvgOccSet2->Fill(iBX, section.lumiDetail.OccLumi[1][iBX]);
1205 
1206  if (section.lumiDetail.OccLumi[0][iBX] > max[0]) {
1207  max[3] = max[2];
1208  bxmax[3] = bxmax[2];
1209  max[2] = max[1];
1210  bxmax[2] = bxmax[1];
1211  max[1] = max[0];
1212  bxmax[1] = bxmax[0];
1213  max[0] = section.lumiDetail.OccLumi[0][iBX];
1214  bxmax[0] = iBX;
1215  } else if (section.lumiDetail.OccLumi[0][iBX] > max[1]) {
1216  max[3] = max[2];
1217  bxmax[3] = bxmax[2];
1218  max[2] = max[1];
1219  bxmax[2] = bxmax[1];
1220  max[1] = section.lumiDetail.OccLumi[0][iBX];
1221  bxmax[1] = iBX;
1222  } else if (section.lumiDetail.OccLumi[0][iBX] > max[2]) {
1223  max[3] = max[2];
1224  bxmax[3] = bxmax[2];
1225  max[2] = section.lumiDetail.OccLumi[0][iBX];
1226  bxmax[2] = iBX;
1227  } else if (section.lumiDetail.OccLumi[0][iBX] > max[3]) {
1228  max[3] = section.lumiDetail.OccLumi[0][iBX];
1229  bxmax[3] = iBX;
1230  }
1231 
1232  int iBin = iBX - (int)XMIN + 1;
1233  if (iBin <= int(XMAX - XMIN) && iBin >= 1) {
1234  LumiInstantEtSum->setBinContent(iBin, section.lumiDetail.ETLumi[iBX]);
1235  LumiInstantOccSet1->setBinContent(iBin, section.lumiDetail.OccLumi[0][iBX]);
1236  LumiInstantOccSet2->setBinContent(iBin, section.lumiDetail.OccLumi[1][iBX]);
1237  LumiInstantEtSum->setBinError(iBin, section.lumiDetail.ETLumiErr[iBX]);
1238  LumiInstantOccSet1->setBinError(iBin, section.lumiDetail.OccLumiErr[0][iBX]);
1239  LumiInstantOccSet2->setBinError(iBin, section.lumiDetail.OccLumiErr[1][iBX]);
1240 
1241  double oldBinContent = LumiIntegratedEtSum->getBinContent(iBin);
1242  if (lumiSectionCount == 0)
1243  oldBinContent = 0;
1244  double newBinContent = oldBinContent + section.lumiDetail.ETLumi[iBX];
1245  LumiIntegratedEtSum->setBinContent(iBin, newBinContent);
1246  oldBinContent = LumiIntegratedOccSet1->getBinContent(iBin);
1247  if (lumiSectionCount == 0)
1248  oldBinContent = 0;
1249  newBinContent = oldBinContent + section.lumiDetail.OccLumi[0][iBX];
1250  LumiIntegratedOccSet1->setBinContent(iBin, newBinContent);
1251  oldBinContent = LumiIntegratedOccSet2->getBinContent(iBin);
1252  if (lumiSectionCount == 0)
1253  oldBinContent = 0;
1254  newBinContent = oldBinContent + section.lumiDetail.OccLumi[1][iBX];
1255  LumiIntegratedOccSet2->setBinContent(iBin, newBinContent);
1256 
1257  double oldBinError = LumiIntegratedEtSum->getBinError(iBin);
1258  if (lumiSectionCount == 0)
1259  oldBinError = 0;
1260  double newBinError =
1261  sqrt(oldBinError * oldBinError + section.lumiDetail.ETLumiErr[iBX] * section.lumiDetail.ETLumiErr[iBX]);
1262  LumiIntegratedEtSum->setBinError(iBin, newBinError);
1263  oldBinError = LumiIntegratedOccSet1->getBinError(iBin);
1264  if (lumiSectionCount == 0)
1265  oldBinError = 0;
1266  newBinError = sqrt(oldBinError * oldBinError +
1267  section.lumiDetail.OccLumiErr[0][iBX] * section.lumiDetail.OccLumiErr[0][iBX]);
1268  LumiIntegratedOccSet1->setBinError(iBin, newBinError);
1269  oldBinError = LumiIntegratedOccSet1->getBinError(iBin);
1270  if (lumiSectionCount == 0)
1271  oldBinError = 0;
1272  newBinError = sqrt(oldBinError * oldBinError +
1273  section.lumiDetail.OccLumiErr[1][iBX] * section.lumiDetail.OccLumiErr[1][iBX]);
1274  LumiIntegratedOccSet2->setBinError(iBin, newBinError);
1275  }
1276  }
1277 
1278  // Now fill the maximum hists, but ordered by BX, so that
1279  // collision BX's or satellite BX's will always appear in the
1280  // same histogram.
1281  int flag = 1;
1282  for (int iM = 0; (iM < 4) && flag; ++iM) {
1283  flag = 0;
1284  for (int iN = 0; iN < 3; ++iN) {
1285  if (bxmax[iN + 1] < bxmax[iN]) {
1286  int tmp = bxmax[iN];
1287  bxmax[iN] = bxmax[iN + 1];
1288  bxmax[iN + 1] = tmp;
1289 
1290  double tmp2 = max[iN];
1291  max[iN] = max[iN + 1];
1292  max[iN + 1] = tmp2;
1293  flag = 1;
1294  }
1295  }
1296  }
1297 
1298  // 0.9e1 = Conversion constant for occ1 at 900GeV COM.
1299  MaxInstLumiBX1->Fill(max[0] * 0.9e1);
1300  MaxInstLumiBXNum1->Fill(bxmax[0]);
1301  MaxInstLumiBX2->Fill(max[1] * 0.9e1);
1302  MaxInstLumiBXNum2->Fill(bxmax[1]);
1303  MaxInstLumiBX3->Fill(max[2] * 0.9e1);
1304  MaxInstLumiBXNum3->Fill(bxmax[2]);
1305  MaxInstLumiBX4->Fill(max[3] * 0.9e1);
1306  MaxInstLumiBXNum4->Fill(bxmax[3]);
1307 
1308  TH1F *tmpHist = MaxInstLumiBX1->getTH1F();
1309  double minX = tmpHist->GetBinLowEdge(1);
1310  double maxX = tmpHist->GetBinLowEdge(tmpHist->GetNbinsX() + 1);
1311 
1312  int inum4NibblePerLS = (int)num4NibblePerLS_;
1313  if (lumiSectionCount % inum4NibblePerLS == 0) {
1314  double mean1 = MaxInstLumiBX1->getMean();
1315  double rms1 = MaxInstLumiBX1->getRMS();
1316  if (rms1 > 0 && mean1 - 5 * rms1 > minX && mean1 + 5 * rms1 < maxX)
1317  MaxInstLumiBX1->setAxisRange(mean1 - 5 * rms1, mean1 + 5 * rms1);
1318 
1319  double mean2 = MaxInstLumiBX2->getMean();
1320  double rms2 = MaxInstLumiBX2->getRMS();
1321  if (rms2 > 0 && mean2 - 5 * rms2 > minX && mean2 + 5 * rms2 < maxX)
1322  MaxInstLumiBX2->setAxisRange(mean2 - 5 * rms2, mean2 + 5 * rms2);
1323 
1324  double mean3 = MaxInstLumiBX3->getMean();
1325  double rms3 = MaxInstLumiBX3->getRMS();
1326  if (rms3 > 0 && mean3 - 5 * rms3 > minX && mean3 + 5 * rms3 < maxX)
1327  MaxInstLumiBX3->setAxisRange(mean3 - 5 * rms3, mean3 + 5 * rms3);
1328 
1329  double mean4 = MaxInstLumiBX4->getMean();
1330  double rms4 = MaxInstLumiBX4->getRMS();
1331  if (rms4 > 0 && mean4 - 5 * rms4 > minX && mean4 + 5 * rms4 < maxX)
1332  MaxInstLumiBX4->setAxisRange(mean4 - 5 * rms4, mean4 + 5 * rms4);
1333  }
1334 
1335  // Add one to the section count (usually short sections)
1336  ++lumiSectionCount;
1337 }
1338 
1340  for (unsigned int iHLX = 0; iHLX < NUM_HLX; ++iHLX) {
1341  unsigned int iWedge = HLXHFMap[iHLX];
1342 
1343  if (section.occupancy[iHLX].hdr.numNibbles != 0) {
1344  float nActvTwrsSet1 = section.occupancy[iHLX].data[set1AboveIndex][TriggerBX] +
1345  section.occupancy[iHLX].data[set1BetweenIndex][TriggerBX] +
1346  section.occupancy[iHLX].data[set1BelowIndex][TriggerBX];
1347 
1348  float nActvTwrsSet2 = section.occupancy[iHLX].data[set2AboveIndex][TriggerBX] +
1349  section.occupancy[iHLX].data[set2BetweenIndex][TriggerBX] +
1350  section.occupancy[iHLX].data[set2BelowIndex][TriggerBX];
1351 
1352  float total = nActvTwrsSet1 + nActvTwrsSet2;
1353 
1354  if (total > 0) {
1355  float tempData = section.etSum[iHLX].data[TriggerBX] / total;
1356  // cout << "Filling HFCompare Et sum " << tempData << endl;
1357  HFCompareEtSum->Fill(iWedge, tempData);
1358  }
1359 
1360  if (nActvTwrsSet1 > 0) {
1361  float tempData = (float)section.occupancy[iHLX].data[set1BelowIndex][TriggerBX] / nActvTwrsSet1;
1362  HFCompareOccBelowSet1->Fill(iWedge, tempData);
1363 
1364  tempData = (float)section.occupancy[iHLX].data[set1BetweenIndex][TriggerBX] / nActvTwrsSet1;
1365  HFCompareOccBetweenSet1->Fill(iWedge, tempData);
1366 
1367  tempData = (float)section.occupancy[iHLX].data[set1AboveIndex][TriggerBX] / nActvTwrsSet1;
1368  HFCompareOccAboveSet1->Fill(iWedge, tempData);
1369  }
1370 
1371  if (nActvTwrsSet2 > 0) {
1372  float tempData = (float)section.occupancy[iHLX].data[set2BelowIndex][TriggerBX] / nActvTwrsSet2;
1373  HFCompareOccBelowSet2->Fill(iWedge, tempData);
1374 
1375  tempData = (float)section.occupancy[iHLX].data[set2BetweenIndex][TriggerBX] / nActvTwrsSet2;
1376  HFCompareOccBetweenSet2->Fill(iWedge, tempData);
1377 
1378  tempData = (float)section.occupancy[iHLX].data[set2AboveIndex][TriggerBX] / nActvTwrsSet2;
1379  HFCompareOccAboveSet2->Fill(iWedge, tempData);
1380  }
1381  }
1382  }
1383 }
1384 
1386  // New run .. set the run number and fill run summaries ...
1387  // std::cout << "Run number " << runNumber_ << " Section hdr run number "
1388  // << section.hdr.runNumber << std::endl;
1389 
1390  runId_->Fill(section.hdr.runNumber);
1391  lumisecId_->Fill((int)(section.hdr.sectionNumber / num4NibblePerLS_) + 1);
1392 
1393  // Update the total nibbles & the expected number
1394  expectedNibbles_ += section.hdr.numOrbits / 4096;
1395  for (unsigned int iHLX = 0; iHLX < NUM_HLX; ++iHLX) {
1396  unsigned int iWedge = HLXHFMap[iHLX] + 1;
1397  totalNibbles_[iWedge - 1] += section.occupancy[iHLX].hdr.numNibbles;
1398  }
1399 
1400  eventId_->Fill(e.id().event());
1401  eventTimeStamp_->Fill(e.time().value() / (double)0xffffffff);
1402 
1403  pEvent_++;
1404  evtRateCount_++;
1406 
1408  gettimeofday(&currentTime_, nullptr);
1411 
1413  if (time >= (evtRateWindow_ * 60.0)) {
1415  evtRateCount_ = 0;
1417  }
1418 }
1419 
1421  // Run summary - Loop over the HLX's and fill the map,
1422  // also calculate the overall quality.
1423  float overall = 0.0;
1424  for (unsigned int iHLX = 0; iHLX < NUM_HLX; ++iHLX) {
1425  unsigned int iWedge = HLXHFMap[iHLX] + 1;
1426  unsigned int iEta = 2;
1427  float frac = 0.0;
1428  if (expectedNibbles_ > 0)
1429  frac = (float)totalNibbles_[iWedge - 1] / (float)expectedNibbles_;
1430  if (iWedge >= 19) {
1431  iEta = 1;
1432  iWedge -= 18;
1433  }
1435  overall += frac;
1436  }
1437 
1438  overall /= (float)NUM_HLX;
1439  if (overall > 1.0)
1440  overall = 0.0;
1441  // std::cout << "Filling report summary! Main. " << overall << std::endl;
1442  reportSummary_->Fill(overall);
1443 }
1444 
1445 double HLXMonitor::getUTCtime(timeval *a, timeval *b) {
1446  double deltaT = (*a).tv_sec * 1000.0 + (*a).tv_usec / 1000.0;
1447  if (b != nullptr)
1448  deltaT = (*b).tv_sec * 1000.0 + (*b).tv_usec / 1000.0 - deltaT;
1449  return deltaT / 1000.0;
1450 }
1451 
1452 // 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 * Set2Between[36]
Definition: HLXMonitor.h:79
MonitorElement * processLatency_
The UTC time of the last event.
Definition: HLXMonitor.h:182
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
double getUTCtime(timeval *a, timeval *b=nullptr)
Definition: HLXMonitor.cc:1445
void FillReportSummary()
Definition: HLXMonitor.cc:1420
void SetupHists(DQMStore::IBooker &)
Definition: HLXMonitor.cc:146
unsigned int HLXHFMap[36]
Definition: HLXMonitor.h:255
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:80
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:889
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 * AvgOccBetweenSet2
Definition: HLXMonitor.h:96
int prescaleEvt_
Definition: HLXMonitor.h:223
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
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
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
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
MonitorElement * bookString(TString const &name, TString const &value, FUNC onbooking=NOOP())
Definition: DQMStore.h:87
std::string EtYAxisTitle
Definition: HLXMonitor.h:246
T getUntrackedParameter(std::string const &, T const &) const
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
virtual double getRMS(int axis=1) const
get RMS of histogram along x, y or z axis (axis=1, 2, 3 respectively)
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
MonitorElement * HFCompareEtSum
Definition: HLXMonitor.h:83
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
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:408
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 * 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
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
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
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:837
MonitorElement * HistAvgOccAboveSet2HFM
Definition: HLXMonitor.h:140
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
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
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:221
MonitorElement * MaxInstLumiBX3
Definition: HLXMonitor.h:118
MonitorElement * bookInt(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:73
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:120
MonitorElement * processName_
Hostname of the local machine.
Definition: HLXMonitor.h:187
void FillEventInfo(const LUMI_SECTION &, const edm::Event &e)
Definition: HLXMonitor.cc:1385
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
virtual double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
MonitorElement * MaxInstLumiBXNum1
Definition: HLXMonitor.h:121
MonitorElement * AvgOccBelowSet2
Definition: HLXMonitor.h:95
HLT enums.
HLXMonitor(const edm::ParameterSet &)
Definition: HLXMonitor.cc:17
double num4NibblePerLS_
Definition: HLXMonitor.h:276
double a
Definition: hdecay.h:121
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
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
virtual double getBinError(int binx) const
get uncertainty on content of bin (1-D) - See TH1::GetBinError for details
MonitorElement * HFCompareOccBetweenSet1
Definition: HLXMonitor.h:85
void FillHistograms(const LUMI_SECTION &)
Definition: HLXMonitor.cc:912
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 * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
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
MonitorElement * reportSummary_
Definition: HLXMonitor.h:196
MonitorElement * HistAvgOccBetweenSet2HFP
Definition: HLXMonitor.h:137
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:759
Definition: Run.h:45
unsigned int set1BetweenIndex
Definition: HLXMonitor.h:230
virtual double getBinContent(int binx) const
get content of bin (1-D)
void FillHistoHFCompare(const LUMI_SECTION &)
Definition: HLXMonitor.cc:1339
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)