File indexing completed on 2023-10-25 09:42:26
0001
0002
0003
0004
0005 #include "DQM/HLXMonitor/interface/HLXMonitor.h"
0006 #include "FWCore/Version/interface/GetReleaseVersion.h"
0007
0008
0009
0010 #include <TSystem.h>
0011 #include <cmath>
0012 #include <iomanip>
0013
0014 using std::cout;
0015 using std::endl;
0016
0017 HLXMonitor::HLXMonitor(const edm::ParameterSet &iConfig) {
0018 NUM_HLX = iConfig.getUntrackedParameter<unsigned int>("numHlx", 36);
0019 NUM_BUNCHES = iConfig.getUntrackedParameter<unsigned int>("numBunches", 3564);
0020 MAX_LS = iConfig.getUntrackedParameter<unsigned int>("maximumNumLS", 480);
0021 listenPort = iConfig.getUntrackedParameter<unsigned int>("SourcePort", 51001);
0022 OutputFilePrefix = iConfig.getUntrackedParameter<std::string>("outputFile", "lumi");
0023 OutputDir = iConfig.getUntrackedParameter<std::string>("outputDir", " data");
0024 SavePeriod = iConfig.getUntrackedParameter<unsigned int>("SavePeriod", 10);
0025 NBINS = iConfig.getUntrackedParameter<unsigned int>("NBINS",
0026 297);
0027 XMIN = iConfig.getUntrackedParameter<double>("XMIN", 0);
0028 XMAX = iConfig.getUntrackedParameter<double>("XMAX", 3564);
0029 Style = iConfig.getUntrackedParameter<std::string>("Style", "BX");
0030 AquireMode = iConfig.getUntrackedParameter<unsigned int>("AquireMode", 0);
0031 Accumulate = iConfig.getUntrackedParameter<bool>("Accumulate", true);
0032 TriggerBX = iConfig.getUntrackedParameter<unsigned int>("TriggerBX", 50);
0033 MinLSBeforeSave = iConfig.getUntrackedParameter<unsigned int>("MinLSBeforeSave", 1);
0034 reconnTime = iConfig.getUntrackedParameter<unsigned int>("ReconnectionTime", 5);
0035 DistribIP1 = iConfig.getUntrackedParameter<std::string>("PrimaryHLXDAQIP", "vmepcs2f17-18");
0036 DistribIP2 = iConfig.getUntrackedParameter<std::string>("SecondaryHLXDAQIP", "vmepcs2f17-19");
0037
0038 eventInfoFolderHLX_ = iConfig.getUntrackedParameter<std::string>("eventInfoFolderHLX", "EventInfoHLX");
0039 eventInfoFolder_ = iConfig.getUntrackedParameter<std::string>("eventInfoFolder", "EventInfo");
0040 subSystemName_ = iConfig.getUntrackedParameter<std::string>("subSystemName", "HLX");
0041
0042
0043 lsBinOld = 0;
0044 previousSection = 0;
0045 lumiSectionCount = 0;
0046 sectionInstantSumEt = 0;
0047 sectionInstantErrSumEt = 0;
0048 sectionInstantSumOcc1 = 0;
0049 sectionInstantErrSumOcc1 = 0;
0050 sectionInstantSumOcc2 = 0;
0051 sectionInstantErrSumOcc2 = 0;
0052 sectionInstantNorm = 0;
0053
0054
0055 set1BelowIndex = 0;
0056 set1BetweenIndex = 1;
0057 set1AboveIndex = 2;
0058 set2BelowIndex = 3;
0059 set2BetweenIndex = 4;
0060 set2AboveIndex = 5;
0061
0062 runNumLength = 9;
0063 secNumLength = 8;
0064
0065 if (NUM_HLX > 36)
0066 NUM_HLX = 36;
0067
0068 if (NUM_BUNCHES > 3564)
0069 NUM_BUNCHES = 3564;
0070
0071 if (XMAX <= XMIN) {
0072 XMIN = 0;
0073 if (XMAX <= 0)
0074 XMAX = 3564;
0075 }
0076
0077 if ((Style == "History") || (NBINS == 0)) {
0078 NBINS = (unsigned int)(XMAX - XMIN);
0079 }
0080
0081 monitorName_ = iConfig.getUntrackedParameter<std::string>("monitorName", "HLX");
0082
0083 prescaleEvt_ = iConfig.getUntrackedParameter<int>("prescaleEvt", -1);
0084
0085
0086 unsigned int HLXHFMapTemp[] = {31, 32, 33, 34, 35, 18,
0087 13, 14, 15, 16, 17, 0,
0088 25, 26, 27, 28, 29, 30,
0089 7, 8, 9, 10, 11, 12,
0090 19, 20, 21, 22, 23, 24,
0091 1, 2, 3, 4, 5, 6};
0092
0093 currentRunEnded_ = true;
0094 runNumber_ = 0;
0095 expectedNibbles_ = 0;
0096
0097 for (int iHLX = 0; iHLX < 36; ++iHLX) {
0098 HLXHFMap[iHLX] = HLXHFMapTemp[iHLX];
0099
0100 totalNibbles_[iHLX] = 0;
0101 }
0102
0103 num4NibblePerLS_ = 16.0;
0104
0105 connectHLXTCP();
0106 }
0107
0108 HLXMonitor::~HLXMonitor() {
0109 HLXTCP.Disconnect();
0110 EndRun();
0111 }
0112
0113
0114 void HLXMonitor::connectHLXTCP() {
0115 HLXTCP.SetIP(DistribIP1);
0116 int errorCode = HLXTCP.SetPort(listenPort);
0117 cout << "SetPort: " << listenPort << " Success: " << errorCode << endl;
0118 errorCode = HLXTCP.SetMode(AquireMode);
0119 cout << "AquireMode: " << AquireMode << " Success: " << errorCode << endl;
0120
0121 while (HLXTCP.IsConnected() == false) {
0122 HLXTCP.SetIP(DistribIP1);
0123 if (HLXTCP.Connect() != 1) {
0124 std::cout << "Failed to connect to " << DistribIP1 << "." << std::endl;
0125 sleep(1);
0126 std::cout << "Trying " << DistribIP2 << std::endl;
0127 HLXTCP.SetIP(DistribIP2);
0128 if (HLXTCP.Connect() == 1)
0129 break;
0130 std::cout << "Failed to connect to " << DistribIP2 << "." << std::endl;
0131 std::cout << " Reconnect in " << reconnTime << " seconds." << std::endl;
0132 sleep(reconnTime);
0133 }
0134 }
0135 if (HLXTCP.IsConnected() == true) {
0136 std::cout << "Successfully connected." << std::endl;
0137 }
0138 }
0139
0140
0141 void HLXMonitor::bookHistograms(DQMStore::IBooker &iBooker, edm::Run const &, edm::EventSetup const &) {
0142 SetupHists(iBooker);
0143 SetupEventInfo(iBooker);
0144 }
0145
0146 void HLXMonitor::SetupHists(DQMStore::IBooker &iBooker) {
0147 iBooker.setCurrentFolder(monitorName_ + "/HFPlus");
0148
0149 for (unsigned int iWedge = 0; iWedge < 18 && iWedge < NUM_HLX; ++iWedge) {
0150 std::ostringstream tempStreamer;
0151 tempStreamer << std::dec << std::setw(2) << std::setfill('0') << (iWedge + 1);
0152
0153 std::ostringstream wedgeNum;
0154 wedgeNum << std::dec << (iWedge % 18) + 1;
0155
0156 iBooker.setCurrentFolder(monitorName_ + "/HFPlus/Wedge" + tempStreamer.str());
0157
0158 Set1Below[iWedge] =
0159 iBooker.book1D("Set1_Below", "HF+ Wedge " + wedgeNum.str() + ": Below Threshold 1 - Set 1", NBINS, XMIN, XMAX);
0160 Set1Between[iWedge] = iBooker.book1D(
0161 "Set1_Between", "HF+ Wedge " + wedgeNum.str() + ": Between Threshold 1 & 2 - Set 1", NBINS, XMIN, XMAX);
0162 Set1Above[iWedge] =
0163 iBooker.book1D("Set1_Above", "HF+ Wedge " + wedgeNum.str() + ": Above Threshold 2 - Set 1", NBINS, XMIN, XMAX);
0164 Set2Below[iWedge] =
0165 iBooker.book1D("Set2_Below", "HF+ Wedge " + wedgeNum.str() + ": Below Threshold 1 - Set 2", NBINS, XMIN, XMAX);
0166 Set2Between[iWedge] = iBooker.book1D(
0167 "Set2_Between", "HF+ Wedge " + wedgeNum.str() + ": Between Threshold 1 & 2 - Set 2", NBINS, XMIN, XMAX);
0168 Set2Above[iWedge] =
0169 iBooker.book1D("Set2_Above", "HF+ Wedge " + wedgeNum.str() + ": Above Threshold 2 - Set 2", NBINS, XMIN, XMAX);
0170 ETSum[iWedge] = iBooker.book1D("ETSum", "HF+ Wedge " + wedgeNum.str() + ": Transverse Energy", NBINS, XMIN, XMAX);
0171 }
0172
0173 if (NUM_HLX > 17) {
0174 iBooker.setCurrentFolder(monitorName_ + "/HFMinus");
0175
0176 for (unsigned int iWedge = 18; iWedge < NUM_HLX; ++iWedge) {
0177 std::ostringstream tempStreamer;
0178 tempStreamer << std::dec << std::setw(2) << std::setfill('0') << (iWedge + 1);
0179
0180 std::ostringstream wedgeNum;
0181 wedgeNum << std::dec << (iWedge % 18) + 1;
0182
0183 iBooker.setCurrentFolder(monitorName_ + "/HFMinus/Wedge" + tempStreamer.str());
0184 Set1Below[iWedge] = iBooker.book1D(
0185 "Set1_Below", "HF- Wedge " + wedgeNum.str() + ": Below Threshold 1 - Set 1", NBINS, XMIN, XMAX);
0186 Set1Between[iWedge] = iBooker.book1D(
0187 "Set1_Between", "HF- Wedge " + wedgeNum.str() + ": Between Threshold 1 & 2 - Set 1", NBINS, XMIN, XMAX);
0188 Set1Above[iWedge] = iBooker.book1D(
0189 "Set1_Above", "HF- Wedge " + wedgeNum.str() + ": Above Threshold 2 - Set 1", NBINS, XMIN, XMAX);
0190 Set2Below[iWedge] = iBooker.book1D(
0191 "Set2_Below", "HF- Wedge " + wedgeNum.str() + ": Below Threshold 1 - Set 2", NBINS, XMIN, XMAX);
0192 Set2Between[iWedge] = iBooker.book1D(
0193 "Set2_Between", "HF- Wedge " + wedgeNum.str() + ": Between Threshold 1 & 2 - Set 2", NBINS, XMIN, XMAX);
0194 Set2Above[iWedge] = iBooker.book1D(
0195 "Set2_Above", "HF- Wedge " + wedgeNum.str() + ": Above Threshold 2 - Set 2", NBINS, XMIN, XMAX);
0196 ETSum[iWedge] = iBooker.book1D("ETSum", "HF- Wedge " + wedgeNum.str() + ": Transverse Energy", NBINS, XMIN, XMAX);
0197 }
0198 }
0199
0200 if (Style == "BX") {
0201 OccXAxisTitle = "Bunch Crossing";
0202 OccYAxisTitle = "Tower Occupancy";
0203 EtXAxisTitle = "Bunch Crossing";
0204 EtYAxisTitle = "E_{T} Sum";
0205 } else if (Style == "Distribution") {
0206 OccXAxisTitle = "Tower Occupancy";
0207 OccYAxisTitle = "Count";
0208 EtXAxisTitle = "E_{T} Sum";
0209 EtYAxisTitle = "Count";
0210 }
0211
0212 for (unsigned int iWedge = 0; iWedge < NUM_HLX; ++iWedge) {
0213 Set1Below[iWedge]->setAxisTitle(OccXAxisTitle, 1);
0214 Set1Below[iWedge]->setAxisTitle(OccYAxisTitle, 2);
0215 Set1Between[iWedge]->setAxisTitle(OccXAxisTitle, 1);
0216 Set1Between[iWedge]->setAxisTitle(OccYAxisTitle, 2);
0217 Set1Above[iWedge]->setAxisTitle(OccXAxisTitle, 1);
0218 Set1Above[iWedge]->setAxisTitle(OccYAxisTitle, 2);
0219 Set2Below[iWedge]->setAxisTitle(OccXAxisTitle, 1);
0220 Set2Below[iWedge]->setAxisTitle(OccYAxisTitle, 2);
0221 Set2Between[iWedge]->setAxisTitle(OccXAxisTitle, 1);
0222 Set2Between[iWedge]->setAxisTitle(OccYAxisTitle, 2);
0223 Set2Above[iWedge]->setAxisTitle(OccXAxisTitle, 1);
0224 Set2Above[iWedge]->setAxisTitle(OccYAxisTitle, 2);
0225 ETSum[iWedge]->setAxisTitle(EtXAxisTitle, 1);
0226 ETSum[iWedge]->setAxisTitle(EtYAxisTitle, 2);
0227 }
0228
0229
0230
0231 iBooker.setCurrentFolder(monitorName_ + "/HFCompare");
0232
0233 std::string CompXTitle = "HF Wedge";
0234 std::string CompEtSumYTitle = "E_{T} Sum per active tower";
0235 std::string CompOccYTitle = "Occupancy per active tower";
0236
0237 HFCompareEtSum = iBooker.book1D("HFCompareEtSum", "E_{T} Sum", NUM_HLX, 0, NUM_HLX);
0238 HFCompareEtSum->setAxisTitle(CompXTitle, 1);
0239 HFCompareEtSum->setAxisTitle(CompEtSumYTitle, 2);
0240
0241 HFCompareOccBelowSet1 =
0242 iBooker.book1D("HFCompareOccBelowSet1", "Occupancy Below Threshold 1 - Set 1", NUM_HLX, 0, NUM_HLX);
0243 HFCompareOccBelowSet1->setAxisTitle(CompXTitle, 1);
0244 HFCompareOccBelowSet1->setAxisTitle(CompOccYTitle, 2);
0245
0246 HFCompareOccBetweenSet1 =
0247 iBooker.book1D("HFCompareOccBetweenSet1", "Occupancy Between Threshold 1 & 2 - Set 1", NUM_HLX, 0, NUM_HLX);
0248 HFCompareOccBetweenSet1->setAxisTitle(CompXTitle, 1);
0249 HFCompareOccBetweenSet1->setAxisTitle(CompOccYTitle, 2);
0250
0251 HFCompareOccAboveSet1 =
0252 iBooker.book1D("HFCompareOccAboveSet1", "Occupancy Above Threshold 2 - Set 1", NUM_HLX, 0, NUM_HLX);
0253 HFCompareOccAboveSet1->setAxisTitle(CompXTitle, 1);
0254 HFCompareOccAboveSet1->setAxisTitle(CompOccYTitle, 2);
0255
0256 HFCompareOccBelowSet2 =
0257 iBooker.book1D("HFCompareOccBelowSet2", "Occupancy Below Threshold 1 - Set 2", NUM_HLX, 0, NUM_HLX);
0258 HFCompareOccBelowSet2->setAxisTitle(CompXTitle, 1);
0259 HFCompareOccBelowSet2->setAxisTitle(CompOccYTitle, 2);
0260
0261 HFCompareOccBetweenSet2 =
0262 iBooker.book1D("HFCompareOccBetweenSet2", "Occupancy Between Threshold 1 & 2 - Set 2", NUM_HLX, 0, NUM_HLX);
0263 HFCompareOccBetweenSet2->setAxisTitle(CompXTitle, 1);
0264 HFCompareOccBetweenSet2->setAxisTitle(CompOccYTitle, 2);
0265
0266 HFCompareOccAboveSet2 =
0267 iBooker.book1D("HFCompareOccAboveSet2", "Occupancy Above Threshold 2 - Set 2", NUM_HLX, 0, NUM_HLX);
0268 HFCompareOccAboveSet2->setAxisTitle(CompXTitle, 1);
0269 HFCompareOccAboveSet2->setAxisTitle(CompOccYTitle, 2);
0270
0271
0272
0273 iBooker.setCurrentFolder(monitorName_ + "/Average");
0274
0275 int OccBins = 10000;
0276 double OccMin = 0;
0277 double OccMax = 0;
0278
0279 int EtSumBins = 10000;
0280
0281 double EtSumMin = 0;
0282 double EtSumMax = 0;
0283
0284 std::string errorOpt = "i";
0285
0286 std::string AvgXTitle = "HF Wedge";
0287 std::string AvgEtSumYTitle = "Average E_{T} Sum";
0288 std::string AvgOccYTitle = "Average Tower Occupancy";
0289
0290 AvgEtSum = iBooker.bookProfile("AvgEtSum", "Average E_{T} Sum", NUM_HLX, 0, NUM_HLX, EtSumBins, EtSumMin, EtSumMax);
0291 AvgEtSum->setAxisTitle(AvgXTitle, 1);
0292 AvgEtSum->setAxisTitle(AvgEtSumYTitle, 2);
0293
0294 AvgOccBelowSet1 = iBooker.bookProfile("AvgOccBelowSet1",
0295 "Average Occupancy Below Threshold 1 - Set1",
0296 NUM_HLX,
0297 0,
0298 NUM_HLX,
0299 OccBins,
0300 OccMin,
0301 OccMax,
0302 errorOpt.c_str());
0303 AvgOccBelowSet1->setAxisTitle(AvgXTitle, 1);
0304 AvgOccBelowSet1->setAxisTitle(AvgOccYTitle, 2);
0305
0306 AvgOccBetweenSet1 = iBooker.bookProfile("AvgOccBetweenSet1",
0307 "Average Occupancy Between Threhold 1 & 2 - Set1",
0308 NUM_HLX,
0309 0,
0310 NUM_HLX,
0311 OccBins,
0312 OccMin,
0313 OccMax,
0314 errorOpt.c_str());
0315 AvgOccBetweenSet1->setAxisTitle(AvgXTitle, 1);
0316 AvgOccBetweenSet1->setAxisTitle(AvgOccYTitle, 2);
0317
0318 AvgOccAboveSet1 = iBooker.bookProfile("AvgOccAboveSet1",
0319 "Average Occupancy Above Threshold 2 - Set1",
0320 NUM_HLX,
0321 0,
0322 NUM_HLX,
0323 OccBins,
0324 OccMin,
0325 OccMax,
0326 errorOpt.c_str());
0327 AvgOccAboveSet1->setAxisTitle(AvgXTitle, 1);
0328 AvgOccAboveSet1->setAxisTitle(AvgOccYTitle, 2);
0329
0330 AvgOccBelowSet2 = iBooker.bookProfile("AvgOccBelowSet2",
0331 "Average Occupancy Below Threshold 1 - Set2",
0332 NUM_HLX,
0333 0,
0334 NUM_HLX,
0335 OccBins,
0336 OccMin,
0337 OccMax,
0338 errorOpt.c_str());
0339 AvgOccBelowSet2->setAxisTitle(AvgXTitle, 1);
0340 AvgOccBelowSet2->setAxisTitle(AvgOccYTitle, 2);
0341
0342 AvgOccBetweenSet2 = iBooker.bookProfile("AvgOccBetweenSet2",
0343 "Average Occupancy Between Threshold 1 & 2 - Set2",
0344 NUM_HLX,
0345 0,
0346 NUM_HLX,
0347 OccBins,
0348 OccMin,
0349 OccMax,
0350 errorOpt.c_str());
0351 AvgOccBetweenSet2->setAxisTitle(AvgXTitle, 1);
0352 AvgOccBetweenSet2->setAxisTitle(AvgOccYTitle, 2);
0353
0354 AvgOccAboveSet2 = iBooker.bookProfile("AvgOccAboveSet2",
0355 "Average Occupancy Above Threshold 2 - Set2",
0356 NUM_HLX,
0357 0,
0358 NUM_HLX,
0359 OccBins,
0360 OccMin,
0361 OccMax,
0362 errorOpt.c_str());
0363 AvgOccAboveSet2->setAxisTitle(AvgXTitle, 1);
0364 AvgOccAboveSet2->setAxisTitle(AvgOccYTitle, 2);
0365
0366
0367 iBooker.setCurrentFolder(monitorName_ + "/Luminosity");
0368
0369 std::string LumiXTitle = "Bunch Crossing";
0370 std::string LumiEtSumYTitle = "Luminosity: E_{T} Sum";
0371 std::string LumiOccYTitle = "Luminosity: Occupancy";
0372
0373 LumiAvgEtSum = iBooker.bookProfile(
0374 "LumiAvgEtSum", "Average Luminosity ", int(XMAX - XMIN), XMIN, XMAX, EtSumBins, EtSumMin, EtSumMax);
0375 LumiAvgEtSum->setAxisTitle(LumiXTitle, 1);
0376 LumiAvgEtSum->setAxisTitle(LumiEtSumYTitle, 2);
0377
0378 LumiAvgOccSet1 = iBooker.bookProfile(
0379 "LumiAvgOccSet1", "Average Luminosity - Set 1", int(XMAX - XMIN), XMIN, XMAX, OccBins, OccMax, OccMin);
0380 LumiAvgOccSet1->setAxisTitle(LumiXTitle, 1);
0381 LumiAvgOccSet1->setAxisTitle(LumiOccYTitle, 2);
0382
0383 LumiAvgOccSet2 = iBooker.bookProfile(
0384 "LumiAvgOccSet2", "Average Luminosity - Set 2", int(XMAX - XMIN), XMIN, XMAX, OccBins, OccMax, OccMin);
0385 LumiAvgOccSet2->setAxisTitle(LumiXTitle, 1);
0386 LumiAvgOccSet2->setAxisTitle(LumiOccYTitle, 2);
0387
0388 LumiInstantEtSum = iBooker.book1D("LumiInstantEtSum", "Instantaneous Luminosity ", int(XMAX - XMIN), XMIN, XMAX);
0389 LumiInstantEtSum->setAxisTitle(LumiXTitle, 1);
0390 LumiInstantEtSum->setAxisTitle(LumiEtSumYTitle, 2);
0391
0392 LumiInstantOccSet1 =
0393 iBooker.book1D("LumiInstantOccSet1", "Instantaneous Luminosity - Set 1", int(XMAX - XMIN), XMIN, XMAX);
0394 LumiInstantOccSet1->setAxisTitle(LumiXTitle, 1);
0395 LumiInstantOccSet1->setAxisTitle(LumiOccYTitle, 2);
0396
0397 LumiInstantOccSet2 =
0398 iBooker.book1D("LumiInstantOccSet2", "Instantaneous Luminosity - Set 2", int(XMAX - XMIN), XMIN, XMAX);
0399 LumiInstantOccSet2->setAxisTitle(LumiXTitle, 1);
0400 LumiInstantOccSet2->setAxisTitle(LumiOccYTitle, 2);
0401
0402 LumiIntegratedEtSum = iBooker.book1D("LumiIntegratedEtSum", "Integrated Luminosity ", int(XMAX - XMIN), XMIN, XMAX);
0403 LumiIntegratedEtSum->setAxisTitle(LumiXTitle, 1);
0404 LumiIntegratedEtSum->setAxisTitle(LumiEtSumYTitle, 2);
0405
0406 LumiIntegratedOccSet1 =
0407 iBooker.book1D("LumiIntegratedOccSet1", "Integrated Luminosity - Set 1", int(XMAX - XMIN), XMIN, XMAX);
0408 LumiIntegratedOccSet1->setAxisTitle(LumiXTitle, 1);
0409 LumiIntegratedOccSet1->setAxisTitle(LumiOccYTitle, 2);
0410
0411 LumiIntegratedOccSet2 =
0412 iBooker.book1D("LumiIntegratedOccSet2", "Integrated Luminosity - Set 2", int(XMAX - XMIN), XMIN, XMAX);
0413 LumiIntegratedOccSet2->setAxisTitle(LumiXTitle, 1);
0414 LumiIntegratedOccSet2->setAxisTitle(LumiOccYTitle, 2);
0415
0416
0417 iBooker.setCurrentFolder(monitorName_ + "/CheckSums");
0418
0419 std::string sumXTitle = "HF Wedge";
0420 std::string sumYTitle = "Occupancy Sum (Below+Above+Between)";
0421
0422 SumAllOccSet1 =
0423 iBooker.bookProfile("SumAllOccSet1", "Occupancy Check - Set 1", NUM_HLX, 0, NUM_HLX, OccBins, OccMax, OccMin);
0424 SumAllOccSet1->setAxisTitle(sumXTitle, 1);
0425 SumAllOccSet1->setAxisTitle(sumYTitle, 2);
0426
0427 SumAllOccSet2 =
0428 iBooker.bookProfile("SumAllOccSet2", "Occupancy Check - Set 2", NUM_HLX, 0, NUM_HLX, OccBins, OccMax, OccMin);
0429 SumAllOccSet2->setAxisTitle(sumXTitle, 1);
0430 SumAllOccSet2->setAxisTitle(sumYTitle, 2);
0431
0432 MissingDQMDataCheck = iBooker.book1D("MissingDQMDataCheck", "Missing Data Count", 1, 0, 1);
0433 MissingDQMDataCheck->setAxisTitle("", 1);
0434 MissingDQMDataCheck->setAxisTitle("Number Missing Nibbles", 2);
0435
0436
0437 iBooker.setCurrentFolder(monitorName_ + "/SigBkgLevels");
0438
0439 MaxInstLumiBX1 = iBooker.book1D("MaxInstLumiBX1", "Max Instantaneous Luminosity BX: 1st", 10000, -1e-5, 0.01);
0440 MaxInstLumiBX1->setAxisTitle("Max Inst. L (10^{30}cm^{-2}s^{-1})", 1);
0441 MaxInstLumiBX1->setAxisTitle("Entries", 2);
0442 MaxInstLumiBX2 = iBooker.book1D("MaxInstLumiBX2", "Max Instantaneous Luminosity BX: 2nd", 10000, -1e-5, 0.01);
0443 MaxInstLumiBX2->setAxisTitle("Max Inst. L (10^{30}cm^{-2}s^{-1})", 1);
0444 MaxInstLumiBX2->setAxisTitle("Entries", 2);
0445 MaxInstLumiBX3 = iBooker.book1D("MaxInstLumiBX3", "Max Instantaneous Luminosity BX: 3rd", 10000, -1e-5, 0.01);
0446 MaxInstLumiBX3->setAxisTitle("Max Inst. L (10^{30}cm^{-2}s^{-1})", 1);
0447 MaxInstLumiBX3->setAxisTitle("Entries", 2);
0448 MaxInstLumiBX4 = iBooker.book1D("MaxInstLumiBX4", "Max Instantaneous Luminosity BX: 4th", 10000, -1e-5, 0.01);
0449 MaxInstLumiBX4->setAxisTitle("Max Inst. L (10^{30}cm^{-2}s^{-1})", 1);
0450 MaxInstLumiBX4->setAxisTitle("Entries", 2);
0451
0452 MaxInstLumiBXNum1 = iBooker.book1D("MaxInstLumiBXNum1", "BX Number of Max: 1st", 3564, 0, 3564);
0453 MaxInstLumiBXNum1->setAxisTitle("BX", 1);
0454 MaxInstLumiBXNum1->setAxisTitle("Num Time Max", 2);
0455 MaxInstLumiBXNum2 = iBooker.book1D("MaxInstLumiBXNum2", "BX Number of Max: 2nd", 3564, 0, 3564);
0456 MaxInstLumiBXNum2->setAxisTitle("BX", 1);
0457 MaxInstLumiBXNum2->setAxisTitle("Num Time Max", 2);
0458 MaxInstLumiBXNum3 = iBooker.book1D("MaxInstLumiBXNum3", "BX Number of Max: 3rd", 3564, 0, 3564);
0459 MaxInstLumiBXNum3->setAxisTitle("BX", 1);
0460 MaxInstLumiBXNum3->setAxisTitle("Num Time Max", 2);
0461 MaxInstLumiBXNum4 = iBooker.book1D("MaxInstLumiBXNum4", "BX Number of Max: 4th", 3564, 0, 3564);
0462 MaxInstLumiBXNum4->setAxisTitle("BX", 1);
0463 MaxInstLumiBXNum4->setAxisTitle("Num Time Max", 2);
0464
0465
0466 iBooker.setCurrentFolder(monitorName_ + "/HistoryRaw");
0467
0468 std::string HistXTitle = "Time (LS)";
0469 std::string RecentHistXTitle = "Time (LS/16)";
0470 std::string HistEtSumYTitle = "Average E_{T} Sum";
0471 std::string HistOccYTitle = "Average Occupancy";
0472 std::string HistLumiYTitle = "Luminosity";
0473 std::string HistLumiErrorYTitle = "Luminosity Error (%)";
0474 std::string BXvsTimeXTitle = "Time (LS)";
0475 std::string BXvsTimeYTitle = "BX";
0476
0477
0478 HistAvgEtSumHFP = iBooker.bookProfile(
0479 "HistAvgEtSumHFP", "Average Et Sum: HF+", MAX_LS, 0.5, (double)MAX_LS + 0.5, EtSumBins, EtSumMin, EtSumMax);
0480 HistAvgEtSumHFP->setAxisTitle(HistXTitle, 1);
0481 HistAvgEtSumHFP->setAxisTitle(HistEtSumYTitle, 2);
0482
0483 HistAvgEtSumHFM = iBooker.bookProfile(
0484 "HistAvgEtSumHFM", "Average Et Sum: HF-", MAX_LS, 0.5, (double)MAX_LS + 0.5, EtSumBins, EtSumMin, EtSumMax);
0485 HistAvgEtSumHFM->setAxisTitle(HistXTitle, 1);
0486 HistAvgEtSumHFM->setAxisTitle(HistEtSumYTitle, 2);
0487
0488
0489 HistAvgOccBelowSet1HFP = iBooker.bookProfile("HistAvgOccBelowSet1HFP",
0490 "Average Occ Set1Below: HF+",
0491 MAX_LS,
0492 0.5,
0493 (double)MAX_LS + 0.5,
0494 OccBins,
0495 OccMin,
0496 OccMax);
0497 HistAvgOccBelowSet1HFP->setAxisTitle(HistXTitle, 1);
0498 HistAvgOccBelowSet1HFP->setAxisTitle(HistOccYTitle, 2);
0499
0500 HistAvgOccBelowSet1HFM = iBooker.bookProfile("HistAvgOccBelowSet1HFM",
0501 "Average Occ Set1Below: HF-",
0502 MAX_LS,
0503 0.5,
0504 (double)MAX_LS + 0.5,
0505 OccBins,
0506 OccMin,
0507 OccMax);
0508 HistAvgOccBelowSet1HFM->setAxisTitle(HistXTitle, 1);
0509 HistAvgOccBelowSet1HFM->setAxisTitle(HistOccYTitle, 2);
0510
0511 HistAvgOccBetweenSet1HFP = iBooker.bookProfile("HistAvgOccBetweenSet1HFP",
0512 "Average Occ Set1Between: HF+",
0513 MAX_LS,
0514 0.5,
0515 (double)MAX_LS + 0.5,
0516 OccBins,
0517 OccMin,
0518 OccMax);
0519 HistAvgOccBetweenSet1HFP->setAxisTitle(HistXTitle, 1);
0520 HistAvgOccBetweenSet1HFP->setAxisTitle(HistOccYTitle, 2);
0521
0522 HistAvgOccBetweenSet1HFM = iBooker.bookProfile("HistAvgOccBetweenSet1HFM",
0523 "Average Occ Set1Between: HF-",
0524 MAX_LS,
0525 0.5,
0526 (double)MAX_LS + 0.5,
0527 OccBins,
0528 OccMin,
0529 OccMax);
0530 HistAvgOccBetweenSet1HFM->setAxisTitle(HistXTitle, 1);
0531 HistAvgOccBetweenSet1HFM->setAxisTitle(HistOccYTitle, 2);
0532
0533 HistAvgOccAboveSet1HFP = iBooker.bookProfile("HistAvgOccAboveSet1HFP",
0534 "Average Occ Set1Above: HF+",
0535 MAX_LS,
0536 0.5,
0537 (double)MAX_LS + 0.5,
0538 OccBins,
0539 OccMin,
0540 OccMax);
0541 HistAvgOccAboveSet1HFP->setAxisTitle(HistXTitle, 1);
0542 HistAvgOccAboveSet1HFP->setAxisTitle(HistOccYTitle, 2);
0543
0544 HistAvgOccAboveSet1HFM = iBooker.bookProfile("HistAvgOccAboveSet1HFM",
0545 "Average Occ Set1Above: HF-",
0546 MAX_LS,
0547 0.5,
0548 (double)MAX_LS + 0.5,
0549 OccBins,
0550 OccMin,
0551 OccMax);
0552 HistAvgOccAboveSet1HFM->setAxisTitle(HistXTitle, 1);
0553 HistAvgOccAboveSet1HFM->setAxisTitle(HistOccYTitle, 2);
0554
0555 HistAvgOccBelowSet2HFP = iBooker.bookProfile("HistAvgOccBelowSet2HFP",
0556 "Average Occ Set2Below: HF+",
0557 MAX_LS,
0558 0.5,
0559 (double)MAX_LS + 0.5,
0560 OccBins,
0561 OccMin,
0562 OccMax);
0563 HistAvgOccBelowSet2HFP->setAxisTitle(HistXTitle, 1);
0564 HistAvgOccBelowSet2HFP->setAxisTitle(HistOccYTitle, 2);
0565
0566 HistAvgOccBelowSet2HFM = iBooker.bookProfile("HistAvgOccBelowSet2HFM",
0567 "Average Occ Set2Below: HF-",
0568 MAX_LS,
0569 0.5,
0570 (double)MAX_LS + 0.5,
0571 OccBins,
0572 OccMin,
0573 OccMax);
0574 HistAvgOccBelowSet2HFM->setAxisTitle(HistXTitle, 1);
0575 HistAvgOccBelowSet2HFM->setAxisTitle(HistOccYTitle, 2);
0576
0577 HistAvgOccBetweenSet2HFP = iBooker.bookProfile("HistAvgOccBetweenSet2HFP",
0578 "Average Occ Set2Between: HF+",
0579 MAX_LS,
0580 0.5,
0581 (double)MAX_LS + 0.5,
0582 OccBins,
0583 OccMin,
0584 OccMax);
0585 HistAvgOccBetweenSet2HFP->setAxisTitle(HistXTitle, 1);
0586 HistAvgOccBetweenSet2HFP->setAxisTitle(HistOccYTitle, 2);
0587
0588 HistAvgOccBetweenSet2HFM = iBooker.bookProfile("HistAvgOccBetweenSet2HFM",
0589 "Average Occ Set2Between: HF-",
0590 MAX_LS,
0591 0.5,
0592 (double)MAX_LS + 0.5,
0593 OccBins,
0594 OccMin,
0595 OccMax);
0596 HistAvgOccBetweenSet2HFM->setAxisTitle(HistXTitle, 1);
0597 HistAvgOccBetweenSet2HFM->setAxisTitle(HistOccYTitle, 2);
0598
0599 HistAvgOccAboveSet2HFP = iBooker.bookProfile("HistAvgOccAboveSet2HFP",
0600 "Average Occ Set2Above: HF+",
0601 MAX_LS,
0602 0.5,
0603 (double)MAX_LS + 0.5,
0604 OccBins,
0605 OccMin,
0606 OccMax);
0607 HistAvgOccAboveSet2HFP->setAxisTitle(HistXTitle, 1);
0608 HistAvgOccAboveSet2HFP->setAxisTitle(HistOccYTitle, 2);
0609
0610 HistAvgOccAboveSet2HFM = iBooker.bookProfile("HistAvgOccAboveSet2HFM",
0611 "Average Occ Set2Above: HF-",
0612 MAX_LS,
0613 0.5,
0614 (double)MAX_LS + 0.5,
0615 OccBins,
0616 OccMin,
0617 OccMax);
0618 HistAvgOccAboveSet2HFM->setAxisTitle(HistXTitle, 1);
0619 HistAvgOccAboveSet2HFM->setAxisTitle(HistOccYTitle, 2);
0620
0621
0622 BXvsTimeAvgEtSumHFP = iBooker.book2D("BXvsTimeAvgEtSumHFP",
0623 "Average Et Sum: HF+",
0624 MAX_LS,
0625 0.5,
0626 (double)MAX_LS + 0.5,
0627 NBINS,
0628 (double)XMIN,
0629 (double)XMAX);
0630 BXvsTimeAvgEtSumHFP->setAxisTitle(BXvsTimeXTitle, 1);
0631 BXvsTimeAvgEtSumHFP->setAxisTitle(BXvsTimeYTitle, 2);
0632
0633 BXvsTimeAvgEtSumHFM = iBooker.book2D("BXvsTimeAvgEtSumHFM",
0634 "Average Et Sum: HF-",
0635 MAX_LS,
0636 0.5,
0637 (double)MAX_LS + 0.5,
0638 NBINS,
0639 (double)XMIN,
0640 (double)XMAX);
0641 BXvsTimeAvgEtSumHFM->setAxisTitle(BXvsTimeXTitle, 1);
0642 BXvsTimeAvgEtSumHFM->setAxisTitle(BXvsTimeYTitle, 2);
0643
0644 iBooker.setCurrentFolder(monitorName_ + "/HistoryLumi");
0645
0646
0647 HistAvgLumiEtSum = iBooker.bookProfile("HistAvgLumiEtSum",
0648 "Average Instant Luminosity: Et Sum",
0649 MAX_LS,
0650 0.5,
0651 (double)MAX_LS + 0.5,
0652 EtSumBins,
0653 EtSumMin,
0654 EtSumMax);
0655 HistAvgLumiEtSum->setAxisTitle(HistXTitle, 1);
0656 HistAvgLumiEtSum->setAxisTitle(HistLumiYTitle, 2);
0657
0658 HistAvgLumiOccSet1 = iBooker.bookProfile("HistAvgLumiOccSet1",
0659 "Average Instant Luminosity: Occ Set1",
0660 MAX_LS,
0661 0.5,
0662 (double)MAX_LS + 0.5,
0663 OccBins,
0664 OccMin,
0665 OccMax);
0666 HistAvgLumiOccSet1->setAxisTitle(HistXTitle, 1);
0667 HistAvgLumiOccSet1->setAxisTitle(HistLumiYTitle, 2);
0668
0669 HistAvgLumiOccSet2 = iBooker.bookProfile("HistAvgLumiOccSet2",
0670 "Average Instant Luminosity: Occ Set2",
0671 MAX_LS,
0672 0.5,
0673 (double)MAX_LS + 0.5,
0674 OccBins,
0675 OccMin,
0676 OccMax);
0677 HistAvgLumiOccSet2->setAxisTitle(HistXTitle, 1);
0678 HistAvgLumiOccSet2->setAxisTitle(HistLumiYTitle, 2);
0679
0680 HistInstantLumiEtSum =
0681 iBooker.book1D("HistInstantLumiEtSum", "Instant Luminosity: Et Sum", MAX_LS, 0.5, (double)MAX_LS + 0.5);
0682 HistInstantLumiEtSum->setAxisTitle(HistXTitle, 1);
0683 HistInstantLumiEtSum->setAxisTitle(HistLumiYTitle, 2);
0684
0685 HistInstantLumiOccSet1 =
0686 iBooker.book1D("HistInstantLumiOccSet1", "Instant Luminosity: Occ Set1", MAX_LS, 0.5, (double)MAX_LS + 0.5);
0687 HistInstantLumiOccSet1->setAxisTitle(HistXTitle, 1);
0688 HistInstantLumiOccSet1->setAxisTitle(HistLumiYTitle, 2);
0689
0690 HistInstantLumiOccSet2 =
0691 iBooker.book1D("HistInstantLumiOccSet2", "Instant Luminosity: Occ Set2", MAX_LS, 0.5, (double)MAX_LS + 0.5);
0692 HistInstantLumiOccSet2->setAxisTitle(HistXTitle, 1);
0693 HistInstantLumiOccSet2->setAxisTitle(HistLumiYTitle, 2);
0694
0695 HistInstantLumiEtSumError =
0696 iBooker.book1D("HistInstantLumiEtSumError", "Luminosity Error: Et Sum", MAX_LS, 0.5, (double)MAX_LS + 0.5);
0697 HistInstantLumiEtSumError->setAxisTitle(HistXTitle, 1);
0698 HistInstantLumiEtSumError->setAxisTitle(HistLumiErrorYTitle, 2);
0699
0700 HistInstantLumiOccSet1Error =
0701 iBooker.book1D("HistInstantLumiOccSet1Error", "Luminosity Error: Occ Set1", MAX_LS, 0.5, (double)MAX_LS + 0.5);
0702 HistInstantLumiOccSet1Error->setAxisTitle(HistXTitle, 1);
0703 HistInstantLumiOccSet1Error->setAxisTitle(HistLumiErrorYTitle, 2);
0704
0705 HistInstantLumiOccSet2Error =
0706 iBooker.book1D("HistInstantLumiOccSet2Error", "Luminosity Error: Occ Set2", MAX_LS, 0.5, (double)MAX_LS + 0.5);
0707 HistInstantLumiOccSet2Error->setAxisTitle(HistXTitle, 1);
0708 HistInstantLumiOccSet2Error->setAxisTitle(HistLumiErrorYTitle, 2);
0709
0710 HistIntegratedLumiEtSum =
0711 iBooker.book1D("HistIntegratedLumiEtSum", "Integrated Luminosity: Et Sum", MAX_LS, 0.5, (double)MAX_LS + 0.5);
0712 HistIntegratedLumiEtSum->setAxisTitle(HistXTitle, 1);
0713 HistIntegratedLumiEtSum->setAxisTitle(HistLumiYTitle, 2);
0714
0715 HistIntegratedLumiOccSet1 =
0716 iBooker.book1D("HistIntegratedLumiOccSet1", "Integrated Luminosity: Occ Set1", MAX_LS, 0.5, (double)MAX_LS + 0.5);
0717 HistIntegratedLumiOccSet1->setAxisTitle(HistXTitle, 1);
0718 HistIntegratedLumiOccSet1->setAxisTitle(HistLumiYTitle, 2);
0719
0720 HistIntegratedLumiOccSet2 =
0721 iBooker.book1D("HistIntegratedLumiOccSet2", "Integrated Luminosity: Occ Set2", MAX_LS, 0.5, (double)MAX_LS + 0.5);
0722 HistIntegratedLumiOccSet2->setAxisTitle(HistXTitle, 1);
0723 HistIntegratedLumiOccSet2->setAxisTitle(HistLumiYTitle, 2);
0724
0725 iBooker.setCurrentFolder(monitorName_ + "/RecentHistoryLumi");
0726
0727
0728 RecentInstantLumiEtSum =
0729 iBooker.book1D("RecentInstantLumiEtSum", "Instant Luminosity: Et Sum", 128, 0.5, (double)128 + 0.5);
0730 RecentInstantLumiEtSum->setAxisTitle(RecentHistXTitle, 1);
0731 RecentInstantLumiEtSum->setAxisTitle(HistLumiYTitle, 2);
0732
0733 RecentInstantLumiOccSet1 =
0734 iBooker.book1D("RecentInstantLumiOccSet1", "Instant Luminosity: Occ Set1", 128, 0.5, (double)128 + 0.5);
0735 RecentInstantLumiOccSet1->setAxisTitle(RecentHistXTitle, 1);
0736 RecentInstantLumiOccSet1->setAxisTitle(HistLumiYTitle, 2);
0737
0738 RecentInstantLumiOccSet2 =
0739 iBooker.book1D("RecentInstantLumiOccSet2", "Instant Luminosity: Occ Set2", 128, 0.5, (double)128 + 0.5);
0740 RecentInstantLumiOccSet2->setAxisTitle(RecentHistXTitle, 1);
0741 RecentInstantLumiOccSet2->setAxisTitle(HistLumiYTitle, 2);
0742
0743 RecentIntegratedLumiEtSum =
0744 iBooker.book1D("RecentIntegratedLumiEtSum", "Integrated Luminosity: Et Sum", 128, 0.5, (double)128 + 0.5);
0745 RecentIntegratedLumiEtSum->setAxisTitle(RecentHistXTitle, 1);
0746 RecentIntegratedLumiEtSum->setAxisTitle(HistLumiYTitle, 2);
0747
0748 RecentIntegratedLumiOccSet1 =
0749 iBooker.book1D("RecentIntegratedLumiOccSet1", "Integrated Luminosity: Occ Set1", 128, 0.5, (double)128 + 0.5);
0750 RecentIntegratedLumiOccSet1->setAxisTitle(RecentHistXTitle, 1);
0751 RecentIntegratedLumiOccSet1->setAxisTitle(HistLumiYTitle, 2);
0752
0753 RecentIntegratedLumiOccSet2 =
0754 iBooker.book1D("RecentIntegratedLumiOccSet2", "Integrated Luminosity: Occ Set2", 128, 0.5, (double)128 + 0.5);
0755 RecentIntegratedLumiOccSet2->setAxisTitle(RecentHistXTitle, 1);
0756 RecentIntegratedLumiOccSet2->setAxisTitle(HistLumiYTitle, 2);
0757 }
0758
0759 void HLXMonitor::SetupEventInfo(DQMStore::IBooker &iBooker) {
0760 using std::string;
0761
0762 string currentfolder = subSystemName_ + "/" + eventInfoFolderHLX_;
0763
0764
0765 iBooker.setCurrentFolder(currentfolder);
0766
0767 pEvent_ = 0;
0768 evtRateCount_ = 0;
0769 gettimeofday(¤tTime_, nullptr);
0770 lastAvgTime_ = currentTime_;
0771 evtRateWindow_ = 0.5;
0772
0773
0774 runId_ = iBooker.bookInt("iRun");
0775 lumisecId_ = iBooker.bookInt("iLumiSection");
0776
0777 eventId_ = iBooker.bookInt("iEvent");
0778 eventId_->Fill(-1);
0779 eventTimeStamp_ = iBooker.bookFloat("eventTimeStamp");
0780
0781 iBooker.setCurrentFolder(currentfolder);
0782
0783 processTimeStamp_ = iBooker.bookFloat("processTimeStamp");
0784 processTimeStamp_->Fill(getUTCtime(¤tTime_));
0785 processLatency_ = iBooker.bookFloat("processLatency");
0786 processTimeStamp_->Fill(-1);
0787 processEvents_ = iBooker.bookInt("processedEvents");
0788 processEvents_->Fill(pEvent_);
0789 processEventRate_ = iBooker.bookFloat("processEventRate");
0790 processEventRate_->Fill(-1);
0791 nUpdates_ = iBooker.bookInt("processUpdates");
0792 nUpdates_->Fill(-1);
0793
0794
0795 processId_ = iBooker.bookInt("processID");
0796 processId_->Fill(gSystem->GetPid());
0797 processStartTimeStamp_ = iBooker.bookFloat("processStartTimeStamp");
0798 processStartTimeStamp_->Fill(getUTCtime(¤tTime_));
0799 runStartTimeStamp_ = iBooker.bookFloat("runStartTimeStamp");
0800 hostName_ = iBooker.bookString("hostName", gSystem->HostName());
0801 processName_ = iBooker.bookString("processName", subSystemName_);
0802 workingDir_ = iBooker.bookString("workingDir", gSystem->pwd());
0803 cmsswVer_ = iBooker.bookString("CMSSW_Version", edm::getReleaseVersion());
0804
0805
0806
0807 currentfolder = subSystemName_ + "/" + eventInfoFolder_;
0808 iBooker.setCurrentFolder(currentfolder);
0809
0810 reportSummary_ = iBooker.bookFloat("reportSummary");
0811 reportSummaryMap_ = iBooker.book2D("reportSummaryMap", "reportSummaryMap", 18, 0., 18., 2, -1.5, 1.5);
0812
0813 currentfolder = subSystemName_ + "/" + eventInfoFolderHLX_;
0814 iBooker.setCurrentFolder(currentfolder);
0815
0816 TH2F *summaryHist = reportSummaryMap_->getTH2F();
0817 summaryHist->GetYaxis()->SetBinLabel(1, "HF-");
0818 summaryHist->GetYaxis()->SetBinLabel(2, "HF+");
0819 summaryHist->GetXaxis()->SetTitle("Wedge #");
0820
0821
0822
0823 reportSummary_->Fill(1.0);
0824
0825 for (unsigned int iHLX = 0; iHLX < NUM_HLX; ++iHLX) {
0826 unsigned int iWedge = HLXHFMap[iHLX] + 1;
0827 unsigned int iEta = 2;
0828 if (iWedge >= 19) {
0829 iEta = 1;
0830 iWedge -= 18;
0831 }
0832 reportSummaryMap_->setBinContent(iWedge, iEta, 1.0);
0833 }
0834 }
0835
0836
0837 void HLXMonitor::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) {
0838 using namespace edm;
0839
0840 while (HLXTCP.IsConnected() == false) {
0841 HLXTCP.SetIP(DistribIP1);
0842 if (HLXTCP.Connect() != 1) {
0843 std::cout << "Failed to connect to " << DistribIP1 << "." << std::endl;
0844 sleep(1);
0845 std::cout << "Trying " << DistribIP2 << std::endl;
0846 HLXTCP.SetIP(DistribIP2);
0847 if (HLXTCP.Connect() == 1)
0848 break;
0849 std::cout << "Failed to connect to " << DistribIP2 << "." << std::endl;
0850 std::cout << " Reconnect in " << reconnTime << " seconds." << std::endl;
0851 sleep(reconnTime);
0852 }
0853 }
0854 if (HLXTCP.IsConnected() == true) {
0855 std::cout << "Successfully connected." << std::endl;
0856 }
0857
0858 if (HLXTCP.ReceiveLumiSection(lumiSection) == 1) {
0859
0860 if (runNumber_ != lumiSection.hdr.runNumber) {
0861 if (!currentRunEnded_ && runNumber_ != 0) {
0862 EndRun();
0863 }
0864 runNumber_ = lumiSection.hdr.runNumber;
0865 currentRunEnded_ = false;
0866
0867 timeval startruntime;
0868 gettimeofday(&startruntime, nullptr);
0869 runStartTimeStamp_->Fill(getUTCtime(&startruntime));
0870 }
0871
0872
0873 FillHistograms(lumiSection);
0874 FillHistoHFCompare(lumiSection);
0875 FillEventInfo(lumiSection, iEvent);
0876 FillReportSummary();
0877
0878 cout << "Run: " << lumiSection.hdr.runNumber << " Section: " << lumiSection.hdr.sectionNumber
0879 << " Orbit: " << lumiSection.hdr.startOrbit << endl;
0880 cout << "Et Lumi: " << lumiSection.lumiSummary.InstantETLumi << endl;
0881 cout << "Occ Lumi 1: " << lumiSection.lumiSummary.InstantOccLumi[0] << endl;
0882 cout << "Occ Lumi 2: " << lumiSection.lumiSummary.InstantOccLumi[1] << endl;
0883 } else {
0884 HLXTCP.Disconnect();
0885 EndRun();
0886 }
0887 }
0888
0889 void HLXMonitor::EndRun() {
0890 FillReportSummary();
0891
0892
0893 expectedNibbles_ = 0;
0894 for (unsigned int iHLX = 0; iHLX < NUM_HLX; ++iHLX)
0895 totalNibbles_[iHLX] = 0;
0896
0897 std::cout << "** Here in end run **" << std::endl;
0898 runNumber_ = 0;
0899 currentRunEnded_ = true;
0900 sectionInstantSumEt = 0;
0901 sectionInstantErrSumEt = 0;
0902 sectionInstantSumOcc1 = 0;
0903 sectionInstantErrSumOcc1 = 0;
0904 sectionInstantSumOcc2 = 0;
0905 sectionInstantErrSumOcc2 = 0;
0906 sectionInstantNorm = 0;
0907 lsBinOld = 0;
0908 lumiSectionCount = 0;
0909 previousSection = 0;
0910 }
0911
0912 void HLXMonitor::FillHistograms(const LUMI_SECTION §ion) {
0913
0914 if (previousSection != (section.hdr.sectionNumber - 1)) {
0915 double weight = (double)(section.hdr.sectionNumber - previousSection - 1);
0916
0917 MissingDQMDataCheck->Fill(0.5, weight);
0918 }
0919 previousSection = section.hdr.sectionNumber;
0920
0921 int lsBin = int(lumiSectionCount / num4NibblePerLS_);
0922 int lsBinBX = int(lumiSectionCount / num4NibblePerLS_);
0923 HistAvgLumiEtSum->Fill(lsBin, section.lumiSummary.InstantETLumi);
0924 HistAvgLumiOccSet1->Fill(lsBin, section.lumiSummary.InstantOccLumi[0]);
0925 HistAvgLumiOccSet2->Fill(lsBin, section.lumiSummary.InstantOccLumi[1]);
0926
0927 int fillBin = lumiSectionCount + 1;
0928 if (fillBin > 128) {
0929
0930
0931 for (int iBin = 1; iBin < 128; ++iBin) {
0932 RecentInstantLumiEtSum->setBinContent(iBin, RecentInstantLumiEtSum->getBinContent(iBin + 1));
0933 RecentInstantLumiOccSet1->setBinContent(iBin, RecentInstantLumiOccSet1->getBinContent(iBin + 1));
0934 RecentInstantLumiOccSet2->setBinContent(iBin, RecentInstantLumiOccSet2->getBinContent(iBin + 1));
0935 RecentIntegratedLumiEtSum->setBinContent(iBin, RecentIntegratedLumiEtSum->getBinContent(iBin + 1));
0936 RecentIntegratedLumiOccSet1->setBinContent(iBin, RecentIntegratedLumiOccSet1->getBinContent(iBin + 1));
0937 RecentIntegratedLumiOccSet2->setBinContent(iBin, RecentIntegratedLumiOccSet2->getBinContent(iBin + 1));
0938 }
0939 fillBin = 128;
0940 }
0941
0942 RecentInstantLumiEtSum->setBinContent(fillBin, section.lumiSummary.InstantETLumi);
0943 RecentInstantLumiEtSum->setBinError(fillBin, section.lumiSummary.InstantETLumiErr);
0944 RecentInstantLumiOccSet1->setBinContent(fillBin, section.lumiSummary.InstantOccLumi[0]);
0945 RecentInstantLumiOccSet1->setBinError(fillBin, section.lumiSummary.InstantOccLumiErr[0]);
0946 RecentInstantLumiOccSet2->setBinContent(fillBin, section.lumiSummary.InstantOccLumi[1]);
0947 RecentInstantLumiOccSet2->setBinError(fillBin, section.lumiSummary.InstantOccLumiErr[1]);
0948
0949 double recentOldBinContent = RecentIntegratedLumiEtSum->getBinContent(fillBin - 1);
0950 if (fillBin == 1)
0951 recentOldBinContent = 0;
0952 double recentNewBinContent = recentOldBinContent + section.lumiSummary.InstantETLumi;
0953 RecentIntegratedLumiEtSum->setBinContent(fillBin, recentNewBinContent);
0954 recentOldBinContent = RecentIntegratedLumiOccSet1->getBinContent(fillBin - 1);
0955 if (fillBin == 1)
0956 recentOldBinContent = 0;
0957 recentNewBinContent = recentOldBinContent + section.lumiSummary.InstantOccLumi[0];
0958 RecentIntegratedLumiOccSet1->setBinContent(fillBin, recentNewBinContent);
0959 recentOldBinContent = RecentIntegratedLumiOccSet2->getBinContent(fillBin - 1);
0960 if (fillBin == 1)
0961 recentOldBinContent = 0;
0962 recentNewBinContent = recentOldBinContent + section.lumiSummary.InstantOccLumi[0];
0963 RecentIntegratedLumiOccSet2->setBinContent(fillBin, recentNewBinContent);
0964
0965 double recentOldBinError = RecentIntegratedLumiEtSum->getBinError(fillBin - 1);
0966 if (fillBin == 1)
0967 recentOldBinError = 0;
0968 double recentNewBinError = sqrt(recentOldBinError * recentOldBinError +
0969 section.lumiSummary.InstantETLumiErr * section.lumiSummary.InstantETLumiErr);
0970 RecentIntegratedLumiEtSum->setBinError(fillBin, recentNewBinError);
0971 recentOldBinError = RecentIntegratedLumiOccSet1->getBinError(fillBin - 1);
0972 if (fillBin == 1)
0973 recentOldBinError = 0;
0974 recentNewBinError = sqrt(recentOldBinError * recentOldBinError +
0975 section.lumiSummary.InstantOccLumiErr[0] * section.lumiSummary.InstantOccLumiErr[0]);
0976 RecentIntegratedLumiOccSet1->setBinError(fillBin, recentNewBinError);
0977 recentOldBinError = RecentIntegratedLumiOccSet2->getBinError(fillBin - 1);
0978 if (fillBin == 1)
0979 recentOldBinError = 0;
0980 recentNewBinError = sqrt(recentOldBinError * recentOldBinError +
0981 section.lumiSummary.InstantOccLumiErr[1] * section.lumiSummary.InstantOccLumiErr[1]);
0982 RecentIntegratedLumiOccSet2->setBinError(fillBin, recentNewBinError);
0983
0984 if (lsBinOld != lsBin) {
0985 HistInstantLumiEtSum->setBinContent(lsBin, sectionInstantSumEt);
0986 HistInstantLumiEtSum->setBinError(lsBin, sqrt(sectionInstantErrSumEt));
0987 HistInstantLumiOccSet1->setBinContent(lsBin, sectionInstantSumOcc1);
0988 HistInstantLumiOccSet1->setBinError(lsBin, sqrt(sectionInstantErrSumOcc1));
0989 HistInstantLumiOccSet2->setBinContent(lsBin, sectionInstantSumOcc2);
0990 HistInstantLumiOccSet2->setBinError(lsBin, sqrt(sectionInstantErrSumOcc2));
0991
0992 double etDenom = fabs(sectionInstantSumEt);
0993 if (etDenom < 1e-10)
0994 etDenom = 1e-10;
0995 double occ1Denom = fabs(sectionInstantSumOcc1);
0996 if (occ1Denom < 1e-10)
0997 occ1Denom = 1e-10;
0998 double occ2Denom = fabs(sectionInstantSumOcc2);
0999 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;
1004 HistInstantLumiEtSumError->setBinContent(lsBinOld, etError);
1005 HistInstantLumiOccSet1Error->setBinContent(lsBinOld, occ1Error);
1006 HistInstantLumiOccSet2Error->setBinContent(lsBinOld, occ2Error);
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;
1041 sectionInstantErrSumEt = 0;
1042 sectionInstantSumOcc1 = 0;
1043 sectionInstantErrSumOcc1 = 0;
1044 sectionInstantSumOcc2 = 0;
1045 sectionInstantErrSumOcc2 = 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];
1056 ++sectionInstantNorm;
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
1064 for (unsigned int iBX = 0; iBX < NUM_BUNCHES; ++iBX) {
1065
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
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
1133 TH1F *Set1BelowHist = Set1Below[iWedge]->getTH1F();
1134 int iBin = Set1BelowHist->FindBin((float)iBX);
1135
1136
1137
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
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
1279
1280
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
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
1336 ++lumiSectionCount;
1337 }
1338
1339 void HLXMonitor::FillHistoHFCompare(const LUMI_SECTION §ion) {
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
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
1385 void HLXMonitor::FillEventInfo(const LUMI_SECTION §ion, const edm::Event &e) {
1386
1387
1388
1389
1390 runId_->Fill(section.hdr.runNumber);
1391 lumisecId_->Fill((int)(section.hdr.sectionNumber / num4NibblePerLS_) + 1);
1392
1393
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_++;
1405 processEvents_->Fill(pEvent_);
1406
1407 lastUpdateTime_ = currentTime_;
1408 gettimeofday(¤tTime_, nullptr);
1409 processTimeStamp_->Fill(getUTCtime(¤tTime_));
1410 processLatency_->Fill(getUTCtime(&lastUpdateTime_, ¤tTime_));
1411
1412 float time = getUTCtime(&lastAvgTime_, ¤tTime_);
1413 if (time >= (evtRateWindow_ * 60.0)) {
1414 processEventRate_->Fill((float)evtRateCount_ / time);
1415 evtRateCount_ = 0;
1416 lastAvgTime_ = currentTime_;
1417 }
1418 }
1419
1420 void HLXMonitor::FillReportSummary() {
1421
1422
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 }
1434 reportSummaryMap_->setBinContent(iWedge, iEta, frac);
1435 overall += frac;
1436 }
1437
1438 overall /= (float)NUM_HLX;
1439 if (overall > 1.0)
1440 overall = 0.0;
1441
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
1453 DEFINE_FWK_MODULE(HLXMonitor);