CMS 3D CMS Logo

BeamSpotDipServer.cc
Go to the documentation of this file.
2 
9 
10 #include <fstream>
11 #include <vector>
12 #include <ctime>
13 #include <sys/stat.h>
14 
15 #include "Dip.h"
16 #include "DipFactory.h"
17 #include "DipPublication.h"
18 #include "DipTimestamp.h"
19 
20 using namespace std;
21 
22 /*****************************************************************************/
23 class ErrHandler : public DipPublicationErrorHandler {
24 public:
25  virtual ~ErrHandler() = default;
26 
27 private:
28  void handleException(DipPublication* publication, DipException& e) override {
29  edm::LogError("BeamSpotDipServer") << "exception (create): " << e.what();
30  }
31 };
32 
33 /*****************************************************************************/
35  //
36  verbose = ps.getUntrackedParameter<bool>("verbose");
37  testing = ps.getUntrackedParameter<bool>("testing");
38 
39  subjectCMS = ps.getUntrackedParameter<string>("subjectCMS");
40  subjectLHC = ps.getUntrackedParameter<string>("subjectLHC");
41  subjectPV = ps.getUntrackedParameter<string>("subjectPV");
42 
43  readFromNFS = ps.getUntrackedParameter<bool>("readFromNFS");
44  // only if readFromNFS = true
45  sourceFile = ps.getUntrackedParameter<string>("sourceFile"); // beamspot
46  sourceFile1 = ps.getUntrackedParameter<string>("sourceFile1"); // tk status
47 
48  timeoutLS = ps.getUntrackedParameter<vector<int>>("timeoutLS");
49 
50  //
51  bsLegacyToken_ = esConsumes<edm::Transition::EndLuminosityBlock>();
52 
53  dcsRecordInputTag_ = ps.getParameter<edm::InputTag>("dcsRecordInputTag");
54  dcsRecordToken_ = consumes<DCSRecord>(dcsRecordInputTag_);
55 
56  //
57  dip = Dip::create("CmsBeamSpotServer");
58  edm::LogInfo("BeamSpotDipServer") << "reading from " << (readFromNFS ? "file (NFS)" : "database");
59 }
60 
61 /*****************************************************************************/
63  // do nothing
64 }
65 
66 /*****************************************************************************/
68  edm::LogInfo("BeamSpotDipServer") << "begin run " << r.run();
69 
70  try {
71  ErrHandler errHandler;
72 
73  edm::LogInfo("BeamSpotDipServer") << "server started at " + getDateTime();
74 
75  edm::LogInfo("BeamSpotDipServer") << "creating publication " + subjectCMS;
76  publicationCMS = dip->createDipPublication(subjectCMS.c_str(), &errHandler);
77  messageCMS = dip->createDipData();
78 
79  edm::LogInfo("BeamSpotDipServer") << "creating publication " + subjectLHC;
80  publicationLHC = dip->createDipPublication(subjectLHC.c_str(), &errHandler);
81  messageLHC = dip->createDipData();
82 
83  edm::LogInfo("BeamSpotDipServer") << "creating publication " + subjectPV;
84  publicationPV = dip->createDipPublication(subjectPV.c_str(), &errHandler);
85  messagePV = dip->createDipData();
86 
87  trueRcd(); // starts with all 0
88  publishRcd("UNINITIALIZED", "", true, false);
89  } catch (exception& e) {
90  edm::LogError("BeamSpotDipServer") << "exception (start up): " << e.what();
91  }
92 
93  quality = qualities[0]; // start with Uncertain
94 }
95 
96 /*****************************************************************************/
98  // do nothing
99 }
100 
101 /*****************************************************************************/
103  if (!readFromNFS) {
104  // get runnumber
105  runnum = iEvent.run();
106 
107  // get tracker status if in a new lumisection
108  int nthlumi = iEvent.luminosityBlock();
109 
110  if (nthlumi > lastlumi) { // check every LS
111  lastlumi = nthlumi;
112 
114  iEvent.getByToken(dcsRecordToken_, dcsRecord);
115 
116  wholeTrackerOn =
117  (*dcsRecord).highVoltageReady(DCSRecord::BPIX) && (*dcsRecord).highVoltageReady(DCSRecord::FPIX) &&
118  (*dcsRecord).highVoltageReady(DCSRecord::TIBTID) && (*dcsRecord).highVoltageReady(DCSRecord::TOB) &&
119  (*dcsRecord).highVoltageReady(DCSRecord::TECp) && (*dcsRecord).highVoltageReady(DCSRecord::TECm);
120 
121  if (verbose)
122  edm::LogInfo("BeamSpotDipServer") << "whole tracker on? " << (wholeTrackerOn ? "yes" : "no");
123  }
124  }
125 }
126 
127 /*****************************************************************************/
129  edm::LogInfo("BeamSpotDipServer") << "--------------------- end of LS " << lumiSeg.luminosityBlock();
130 
131  try {
132  if (readFromNFS) {
133  ifstream logFile(sourceFile);
134 
135  if (!logFile.good()) {
136  edm::LogWarning("BeamSpotDipServer") << "Source File: " + sourceFile + " doesn't exist!";
137  problem();
138  } else {
139  lastModTime = getLastTime(sourceFile);
140 
141  if (lastFitTime == 0)
142  lastFitTime = lastModTime;
143 
144  if (getFileSize(sourceFile) == 0) {
145  // source file has zero length
146  if (lastModTime > lastFitTime) {
147  string tmp = tkStatus();
148  edm::LogInfo("BeamSpotDipServer") << "New run starts. Run number: " << runnum;
149  if (verbose)
150  edm::LogInfo("BeamSpotDipServer") << "Initial lastModTime = " + getDateTime(lastModTime);
151  }
152  lastFitTime = lastModTime;
153  }
154 
155  if (lastModTime > lastFitTime) {
156  // source file modified
157  if (verbose) {
158  edm::LogInfo("BeamSpotDipServer") << "time of last fit = " + getDateTime(lastFitTime);
159  edm::LogInfo("BeamSpotDipServer") << "time of current fit = " + getDateTime(lastModTime);
160  }
161  lastFitTime = lastModTime;
162 
163  // source file length > 0
164  if (getFileSize(sourceFile) > 0) {
165  if (verbose)
166  edm::LogInfo("BeamSpotDipServer") << "reading record from " + sourceFile;
167 
168  if (readRcd(logFile)) {
169  if (verbose)
170  edm::LogInfo("BeamSpotDipServer") << "got new record from file";
171 
172  trueRcd();
173  alive.reset();
174  alive.flip(7);
175  } else {
176  if (verbose)
177  edm::LogInfo("BeamSpotDipServer") << "problem with new record";
178  fakeRcd();
179  }
180 
181  lsCount = 0;
182  }
183  } else {
184  // source file not touched
185  problem();
186  }
187  }
188 
189  logFile.close();
190  } else {
191  edm::ESHandle<BeamSpotOnlineObjects> bsLegacyHandle = iSetup.getHandle(bsLegacyToken_);
192  auto const& bs = *bsLegacyHandle;
193 
194  // from database
195  if (readRcd(bs)) {
196  if (verbose)
197  edm::LogInfo("BeamSpotDipServer") << "got new record from database";
198  trueRcd();
199  alive.reset();
200  alive.flip(7);
201  } else {
202  if (verbose)
203  edm::LogInfo("BeamSpotDipServer") << "problem with new record";
204  fakeRcd();
205  }
206 
207  lsCount = 0;
208  }
209 
210  // quality of the publish results
211  if (testing)
212  publishRcd(qualities[0], "Testing", true, true); // Uncertain
213  else if (quality == qualities[1]) // Bad
214  publishRcd(quality, "No fit or fit fails", true, true);
215  else
216  publishRcd(quality, "", true, true); // Good
217  } catch (exception& e) {
218  edm::LogWarning("BeamSpotDipServer") << "io exception (end of lumi): " << e.what();
219  };
220 }
221 
222 /*****************************************************************************/
224  // destroy publications and data
225  edm::LogInfo("BeamSpotDipServer") << "destroying publication " + subjectCMS;
226  dip->destroyDipPublication(publicationCMS);
227  delete messageCMS;
228 
229  edm::LogInfo("BeamSpotDipServer") << "destroying publication " + subjectLHC;
230  dip->destroyDipPublication(publicationLHC);
231  delete messageLHC;
232 
233  edm::LogInfo("BeamSpotDipServer") << "destroying publication " + subjectPV;
234  dip->destroyDipPublication(publicationPV);
235  delete messagePV;
236 }
237 
238 /*****************************************************************************/
240  struct stat stat_buf;
241  int rc = stat(filename.c_str(), &stat_buf);
242  return (rc == 0 ? stat_buf.st_size : -1);
243 }
244 
245 /*****************************************************************************/
247  struct stat stat_buf;
248  int rc = stat(filename.c_str(), &stat_buf);
249  return (rc == 0 ? stat_buf.st_mtime : -1);
250 }
251 
252 /*****************************************************************************/
253 vector<string> BeamSpotDipServer::parse(string line, const string& delimiter) {
254  vector<string> list;
255 
256  size_t pos = 0;
257  while ((pos = line.find(delimiter)) != string::npos) {
258  string token = line.substr(0, pos);
259 
260  list.push_back(token);
261 
262  line.erase(0, pos + delimiter.length());
263  }
264 
265  list.push_back(line); // remainder
266 
267  return list;
268 }
269 
270 /*****************************************************************************/
272  string outstr;
273 
274  if (readFromNFS) { // get from file on /nfs
275  ifstream logfile(sourceFile1);
276 
277  if (!logfile.good() || getFileSize(sourceFile1) == 0) {
278  // file does not exist or has zero size
279  outstr = "No CMS Tracker status available. No DAQ/DQM.";
280  } else {
281  int nthLnInRcd = 0;
282  string record;
283 
284  try {
285  string record;
286 
287  while (getline(logfile, record)) {
288  nthLnInRcd++;
289  vector<string> tmp = parse(record, " ");
290 
291  switch (nthLnInRcd) {
292  case 7:
293  if (tmp[1].find("Yes") == string::npos)
294  outstr = "CMS Tracker OFF.";
295  else
296  outstr = "CMS not taking data or no beam.";
297  break;
298  case 8:
299  runnum = stoi(tmp[1]);
300  break;
301  default:
302  break;
303  }
304  }
305  } catch (exception& e) {
306  edm::LogWarning("BeamSpotDipServer") << "exception (tkStatus): " << e.what();
307  }
308  }
309 
310  logfile.close();
311  } else {
312  // get from DCS
313  if (wholeTrackerOn)
314  outstr = "CMS not taking data or no beam.";
315  else
316  outstr = "CMS Tracker OFF.";
317  }
318 
319  return outstr;
320 }
321 
322 /*****************************************************************************/
324  if (verbose)
325  edm::LogInfo("BeamSpotDipServer") << "no update | alive = " << alive;
326 
327  lsCount++;
328 
329  if ((lsCount % timeoutLS[0] == 0) && (lsCount % timeoutLS[1] != 0)) // first time out
330  {
331  if (!alive.test(1))
332  alive.flip(1);
333  if (!alive.test(2)) {
334  if (!alive.test(7))
335  fakeRcd();
336  else
337  trueRcd();
338 
339  stringstream warnMsg;
340  warnMsg << "No new data for " << lsCount << " LS";
341  publishRcd("Uncertain", warnMsg.str(), false, false);
342  } else {
343  fakeRcd();
344 
345  stringstream warnMsg;
346  warnMsg << "No new data for " << lsCount << " LS: " << tkStatus();
347  publishRcd("Bad", warnMsg.str(), false, false);
348  }
349  } else if (lsCount % timeoutLS[1] == 0) // second time out
350  {
351  if (!alive.test(2))
352  alive.flip(2);
353  fakeRcd();
354 
355  stringstream warnMsg;
356  warnMsg << "No new data for " << lsCount << " LS: " << tkStatus();
357  publishRcd("Bad", warnMsg.str(), false, false);
358  }
359 }
360 
361 /*****************************************************************************/
363 // read from database
364 {
365  runnum = bs.GetLastAnalyzedRun();
366 
367  // get from BeamSpotOnlineObject
368 
369  try {
370  startTime = bs.GetStartTime();
371  startTimeStamp = bs.GetStartTimeStamp();
372  endTime = bs.GetEndTime();
373  endTimeStamp = bs.GetEndTimeStamp();
374  } catch (exception& e) {
375  edm::LogWarning("BeamSpotDipServer") << "time variables are not available (readRcd): " << e.what();
376 
377  startTime = bs.GetCreationTime();
378  startTimeStamp = bs.GetCreationTime();
379  endTime = bs.GetCreationTime();
380  endTimeStamp = bs.GetCreationTime();
381  }
382 
383  try {
384  lumiRange = bs.GetLumiRange();
385  } catch (exception& e) {
386  edm::LogWarning("BeamSpotDipServer") << "lumirange variable not avaialble (readRcd): " << e.what();
387 
388  lumiRange = to_string(bs.GetLastAnalyzedLumi());
389  }
390 
391  currentLS = bs.GetLastAnalyzedLumi();
392 
393  type = bs.GetBeamType();
394 
395  if (verbose)
396  edm::LogInfo("BeamSpotDipServer") << "run: " << runnum << ", LS: " << currentLS << ", time: " << startTime << " "
397  << startTimeStamp << ", type: " << type;
398 
399  if (testing)
400  quality = qualities[0]; // Uncertain
401  else if (type >= 2)
402  quality = qualities[2]; // Good
403  else
404  quality = qualities[1]; // Bad
405 
406  x = bs.GetX();
407  y = bs.GetY();
408  z = bs.GetZ();
409 
410  sigma_z = bs.GetSigmaZ();
411  dxdz = bs.Getdxdz();
412  dydz = bs.Getdydz();
413  width_x = bs.GetBeamWidthX();
414  width_y = bs.GetBeamWidthX();
415 
416  err_x = bs.GetXError();
417  err_y = bs.GetYError();
418  err_z = bs.GetZError();
419  err_sigma_z = bs.GetSigmaZError();
420  err_dxdz = bs.GetdxdzError();
421  err_dydz = bs.GetdydzError();
422  err_width_x = bs.GetBeamWidthXError();
423  err_width_y = bs.GetBeamWidthYError();
424 
425  try {
426  events = bs.GetUsedEvents();
427  meanPV = bs.GetMeanPV();
428  err_meanPV = bs.GetMeanErrorPV();
429  rmsPV = bs.GetRmsPV();
430  err_rmsPV = bs.GetRmsErrorPV();
431  maxPV = bs.GetMaxPVs();
432  } catch (exception& e) {
433  edm::LogWarning("BeamSpotDipServer") << "PV variables are not available (readRcd): " << e.what();
434 
435  events = 0.;
436  meanPV = 0.;
437  err_meanPV = 0.;
438  rmsPV = 0.;
439  err_rmsPV = 0.;
440  maxPV = 0.;
441  }
442 
443  nPV = bs.GetNumPVs();
444 
445  if (verbose)
446  edm::LogInfo("BeamSpotDipServer") << "pos: (" << x << "," << y << "," << z << ")"
447  << " nPV: " << nPV;
448 
449  return true;
450 }
451 
452 /*****************************************************************************/
453 bool BeamSpotDipServer::readRcd(ifstream& file) // readFromNFS
454 {
455  int nthLnInRcd = 0;
456  bool rcdQlty = false;
457 
458  try {
459  string record;
460  while (getline(file, record)) {
461  nthLnInRcd++;
462 
463  vector<string> tmp = parse(record, " ");
464 
465  switch (nthLnInRcd) {
466  case 1:
467  if (record.rfind("Run", 0) != 0) {
468  edm::LogError("BeamSpotDipServer") << "Reading of results text file interrupted. " + getDateTime();
469  return false;
470  }
471  runnum = stoi(tmp[1]);
472  break;
473  case 2:
474  startTime = tmp[1] + " " + tmp[2] + " " + tmp[3];
475  startTimeStamp = stol(tmp[4]);
476  break;
477  case 3:
478  endTime = tmp[1] + " " + tmp[2] + " " + tmp[3];
479  endTimeStamp = stol(tmp[4]);
480  break;
481  case 4:
482  lumiRange = record.substr(10);
483  if (verbose)
484  edm::LogInfo("BeamSpotDipServer") << "lumisection range: " + lumiRange;
485  currentLS = stoi(tmp[3]);
486  break;
487  case 5:
488  type = stoi(tmp[1]);
489  if (testing)
490  quality = qualities[0]; // Uncertain
491  else if (type >= 2)
492  quality = qualities[2]; // Good
493  else
494  quality = qualities[1]; // Bad
495  break;
496 
497  case 6:
498  x = stof(tmp[1]);
499  break;
500  case 7:
501  y = stof(tmp[1]);
502  break;
503  case 8:
504  z = stof(tmp[1]);
505  break;
506 
507  case 9:
508  sigma_z = stof(tmp[1]);
509  break;
510  case 10:
511  dxdz = stof(tmp[1]);
512  break;
513  case 11:
514  dydz = stof(tmp[1]);
515  break;
516  case 12:
517  width_x = stof(tmp[1]);
518  break;
519  case 13:
520  width_y = stof(tmp[1]);
521  break;
522 
523  case 14:
524  err_x = sqrt(stof(tmp[1]));
525  break;
526  case 15:
527  err_y = sqrt(stof(tmp[2]));
528  break;
529  case 16:
530  err_z = sqrt(stof(tmp[3]));
531  break;
532  case 17:
533  err_sigma_z = sqrt(stof(tmp[4]));
534  break;
535  case 18:
536  err_dxdz = sqrt(stof(tmp[5]));
537  break;
538  case 19:
539  err_dydz = sqrt(stof(tmp[6]));
540  break;
541  case 20:
542  err_width_x = sqrt(stof(tmp[7]));
543  err_width_y = err_width_x;
544  break;
545  case 21:
546  break;
547  case 22:
548  break;
549  case 23:
550  break;
551  case 24:
552  events = stoi(tmp[1]);
553  break;
554 
555  case 25:
556  meanPV = stof(tmp[1]);
557  break;
558  case 26:
559  err_meanPV = stof(tmp[1]);
560  break;
561  case 27:
562  rmsPV = stof(tmp[1]);
563  break;
564  case 28:
565  err_rmsPV = stof(tmp[1]);
566  break;
567  case 29:
568  maxPV = stoi(tmp[1]);
569  break;
570  case 30:
571  nPV = stoi(tmp[1]);
572  rcdQlty = true;
573  break;
574 
575  default:
576  break;
577  }
578  }
579 
580  file.close();
581  } catch (exception& e) {
582  edm::LogWarning("BeamSpotDipServer") << "io exception (readRcd): " << e.what();
583  }
584 
585  return rcdQlty;
586 }
587 
588 /*****************************************************************************/
589 void BeamSpotDipServer::CMS2LHCRF_POS(float x, float y, float z) {
590  if (x != 0) { // Rotation + Translation + Inversion + Scaling
591  double tmpx = x;
592  // x*rotY[0]*rotZ[0] + y*rotY[0]*rotZ[1] - z*rotY[1] + trans[0];
593  Centroid[0] = tmpx;
594  Centroid[0] *= -1.0 * cm2um;
595  } else
596  Centroid[0] = x;
597 
598  if (y != 0) { // Rotation + Translation + Scaling
599  double tmpy = y;
600  // x*(rotX[1]*rotY[1]*rotZ[0] - rotX[0]*rotZ[1]) +
601  // y*(rotX[0]*rotZ[0] + rotX[1]*rotY[1]*rotZ[1]) +
602  // z*rotX[1]*rotY[0] + trans[1];
603  Centroid[1] = tmpy;
604  Centroid[1] *= cm2um;
605  } else
606  Centroid[1] = y;
607 
608  if (z != 0) { // Rotation + Translation + Inversion + Scaling
609  double tmpz = z;
610  // x*(rotX[0]*rotY[1]*rotZ[0] + rotX[1]*rotZ[1]) +
611  // y*(rotX[0]*rotY[1]*rotZ[1] - rotX[1]*rotZ[0]) +
612  // z*rotX[0]*rotY[0] + trans[2];
613  Centroid[2] = tmpz;
614  Centroid[2] *= -1.0 * cm2mm;
615  } else
616  Centroid[2] = z;
617 }
618 
619 /*****************************************************************************/
621  try {
622  // CMS to LHC RF
623  CMS2LHCRF_POS(x, y, z);
624 
625  Tilt[0] = dxdz * rad2urad;
626  Tilt[1] = (dydz != 0 ? (dydz * -1 * rad2urad) : 0);
627 
628  Size[0] = width_x * cm2um;
629  Size[1] = width_y * cm2um;
630  Size[2] = sigma_z * cm2mm;
631 
632  // CMS
633  messageCMS->insert(runnum, "runnum");
634  messageCMS->insert(startTime, "startTime");
635  messageCMS->insert(endTime, "endTime");
636  messageCMS->insert(startTimeStamp, "startTimeStamp");
637  messageCMS->insert(endTimeStamp, "endTimeStamp");
638  messageCMS->insert(lumiRange, "lumiRange");
639  messageCMS->insert(quality, "quality");
640  messageCMS->insert(type, "type"); // Unknown=-1, Fake=0, Tracker=2(Good)
641  messageCMS->insert(x, "x");
642  messageCMS->insert(y, "y");
643  messageCMS->insert(z, "z");
644  messageCMS->insert(dxdz, "dxdz");
645  messageCMS->insert(dydz, "dydz");
646  messageCMS->insert(width_x, "width_x");
647  messageCMS->insert(width_y, "width_y");
648  messageCMS->insert(sigma_z, "sigma_z");
649 
650  if (publishStatErrors) {
651  messageCMS->insert(err_x, "err_x");
652  messageCMS->insert(err_y, "err_y");
653  messageCMS->insert(err_z, "err_z");
654  messageCMS->insert(err_dxdz, "err_dxdz");
655  messageCMS->insert(err_dydz, "err_dydz");
656  messageCMS->insert(err_width_x, "err_width_x");
657  messageCMS->insert(err_width_y, "err_width_y");
658  messageCMS->insert(err_sigma_z, "err_sigma_z");
659  }
660 
661  // LHC
662  messageLHC->insert(Size, 3, "Size");
663  messageLHC->insert(Centroid, 3, "Centroid");
664  messageLHC->insert(Tilt, 2, "Tilt");
665 
666  // PV
667  messagePV->insert(runnum, "runnum");
668  messagePV->insert(startTime, "startTime");
669  messagePV->insert(endTime, "endTime");
670  messagePV->insert(startTimeStamp, "startTimeStamp");
671  messagePV->insert(endTimeStamp, "endTimeStamp");
672  messagePV->insert(lumiRange, "lumiRange");
673  messagePV->insert(events, "events");
674  messagePV->insert(meanPV, "meanPV");
675  messagePV->insert(err_meanPV, "err_meanPV");
676  messagePV->insert(rmsPV, "rmsPV");
677  messagePV->insert(err_rmsPV, "err_rmsPV");
678  messagePV->insert(maxPV, "maxPV");
679  messagePV->insert(nPV, "nPV");
680  } catch (exception& e) {
681  edm::LogWarning("BeamSpotDipServer") << "exception (trueRcd): " << e.what();
682  }
683 }
684 
685 /*****************************************************************************/
687  try {
688  Centroid[0] = 0;
689  Centroid[1] = 0;
690  Centroid[2] = 0;
691 
692  Size[0] = 0;
693  Size[1] = 0;
694  Size[2] = 0;
695 
696  Tilt[0] = 0;
697  Tilt[1] = 0;
698 
699  messageLHC->insert(Size, 3, "Size");
700  messageLHC->insert(Centroid, 3, "Centroid");
701  messageLHC->insert(Tilt, 2, "Tilt");
702  } catch (exception& e) {
703  edm::LogWarning("BeamSpotDipServer") << "exception (fakeRcd): " << e.what();
704  }
705 }
706 
707 /*****************************************************************************/
708 void BeamSpotDipServer::publishRcd(string qlty, string err, bool pubCMS, bool fitTime) {
709  try {
710  bool updateCMS = pubCMS && (currentLS % intLS == 0);
711 
712  if (verbose) {
713  edm::LogInfo("BeamSpotDipServer") << "sending (" << qlty << " | " << err << ")";
714 
715  if (alive.test(7)) {
716  if (updateCMS)
717  edm::LogInfo("BeamSpotDipServer") << " to CCC and CMS";
718  else if (!alive.test(1) && !alive.test(2))
719  edm::LogInfo("BeamSpotDipServer") << " to CCC only";
720  }
721  }
722 
723  DipTimestamp zeit;
724  if (fitTime) {
725  long epoch;
726  epoch = endTimeStamp * 1000; // convert to ms
727  zeit = DipTimestamp(epoch);
728  } else
729  zeit = DipTimestamp();
730 
731  // send
732  if (updateCMS)
733  publicationCMS->send(messageCMS, zeit);
734 
735  publicationLHC->send(messageLHC, zeit);
736  publicationPV->send(messagePV, zeit);
737 
738  // set qualities
739  if (qlty == qualities[0]) { // Uncertain
740  if (updateCMS)
741  publicationCMS->setQualityUncertain(err.c_str());
742 
743  publicationLHC->setQualityUncertain(err.c_str());
744  } else if (qlty == qualities[1]) { // Bad
745  if (updateCMS)
746  publicationCMS->setQualityBad(err.c_str());
747 
748  publicationLHC->setQualityBad(err.c_str());
749  } else if (qlty == "UNINITIALIZED") {
750  if (updateCMS)
751  publicationCMS->setQualityBad("UNINITIALIZED");
752 
753  publicationLHC->setQualityBad("UNINITIALIZED");
754  }
755  } catch (exception& e) {
756  edm::LogWarning("BeamSpotDipServer") << "exception (publishRcd): " << e.what();
757  }
758 }
759 
760 /*****************************************************************************/
761 string BeamSpotDipServer::getDateTime(time_t t) {
762  char mbstr[100];
763  strftime(mbstr, sizeof(mbstr), "%Y.%m.%d %H:%M:%S %z", std::localtime(&t));
764 
765  return mbstr;
766 }
767 
768 //
770  time_t t = time(nullptr);
771 
772  return getDateTime(t);
773 }
774 
ConfigurationDescriptions.h
DDAxes::y
MessageLogger.h
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
makeHLTPrescaleTable.delimiter
delimiter
Definition: makeHLTPrescaleTable.py:181
edm::Run
Definition: Run.h:45
LuminosityBlock.h
pos
Definition: PixelAliasList.h:18
DCSRecord::TIBTID
Definition: DCSRecord.h:42
BeamSpotDipServer::problem
void problem()
Definition: BeamSpotDipServer.cc:323
protons_cff.time
time
Definition: protons_cff.py:35
BeamSpotDipServer
Definition: BeamSpotDipServer.h:29
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
DDAxes::x
BeamSpotDipServer::tkStatus
std::string tkStatus()
Definition: BeamSpotDipServer.cc:271
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
beamerCreator.create
def create(alignables, pedeDump, additionalData, outputFile, config)
Definition: beamerCreator.py:44
patZpeak.events
events
Definition: patZpeak.py:20
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
DCSRecord::TECp
Definition: DCSRecord.h:44
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
BeamSpotDipServer::getFileSize
long getFileSize(std::string filename)
Definition: BeamSpotDipServer.cc:239
edm::Handle
Definition: AssociativeIterator.h:50
BeamSpotDipServer::dqmEndRun
void dqmEndRun(const edm::Run &, const edm::EventSetup &iSetup) override
Definition: BeamSpotDipServer.cc:223
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
BeamSpotDipServer::BeamSpotDipServer
BeamSpotDipServer(const edm::ParameterSet &)
Definition: BeamSpotDipServer.cc:34
BeamSpotDipServer::CMS2LHCRF_POS
void CMS2LHCRF_POS(float x, float y, float z)
Definition: BeamSpotDipServer.cc:589
quality
const uint32_t *__restrict__ Quality * quality
Definition: CAHitNtupletGeneratorKernelsImpl.h:122
ErrHandler
Definition: BeamSpotDipServer.cc:23
MakerMacros.h
cms::cuda::bs
bs
Definition: HistoContainer.h:76
BeamSpotDipServer::getDateTime
std::string getDateTime()
Definition: BeamSpotDipServer.cc:769
DCSRecord::BPIX
Definition: DCSRecord.h:46
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::LuminosityBlockBase::luminosityBlock
LuminosityBlockNumber_t luminosityBlock() const
Definition: LuminosityBlockBase.h:40
BeamSpotDipServer_cff.subjectPV
subjectPV
Definition: BeamSpotDipServer_cff.py:12
DCSRecord::TOB
Definition: DCSRecord.h:43
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
DDAxes::z
edm::ESHandle
Definition: DTSurvey.h:22
BeamSpotDipServer_cff.testing
testing
Definition: BeamSpotDipServer_cff.py:8
BeamSpotDipServer_cff.readFromNFS
readFromNFS
Definition: BeamSpotDipServer_cff.py:14
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
verbose
static constexpr int verbose
Definition: HLTExoticaSubAnalysis.cc:25
BeamSpotPI::dxdz
Definition: BeamSpotPayloadInspectorHelper.h:37
BeamSpotDipServer::dqmBeginLuminosityBlock
void dqmBeginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &) override
Definition: BeamSpotDipServer.cc:97
BeamSpotDipServer::parse
std::vector< std::string > parse(std::string line, const std::string &delimiter)
Definition: BeamSpotDipServer.cc:253
BeamSpotDipServer::dqmEndLuminosityBlock
void dqmEndLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &) override
Definition: BeamSpotDipServer.cc:128
BeamSpotDipServer::fakeRcd
void fakeRcd()
Definition: BeamSpotDipServer.cc:686
geometryDiff.file
file
Definition: geometryDiff.py:13
cppFunctionSkipper.exception
exception
Definition: cppFunctionSkipper.py:10
dumpparser.parse
def parse(path, config)
Definition: dumpparser.py:13
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
DCSRecord::FPIX
Definition: DCSRecord.h:47
BeamSpotDipServer::publishRcd
void publishRcd(std::string qlty, std::string err, bool pubCMS, bool fitTime)
Definition: BeamSpotDipServer.cc:708
BeamSpotDipServer_cff.subjectCMS
subjectCMS
Definition: BeamSpotDipServer_cff.py:10
type
type
Definition: SiPixelVCal_PayloadInspector.cc:39
gainCalibHelper::gainCalibPI::type
type
Definition: SiPixelGainCalibHelper.h:40
BeamSpotPI::dydz
Definition: BeamSpotPayloadInspectorHelper.h:38
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:155
DQMOffline_cff.dcsRecord
dcsRecord
Definition: DQMOffline_cff.py:27
BeamSpotDipServer::dqmBeginRun
void dqmBeginRun(const edm::Run &r, const edm::EventSetup &) override
Definition: BeamSpotDipServer.cc:67
edm::EventSetup
Definition: EventSetup.h:58
AlCaHarvesting_cff.record
record
Definition: AlCaHarvesting_cff.py:42
BeamSpotDipServer::analyze
void analyze(const edm::Event &e, const edm::EventSetup &) override
Definition: BeamSpotDipServer.cc:102
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
submitPVResolutionJobs.err
err
Definition: submitPVResolutionJobs.py:85
BeamSpotDipServer_cff.sourceFile
sourceFile
Definition: BeamSpotDipServer_cff.py:18
alignCSCRings.r
r
Definition: alignCSCRings.py:93
std
Definition: JetResolutionObject.h:76
BeamSpotDipServer::bookHistograms
void bookHistograms(DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &) override
Definition: BeamSpotDipServer.cc:62
BeamSpotOnlineObjects
Definition: BeamSpotOnlineObjects.h:25
BeamSpotDipServer::trueRcd
void trueRcd()
Definition: BeamSpotDipServer.cc:620
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
BeamSpotDipServer::getLastTime
time_t getLastTime(std::string filename)
Definition: BeamSpotDipServer.cc:246
dqm::implementation::IBooker
Definition: DQMStore.h:43
heppy_check.logFile
logFile
Definition: heppy_check.py:40
ConsumesCollector.h
BeamSpotDipServer_cff.sourceFile1
sourceFile1
Definition: BeamSpotDipServer_cff.py:20
ErrHandler::handleException
void handleException(DipPublication *publication, DipException &e) override
Definition: BeamSpotDipServer.cc:28
edm_modernize_messagelogger.stat
stat
Definition: edm_modernize_messagelogger.py:27
edm::Event
Definition: Event.h:73
mps_splice.line
line
Definition: mps_splice.py:76
BeamSpotDipServer.h
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
edm::Log
Definition: MessageLogger.h:70
BeamSpotDipServer_cff.subjectLHC
subjectLHC
Definition: BeamSpotDipServer_cff.py:11
BeamSpotDipServer_cff.timeoutLS
timeoutLS
Definition: BeamSpotDipServer_cff.py:23
edm::InputTag
Definition: InputTag.h:15
BeamSpotDipServer::readRcd
bool readRcd(const BeamSpotOnlineObjects &bs)
Definition: BeamSpotDipServer.cc:362
dqmPostProcessing_online.logfile
logfile
Definition: dqmPostProcessing_online.py:96
DCSRecord::TECm
Definition: DCSRecord.h:45
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
unpackBuffers-CaloStage2.token
token
Definition: unpackBuffers-CaloStage2.py:316