CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HLTScalersClient.cc
Go to the documentation of this file.
1 // $Id: HLTScalersClient.cc,v 1.20 2012/12/06 09:49:36 eulisse Exp $
2 //
3 // $Log: HLTScalersClient.cc,v $
4 // Revision 1.20 2012/12/06 09:49:36 eulisse
5 // Use `edm::isNotFinite` in place of `std::isnan`.
6 //
7 // * Required when running `-Ofast` builds.
8 //
9 // Revision 1.19 2010/07/20 02:58:27 wmtan
10 // Add missing #include files
11 //
12 // Revision 1.18 2010/04/02 20:48:12 wittich
13 // updates to scale entries by received number of FU's
14 //
15 // Revision 1.17 2010/03/17 20:56:19 wittich
16 // Check for good updates based on mergeCount values
17 // add code for rates normalized per FU
18 //
19 // Revision 1.16 2010/03/16 22:19:19 wittich
20 // updates for per-LS normalization for variable
21 // number of FU's sending information back to the clients.
22 //
23 // Revision 1.15 2010/02/11 23:55:18 wittich
24 // - adapt to shorter Lumi Section length
25 // - fix bug in how history of counts was filled
26 //
27 // Revision 1.14 2010/02/02 11:44:20 wittich
28 // more diagnostics for online scalers
29 //
30 // Revision 1.13 2009/12/15 20:41:16 wittich
31 // better hlt scalers client
32 //
33 // Revision 1.12 2009/11/22 13:33:05 puigh
34 // clean beginJob
35 //
36 // Revision 1.11 2009/11/07 03:35:05 lorenzo
37 // fixed binning
38 //
39 // Revision 1.10 2009/11/04 06:00:05 lorenzo
40 // changed folders
41 //
42 
44 
45 #include <cassert>
46 #include <numeric>
47 
49 
57 
58 
61 
62 
63 using edm::LogInfo;
64 using edm::LogWarning;
65 
66 // I am not sure this is right at more than 10%
67 #define SECS_PER_LUMI_SECTION 23.31
68 const int kPerHisto = 20;
69 
70 
71 
72 
75  dbe_(0),
76  nLumi_(0),
77  currentRate_(0),
78  currentLumiBlockNumber_(0),
79  first_(true), missingPathNames_(true),
80  folderName_(ps.getUntrackedParameter<std::string>("dqmFolder",
81  "HLT/HLScalers_EvF")),
82  kRateIntegWindow_(ps.getUntrackedParameter<unsigned int>("rateIntegWindow",
83  3)),
84  processName_(ps.getParameter<std::string>("processName")),
85  ignores_(),
86  debug_(ps.getUntrackedParameter<bool>("debugDump", false)),
87  maxFU_(ps.getUntrackedParameter<unsigned int>("maxFU", false)),
88  recentOverallCountsPerLS_(kRateIntegWindow_),
89  recentNormedOverallCountsPerLS_(2)
90 {
91  LogDebug("HLTScalersClient") << "constructor" ;
92  if ( debug_ ) {
93  textfile_.open("debug.txt");
94  if ( ! textfile_ ) {
95  std::cout << "constructor: can't open text file" << std::endl;
96  }
97  }
98  // get back-end interface
100  dbe_->setVerbose(1);
102 
103 
104  std::string rawdir(folderName_ + "/raw");
105  dbe_->setCurrentFolder(rawdir);
106  hltRate_ = dbe_->book1D("hltRate", "Overall HLT Accept rate vs LS",
109  hltNormRate_ = dbe_->book1D("hltRateNorm",
110  "Overall HLT Accept rate vs LS, scaled",
112  hltCount_= dbe_->book1D("hltCount", "Overall HLT Counts vs LS",
114 // hltCountN_= dbe_->book1D("hltCountN", "Overall HLT Counts per LS vs LS",
115 // MAX_LUMI_SEG_HLT, -0.5, MAX_LUMI_SEG_HLT-0.5);
116  mergeCount_= dbe_->book1D("mergeCount", "Number of merge counts vs LS",
118 
119 
120 
121  updates_ = dbe_->book1D("updates", "Status of Updates", 2, 0, 2);
122  updates_->setBinLabel(1, "Good Updates");
123  updates_->setBinLabel(2, "Incomplete Updates");
124 
125 
126 } // end constructor
127 
128 
131 {
132  LogDebug("HLTScalersClient") << "beingJob" ;
133  if (dbe_) {
135  }
136  first_ = true;
137  missingPathNames_ = true;
138 }
139 
140 
143 {
144  missingPathNames_ = true;
145  first_ = true;
146  LogDebug("HLTScalersClient") << "beginRun, run " << run.id();
147 
148 } // beginRun
149 
152 {
153  missingPathNames_ = true;
154  first_ = true;
155 }
156 
157 
161  const edm::EventSetup& c)
162 {
163  nLumi_ = lumiSeg.id().luminosityBlock();
164  // PWDEBUG
165  if ( first_ && debug_)
167  // PWDEBUG END
168 
169  // get raw data
170  std::string scalHisto = folderName_ + "/raw/hltScalers";
171  MonitorElement *scalers = dbe_->get(scalHisto);
172  if ( scalers == 0 ) {
173  LogDebug("HLTScalersClient") << "cannot get hlt scalers histogram, "
174  << "bailing out.";
175  if ( debug_ )
176  std::cout << "No scalers ? Looking for "
177  << scalHisto
178  << std::endl;
179  return;
180  }
181 
182 
183  int npaths = scalers->getNbinsX();
184  if ( npaths > MAX_PATHS ) npaths = MAX_PATHS; // HARD CODE FOR NOW
185  LogDebug("HLTScalersClient") << "I see " << npaths << " paths. ";
186 
187  // set the bin labels on the first go-through
188  // I need to do this here because we don't have the paths yet
189  // on begin-run. I should do this in a less ugly way (see FV?)
190  if ( first_) {
191  std::string rawdir(folderName_ + "/raw");
192 
193  LogDebug("HLTScalersClient") << "Setting up paths on first endLumiBlock "
194  << npaths;
195  dbe_->setCurrentFolder(rawdir);
196  currentRate_ = dbe_->book1D("cur_rate",
197  "current lumi section rate per path",
198  npaths, -0.5, npaths-0.5);
199  currentNormRate_ = dbe_->book1D("cur_rate_norm",
200  "current norm. lumi section rate per path",
201  npaths, -0.5, npaths-0.5);
202  recentPathCountsPerLS_.reserve(npaths);
203  recentNormedPathCountsPerLS_.reserve(npaths);
204  char rates_subfolder[256]; snprintf(rates_subfolder, 256, "%s/RateHistory",
205  folderName_.c_str());
206  char counts_subfolder[256]; snprintf(counts_subfolder, 256,
207  "%s/CountHistory",
208  folderName_.c_str());
209 
210  hltCurrentRate_. reserve(npaths);
211  rateHistories_. reserve(npaths);
212  countHistories_. reserve(npaths);
213  hltCurrentNormRate_.reserve(npaths);
214  rateNormHistories_. reserve(npaths);
215 
216  dbe_->setCurrentFolder(folderName_); // these belong in top-level
217  for (int i = 0; i < npaths; ++i ) {
218  dbe_->setCurrentFolder(std::string(rates_subfolder)+"/raw");
219 
220  char name[256]; snprintf(name, 256, "raw_rate_p%03d", i);
221  // LogDebug("HLTScalersClient") << "name " << i << " is " << name ;
222  rateHistories_.push_back(dbe_->book1D(name, name, MAX_LUMI_SEG_HLT,
223  -0.5, MAX_LUMI_SEG_HLT-0.5));
224  snprintf(name, 256, "norm_rate_p%03d", i);
225  dbe_->setCurrentFolder(rates_subfolder);
226  rateNormHistories_.push_back(dbe_->book1D(name, name, MAX_LUMI_SEG_HLT,
227  -0.5, MAX_LUMI_SEG_HLT-0.5));
228  dbe_->setCurrentFolder(counts_subfolder);
229  snprintf(name, 256, "counts_p%03d", i);
230  countHistories_.push_back(dbe_->book1D(name, name, MAX_LUMI_SEG_HLT,
231  -0.5, MAX_LUMI_SEG_HLT-0.5));
232  // prefill the data structures
235  }
237 
238 
239  // split hlt scalers up into groups of 20
240  const int maxlen = 40;
241  char metitle[maxlen]; //histo name
242  char mename[maxlen]; //ME name
243  int numHistos = int(npaths/kPerHisto); // this hasta be w/o remainders
244 
245  int remainder = npaths%kPerHisto;
246  if ( remainder ) numHistos += 1;
247 
248  for( int k = 0; k < numHistos; k++ ) {
249  int npath_low = kPerHisto*k;
250  int npath_high = kPerHisto*(k+1)-1;
251  snprintf(mename, maxlen, "hltScalers_%0d", k);
252  snprintf(metitle, maxlen, "HLT scalers - Paths %d to %d", npath_low,
253  npath_high);
254  dbe_->setCurrentFolder(rawdir);
255  hltCurrentRate_.push_back(dbe_->book1D(mename, metitle, kPerHisto,
256  -0.5 + npath_low, npath_high+0.5));
257  dbe_->setCurrentFolder(folderName_); // these belong in top-level
258  snprintf(mename, maxlen, "hltScalersNorm_%0d", k);
259  snprintf(metitle, maxlen,
260  "HLT Rate (scaled) - Paths %d to %d", npath_low, npath_high);
261  hltCurrentNormRate_.push_back(dbe_->book1D(mename, metitle, kPerHisto,
262  -0.5 + npath_low,
263  npath_high+0.5));
264  }
265 
266  first_ = false;
267 
268 
269 
270  }
271 
272  if ( missingPathNames_) {
273  // first try the scalers histogram and see if the bin names are set
274  for ( int i = 0; i < npaths; ++i ) {
275  // needs to be i+1 since root bins start at 1
276  const char* name = scalers->getTH1()->GetXaxis()->GetBinLabel(i+1);
277  if ( name && (strlen(name) > 0)) {
278  if ( debug_ ) {
279  std::cout << "path " << i << " name is " << name << std::endl;
280  }
281  int whichHisto = i/kPerHisto;
282  int whichBin = i%kPerHisto + 1;
283  char pname[256];
284  hltCurrentRate_[whichHisto]->setBinLabel(whichBin, name);
285  hltCurrentNormRate_[whichHisto]->setBinLabel(whichBin, name);
286  snprintf(pname, 256, "Rate - path %s (Path # %03d)", name, i);
287  rateHistories_[i] ->setTitle(pname);
288  rateNormHistories_[i]->setTitle(pname);
289  snprintf(pname, 256, "Counts - path %s (Path # %03d)", name, i);
290  countHistories_[i]->setTitle(pname);
291 
292  currentRate_->setBinLabel(i+1, name);
293  currentNormRate_->setBinLabel(i+1, name);
294 
295  missingPathNames_ = false;
296  }
297  }
298 
299  }
300  // MEGA-HACK
301  if ( missingPathNames_) {
302  // if that didn't work we load 'em from a text file. damn straight.
303  int ipath = 1;
304  std::ifstream names("names.dat");
305  if ( ! names ) {
306  if ( debug_ ) {
307  std::ostringstream msg;
308  msg << "open of " << "names.dat";
309  perror(msg.str().c_str());
310  }
311  }
312  else { // open succeeded
313  missingPathNames_ = false;
315  while ( ! names.eof() ) {
316  getline(names, line);
317  std::istringstream fnames(line);
318  std::string label; int bin;
319  if ( fnames.str().find("#") == 0 ) // skip comment lines
320  continue;
321  if ( fnames >> bin >> label ) {
322  if ( debug_ ) {
323  std::cout << bin << "--" << label << "(" << ipath << ")"
324  << std::endl;
325  }
326  currentRate_->setBinLabel(ipath, label);
327  currentNormRate_->setBinLabel(ipath, label);
328  countHistories_[ipath-1]->setTitle(label);
329  rateHistories_[ipath-1]->setTitle(label);
330  rateNormHistories_[ipath-1]->setTitle(label);
331  int whichHisto = (ipath-1)/kPerHisto;
332  int whichBin = (ipath-1)%kPerHisto +1;
333  hltCurrentRate_[whichHisto]->setBinLabel(whichBin, label);
334  hltCurrentNormRate_[whichHisto]->setBinLabel(whichBin, label);
335  ++ipath;
336  if ( ipath > npaths )
337  break;
338  } //
339  } // loop lines
340  } // open ok
341  }
342 
343 
344  // END SETUP
345 
346  std::string nLumiHisto(folderName_ + "/nLumiBlock");
347  MonitorElement *nLumi = dbe_->get(nLumiHisto);
348  if ( nLumi == 0 ) {
349  nLumiHisto = folderName_ + "/raw/nLumiBlock";
350  nLumi = dbe_->get(nLumiHisto);
351  }
352  int testval = (nLumi!=0?nLumi->getIntValue():-1);
353  LogDebug("HLTScalersClient") << "Lumi Block from DQM: "
354  << testval
355  << ", local is " << nLumi_;
356  int nL = (nLumi!=0?nLumi->getIntValue():nLumi_);
357  if ( nL > MAX_LUMI_SEG_HLT ) {
358  LogDebug("HLTScalersClient") << "Too many Lumi segments, "
359  << nL << " is greater than MAX_LUMI_SEG_HLT,"
360  << " wrapping to "
361  << (nL%MAX_LUMI_SEG_HLT);
362  //nL = MAX_LUMI_SEG_HLT;
363  nL = nL%MAX_LUMI_SEG_HLT;
364  }
365 
366  // merging counts
367  double num_fu = -1.0;
368  std::string mergeName(folderName_ + "/raw/hltMerge");
369  MonitorElement *merge = dbe_->get(mergeName);
370  if ( merge != 0 ) {
371  num_fu = merge->getBinContent(1);
372  if ( debug_ ) {
373  std::cout << "Number of received entries: " << num_fu
374  << std::endl;
375  }
376  mergeCount_->Fill(nL,num_fu);
377  }
378  // end
379 
380 
381  // evaluate the data
382  // loop over current counts
383 
384  // this gets filled for all times. Mainly for debugging.
385  for ( int i = 1; i <= npaths; ++i ) { // bins start at 1
386  double current_count = scalers->getBinContent(i);
387  // nb that this will now _overwrite_ some settings
388  countHistories_[i-1]->setBinContent(nL, current_count); // good or bad
389  }
390 
391  std::string overallScalerName(folderName_ + "/raw/hltOverallScaler");
392  MonitorElement *hltScaler = dbe_->get(overallScalerName);
393  if ( hltScaler != 0 ) {
394  double current_count = hltScaler->getBinContent(1);
395  hltCount_->setBinContent(nL,current_count);
396  recentOverallCountsPerLS_.update(CountLS_t(nL,current_count));
397  std::pair<double,double> sl = getSlope_(recentOverallCountsPerLS_);
398  double slope = sl.first; double slope_err = sl.second;
399  if ( slope > 0 ) {
400  hltRate_->setBinContent(nL,slope);
401  if ( ! edm::isNotFinite(slope_err ) && (slope_err >= 0 ) )
402  hltRate_->setBinError(nL,slope_err);
403  }
404  } // found histo
405 
406 
407 
408  if ( num_fu >= 0.95*maxFU_ ) {
409  if ( num_fu > maxFU_ ) {
410  maxFU_ = num_fu;
411  if ( debug_ )
412  std::cout << "maxFU is now " << maxFU_ << std::endl;
413  }
414  // good data
415  for ( int i = 1; i <= npaths; ++i ) { // bins start at 1
416  double current_count = scalers->getBinContent(i);
417  // DEBUG
418  if ( ! recentPathCountsPerLS_[i-1].empty() && debug_ )
419  std::cout << i << "\t-> good one: new => cnt, ls = "
420  << current_count << ", " << nL
421  << ", old = "
422  << recentPathCountsPerLS_[i-1].back().second << "\t"
423  << recentPathCountsPerLS_[i-1].back().first
424  << std::endl;
425  // END DEBUG
426  recentPathCountsPerLS_[i-1].update(CountLS_t(nL,current_count));
427 
428  // NB: we do not fill a new entry in the rate histo if we can't
429  // calculate it
430  std::pair<double,double> sl = getSlope_(recentPathCountsPerLS_[i-1]);
431  double slope = sl.first; double slope_err = sl.second;
432  //rateHistories_[i-1]->Fill(nL,slope);
433  if ( slope > 0 ) {
434  rateHistories_[i-1]->setBinContent(nL,slope);
435  // set the current rate(s)
436  hltCurrentRate_[(i-1)/kPerHisto]->setBinContent(i%kPerHisto, slope);
437  currentRate_->setBinContent(i, slope);
438  if ( ! edm::isNotFinite(slope_err ) && (slope_err >= 0 ) ) {
439  currentRate_->setBinError(i, slope_err);
440  hltCurrentRate_[(i-1)/kPerHisto]->setBinError(i%kPerHisto, slope_err);
441  rateHistories_[i-1]->setBinError(nL,slope_err);
442  }
443  }
446 
447  } // loop over paths
448 
449  // ---------------------------- overall rate, absolute counts
450  std::string overallScalerName(folderName_ + "/raw/hltOverallScaler");
451  MonitorElement *hltScaler = dbe_->get(overallScalerName);
452  if ( hltScaler != 0 ) {
453  double current_count = hltScaler->getBinContent(1);
454  hltCount_->setBinContent(nL,current_count);
455  recentOverallCountsPerLS_.update(CountLS_t(nL,current_count));
456  std::pair<double,double> sl = getSlope_(recentOverallCountsPerLS_);
457  double slope = sl.first; double slope_err = sl.second;
458  if ( slope >= 0 ) {
459  hltRate_->setBinContent(nL,slope);
460  if ( ! edm::isNotFinite(slope_err ) && (slope_err >= 0 ) )
461  hltRate_->setBinError(nL,slope_err);
462  }
463  } // found histo
464  updates_->Fill(0); // good
465  } // check on number of FU's - good data
466  else {
467  updates_->Fill(1); // missing updates
468  }
469 
470  // PW DEBUG
471  if ( debug_ ) {
472  textfile_ << nL << "\t"
473  << npaths << "\t";
474  for ( int i = 0; i < npaths ; ++i ) {
475  textfile_ << scalers->getBinContent(i) << " ";
476  }
477  textfile_ << std::endl;
478  }
479  // end DEBUG
480 
481 
482 #ifdef LATER
483  // ------ overall rate normalized - all data
484  overallScalerName = std::string(folderName_ + "/raw/hltOverallScalerN");
485  hltScaler = dbe_->get(overallScalerName);
486  if ( hltScaler != 0 ) {
487  double cnt = hltScaler->getBinContent(1);
488 // hltCountN_->setBinContent(nL,cnt);
489  if ( debug_ ) {
490  std::cout << "Overall Norm: new => cnt, ls = "
491  << cnt << ", " << nL
492  << ", num_fu = " << num_fu
493  << std::endl;
494  }
496  cnt = recentNormedOverallCountsPerLS_.getCount(nL); // for dupes/partials
497  double slope = cnt / num_fu / SECS_PER_LUMI_SECTION;
498  if ( debug_ ) {
499  std::cout << "Normalized slope = " << slope << std::endl;
500  }
501  if ( slope > 0 )
502  hltNormRate_->setBinContent(nL,slope);
503  }
504  //
505  std::string scalHistoNorm = folderName_ + "/raw/hltScalersN";
506  MonitorElement *scalersN = dbe_->get(scalHistoNorm);
507  if ( scalersN ) {
508  for (int i = 0; i < npaths ; ++i ) {
509  double cnt = scalersN->getBinContent(i);
510  double slope = cnt / num_fu / SECS_PER_LUMI_SECTION;
511  if ( slope > 0 ) {
512  rateNormHistories_[i-1]->setBinContent(nL,slope);
513  // set the current rate(s)
514  hltCurrentNormRate_[(i-1)/kPerHisto]->setBinContent(i%kPerHisto, slope);
516  }
517  }
518  }
519 #else // NOT LATER
520  // ------ overall rate normalized - all data
521  overallScalerName = std::string(folderName_ + "/raw/hltOverallScaler");
522  hltScaler = dbe_->get(overallScalerName);
523  if ( hltScaler != 0 ) {
524  double cnt = hltScaler->getBinContent(1);
525 // hltCountN_->setBinContent(nL,cnt);
526  float sf = num_fu/maxFU_;
527  if ( debug_ ) {
528  std::cout << "Overall Norm: new => cnt, ls = "
529  << cnt << ", " << nL
530  << ", num_fu = " << num_fu << ", sf = " << sf
531  << std::endl;
532  }
534  cnt = recentNormedOverallCountsPerLS_.getCount(nL); // for dupes/partials
535  std::pair<double,double> sl = getSlope_(recentNormedOverallCountsPerLS_);
536  double slope = sl.first; double slope_err = sl.second;
537  if ( debug_ ) {
538  std::cout << "Normalized slope = " << slope << std::endl;
539  }
540  if ( slope > 0 ) {
541  hltNormRate_->setBinContent(nL,slope);
542  if ( cnt > 0 ) slope_err = slope*sqrt( 2./num_fu + 2./cnt);
543  if ( ! edm::isNotFinite(slope_err ) && (slope_err >= 0 ) )
544  hltNormRate_->setBinError(nL,slope_err);
545  }
546  }
547  //
548  std::string scalHistoNorm = folderName_ + "/raw/hltScalers";
549  MonitorElement *scalersN = dbe_->get(scalHistoNorm);
550  if ( scalersN ) {
551  double sf = num_fu /maxFU_;
552  for (int i = 1; i <= npaths ; ++i ) {
553  double cnt = scalersN->getBinContent(i);
554  recentNormedPathCountsPerLS_[i-1].update(CountLS_t(nL,cnt/sf));
555  std::pair<double,double> sl = getSlope_(recentNormedPathCountsPerLS_[i-1]);
556  double slope = sl.first; double slope_err = sl.second;
557  if ( slope >= 0 ) {
558  rateNormHistories_[i-1]->setBinContent(nL,slope);
559  // set the current rate(s)
560  hltCurrentNormRate_[(i-1)/kPerHisto]->setBinContent(i%kPerHisto, slope);
562  if ( slope_err <= 0 && cnt > 0) {
563  // ignores error on prev point, so scale by sqrt(2)
564  slope_err = slope*sqrt( 2./num_fu + 2./cnt);
565  if ( debug_ ) {
566  std::cout << "Slope err " << i << " = " << slope_err << std::endl;
567  }
568  }
569  if ( ! edm::isNotFinite(slope_err ) && (slope_err >= 0 ) ) {
570  rateNormHistories_[i-1]->setBinError(nL,slope_err);
571  // set the current rate(s)
572  hltCurrentNormRate_[(i-1)/kPerHisto]->setBinError(i%kPerHisto, slope_err);
573  currentNormRate_->setBinError(i, slope_err);
574 
575  }
576 
577  }
578  }
579  }
580 
581 #endif // LATER
582  //
583 
584 
585 
586 }
587 
588 // unused
590 {
591  // nothing to do here
592 }
593 
594 // this is probably overkill. Do a least-squares fit to get slope
595 // note that the data is in units of counts, ls number
596 // but we return a value in Hz...
597 std::pair<double,double>
599 {
600  double slope, sigma_m;
601  if ( points.size() < points.targetSize() ) {
602  return std::pair<double,double>(-1,-1);
603  }
604  // just do a delta if we just want two bins
605  else if ( points.size() == 2 ) {
606  // just do diff and be done with it
607  double delta_ls = points.front().first - points.back().first;
608  double delta_cnt = points.front().second - points.back().second;
609  slope = delta_cnt / delta_ls ;
610  sigma_m = -1;
611  }
612  else { // do a fit
613  double xy = 0;
614  double x = 0;
615  double xsq = 0;
616  double y = 0;
617  double n = double(points.size());
618  for ( CountLSFifo_t::iterator i(points.begin());
619  i != points.end(); ++i ) {
620  if ( debug_ )
621  std::cout << "x = " << i->first << ", y = " << i->second
622  << std::endl;
623  xy += i->first * i->second;
624  x += i->first;
625  xsq += i->first*i->first;
626  y += i->second;
627  }
628  slope = (n*xy - x*y)/(n*xsq - x*x);
629 
630  // now get the uncertainty on the slope. Need intercept for this.
631  double intercept = (xsq*y - xy*x)/(n*xsq-x*x);
632  double sigma_ysq = 0;
633  for ( CountLSFifo_t::iterator i(points.begin());
634  i != points.end(); ++i ) {
635  sigma_ysq += pow(( i->second - slope * i->first - intercept),2.);
636  }
637 // if ( debug_ )
638 // std::cout << "chi^2 = " << sigma_ysq << std::endl;
639  sigma_ysq *= 1./(n-2.);
640 
641  sigma_m = sqrt( n*sigma_ysq/(n*xsq - x*x));
642  }
643 
644  // std::cout << "Slope is " << slope << std::endl;
645  slope /= SECS_PER_LUMI_SECTION;
646  if ( sigma_m >0 )
647  sigma_m /= SECS_PER_LUMI_SECTION;
648 // if ( debug_ ) {
649 // std::cout << "Slope = " << slope << " +- " << sigma_m
650 // << std::endl;
651 // std::cout << "intercept is " << intercept
652 // << std::endl;
653 // }
654 
655 
656  return std::pair<double,double>(slope, sigma_m);
657 }
#define LogDebug(id)
std::pair< double, double > getSlope_(CountLSFifo_t points)
LuminosityBlockID id() const
std::ofstream textfile_
void endRun(const edm::Run &run, const edm::EventSetup &c)
EndRun.
int i
Definition: DBlmapReader.cc:9
MonitorElement * updates_
void setBinContent(int binx, double content)
set content of bin (1-D)
RunID const & id() const
Definition: RunBase.h:41
static const HistoName names[]
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:722
std::vector< MonitorElement * > rateHistories_
static const double slope[3]
MonitorElement * currentNormRate_
std::vector< CountLSFifo_t > recentNormedPathCountsPerLS_
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 beginJob(void)
BeginJob.
void Fill(long long x)
void analyze(const edm::Event &e, const edm::EventSetup &c)
std::vector< MonitorElement * > hltCurrentNormRate_
bool isNotFinite(T x)
Definition: isFinite.h:10
std::string folderName_
#define SECS_PER_LUMI_SECTION
MonitorElement * hltRate_
T sqrt(T t)
Definition: SSEVec.h:48
std::vector< MonitorElement * > countHistories_
void beginRun(const edm::Run &run, const edm::EventSetup &c)
BeginRun.
TH1 * getTH1(void) const
MonitorElement * mergeCount_
unsigned int kRateIntegWindow_
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
void setVerbose(unsigned level)
Definition: DQMStore.cc:398
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1473
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
CountLSFifo_t recentOverallCountsPerLS_
DQMStore * dbe_
MonitorElement * currentRate_
int k[5][pyjets_maxn]
void update(const CountLS_t &T)
std::vector< CountLSFifo_t > recentPathCountsPerLS_
int64_t getIntValue(void) const
LuminosityBlockNumber_t luminosityBlock() const
MonitorElement * hltCount_
HLTScalersClient(const edm::ParameterSet &ps)
Constructors.
CountLSFifo_t recentNormedOverallCountsPerLS_
double getBinContent(int binx) const
get content of bin (1-D)
#define MAX_LUMI_SEG_HLT
std::vector< MonitorElement * > hltCurrentRate_
int getNbinsX(void) const
get # of bins in X-axis
const int kPerHisto
tuple cout
Definition: gather_cfg.py:121
MonitorElement * hltNormRate_
void showDirStructure(void) const
Definition: DQMStore.cc:2766
Definition: DDAxes.h:10
#define MAX_PATHS
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
Definition: Run.h:36
std::vector< MonitorElement * > rateNormHistories_