CMS 3D CMS Logo

DQMProvInfo.cc
Go to the documentation of this file.
1 /*
2  * Original author: A. Raval / A. Meyer - DESY
3  * Rewritten by: B. van Besien - CERN
4  * Improved by: S. Di Guida - INFN and Marconi University
5  */
6 
23 
24 #include <string>
25 #include <vector>
26 
27 #include <TSystem.h>
28 
29 class DQMProvInfo : public DQMOneEDAnalyzer<> {
30 public:
31  // Constructor
32  DQMProvInfo(const edm::ParameterSet& ps);
33  // Destructor
34  ~DQMProvInfo() override = default;
35 
36 protected:
37  void dqmBeginRun(const edm::Run& r, const edm::EventSetup& c) override;
38  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
39  void analyze(const edm::Event& e, const edm::EventSetup& c) override;
40 
41 private:
45 
46  void analyzeLhcInfo(const edm::Event& e);
47  void analyzeEventInfo(const edm::Event& e);
48  void analyzeProvInfo(const edm::Event& e);
49 
50  void fillDcsBitsFromDCSRecord(const DCSRecord&, bool* dcsBits);
52  bool isPhysicsDeclared(bool* dcsBits);
53 
54  void blankAllLumiSections();
55  void fillSummaryMapBin(int ls, int bin, double value);
56  void setupLumiSection(int ls);
57 
58  // To max amount of lumisections we foresee for the plots
59  // DQM GUI renderplugins provide scaling to actual amount
60  const static int MAX_LUMIS = 6000;
61 
62  // Numbers of each of the vertical bins
63  const static int VBIN_CSC_P = 1;
64  const static int VBIN_CSC_M = 2;
65  const static int VBIN_DT_0 = 3;
66  const static int VBIN_DT_P = 4;
67  const static int VBIN_DT_M = 5;
68  const static int VBIN_EB_P = 6;
69  const static int VBIN_EB_M = 7;
70  const static int VBIN_EE_P = 8;
71  const static int VBIN_EE_M = 9;
72  const static int VBIN_ES_P = 10;
73  const static int VBIN_ES_M = 11;
74  const static int VBIN_HBHE_A = 12;
75  const static int VBIN_HBHE_B = 13;
76  const static int VBIN_HBHE_C = 14;
77  const static int VBIN_HF = 15;
78  const static int VBIN_HO = 16;
79  const static int VBIN_BPIX = 17;
80  const static int VBIN_FPIX = 18;
81  const static int VBIN_RPC = 19;
82  const static int VBIN_TIBTID = 20;
83  const static int VBIN_TOB = 21;
84  const static int VBIN_TEC_P = 22;
85  const static int VBIN_TE_M = 23;
86  const static int VBIN_CASTOR = 24;
87  const static int VBIN_ZDC = 25;
88  const static int VBIN_GEM_P = 26;
89  const static int VBIN_GEM_M = 27;
90 
91  // Highest DCS bin, used for the length of the corresponding array.
92  // We will have the indexes to this array the same as the vbins numbers.
93  // (I.e. value at index 0 will not be used.)
94  const static int MAX_DCS_VBINS = 27;
95 
96  const static int VBIN_PHYSICS_DECLARED = 28;
97  const static int VBIN_MOMENTUM = 29;
98  const static int VBIN_STABLE_BEAM = 30;
99  const static int VBIN_VALID = 31;
100 
101  const static int MAX_VBINS = 31;
102 
103  // Beam momentum at flat top, used to determine if collisions are
104  // occurring with the beams at the energy allowed for physics production.
105  const static int MAX_MOMENTUM = 6500;
106 
107  // Beam momentum allowed offset: it is a momentum value subtracted to
108  // maximum momentum in order to decrease the threshold for beams going to
109  // collisions for physics production. This happens because BST sends from
110  // time to time a value of the beam momentum slightly below the nominal values,
111  // even during stable collisions: in this way, we provide a correct information
112  // at the cost of not requiring the exact momentum being measured by BST.
113  const static int MOMENTUM_OFFSET = 1;
114 
115  // Process parameters
118 
122 
123  // MonitorElements for LhcInfo and corresponding variables
130 
131  // MonitorElements for EventInfo and corresponding variables
134 
135  // MonitorElements for ProvInfo and corresponding variables
146  MonitorElement* processId_; // The PID associated with this job
148 };
149 
150 // The LHC beam info used to come from FED812, but since the new TCDS this
151 // info is in FED1024. We retrieve the BST record from the TCDS digis, and
152 // we get the LHC beam info using a dedicated data format.
153 
154 const int DQMProvInfo::MAX_VBINS;
155 const int DQMProvInfo::MAX_LUMIS;
156 
157 // Constructor
159  // Initialization of DQM parameters
160  subsystemname_ = ps.getUntrackedParameter<std::string>("subSystemFolder", "Info");
161  provinfofolder_ = ps.getUntrackedParameter<std::string>("provInfoFolder", "ProvInfo");
162  runType_ = ps.getUntrackedParameter<std::string>("runType", "No run type selected");
163 
164  // Initialization of the input
165  // Used to get the DCS bits:
167  consumes<DcsStatusCollection>(ps.getUntrackedParameter<std::string>("dcsStatusCollection", "scalersRawToDigi"));
168 
169  // Used to get the BST record from the TCDS information
170  tcdsrecord_ = consumes<TCDSRecord>(
171  ps.getUntrackedParameter<edm::InputTag>("tcdsData", edm::InputTag("tcdsDigis", "tcdsRecord")));
172 
173  // Used to get the DCS bits:
174  dcsRecordToken_ = consumes<DCSRecord>(
175  ps.getUntrackedParameter<edm::InputTag>("dcsRecord", edm::InputTag("onlineMetaDataRawToDigi")));
176 
177  // Initialization of the global tag
178  globalTag_ = "MODULE::DEFAULT"; // default
179  globalTagRetrieved_ = false; // set as soon as retrieved from first event
180 }
181 
182 void DQMProvInfo::dqmBeginRun(const edm::Run& iRun, const edm::EventSetup& iEventSetup) {
183  // Here we do everything that needs to be done before the booking
184  // Getting the HLT key from HLTConfigProvider:
185  hltKey_ = "";
187  bool changed(true);
188  if (!hltConfig.init(iRun, iEventSetup, "HLT", changed)) {
189  edm::LogInfo("DQMProvInfo") << "errorHltConfigExtraction" << std::endl;
190  hltKey_ = "error extraction";
191  } else if (hltConfig.size() <= 0) {
192  edm::LogInfo("DQMProvInfo") << "hltConfig" << std::endl;
193  hltKey_ = "error key of length 0";
194  } else {
195  edm::LogInfo("DQMProvInfo") << "HLT key (run): " << hltConfig.tableName() << std::endl;
196  hltKey_ = hltConfig.tableName();
197  }
198 }
199 
200 void DQMProvInfo::bookHistograms(DQMStore::IBooker& iBooker, edm::Run const& iRun, edm::EventSetup const& iEventSetup) {
201  iBooker.cd();
202  // This module will create elements in 3 different folders:
203  // - Info/LhcInfo
204  // - Info/EventInfo
205  // - Info/ProvInfo
206  // (string "Info" configurable through subsystemname_)
207  // (string "Provinfo" configurable through provinfofolder_)
208  iBooker.setCurrentFolder(subsystemname_ + "/LhcInfo/");
209  bookHistogramsLhcInfo(iBooker);
210 
211  iBooker.setCurrentFolder(subsystemname_ + "/EventInfo/");
212  bookHistogramsEventInfo(iBooker);
213 
215  bookHistogramsProvInfo(iBooker);
216 }
217 
219  // Element: beamMode
220  // Beam parameters provided by BST are defined in:
221  // https://edms.cern.ch/document/638899/2.0
222  hBeamMode_ = iBooker.book1D("beamMode", "beamMode", MAX_LUMIS, 1., MAX_LUMIS + 1);
223  hBeamMode_->getTH1F()->GetYaxis()->Set(21, 0.5, 21.5);
224  hBeamMode_->getTH1F()->SetMaximum(21.5);
225  hBeamMode_->setBinContent(0., 22.); // Not clear, remove when testable
226 
227  hBeamMode_->setAxisTitle("Luminosity Section", 1);
228  hBeamMode_->setBinLabel(1, "no mode", 2);
229  hBeamMode_->setBinLabel(2, "setup", 2);
230  hBeamMode_->setBinLabel(3, "inj pilot", 2);
231  hBeamMode_->setBinLabel(4, "inj intr", 2);
232  hBeamMode_->setBinLabel(5, "inj nomn", 2);
233  hBeamMode_->setBinLabel(6, "pre ramp", 2);
234  hBeamMode_->setBinLabel(7, "ramp", 2);
235  hBeamMode_->setBinLabel(8, "flat top", 2);
236  hBeamMode_->setBinLabel(9, "squeeze", 2);
237  hBeamMode_->setBinLabel(10, "adjust", 2);
238  hBeamMode_->setBinLabel(11, "stable", 2);
239  hBeamMode_->setBinLabel(12, "unstable", 2);
240  hBeamMode_->setBinLabel(13, "beam dump", 2);
241  hBeamMode_->setBinLabel(14, "ramp down", 2);
242  hBeamMode_->setBinLabel(15, "recovery", 2);
243  hBeamMode_->setBinLabel(16, "inj dump", 2);
244  hBeamMode_->setBinLabel(17, "circ dump", 2);
245  hBeamMode_->setBinLabel(18, "abort", 2);
246  hBeamMode_->setBinLabel(19, "cycling", 2);
247  hBeamMode_->setBinLabel(20, "warn b-dump", 2);
248  hBeamMode_->setBinLabel(21, "no beam", 2);
249 
250  // Element: intensity1
251  hIntensity1_ = iBooker.book1D("intensity1", "Intensity Beam 1", MAX_LUMIS, 1., MAX_LUMIS + 1);
252  hIntensity1_->setAxisTitle("Luminosity Section", 1);
253  hIntensity1_->setAxisTitle("N [E10]", 2);
254 
255  // Element: intensity2
256  hIntensity2_ = iBooker.book1D("intensity2", "Intensity Beam 2", MAX_LUMIS, 1., MAX_LUMIS + 1);
257  hIntensity2_->setAxisTitle("Luminosity Section", 1);
258  hIntensity2_->setAxisTitle("N [E10]", 2);
259 
260  // Element: lhcFill
261  hLhcFill_ = iBooker.book1D("lhcFill", "LHC Fill Number", MAX_LUMIS, 1., MAX_LUMIS + 1);
262  hLhcFill_->setAxisTitle("Luminosity Section", 1);
263 
264  // Element: momentum
265  hMomentum_ = iBooker.book1D("momentum", "Beam Energy [GeV]", MAX_LUMIS, 1., MAX_LUMIS + 1);
266  hMomentum_->setAxisTitle("Luminosity Section", 1);
267 }
268 
270  // Element: reportSummary
271  reportSummary_ = iBooker.bookFloat("reportSummary");
272 
273  // Element: reportSummaryMap (this is the famous HV plot)
274  reportSummaryMap_ = iBooker.book2D("reportSummaryMap",
275  "DCS HV Status and Beam Status per Lumisection",
276  MAX_LUMIS,
277  0,
278  MAX_LUMIS,
279  MAX_VBINS,
280  0.,
281  MAX_VBINS);
282  reportSummaryMap_->setAxisTitle("Luminosity Section");
283 
315 
317 }
318 
320  // Note: Given that all these elements are only filled once per run, they
321  // are filled here right away. (except for isCollisionsRun)
322 
323  // Element: CMMSW
324  versCMSSW_ = iBooker.bookString("CMSSW", edm::getReleaseVersion().c_str());
325 
326  // Element: Globaltag
327  versGlobaltag_ = iBooker.bookString("Globaltag", globalTag_);
328 
329  // Element: RunType
330  versRuntype_ = iBooker.bookString("Run Type", runType_);
331 
332  // Element: hltKey
333  hHltKey_ = iBooker.bookString("hltKey", hltKey_);
334 
335  // Element: hostName
336  hostName_ = iBooker.bookString("hostName", gSystem->HostName());
337 
338  // Element: isCollisionsRun (filled for real in EndLumi)
339  hIsCollisionsRun_ = iBooker.bookInt("isCollisionsRun");
341 
342  // Element: processID
343  processId_ = iBooker.bookInt("processID");
344  processId_->Fill(gSystem->GetPid());
345 
346  // Element: workingDir
347  workingDir_ = iBooker.bookString("workingDir", gSystem->pwd());
348 }
349 
351  // This happens on an event by event base
352  // We extract information from events, placing them in local variables
353  // and then at the end of each lumisection, we fill them in the MonitorElement
354  // (Except for the global tag, which we only extract from the first event we
355  // ever encounter and put in the MonitorElement right away)
356 
357  // We set the top value to "Valid" to 1 for each LS we encounter
358  setupLumiSection(event.id().luminosityBlock());
359 
363 }
364 
366  unsigned int currentLSNumber = event.id().luminosityBlock();
367  edm::Handle<TCDSRecord> tcdsData;
368  event.getByToken(tcdsrecord_, tcdsData);
369  // We unpack the TCDS record from TCDS
370  if (tcdsData.isValid()) {
371  //and we look at the BST information
372  auto lhcFill = static_cast<int>(tcdsData->getBST().getLhcFill());
373  beamMode_ = static_cast<int>(tcdsData->getBST().getBeamMode());
374  auto momentum = static_cast<int>(tcdsData->getBST().getBeamMomentum());
375  auto intensity1 = static_cast<int>(tcdsData->getBST().getIntensityBeam1());
376  auto intensity2 = static_cast<int>(tcdsData->getBST().getIntensityBeam2());
377 
378  // Quite straightforward: Fill in the value for the LS in each plot:
379  hLhcFill_->setBinContent(currentLSNumber, lhcFill);
380  hBeamMode_->setBinContent(currentLSNumber, beamMode_);
381  hMomentum_->setBinContent(currentLSNumber, momentum);
382  hIntensity1_->setBinContent(currentLSNumber, intensity1);
383  hIntensity2_->setBinContent(currentLSNumber, intensity2);
384 
385  // Part3: Using LHC status info, fill in VBIN_MOMENTUM and VBIN_STABLE_BEAM
386  // Fill 13 TeV bit in y bin VBIN_MOMENTUM
387  if (momentum >= MAX_MOMENTUM - MOMENTUM_OFFSET) {
388  fillSummaryMapBin(currentLSNumber, VBIN_MOMENTUM, 1.);
389  } else {
390  fillSummaryMapBin(currentLSNumber, VBIN_MOMENTUM, 0.);
391  }
392 
393  // Fill stable beams bit in y bin VBIN_STABLE_BEAM
394  if (beamMode_ == 11) {
396  reportSummary_->Fill(1.);
397  fillSummaryMapBin(currentLSNumber, VBIN_STABLE_BEAM, 1.);
398  } else {
399  reportSummary_->Fill(0.);
400  fillSummaryMapBin(currentLSNumber, VBIN_STABLE_BEAM, 0.);
401  }
402  } else {
403  edm::LogWarning("DQMProvInfo") << "TCDS Data inaccessible.";
404  }
405 }
406 
408  unsigned int currentLSNumber = event.id().luminosityBlock();
409  // Part 1:
410  // If FED#735 is available use it to extract DcsStatusCollection.
411  // If not, use softFED#1022 to extract DCSRecord.
412 
413  edm::Handle<DcsStatusCollection> dcsStatusCollection;
414  event.getByToken(dcsStatusCollection_, dcsStatusCollection);
416  event.getByToken(dcsRecordToken_, dcsRecord);
417 
418  // Populate dcsBits array with received information.
419  bool dcsBits[MAX_DCS_VBINS + 1] = {};
420 
421  if (dcsStatusCollection.isValid() && !dcsStatusCollection->empty()) {
422  edm::LogInfo("DQMProvInfo") << "Using FED#735 for reading DCS bits" << std::endl;
423  fillDcsBitsFromDcsStatusCollection(dcsStatusCollection, dcsBits);
424  } else if (dcsRecord.isValid()) {
425  edm::LogInfo("DQMProvInfo") << "Using softFED#1022 for reading DCS bits" << std::endl;
427  } else {
428  edm::LogError("DQMProvInfo") << "No DCS information found!" << std::endl;
429  }
430 
431  // Part 2: Compute the PhysicsDeclared bit from the event
432  auto physicsDeclared = isPhysicsDeclared(dcsBits);
433 
434  // Some info-level logging
435  edm::LogInfo("DQMProvInfo") << "Physics declared bit: " << physicsDeclared << std::endl;
436 
437  // Part 1: Physics declared bit in y bin VBIN_PHYSICS_DECLARED
438  // This also is used as the global value of the summary.
439  if (physicsDeclared) {
440  fillSummaryMapBin(currentLSNumber, VBIN_PHYSICS_DECLARED, 1.);
441  } else {
442  fillSummaryMapBin(currentLSNumber, VBIN_PHYSICS_DECLARED, 0.);
443  }
444 
445  // Part2: DCS bits in y bins 1 to MAX_DCS_VBINS
446  for (int vbin = 1; vbin <= MAX_DCS_VBINS; vbin++) {
447  if (dcsBits[vbin]) {
448  fillSummaryMapBin(currentLSNumber, vbin, 1.);
449  } else {
450  fillSummaryMapBin(currentLSNumber, vbin, 0.);
451  }
452  }
453 }
454 
456  // Only trying to retrieve the global tag for the first event we ever
457  // encounter.
458  if (!globalTagRetrieved_) {
459  // Getting the real process name for the given event
460  std::string processName = event.processHistory()[event.processHistory().size() - 1].processName();
461  // Getting parameters for that process
463  event.getProcessParameterSet(processName, ps);
464  // Getting the global tag
465  globalTag_ = ps.getParameterSet("PoolDBESSource@GlobalTag").getParameter<std::string>("globaltag");
467  // Finaly: Setting globalTagRetrieved_ to true, since we got it now
468  globalTagRetrieved_ = true;
469  }
470 }
471 
473  dcsBits[VBIN_CSC_P] = dcsRecord.highVoltageReady(DCSRecord::Partition::CSCp);
474  dcsBits[VBIN_CSC_M] = dcsRecord.highVoltageReady(DCSRecord::Partition::CSCm);
475  dcsBits[VBIN_DT_0] = dcsRecord.highVoltageReady(DCSRecord::Partition::DT0);
476  dcsBits[VBIN_DT_P] = dcsRecord.highVoltageReady(DCSRecord::Partition::DTp);
477  dcsBits[VBIN_DT_M] = dcsRecord.highVoltageReady(DCSRecord::Partition::DTm);
478  dcsBits[VBIN_EB_P] = dcsRecord.highVoltageReady(DCSRecord::Partition::EBp);
479  dcsBits[VBIN_EB_M] = dcsRecord.highVoltageReady(DCSRecord::Partition::EBm);
480  dcsBits[VBIN_EE_P] = dcsRecord.highVoltageReady(DCSRecord::Partition::EEp);
481  dcsBits[VBIN_EE_M] = dcsRecord.highVoltageReady(DCSRecord::Partition::EEm);
482  dcsBits[VBIN_ES_P] = dcsRecord.highVoltageReady(DCSRecord::Partition::ESp);
483  dcsBits[VBIN_ES_M] = dcsRecord.highVoltageReady(DCSRecord::Partition::ESm);
484  dcsBits[VBIN_HBHE_A] = dcsRecord.highVoltageReady(DCSRecord::Partition::HBHEa);
485  dcsBits[VBIN_HBHE_B] = dcsRecord.highVoltageReady(DCSRecord::Partition::HBHEb);
486  dcsBits[VBIN_HBHE_C] = dcsRecord.highVoltageReady(DCSRecord::Partition::HBHEc);
487  dcsBits[VBIN_HF] = dcsRecord.highVoltageReady(DCSRecord::Partition::HF);
488  dcsBits[VBIN_HO] = dcsRecord.highVoltageReady(DCSRecord::Partition::HO);
489  dcsBits[VBIN_BPIX] = dcsRecord.highVoltageReady(DCSRecord::Partition::BPIX);
490  dcsBits[VBIN_FPIX] = dcsRecord.highVoltageReady(DCSRecord::Partition::FPIX);
491  dcsBits[VBIN_RPC] = dcsRecord.highVoltageReady(DCSRecord::Partition::RPC);
492  dcsBits[VBIN_TIBTID] = dcsRecord.highVoltageReady(DCSRecord::Partition::TIBTID);
493  dcsBits[VBIN_TOB] = dcsRecord.highVoltageReady(DCSRecord::Partition::TOB);
494  dcsBits[VBIN_TEC_P] = dcsRecord.highVoltageReady(DCSRecord::Partition::TECp);
495  dcsBits[VBIN_TE_M] = dcsRecord.highVoltageReady(DCSRecord::Partition::TECm);
496  dcsBits[VBIN_CASTOR] = dcsRecord.highVoltageReady(DCSRecord::Partition::CASTOR);
497  dcsBits[VBIN_ZDC] = dcsRecord.highVoltageReady(DCSRecord::Partition::ZDC);
498  dcsBits[VBIN_GEM_P] = dcsRecord.highVoltageReady(DCSRecord::Partition::GEMp);
499  dcsBits[VBIN_GEM_M] = dcsRecord.highVoltageReady(DCSRecord::Partition::GEMm);
500 }
501 
503  bool* dcsBits) {
504  // Loop over the DCSStatus entries in the DcsStatusCollection
505  // (Typically there is only one)
506  bool first = true;
507  for (auto const& dcsStatusItr : *dcsStatusCollection) {
508  // By default all the bits are false. We put all the bits on true only
509  // for the first DCSStatus that we encounter:
510  if (first) {
511  for (int vbin = 1; vbin <= MAX_DCS_VBINS; vbin++) {
512  dcsBits[vbin] = true;
513  }
514  first = false;
515  }
516  dcsBits[VBIN_CSC_P] &= dcsStatusItr.ready(DcsStatus::CSCp);
517  dcsBits[VBIN_CSC_M] &= dcsStatusItr.ready(DcsStatus::CSCm);
518  dcsBits[VBIN_DT_0] &= dcsStatusItr.ready(DcsStatus::DT0);
519  dcsBits[VBIN_DT_P] &= dcsStatusItr.ready(DcsStatus::DTp);
520  dcsBits[VBIN_DT_M] &= dcsStatusItr.ready(DcsStatus::DTm);
521  dcsBits[VBIN_EB_P] &= dcsStatusItr.ready(DcsStatus::EBp);
522  dcsBits[VBIN_EB_M] &= dcsStatusItr.ready(DcsStatus::EBm);
523  dcsBits[VBIN_EE_P] &= dcsStatusItr.ready(DcsStatus::EEp);
524  dcsBits[VBIN_EE_M] &= dcsStatusItr.ready(DcsStatus::EEm);
525  dcsBits[VBIN_ES_P] &= dcsStatusItr.ready(DcsStatus::ESp);
526  dcsBits[VBIN_ES_M] &= dcsStatusItr.ready(DcsStatus::ESm);
527  dcsBits[VBIN_HBHE_A] &= dcsStatusItr.ready(DcsStatus::HBHEa);
528  dcsBits[VBIN_HBHE_B] &= dcsStatusItr.ready(DcsStatus::HBHEb);
529  dcsBits[VBIN_HBHE_C] &= dcsStatusItr.ready(DcsStatus::HBHEc);
530  dcsBits[VBIN_HF] &= dcsStatusItr.ready(DcsStatus::HF);
531  dcsBits[VBIN_HO] &= dcsStatusItr.ready(DcsStatus::HO);
532  dcsBits[VBIN_BPIX] &= dcsStatusItr.ready(DcsStatus::BPIX);
533  dcsBits[VBIN_FPIX] &= dcsStatusItr.ready(DcsStatus::FPIX);
534  dcsBits[VBIN_RPC] &= dcsStatusItr.ready(DcsStatus::RPC);
535  dcsBits[VBIN_TIBTID] &= dcsStatusItr.ready(DcsStatus::TIBTID);
536  dcsBits[VBIN_TOB] &= dcsStatusItr.ready(DcsStatus::TOB);
537  dcsBits[VBIN_TEC_P] &= dcsStatusItr.ready(DcsStatus::TECp);
538  dcsBits[VBIN_TE_M] &= dcsStatusItr.ready(DcsStatus::TECm);
539  dcsBits[VBIN_CASTOR] &= dcsStatusItr.ready(DcsStatus::CASTOR);
540  dcsBits[VBIN_ZDC] &= dcsStatusItr.ready(DcsStatus::ZDC);
541  //dcsBits[VBIN_GEM_P] &= dcsStatusItr.ready(DcsStatus::GEMp); // GEMp and GEMm are not implemented
542  //dcsBits[VBIN_GEM_M] &= dcsStatusItr.ready(DcsStatus::GEMm);
543 
544  // Some info-level logging
545  edm::LogInfo("DQMProvInfo") << "DCS status: 0x" << std::hex << dcsStatusItr.ready() << std::dec << std::endl;
546  }
547 }
548 
549 bool DQMProvInfo::isPhysicsDeclared(bool* dcsBits) {
550  // Compute the PhysicsDeclared bit from the event
551  // The bit is set to to true if:
552  // - the LHC is in stable beams
553  // - all the pixel and strips partitions have DCSStatus ON
554  // - at least one muon partition has DCSStatus ON
555  // Basically: we do an AND of the physicsDeclared of ALL events.
556  // As soon as one value is not "1", physicsDeclared_ becomes false.
557  return (beamMode_ == 11) &&
558  (dcsBits[VBIN_BPIX] && dcsBits[VBIN_FPIX] && dcsBits[VBIN_TIBTID] && dcsBits[VBIN_TOB] &&
559  dcsBits[VBIN_TEC_P] && dcsBits[VBIN_TE_M]) &&
560  (dcsBits[VBIN_CSC_P] || dcsBits[VBIN_CSC_M] || dcsBits[VBIN_DT_0] || dcsBits[VBIN_DT_P] ||
561  dcsBits[VBIN_DT_M] || dcsBits[VBIN_RPC] || dcsBits[VBIN_GEM_P] || dcsBits[VBIN_GEM_M]);
562 }
563 
565  // Initially we want all lumisection to be blank (-1) and
566  // white instead of red which is misleading.
567  for (int ls = 0; ls < MAX_LUMIS; ls++) {
568  // Color all the bins white (-1)
569  for (int vBin = 1; vBin <= MAX_VBINS; vBin++) {
570  reportSummaryMap_->setBinContent(ls, vBin, -1.);
571  }
572  }
573 }
574 
575 void DQMProvInfo::fillSummaryMapBin(int ls, int bin, double value) {
576  // All lumis are initialized as -1 (white).
577  // We'll set them to red (0) whenever we see a 0 -- else, the value should be
578  // green (1).
579  // This need to be atomic, DQMOneEDAnalyzer for this reason.
580  double current = reportSummaryMap_->getBinContent(ls, bin);
581  if (current == -1) {
583  } else if (value < current) {
585  } // else: ignore, keep min value.
586 }
587 
588 void DQMProvInfo::setupLumiSection(int currentLSNumber) {
589  if (reportSummaryMap_->getBinContent(currentLSNumber, VBIN_VALID) < 1.) {
590  reportSummaryMap_->setBinContent(currentLSNumber, VBIN_VALID, 1.);
591 
592  // Mark all lower LS as invalid, if they are not set valid yet.
593  // This is a hint for the render plugin to show the correct range.
594  for (int ls = 1; ls < currentLSNumber; ls++) {
597  }
598  }
599  }
600 }
601 
void fillSummaryMapBin(int ls, int bin, double value)
Definition: DQMProvInfo.cc:575
MonitorElement * hBeamMode_
Definition: DQMProvInfo.cc:124
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:80
MonitorElement * hIntensity2_
Definition: DQMProvInfo.cc:127
MonitorElement * reportSummary_
Definition: DQMProvInfo.cc:132
void analyzeEventInfo(const edm::Event &e)
Definition: DQMProvInfo.cc:407
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
static const int VBIN_GEM_P
Definition: DQMProvInfo.cc:88
MonitorElement * hMomentum_
Definition: DQMProvInfo.cc:129
static const int VBIN_EE_P
Definition: DQMProvInfo.cc:70
MonitorElement * workingDir_
Definition: DQMProvInfo.cc:147
static const int VBIN_GEM_M
Definition: DQMProvInfo.cc:89
void fillDcsBitsFromDcsStatusCollection(const edm::Handle< DcsStatusCollection > &, bool *dcsBits)
Definition: DQMProvInfo.cc:502
edm::EDGetTokenT< DcsStatusCollection > dcsStatusCollection_
Definition: DQMProvInfo.cc:119
ParameterSet const & getParameterSet(std::string const &) const
edm::EDGetTokenT< DCSRecord > dcsRecordToken_
Definition: DQMProvInfo.cc:121
static const int VBIN_VALID
Definition: DQMProvInfo.cc:99
Class to contain DCS information from soft FED 1022.
Definition: DCSRecord.h:20
uint32_t const getIntensityBeam2() const
Definition: BSTRecord.h:85
MonitorElement * processId_
Definition: DQMProvInfo.cc:146
MonitorElement * hHltKey_
Definition: DQMProvInfo.cc:142
Log< level::Error, false > LogError
void blankAllLumiSections()
Definition: DQMProvInfo.cc:564
MonitorElement * versGlobaltag_
Definition: DQMProvInfo.cc:137
static const int VBIN_CASTOR
Definition: DQMProvInfo.cc:86
static const int VBIN_HBHE_B
Definition: DQMProvInfo.cc:75
static const int VBIN_EE_M
Definition: DQMProvInfo.cc:71
MonitorElement * bookString(TString const &name, TString const &value, FUNC onbooking=NOOP())
Definition: DQMStore.h:87
static const int VBIN_HBHE_C
Definition: DQMProvInfo.cc:76
bool globalTagRetrieved_
Definition: DQMProvInfo.cc:139
static const int VBIN_HO
Definition: DQMProvInfo.cc:78
uint32_t const getIntensityBeam1() const
Definition: BSTRecord.h:82
T getUntrackedParameter(std::string const &, T const &) const
void Fill(long long x)
std::string globalTag_
Definition: DQMProvInfo.cc:138
static const int VBIN_DT_0
Definition: DQMProvInfo.cc:65
static const int VBIN_TEC_P
Definition: DQMProvInfo.cc:84
void bookHistogramsEventInfo(DQMStore::IBooker &)
Definition: DQMProvInfo.cc:269
static const int VBIN_CSC_M
Definition: DQMProvInfo.cc:64
MonitorElement * versRuntype_
Definition: DQMProvInfo.cc:140
static const int VBIN_TOB
Definition: DQMProvInfo.cc:83
static const int VBIN_FPIX
Definition: DQMProvInfo.cc:80
static const int MAX_LUMIS
Definition: DQMProvInfo.cc:60
static const int VBIN_DT_M
Definition: DQMProvInfo.cc:67
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
static const int VBIN_MOMENTUM
Definition: DQMProvInfo.cc:97
Definition: value.py:1
void bookHistogramsProvInfo(DQMStore::IBooker &)
Definition: DQMProvInfo.cc:319
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
void bookHistogramsLhcInfo(DQMStore::IBooker &)
Definition: DQMProvInfo.cc:218
void analyzeProvInfo(const edm::Event &e)
Definition: DQMProvInfo.cc:455
static const int MAX_MOMENTUM
Definition: DQMProvInfo.cc:105
void dqmBeginRun(const edm::Run &r, const edm::EventSetup &c) override
Definition: DQMProvInfo.cc:182
const BSTRecord & getBST() const
Definition: TCDSRecord.h:100
int32_t const getBeamMomentum() const
Definition: BSTRecord.h:79
#define BPIX
static const int MAX_VBINS
Definition: DQMProvInfo.cc:101
std::string subsystemname_
Definition: DQMProvInfo.cc:116
uint16_t const getBeamMode() const
Definition: BSTRecord.h:70
MonitorElement * hLhcFill_
Definition: DQMProvInfo.cc:128
std::string getReleaseVersion()
Log< level::Info, false > LogInfo
void fillDcsBitsFromDCSRecord(const DCSRecord &, bool *dcsBits)
Definition: DQMProvInfo.cc:472
static const int VBIN_STABLE_BEAM
Definition: DQMProvInfo.cc:98
static const int VBIN_TIBTID
Definition: DQMProvInfo.cc:82
def ls(path, rec=False)
Definition: eostools.py:349
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Definition: DQMProvInfo.cc:350
static const int VBIN_EB_P
Definition: DQMProvInfo.cc:68
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
static const int VBIN_BPIX
Definition: DQMProvInfo.cc:79
void analyzeLhcInfo(const edm::Event &e)
Definition: DQMProvInfo.cc:365
MonitorElement * hIntensity1_
Definition: DQMProvInfo.cc:126
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:212
static const int VBIN_TE_M
Definition: DQMProvInfo.cc:85
MonitorElement * bookInt(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:73
static const int VBIN_RPC
Definition: DQMProvInfo.cc:81
MonitorElement * versCMSSW_
Definition: DQMProvInfo.cc:136
MonitorElement * hIsCollisionsRun_
Definition: DQMProvInfo.cc:145
std::string runType_
Definition: DQMProvInfo.cc:141
~DQMProvInfo() override=default
bool isValid() const
Definition: HandleBase.h:70
edm::EDGetTokenT< TCDSRecord > tcdsrecord_
Definition: DQMProvInfo.cc:120
static const int MAX_DCS_VBINS
Definition: DQMProvInfo.cc:94
static const int VBIN_ZDC
Definition: DQMProvInfo.cc:87
DQMProvInfo(const edm::ParameterSet &ps)
Definition: DQMProvInfo.cc:158
static const int VBIN_ES_P
Definition: DQMProvInfo.cc:72
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: DQMProvInfo.cc:200
std::string hltKey_
Definition: DQMProvInfo.cc:143
static const int VBIN_CSC_P
Definition: DQMProvInfo.cc:63
bool isPhysicsDeclared(bool *dcsBits)
Definition: DQMProvInfo.cc:549
static const int VBIN_DT_P
Definition: DQMProvInfo.cc:66
static const int VBIN_ES_M
Definition: DQMProvInfo.cc:73
uint32_t const getLhcFill() const
Definition: BSTRecord.h:67
Log< level::Warning, false > LogWarning
std::string provinfofolder_
Definition: DQMProvInfo.cc:117
static const int MOMENTUM_OFFSET
Definition: DQMProvInfo.cc:113
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
void setupLumiSection(int ls)
Definition: DQMProvInfo.cc:588
static const int VBIN_HF
Definition: DQMProvInfo.cc:77
MonitorElement * hostName_
Definition: DQMProvInfo.cc:144
static const int VBIN_HBHE_A
Definition: DQMProvInfo.cc:74
static const int VBIN_EB_M
Definition: DQMProvInfo.cc:69
Definition: event.py:1
Definition: Run.h:45
MonitorElement * reportSummaryMap_
Definition: DQMProvInfo.cc:133
static const int VBIN_PHYSICS_DECLARED
Definition: DQMProvInfo.cc:96
virtual double getBinContent(int binx) const
get content of bin (1-D)
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)