ATLAS Offline Software
TrigT1CaloLWHistogramTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include <cmath>
6 #include <iomanip>
7 #include <set>
8 #include <sstream>
9 
10 #include "TH1.h"
11 #include "TH1F.h"
12 #include "TH2F.h"
13 #include "LWHists/LWHist.h"
14 #include "LWHists/LWHist1D.h"
15 #include "LWHists/LWHist2D.h"
16 #include "LWHists/TH1F_LW.h"
17 #include "LWHists/TH2F_LW.h"
18 #include "LWHists/TH2I_LW.h"
19 #include "LWHists/TProfile_LW.h"
20 #include "LWHists/TProfile2D_LW.h"
21 
22 #include "GaudiKernel/IInterface.h"
23 #include "GaudiKernel/MsgStream.h"
24 #include "GaudiKernel/StatusCode.h"
25 
28 #include "TrigConfL1Data/Menu.h"
30 //#include "TrigConfigSvc/ILVL1ConfigSvc.h"
34 
36 
37 // ============================================================================
38 namespace LVL1 {
39 // ============================================================================
40 
41 // Constructor
42 
44  : AsgTool(name),
45  m_configSvc("TrigConf::TrigConfigSvc/TrigConfigSvc", name),
46  m_monGroup(0), m_phiScaleTT(32./M_PI), m_phiScaleJE(16./M_PI)
47 {
48  declareInterface<TrigT1CaloLWHistogramTool>(this);
49  declareProperty( "LVL1ConfigSvc", m_configSvc, "LVL1 Config Service");
50 
51  declareProperty("EventSamples", m_eventSamples = 10,
52  "Number of Error Event Number Samples");
53  declareProperty("ShrinkEtaBins", m_shrinkEtaBins = true,
54  "Make all eta bins the same size in eta/phi plots");
55 }
56 
57 // Destructor
58 
60 {
61 }
62 
63 // Initialize
64 
66 {
67  msg(MSG::INFO) << "Initializing " << name() << endmsg;
68 
69  // Connect to the TrigConfigSvc for the trigger configuration:
70 
71  if (m_configSvc.typeAndName() != "") {
72  StatusCode sc = m_configSvc.retrieve();
73  if ( sc.isFailure() ) {
74  msg(MSG::ERROR) << "Couldn't connect to " << m_configSvc.typeAndName()
75  << endmsg;
76  return sc;
77  } else msg(MSG::INFO) << "Connected to " << m_configSvc.typeAndName()
78  << endmsg;
79  }
80 
81  return StatusCode::SUCCESS;
82 }
83 
84 // Finalize
85 
87 {
88  return StatusCode::SUCCESS;
89 }
90 
91 //===========================================================================
92 // Labelling Utilities - General
93 //===========================================================================
94 
95 // Return int/double pair as a string
96 
98  int precision)
99 {
100  std::ostringstream cnum;
101  cnum << num << "/"
102  << std::setiosflags(std::ios::fixed | std::ios::showpoint)
103  << std::setprecision(precision) << val;
104  return cnum.str();
105 }
106 
107 // Label bins with number pairs
108 
110  int firstMax, int secondMin, int secondMax,
111  int step, int offset, bool xAxis)
112 {
113  LWHist::LWHistAxis* axis = (xAxis) ? hist->GetXaxis() : hist->GetYaxis();
114  const int numSecond = secondMax - secondMin + 1;
115  for (int first = firstMin; first <= firstMax; ++first) {
116  int bin = 1 + offset + (first-firstMin)*numSecond;
117  for (int second = secondMin; second <= secondMax; second += step) {
118  std::ostringstream cnum;
119  cnum << first << "/" << second;
120  axis->SetBinLabel(bin, cnum.str().c_str());
121  bin += step;
122  }
123  }
124 }
125 
126 // Label bins with number pairs without skipping bins when stepping
127 
129  int firstMin, int firstMax,
130  int secondMin, int secondMax, int step, int offset, bool xAxis)
131 {
132  LWHist::LWHistAxis* axis = (xAxis) ? hist->GetXaxis() : hist->GetYaxis();
133  int bin = 1 + offset;
134  for (int first = firstMin; first <= firstMax; ++first) {
135  for (int second = secondMin; second <= secondMax; second += step) {
136  std::ostringstream cnum;
137  cnum << first << "/" << second;
138  axis->SetBinLabel(bin, cnum.str().c_str());
139  bin++;
140  }
141  }
142 }
143 
144 // Label bins with numbers
145 
147  int step, int offset, bool xAxis)
148 {
149  LWHist::LWHistAxis* axis = (xAxis) ? hist->GetXaxis() : hist->GetYaxis();
150  int bin = 1 + offset;
151  for (int num = min; num <= max; num += step) {
152  std::ostringstream cnum;
153  cnum << num;
154  axis->SetBinLabel(bin, cnum.str().c_str());
155  bin += step;
156  }
157 }
158 
159 // Split long names for Y axis
160 
161 std::string TrigT1CaloLWHistogramTool::splitLine(const std::string& word,
162  bool xAxis)
163 {
164  std::string newWord(word);
165  if (!xAxis && word.length() > 6) {
166  // split at last capital
167  std::string::size_type idx =
168  word.find_last_of("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
169  if (idx != std::string::npos && idx != 0 && idx != word.length()-1) {
170  newWord = "#splitline{" + word.substr(0, idx) + "}{"
171  + word.substr(idx) + "}";
172  }
173  }
174  return newWord;
175 }
176 
177 // Label bins with sub-status error bit names
178 
180 {
181  LWHist::LWHistAxis* axis = (xAxis) ? hist->GetXaxis() : hist->GetYaxis();
182  const LVL1::DataError err(0);
183  for (int bit = 0; bit < 8; ++bit) {
184  std::string label(splitLine(err.bitName(bit +
186  axis->SetBinLabel(bit + 1 + offset, label.c_str());
187  }
188 }
189 
190 // Get list of threshold names for given type
191 // NB. Treats EM/TAU as one
192 
194  std::vector<std::string>& names)
195 {
196  bool found = false;
197  names.clear();
199 // int nthresh = 0;
200 // if (type == def.emType() || type == def.tauType())
201 // nthresh = def.max_EM_Threshold_Number();
202 // else if (type == def.jetType()) nthresh = def.max_J_Threshold_Number();
203 // else if (type == def.jfType()) nthresh = def.max_JF_Threshold_Number();
204 // else if (type == def.jbType()) nthresh = def.max_JB_Threshold_Number();
205 // else if (type == def.xeType()) nthresh = def.max_XE_Threshold_Number();
206 // else if (type == def.jeType()) nthresh = def.max_JE_Threshold_Number();
207 // else if (type == def.teType()) nthresh = def.max_TE_Threshold_Number();
208 // else if (type == def.xsType()) nthresh = def.max_XS_Threshold_Number();
209 // else return found;
210 
212  if(tt == TrigConf::L1DataDef::UNDEF) return found;
213 
215  int nthresh = ttc.max;
216 
217  for (int thr = 0; thr < nthresh; ++thr) {
218  std::ostringstream cnum;
219  cnum << type << " " << thr;
220  names.push_back(cnum.str());
221  }
222 
223  if (m_configSvc) {
224  const TrigConf::CTPConfig* ctpConf = m_configSvc->ctpConfig();
225  if (ctpConf) {
226  const std::vector<TrigConf::TriggerThreshold*>& thresholds = ctpConf->menu().thresholdVector();
227 
228  std::vector<TrigConf::TriggerThreshold*>::const_iterator it;
229  for (it = thresholds.begin(); it != thresholds.end(); ++it) {
230  const std::string thrType((*it)->type());
231  if (type == def.emType() || type == def.tauType()) {
232  if (thrType != def.emType() && thrType != def.tauType()) continue;
233  } else if (thrType != type) continue;
234  const int threshNum = (*it)->thresholdNumber();
235  if (threshNum >= 0 && threshNum < nthresh) {
236  names[threshNum] = (*it)->name();
237  found = true;
238  }
239  }
240 
241  }
242  }
243  return found;
244 }
245 
246 // Label bins with threshold names
247 
249  const std::string& type, int offset, bool xAxis)
250 {
251  LWHist::LWHistAxis* axis = (xAxis) ? hist->GetXaxis() : hist->GetYaxis();
252  std::vector<std::string> names;
253  //const bool found = thresholdNames(type, names);
255  std::vector<std::string>::const_iterator it = names.begin();
256  for (int bin = 1; it != names.end(); ++it, ++bin) {
257  axis->SetBinLabel(bin+offset, (*it).c_str());
258  }
259  //if (!found) axis->SetTitle("Threshold Number");
260 }
261 
262 // Put threshold hit values into a string suitable for printing
263 
264 std::string TrigT1CaloLWHistogramTool::thresholdString(int val, int nThresh,
265  int nBits)
266 {
267  std::ostringstream cval;
268  const int mask = (1 << nBits) - 1;
269  for (int thr = 0; thr < nThresh; ++thr) {
270  const int hit = (val >> (nBits*thr)) & mask;
271  cval << hit;
272  if (thr != nThresh-1) cval << " ";
273  }
274  return cval.str();
275 }
276 
277 // Flag which threshold hit values are non-zero and the same
278 
280  int nThresh, int nBits)
281 {
282  int result = 0;
283  const int mask = (1 << nBits) - 1;
284  for (int thr = 0; thr < nThresh; ++thr) {
285  const int hit1 = (val1 >> (nBits*thr)) & mask;
286  const int hit2 = (val2 >> (nBits*thr)) & mask;
287  if (hit1 && (hit1 == hit2)) result |= (1 << thr);
288  }
289  return result;
290 }
291 
292 // Flag which threshold hit values are different
293 
295  int nThresh, int nBits)
296 {
297  int result = 0;
298  const int mask = (1 << nBits) - 1;
299  for (int thr = 0; thr < nThresh; ++thr) {
300  const int hit1 = (val1 >> (nBits*thr)) & mask;
301  const int hit2 = (val2 >> (nBits*thr)) & mask;
302  if (hit1 != hit2) result |= (1 << thr);
303  }
304  return result;
305 }
306 
307 // Get threshold bit mask for given type
308 // NB. Treats EM and TAU separately
309 
310 unsigned int TrigT1CaloLWHistogramTool::thresholdMask(const std::string& type)
311 {
312  unsigned int mask = 0;
313  //TrigConf::L1DataDef def;
314  // int nthresh = 0;
315  // if (type == def.emType() || type == def.tauType())
316  // nthresh = def.max_EM_Threshold_Number();
317  // else if (type == def.jetType()) nthresh = def.max_J_Threshold_Number();
318  // else if (type == def.jfType()) nthresh = def.max_JF_Threshold_Number();
319  // else if (type == def.jbType()) nthresh = def.max_JB_Threshold_Number();
320  // else if (type == def.xeType()) nthresh = def.max_XE_Threshold_Number();
321  // else if (type == def.jeType()) nthresh = def.max_JE_Threshold_Number();
322  // else if (type == def.teType()) nthresh = def.max_TE_Threshold_Number();
323  // else if (type == def.xsType()) nthresh = def.max_XS_Threshold_Number();
324 
327  int nthresh = ttc.max;
328 
329 
330 
331  if (m_configSvc) {
332  const TrigConf::CTPConfig* ctpConf = m_configSvc->ctpConfig();
333  if (ctpConf) {
334  const std::vector<TrigConf::TriggerThreshold*>& thresholds = ctpConf->menu().thresholdVector();
335  std::vector<TrigConf::TriggerThreshold*>::const_iterator it;
336  for (it = thresholds.begin(); it != thresholds.end(); ++it) {
337  const std::string thrType((*it)->type());
338  if (thrType != type) continue;
339  const int threshNum = (*it)->thresholdNumber();
340  if (threshNum >= 0 && threshNum < nthresh) {
341  mask |= (1<<threshNum);
342  }
343  }
344  }
345  }
346  return mask;
347 }
348 
349 // Get threshold bit mask for EM
350 
352 {
353  return thresholdMask(TrigConf::L1DataDef::emType());
354 }
355 
356 // Get threshold bit mask for Tau
357 
359 {
360  return thresholdMask(TrigConf::L1DataDef::tauType());
361 }
362 
363 //===========================================================================
364 // Labelling Utilities - CPM
365 //===========================================================================
366 
367 // Label bins with CPM chip/local coordinate (3bit/3bit)
368 
370  bool xAxis)
371 {
372  const int nChips = 8;
373  const int nLoc = 8;
374  numberPairs(hist, 0, nChips-1, 0, nLoc-1, 4, offset, xAxis);
375  LWHist::LWHistAxis* axis = (xAxis) ? hist->GetXaxis() : hist->GetYaxis();
376  axis->SetTitle("Chip/Local Coord");
377 }
378 
379 // Label bins with CMX-CP TOB chip/local coordinate (4bit/2bit)
380 
382  bool xAxis)
383 {
384  const int nChips = 16;
385  const int nLoc = 4;
386  numberPairs(hist, 0, nChips-1, 0, nLoc-1, 4, offset, xAxis);
387  LWHist::LWHistAxis* axis = (xAxis) ? hist->GetXaxis() : hist->GetYaxis();
388  axis->SetTitle("Chip/Local Coord");
389 }
390 
391 // Label bins with CPM/CMX crate/module
392 
394  bool xAxis)
395 {
396  cpmCrateModule(hist, offset, xAxis);
397  LWHist::LWHistAxis* axis = (xAxis) ? hist->GetXaxis() : hist->GetYaxis();
398  axis->SetBinLabel(1+offset, "CPM");
399  axis->SetBinLabel(57+offset, "CMX");
400  axis->SetBinLabel(59+offset, "1/0");
401  axis->SetBinLabel(61+offset, "2/0");
402  axis->SetBinLabel(63+offset, "3/0");
403 }
404 
405 // Label bins with CPM crate/CMX
406 
408  bool xAxis)
409 {
410  const int nCrates = 4;
411  const int nCMXs = 2;
412  numberPairs(hist, 0, nCrates-1, 0, nCMXs-1, 1, offset, xAxis);
413  LWHist::LWHistAxis* axis = (xAxis) ? hist->GetXaxis() : hist->GetYaxis();
414  axis->SetTitle("Crate/CMX");
415 }
416 
417 // Label bins with CPM crate/module
418 
420  bool xAxis)
421 {
422  const int nCrates = 4;
423  const int nCPMs = 14;
424  numberPairs(hist, 0, nCrates-1, 1, nCPMs, nCPMs/2, offset, xAxis);
425  LWHist::LWHistAxis* axis = (xAxis) ? hist->GetXaxis() : hist->GetYaxis();
426  axis->SetTitle("Crate/Module");
427 }
428 
429 // Label bins with CPM RoI threshold names
430 
432  bool xAxis)
433 {
434  thresholds(hist, TrigConf::L1DataDef::emType(), offset, xAxis);
435 }
436 
437 //===========================================================================
438 // Labelling Utilities - JEM
439 //===========================================================================
440 
441 // Label bins with JEM crate/module
442 
444  bool xAxis)
445 {
446  const int nCrates = 2;
447  const int nJEMs = 16;
448  numberPairs(hist, 0, nCrates-1, 0, nJEMs-1, 2, offset, xAxis);
449  LWHist::LWHistAxis* axis = (xAxis) ? hist->GetXaxis() : hist->GetYaxis();
450  axis->SetTitle("Crate/Module");
451 }
452 
453 // Label bins with JEM/CMX crate/module
454 
456  bool xAxis)
457 {
458  jemCrateModule(hist, offset, xAxis);
459  LWHist::LWHistAxis* axis = (xAxis) ? hist->GetXaxis() : hist->GetYaxis();
460  axis->SetBinLabel(1+offset, "JEM");
461  axis->SetBinLabel(33+offset, "CMX");
462  axis->SetBinLabel(35+offset, "1/0");
463 }
464 
465 // Label bins with JEM crate/CMX
466 
468  bool xAxis)
469 {
470  const int nCrates = 2;
471  const int nCMXs = 2;
472  numberPairs(hist, 0, nCrates-1, 0, nCMXs-1, 1, offset, xAxis);
473  LWHist::LWHistAxis* axis = (xAxis) ? hist->GetXaxis() : hist->GetYaxis();
474  axis->SetTitle("Crate/CMX");
475 }
476 
477 // Label bins with JEM frame/local coord
478 
480  bool xAxis)
481 {
482  const int nFrame = 8;
483  const int nLoc = 4;
484  numberPairs(hist, 0, nFrame-1, 0, nLoc-1, 2, offset, xAxis);
485  LWHist::LWHistAxis* axis = (xAxis) ? hist->GetXaxis() : hist->GetYaxis();
486  axis->SetTitle("Frame/Local Coord");
487 }
488 
489 // Label bins with JEM RoI threshold names
490 
492  bool xAxis)
493 {
494  int newOffset = offset;
495  thresholds(hist, TrigConf::L1DataDef::jetType(), newOffset, xAxis);
496  newOffset += TrigConf::L1DataDef::max_JET_Threshold_Number();
497  thresholds(hist, TrigConf::L1DataDef::jbType(), newOffset, xAxis);
498  newOffset += TrigConf::L1DataDef::max_JB_Threshold_Number();
499  thresholds(hist, TrigConf::L1DataDef::jfType(), newOffset, xAxis);
500 }
501 
502 // Label bins with Main Jet threshold names
503 
505  bool xAxis)
506 {
508 }
509 
510 // Label bins with Backward Jet threshold names
511 
513  bool xAxis)
514 {
515  thresholds(hist, TrigConf::L1DataDef::jbType(), offset, xAxis);
516 }
517 
518 // Label bins with Forward Jet threshold names
519 
521  bool xAxis)
522 {
523  thresholds(hist, TrigConf::L1DataDef::jfType(), offset, xAxis);
524 }
525 
526 // Label bins with JetEt threshold names
527 
529  bool xAxis)
530 {
531  thresholds(hist, TrigConf::L1DataDef::jeType(), offset, xAxis);
532 }
533 
534 // Label bins with MissingEt threshold names
535 
537  bool xAxis)
538 {
539  thresholds(hist, TrigConf::L1DataDef::xeType(), offset, xAxis);
540 }
541 
542 // Label bins with SumEt threshold names
543 
545  bool xAxis)
546 {
547  thresholds(hist, TrigConf::L1DataDef::teType(), offset, xAxis);
548 }
549 
550 // Label bins with MissingEtSig threshold names
551 
553  bool xAxis)
554 {
555  //thresholds(hist, TrigConf::L1DataDef::xsType(), offset, xAxis);
556  thresholds(hist, "XS", offset, xAxis);
557 }
558 
559 //===========================================================================
560 // Labelling Utilities - PPM
561 //===========================================================================
562 
563 // Label bins with PPM crate/module
564 
566  int lastCrate, int offset, bool xAxis)
567 {
568  int step = 2;
569  if (lastCrate-firstCrate > 1) step = 4;
570  numberPairs(hist, firstCrate, lastCrate, 0, 15, step, offset, xAxis);
571  LWHist::LWHistAxis* axis = (xAxis) ? hist->GetXaxis() : hist->GetYaxis();
572  axis->SetTitle("Crate/Module");
573 }
574 
575 // Label bins with PPM error bit names
576 
578 {
579  LWHist::LWHistAxis* axis = (xAxis) ? hist->GetXaxis() : hist->GetYaxis();
580  const LVL1::DataError err(0);
581  for (int bit = 0; bit < 8; ++bit) {
582  std::string label(splitLine(err.bitName(bit +
584  axis->SetBinLabel(bit + 1 + offset, label.c_str());
585  }
586 }
587 
588 // Label bins with PPM submodule/channel
589 
591  bool xAxis)
592 {
593  numberPairs(hist, 0, 15, 0, 3, 4, offset, xAxis);
594  LWHist::LWHistAxis* axis = (xAxis) ? hist->GetXaxis() : hist->GetYaxis();
595  axis->SetTitle("Submodule/Channel");
596 }
597 
598 //===========================================================================
599 // Booking Utilities - General
600 //===========================================================================
601 
602 // Book and register a 1D histogram
603 
605  const std::string& title,
606  int nx, double xmin, double xmax)
607 {
608  TH1F_LW *hist = TH1F_LW::create(name.c_str(), title.c_str(), nx, xmin, xmax);
610  return hist;
611 }
612 
613 // Book and register a 1D histogram with variable width bins
614 
616  const std::string& title,
617  int nx, const double* xbins)
618 {
619  TH1F_LW *hist = TH1F_LW::create(name.c_str(), title.c_str(), nx, xbins);
621  return hist;
622 }
623 
624 // Book and register a 1D profile histogram
625 
627  const std::string& title, int nx, double xmin, double xmax)
628 {
629  TProfile_LW *hist = TProfile_LW::create(name.c_str(), title.c_str(),
630  nx, xmin, xmax);
632  return hist;
633 }
634 
635 // Book and register a 1D profile histogram with variable width bins
636 
638  const std::string& title, int nx, const double* xbins)
639 {
640  TProfile_LW *hist = TProfile_LW::create(name.c_str(), title.c_str(),
641  nx, xbins);
643  return hist;
644 }
645 
646 // Book and register a 2D histogram
647 
649  const std::string& title,
650  int nx, double xmin, double xmax,
651  int ny, double ymin, double ymax)
652 {
653  TH2F_LW *hist = TH2F_LW::create(name.c_str(), title.c_str(), nx, xmin, xmax,
654  ny, ymin, ymax);
656  hist->SetOption("colz");
657  return hist;
658 }
659 
660 // Book and register a 2D histogram with variable width bins
661 
663  const std::string& title,
664  int nx, const double* xbins,
665  int ny, double ymin, double ymax)
666 {
667  TH2F_LW *hist = TH2F_LW::create(name.c_str(), title.c_str(), nx, xbins,
668  ny, ymin, ymax);
670  hist->SetOption("colz");
671  return hist;
672 }
673 
674 // Book and register a 2D histogram with variable width bins both axes
675 
677  const std::string& title,
678  int nx, const double* xbins,
679  int ny, const double* ybins)
680 {
681  TH2F_LW *hist = TH2F_LW::create(name.c_str(), title.c_str(), nx, xbins,
682  ny, ybins);
684  hist->SetOption("colz");
685  return hist;
686 }
687 
688 // Book and register a 2D profile histogram
689 
691  const std::string& name, const std::string& title,
692  int nx, double xmin, double xmax, int ny, double ymin, double ymax)
693 {
694  TProfile2D_LW *hist = TProfile2D_LW::create(name.c_str(), title.c_str(),
695  nx, xmin, xmax, ny, ymin, ymax);
697  hist->SetOption("colz");
698  return hist;
699 }
700 
701 // Book and register a 2D profile histogram with variable width bins
702 
704  const std::string& name, const std::string& title,
705  int nx, const double* xbins, int ny, double ymin, double ymax)
706 {
707  TProfile2D_LW *hist = TProfile2D_LW::create(name.c_str(), title.c_str(),
708  nx, xbins, ny, ymin, ymax);
710  hist->SetOption("colz");
711  return hist;
712 }
713 
714 // Book and register a 2D profile histogram with variable width bins both axes
715 
717  const std::string& name, const std::string& title,
718  int nx, const double* xbins, int ny, const double* ybins)
719 {
720  TProfile2D_LW *hist = TProfile2D_LW::create(name.c_str(), title.c_str(),
721  nx, xbins, ny, ybins);
723  hist->SetOption("colz");
724  return hist;
725 }
726 
727 // Book and register a 2D histogram of integers displayed as text
728 
730  const std::string& title,
731  int nx, double xmin, double xmax,
732  int ny, double ymin, double ymax)
733 {
734  TH2I_LW *hist = TH2I_LW::create(name.c_str(), title.c_str(), nx, xmin, xmax,
735  ny, ymin, ymax);
737  hist->SetOption("text");
738  return hist;
739 }
740 
741 // Book and register a 2D histogram containing event numbers as bin contents
742 
744  const std::string& name, const std::string& title,
745  int ny, double ymin, double ymax)
746 {
748  ny, ymin, ymax);
749  if (m_eventSamples <= 10) numbers(hist, 1, m_eventSamples);
750  hist->GetXaxis()->SetTitle("Events with Error/Mismatch");
751  return hist;
752 }
753 
754 // Register a histogram
755 
757 {
758  if (m_monGroup && m_monGroup->regHist(hist) != StatusCode::SUCCESS) {
759  msg(MSG::WARNING) << "Could not register histogram : "
760  << hist->GetName() << endmsg;
761  }
762 }
763 
764 // ROOT versions
765 
766 // Book and register a 1D histogram
767 
769  const std::string& title,
770  int nx, double xmin, double xmax)
771 {
772  TH1F* hist = new TH1F(name.c_str(), title.c_str(), nx, xmin, xmax);
774  return hist;
775 }
776 
777 // Book and register a 2D histogram
778 
780  const std::string& title,
781  int nx, double xmin, double xmax,
782  int ny, double ymin, double ymax)
783 {
784  TH2F* hist = new TH2F(name.c_str(), title.c_str(), nx, xmin, xmax,
785  ny, ymin, ymax);
787  hist->SetOption("colz");
788  return hist;
789 }
790 
791 // Register a histogram
792 
794 {
795  if (m_monGroup && m_monGroup->regHist(hist) != StatusCode::SUCCESS) {
796  msg(MSG::WARNING) << "Could not register histogram : "
797  << hist->GetName() << endmsg;
798  }
799  if (!m_monGroup) hist->SetDirectory(0);
800 }
801 
802 //===========================================================================
803 // Booking Utilities - CPM
804 //===========================================================================
805 
806 // Book CPM crate/module vs chip/local coordinate (3bits/3bits)
807 
809  const std::string& name, const std::string& title)
810 {
811  TH2F_LW *hist = book2F(name, title, 56, 0., 56., 64, 0., 64.);
813  cpmChipLocalCoord(hist, 0, false);
814  return hist;
815 }
816 
817 // Book CPM crate/module vs TOB chip/local coordinate (4bits/2bits)
818 
820  const std::string& name, const std::string& title)
821 {
822  TH2F_LW *hist = book2F(name, title, 56, 0., 56., 64, 0., 64.);
824  cpmTobChipLocalCoord(hist, 0, false);
825  return hist;
826 }
827 
828 // Book CPM crate/module vs FPGA
829 
831  const std::string& name, const std::string& title)
832 {
833  TH2F_LW *hist = book2F(name, title, 56, 0., 56., 20, 0., 20.);
835  numbers(hist, 2, 17, 1, 2, false);
836  // colour overlap fpga bins
837  LWHist::LWHistAxis* axis = hist->GetYaxis();
838  axis->SetBinLabel(1, "#color[4]{0}");
839  axis->SetBinLabel(2, "#color[4]{1}");
840  axis->SetBinLabel(19, "#color[4]{18}");
841  axis->SetBinLabel(20, "#color[4]{19}");
842  axis->SetTitle("Serialiser FPGA");
843  return hist;
844 }
845 
846 // Book CPM crate/module vs thresholds
847 
849  const std::string& name, const std::string& title)
850 {
851  TH2F_LW *hist = book2F(name, title, 56, 0., 56., 16, 0., 16.);
853  cpmThresholds(hist, 0, false);
854  return hist;
855 }
856 
857 // Book CPM eta vs phi
858 
860  const std::string& title)
861 {
862  TH2F_LW* hist = 0;
864  if (m_shrinkEtaBins) {
866  axis = hist->GetXaxis();
867  for (int bin = 1; bin <= 8; ++bin) {
868  axis->SetBinLabel(bin, "+");
869  axis->SetBinLabel(bin+58, "+");
870  }
871  } else {
872  hist = book2F(name, title, 50, -2.5, 2.5, 64, 0., 64.);
873  hist->SetXTitle("eta");
874  const double phiBin = M_PI/32.;
875  const double halfPhiBin = M_PI/64.;
876  axis = hist->GetYaxis();
877  for (int chan = 0; chan < 64; chan += 4 ) {
878  const double rad = chan*phiBin + halfPhiBin;
879  axis->SetBinLabel(chan+1, intDoubleString(chan, rad).c_str());
880  }
881  axis->SetBinLabel(64, "phi");
882  }
883  return hist;
884 }
885 
886 // Book CPM RoI eta vs phi
887 
889  const std::string& title)
890 {
891  TH2F_LW* hist = 0;
893  if (m_shrinkEtaBins) {
894  hist = book2F(name, title, 66, -3.3, 3.3, 64, 0., 64.);
895  axis = hist->GetXaxis();
896  for (int chan = -24; chan < 26; chan+=4) {
897  const double eta = (chan/10.);
898  axis->SetBinLabel(chan+33, intDoubleString(chan, eta).c_str());
899  }
900  for (int bin = 1; bin <= 8; ++bin) {
901  axis->SetBinLabel(bin, "+");
902  axis->SetBinLabel(bin+58, "+");
903  }
904  } else {
905  hist = book2F(name, title, 50, -2.45, 2.55, 64, 0., 64.);
906  hist->SetXTitle("eta");
907  }
908  const double phiBin = M_PI/32.;
909  axis = hist->GetYaxis();
910  for (int chan = 0; chan < 64; chan += 4 ) {
911  const double rad = (chan + 1)*phiBin;
912  axis->SetBinLabel(chan+1, intDoubleString(chan, rad).c_str());
913  }
914  if (m_shrinkEtaBins) axis->SetBinLabel(64, "etaVphi");
915  else axis->SetBinLabel(64, "phi");
916  return hist;
917 }
918 
919 // Book CPM events with error/mismatch vs crate/module
920 
922  const std::string& name, const std::string& title)
923 {
924  TH2I_LW* hist = bookEventNumbers(name, title, 56, 0., 56.);
925  cpmCrateModule(hist, 0, false);
926  return hist;
927 }
928 
929 // Book CPM module vs crate
930 
932  const std::string& name, const std::string& title)
933 {
934  TH2F_LW *hist = book2F(name, title, 14, 1., 15., 4, 0., 4.);
935  numbers(hist, 1, 14);
936  numbers(hist, 0, 3, 1, 0, false);
937  hist->GetXaxis()->SetTitle("Module");
938  hist->GetYaxis()->SetTitle("Crate");
939  return hist;
940 }
941 
942 // Book CPM module vs crate/CMX
943 
945  const std::string& name, const std::string& title)
946 {
947  TH2F_LW *hist = book2F(name, title, 14, 1., 15., 8, 0., 8.);
948  numbers(hist, 1, 14);
949  hist->GetXaxis()->SetTitle("Module");
950  cpmCrateCMX(hist, 0, false);
951  return hist;
952 }
953 
954 // Book CPM crate/module vs CMX
955 
957  const std::string& name, const std::string& title)
958 {
959  TH2F_LW *hist = book2F(name, title, 56, 0., 56., 2, 0., 2.);
961  numbers(hist, 0, 3, 1, 0, false);
962  hist->GetYaxis()->SetTitle("CMX");
963  return hist;
964 }
965 
966 // Book CPM sub-status errors vs crate/module
967 
969  const std::string& name, const std::string& title)
970 {
971  TH2F_LW* hist = book2F(name, title, 8, 0., 8., 56, 0., 56.);
972  subStatus(hist);
973  cpmCrateModule(hist, 0, false);
974  return hist;
975 }
976 
977 // Book CPM Sum/CMX
978 
980  const std::string& title)
981 {
982  TH1F_LW* hist = book1F(name, title, 16, 0., 16.);
983  LWHist::LWHistAxis* axis = hist->GetXaxis();
984  axis->SetBinLabel(1, "L0/0");
985  axis->SetBinLabel(2, "L0/1");
986  axis->SetBinLabel(3, "L1/0");
987  axis->SetBinLabel(4, "L1/1");
988  axis->SetBinLabel(5, "L2/0");
989  axis->SetBinLabel(6, "L2/1");
990  axis->SetBinLabel(7, "L3/0");
991  axis->SetBinLabel(8, "L3/1");
992  axis->SetBinLabel(9, "R0/0");
993  axis->SetBinLabel(10, "R0/1");
994  axis->SetBinLabel(11, "R1/0");
995  axis->SetBinLabel(12, "R1/1");
996  axis->SetBinLabel(13, "R2/0");
997  axis->SetBinLabel(14, "R2/1");
998  axis->SetBinLabel(15, "T/0");
999  axis->SetBinLabel(16, "T/1");
1000  axis->SetTitle("Sum/CMX");
1001  return hist;
1002 }
1003 
1004 // Book CPM Sum vs Threshold
1005 
1007  const std::string& name, const std::string& title)
1008 {
1009  TH2F_LW* hist = book2F(name, title, 8, 0., 8., 16, 0., 16.);
1010  LWHist::LWHistAxis* axis = hist->GetXaxis();
1011  axis->SetBinLabel(1, "L0");
1012  axis->SetBinLabel(2, "L1");
1013  axis->SetBinLabel(3, "L2");
1014  axis->SetBinLabel(4, "L3");
1015  axis->SetBinLabel(5, "R0");
1016  axis->SetBinLabel(6, "R1");
1017  axis->SetBinLabel(7, "R2");
1018  axis->SetBinLabel(8, "T");
1019  axis->SetTitle("Sum (Local/Remote/Total)");
1020  cpmThresholds(hist, 0, false);
1021  return hist;
1022 }
1023 
1024 // Book CPM Sum vs Threshold by CMX
1025 
1027  const std::string& name, const std::string& title, int cmx)
1028 {
1029  TH2F_LW* hist = book2F(name, title, 8, 0., 8., 16, 0., 16.);
1030  LWHist::LWHistAxis* axis = hist->GetXaxis();
1031  axis->SetBinLabel(1, "L0");
1032  axis->SetBinLabel(2, "L1");
1033  axis->SetBinLabel(3, "L2");
1034  axis->SetBinLabel(4, "L3");
1035  axis->SetBinLabel(5, "R0");
1036  axis->SetBinLabel(6, "R1");
1037  axis->SetBinLabel(7, "R2");
1038  axis->SetBinLabel(8, "T");
1039  axis->SetTitle("Sum (Local/Remote/Total)");
1040  std::string type = (cmx) ? TrigConf::L1DataDef::emType() // <<== CHECK
1041  : TrigConf::L1DataDef::tauType();
1042  thresholds(hist, type, 0, false);
1043  return hist;
1044 }
1045 
1046 //===========================================================================
1047 // Booking Utilities - JEM
1048 //===========================================================================
1049 
1050 // Book JEM crate/module vs EX,Ey,Et
1051 
1053  const std::string& name, const std::string& title)
1054 {
1055  TH2F_LW* hist = book2F(name, title, 32, 0., 32., 3, 0., 3.);
1057  LWHist::LWHistAxis* axis = hist->GetYaxis();
1058  axis->SetBinLabel(1, "Ex");
1059  axis->SetBinLabel(2, "Ey");
1060  axis->SetBinLabel(3, "Et");
1061  return hist;
1062 }
1063 
1064 // Book JEM crate/module vs frame/local coord
1065 
1067  const std::string& name, const std::string& title)
1068 {
1069  TH2F_LW* hist = book2F(name, title, 32, 0., 32., 32, 0., 32.);
1071  jemFrameLoc(hist, 0, false);
1072  return hist;
1073 }
1074 
1075 // Book JEM crate/module vs thresholds
1076 
1078  const std::string& name, const std::string& title)
1079 {
1080  TH2F_LW* hist = book2F(name, title, 32, 0., 32., 16, 0., 16.);
1082  jemThresholds(hist, 0, false);
1083  return hist;
1084 }
1085 
1086 // Book JEM events with error/mismatch vs crate/module
1087 
1089  const std::string& name, const std::string& title)
1090 {
1091  TH2I_LW* hist = bookEventNumbers(name, title, 32, 0., 32.);
1092  jemCrateModule(hist, 0, false);
1093  return hist;
1094 }
1095 
1096 // Book JEM module Vs crate
1097 
1099  const std::string& name, const std::string& title)
1100 {
1101  TH2F_LW* hist = book2F(name, title, 16, 0., 16., 2, 0., 2.);
1102  numbers(hist, 0, 15);
1103  numbers(hist, 0, 1, 1, 0, false);
1104  hist->SetXTitle("Module");
1105  hist->SetYTitle("Crate");
1106  return hist;
1107 }
1108 
1109 // Book JEM eta
1110 
1112  const std::string& title)
1113 {
1114  const int nxbins = 32;
1115  const double xbins[nxbins+1] = {-4.9,-3.2,-2.9,-2.7,-2.4,-2.2,-2.0,-1.8,-1.6,
1116  -1.4,-1.2,-1.0,-0.8,-0.6,-0.4,-0.2,0.0,0.2,
1117  0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.0,2.2,2.4,
1118  2.7,2.9,3.2,4.9};
1119  TH1F_LW* hist = book1F(name, title, nxbins, xbins);
1120  hist->SetXTitle("eta");
1121  return hist;
1122 }
1123 
1124 // Book JEM eta vs phi
1125 
1127  const std::string& title)
1128 {
1129  TH2F_LW* hist = 0;
1130  LWHist::LWHistAxis* axis = 0;
1131  if (m_shrinkEtaBins) {
1132  hist = book2F(name, title, 32, -3.2, 3.2, 32, 0., 32.);
1133  axis = hist->GetXaxis();
1134  for (int ch = -11; ch < 12; ch+=2) {
1135  int chan = ch;
1136  if (chan >= -1) ++chan;
1137  const double eta = chan/5. + 0.1;
1138  axis->SetBinLabel(chan+17, intDoubleString(chan, eta).c_str());
1139  }
1140  axis->SetBinLabel(2, "-15/-3.05");
1141  axis->SetBinLabel(4, "-13/-2.55");
1142  axis->SetBinLabel(29, "12/2.55");
1143  axis->SetBinLabel(31, "14/3.05");
1144  } else {
1145  const int nxbins = 32;
1146  const double xbins[nxbins+1] = {-4.9,-3.2,-2.9,-2.7,-2.4,-2.2,-2.0,-1.8,
1147  -1.6,-1.4,-1.2,-1.0,-0.8,-0.6,-0.4,-0.2,
1148  0.0,0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,
1149  2.0,2.2,2.4,2.7,2.9,3.2,4.9};
1150  hist = book2F(name, title, nxbins, xbins, 32, 0., 32.);
1151  hist->SetXTitle("eta");
1152  }
1153  axis = hist->GetYaxis();
1154  const double phiBin = M_PI/16.;
1155  const double halfPhiBin = M_PI/32.;
1156  for (int chan = 0; chan < 32; chan += 2 ) {
1157  const double rad = chan*phiBin + halfPhiBin;
1158  axis->SetBinLabel(chan+1, intDoubleString(chan, rad).c_str());
1159  }
1160  if (m_shrinkEtaBins) axis->SetBinLabel(32, "etaVphi");
1161  else axis->SetBinLabel(32, "phi");
1162  return hist;
1163 }
1164 
1165 // Book JEM RoI eta vs phi
1166 
1168  const std::string& title)
1169 {
1170  TH2F_LW* hist = 0;
1171  LWHist::LWHistAxis* axis = 0;
1172  if (m_shrinkEtaBins) {
1173  hist = book2F(name, title, 32, -3.2, 3.2, 32, 0., 32.);
1174  axis = hist->GetXaxis();
1175  for (int chan = -10; chan < 12; chan+=2) {
1176  const double eta = chan/5.;
1177  axis->SetBinLabel(chan+16, intDoubleString(chan, eta).c_str());
1178  }
1179  axis->SetBinLabel(2, "-14/-2.95");
1180  axis->SetBinLabel(4, "-12/-2.45");
1181  axis->SetBinLabel(28, "12/2.45");
1182  axis->SetBinLabel(30, "14/2.95");
1183  axis->SetBinLabel(32, "16/4.05");
1184  } else {
1185  const int nxbins = 32;
1186  const double xbins[nxbins+1] = {-4.0,-3.05,-2.8,-2.55,-2.3,-2.1,-1.9,-1.7,
1187  -1.5,-1.3,-1.1,-0.9,-0.7,-0.5,-0.3,-0.1,
1188  0.1,0.3,0.5,0.7,0.9,1.1,1.3,1.5,1.7,1.9,
1189  2.1,2.3,2.55,2.8,3.05,4.0,4.95};
1190  hist = book2F(name, title, nxbins, xbins, 32, 0., 32.);
1191  hist->SetXTitle("eta");
1192  }
1193  axis = hist->GetYaxis();
1194  const double phiBin = M_PI/16.;
1195  for (int chan = 0; chan < 32; chan += 2 ) {
1196  const double rad = (chan + 1)*phiBin;
1197  axis->SetBinLabel(chan+1, intDoubleString(chan, rad).c_str());
1198  }
1199  if (m_shrinkEtaBins) axis->SetBinLabel(32, "etaVphi");
1200  else axis->SetBinLabel(32, "phi");
1201  return hist;
1202 }
1203 
1204 // Book JEM energy with bins matching QuadLinear encoding
1205 
1207  const std::string& title,
1208  int scale)
1209 {
1210  if (scale < 1) scale = 1;
1211  const int eRange = 256; //range of encoded value
1212  const int dRange = 4096*scale; //range of decoded value
1213  std::set<int> sorted;
1214  for (int i = 0; i < eRange; ++i) {
1215  const int val = LVL1::QuadLinear::Expand(i);
1216  if (val != 0) sorted.insert(val);
1217  }
1218  double binedges[eRange+2];
1219  int nbins = (scale > 1) ? 1 : 0;
1220  std::set<int>::const_iterator iter = sorted.begin();
1221  std::set<int>::const_iterator iterE = sorted.end();
1222  for (; iter != iterE; ++iter) {
1223  binedges[nbins] = (*iter)*scale;
1224  ++nbins;
1225  }
1226  binedges[0] = 1;
1227  //if (scale > 1) binedges[1] = scale;
1228  binedges[nbins] = dRange;
1229  TH1F_LW* hist = book1F(name, title, nbins, binedges);
1230  return hist;
1231 }
1232 
1233 
1234 // Book JEM main jet thresholds
1235 
1237  const std::string& name, const std::string& title)
1238 {
1239  const int nbins = TrigConf::L1DataDef::max_JET_Threshold_Number();
1240  TH1F_LW* hist = book1F(name, title, nbins, 0, nbins);
1242  return hist;
1243 }
1244 
1245 // Book JEM backward jet thresholds
1246 
1248  const std::string& name, const std::string& title)
1249 {
1250  const int nbins = TrigConf::L1DataDef::max_JB_Threshold_Number();
1251  TH1F_LW* hist = book1F(name, title, nbins, 0, nbins);
1253  return hist;
1254 }
1255 
1256 // Book JEM forward jet thresholds
1257 
1259  const std::string& name, const std::string& title)
1260 {
1261  const int nbins = TrigConf::L1DataDef::max_JF_Threshold_Number();
1262  TH1F_LW* hist = book1F(name, title, nbins, 0, nbins);
1264  return hist;
1265 }
1266 
1267 // Book JEM JetEt thresholds
1268 
1270  const std::string& name, const std::string& title)
1271 {
1272  const int nbins = TrigConf::L1DataDef::max_JE_Threshold_Number();
1273  TH1F_LW* hist = book1F(name, title, nbins, 0, nbins);
1275  return hist;
1276 }
1277 
1278 // Book JEM MissingEt thresholds
1279 
1281  const std::string& name, const std::string& title)
1282 {
1283  const int nbins = TrigConf::L1DataDef::max_XE_Threshold_Number();
1284  TH1F_LW* hist = book1F(name, title, nbins, 0, nbins);
1286  return hist;
1287 }
1288 
1289 // Book JEM SumEt thresholds
1290 
1292  const std::string& name, const std::string& title)
1293 {
1294  //const int nbins = TrigConf::L1DataDef::max_TE_Threshold_Number();
1295  const int nbins = 8;
1296  TH1F_LW* hist = book1F(name, title, nbins, 0, nbins);
1298  return hist;
1299 }
1300 
1301 // Book JEM MissingEtSig thresholds
1302 
1304  const std::string& name, const std::string& title)
1305 {
1306  //const int nbins = TrigConf::L1DataDef::max_XS_Threshold_Number();
1307  const int nbins = 8;
1308  TH1F_LW* hist = book1F(name, title, nbins, 0, nbins);
1310  return hist;
1311 }
1312 
1313 // Book JEM sub-status errors vs crate/module
1314 
1316  const std::string& name, const std::string& title)
1317 {
1318  TH2F_LW* hist = book2F(name, title, 8, 0., 8., 32, 0., 32.);
1319  subStatus(hist);
1320  jemCrateModule(hist, 0, false);
1321  return hist;
1322 }
1323 
1324 // Book JEM sub-status errors vs crate
1325 
1327  const std::string& name, const std::string& title)
1328 {
1329  TH2F_LW* hist = book2F(name, title, 8, 0., 8., 2, 0., 2.);
1330  subStatus(hist);
1331  numbers(hist, 0, 1, 1, 0, false);
1332  hist->SetYTitle("Crate");
1333  return hist;
1334 }
1335 
1336 //===========================================================================
1337 // Booking Utilities - PPM
1338 //===========================================================================
1339 
1340 // Book PPM Em eta
1341 
1343  const std::string& title)
1344 {
1345  const int nxbins = 66;
1346  const double xbins[nxbins+1] = {-4.9,-4.475,-4.050,-3.625,-3.2,-3.1,-2.9,
1347  -2.7,-2.5,-2.4,-2.3,-2.2,-2.1,-2.0,-1.9,
1348  -1.8,-1.7,-1.6,-1.5,-1.4,-1.3,-1.2,-1.1,
1349  -1.0,-0.9,-0.8,-0.7,-0.6,-0.5,-0.4,-0.3,
1350  -0.2,-0.1,0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,
1351  0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,
1352  1.8,1.9,2.0,2.1,2.2,2.3,2.4,2.5,2.7,2.9,
1353  3.1,3.2,3.625,4.050,4.475,4.9};
1354  TH1F_LW* hist = book1F(name, title, nxbins, xbins);
1355  hist->SetXTitle("eta");
1356  return hist;
1357 }
1358 
1359 // Book PPM Had eta
1360 
1362  const std::string& title)
1363 {
1364  const int nxbins = 62;
1365  const double xbins[nxbins+1] = {-4.9,-4.050,-3.2,-3.1,-2.9,
1366  -2.7,-2.5,-2.4,-2.3,-2.2,-2.1,-2.0,-1.9,
1367  -1.8,-1.7,-1.6,-1.5,-1.4,-1.3,-1.2,-1.1,
1368  -1.0,-0.9,-0.8,-0.7,-0.6,-0.5,-0.4,-0.3,
1369  -0.2,-0.1,0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,
1370  0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,
1371  1.8,1.9,2.0,2.1,2.2,2.3,2.4,2.5,2.7,2.9,
1372  3.1,3.2,4.050,4.9};
1373  TH1F_LW* hist = book1F(name, title, nxbins, xbins);
1374  hist->SetXTitle("eta");
1375  return hist;
1376 }
1377 
1378 // Book PPM Em eta vs phi
1379 
1381  const std::string& title)
1382 {
1383  TH2F_LW* hist = 0;
1384  LWHist::LWHistAxis* axis = 0;
1385  if (m_shrinkEtaBins) {
1386  hist = book2F(name, title, 66, -3.3, 3.3, 64, 0., 64.);
1387  axis = hist->GetXaxis();
1388  for (int ch = -25; ch < 25; ch+=4) {
1389  int chan = ch;
1390  if (chan >= -1) ++chan;
1391  const double eta = (chan/10.)+0.05;
1392  axis->SetBinLabel(chan+34, intDoubleString(chan, eta).c_str());
1393  }
1394  axis->SetBinLabel(1, "-49/-4.41");
1395  axis->SetBinLabel(5, "-32/-3.15");
1396  axis->SetBinLabel(62, "31/3.15");
1397  axis->SetBinLabel(66, "44/4.41");
1398  } else {
1399  const int nxbins = 66;
1400  const double xbins[nxbins+1] = {-4.9,-4.475,-4.050,-3.625,-3.2,-3.1,-2.9,
1401  -2.7,-2.5,-2.4,-2.3,-2.2,-2.1,-2.0,-1.9,
1402  -1.8,-1.7,-1.6,-1.5,-1.4,-1.3,-1.2,-1.1,
1403  -1.0,-0.9,-0.8,-0.7,-0.6,-0.5,-0.4,-0.3,
1404  -0.2,-0.1,0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,
1405  0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,
1406  1.8,1.9,2.0,2.1,2.2,2.3,2.4,2.5,2.7,2.9,
1407  3.1,3.2,3.625,4.050,4.475,4.9};
1408  hist = book2F(name, title, nxbins, xbins, 64, 0., 64.);
1409  hist->SetXTitle("eta");
1410  }
1411 
1412  axis = hist->GetYaxis();
1413  const double phiBin = M_PI/32.;
1414  const double halfPhiBin = M_PI/64.;
1415  for (int chan = 0; chan < 64; chan += 4 ) {
1416  const double rad = chan*phiBin + halfPhiBin;
1417  axis->SetBinLabel(chan+1, intDoubleString(chan, rad).c_str());
1418  }
1419  if (m_shrinkEtaBins) axis->SetBinLabel(64, "etaVphi");
1420  else axis->SetBinLabel(64, "phi");
1421  return hist;
1422 
1423 }
1424 
1425 // Book PPM Had eta vs phi
1426 
1428  const std::string& title)
1429 {
1431  if (m_shrinkEtaBins) {
1432  LWHist::LWHistAxis* axis = hist->GetXaxis();
1433  axis->SetBinLabel(1, "-49/-4.17");
1434  axis->SetBinLabel(66, "44/4.19");
1435  }
1436  return hist;
1437 
1438 }
1439 
1440 // Book PPM Em eta vs phi profile
1441 
1443  const std::string& name, const std::string& title)
1444 {
1445  // todo - remove duplication with above
1446  TProfile2D_LW* hist = 0;
1447  LWHist::LWHistAxis* axis = 0;
1448  if (m_shrinkEtaBins) {
1449  hist = bookProfile2D(name, title, 66, -3.3, 3.3, 64, 0., 64.);
1450  axis = hist->GetXaxis();
1451  for (int ch = -25; ch < 25; ch+=4) {
1452  int chan = ch;
1453  if (chan >= -1) ++chan;
1454  const double eta = (chan/10.)+0.05;
1455  axis->SetBinLabel(chan+34, intDoubleString(chan, eta).c_str());
1456  }
1457  axis->SetBinLabel(1, "-49/-4.41");
1458  axis->SetBinLabel(5, "-32/-3.15");
1459  axis->SetBinLabel(62, "31/3.15");
1460  axis->SetBinLabel(66, "44/4.41");
1461  } else {
1462  const int nxbins = 66;
1463  const double xbins[nxbins+1] = {-4.9,-4.475,-4.050,-3.625,-3.2,-3.1,-2.9,
1464  -2.7,-2.5,-2.4,-2.3,-2.2,-2.1,-2.0,-1.9,
1465  -1.8,-1.7,-1.6,-1.5,-1.4,-1.3,-1.2,-1.1,
1466  -1.0,-0.9,-0.8,-0.7,-0.6,-0.5,-0.4,-0.3,
1467  -0.2,-0.1,0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,
1468  0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,
1469  1.8,1.9,2.0,2.1,2.2,2.3,2.4,2.5,2.7,2.9,
1470  3.1,3.2,3.625,4.050,4.475,4.9};
1471  hist = bookProfile2D(name, title, nxbins, xbins, 64, 0., 64.);
1472  hist->SetXTitle("eta");
1473  }
1474 
1475  axis = hist->GetYaxis();
1476  const double phiBin = M_PI/32.;
1477  const double halfPhiBin = M_PI/64.;
1478  for (int chan = 0; chan < 64; chan += 4 ) {
1479  const double rad = chan*phiBin + halfPhiBin;
1480  axis->SetBinLabel(chan+1, intDoubleString(chan, rad).c_str());
1481  }
1482  if (m_shrinkEtaBins) axis->SetBinLabel(64, "etaVphi");
1483  else axis->SetBinLabel(64, "phi");
1484  return hist;
1485 
1486 }
1487 
1488 // Book PPM Had eta vs phi profile
1489 
1491  const std::string& name, const std::string& title)
1492 {
1494  if (m_shrinkEtaBins) {
1495  LWHist::LWHistAxis* axis = hist->GetXaxis();
1496  axis->SetBinLabel(1, "-49/-4.17");
1497  axis->SetBinLabel(66, "44/4.19");
1498  }
1499  return hist;
1500 
1501 }
1502 
1503 // Book PPM events with error/mismatch vs crate/module
1504 
1506  const std::string& name, const std::string& title,
1507  int firstCrate, int lastCrate)
1508 {
1509  const int nbins = (lastCrate-firstCrate+1)*16;
1511  ppmCrateModule(hist, firstCrate, lastCrate, 0, false);
1512  return hist;
1513 }
1514 
1515 // Book PPM Crate/Module vs Submodule/Channel
1516 
1518  const std::string& name, const std::string& title,
1519  int firstCrate, int lastCrate)
1520 {
1521  const int nbins = (lastCrate-firstCrate+1)*16;
1522  TH2F_LW* hist = book2F(name, title, nbins, 0., nbins, 64, 0., 64.);
1523  ppmCrateModule(hist, firstCrate, lastCrate);
1524  ppmSubmoduleChannel(hist, 0, false);
1525  return hist;
1526 }
1527 
1528 // Book PPM Crate/Module vs Submodule/Channel profile
1529 
1532  const std::string& name, const std::string& title,
1533  int firstCrate, int lastCrate)
1534 {
1535  const int nbins = (lastCrate-firstCrate+1)*16;
1537  64, 0., 64.);
1538  ppmCrateModule(hist, firstCrate, lastCrate);
1539  ppmSubmoduleChannel(hist, 0, false);
1540  return hist;
1541 }
1542 
1543 // Book PPM SubStatus vs crate/module
1544 
1546  const std::string& name, const std::string& title,
1547  int firstCrate, int lastCrate)
1548 {
1549  const int nbins = (lastCrate-firstCrate+1)*16;
1550  TH2F_LW* hist = book2F(name, title, 8, 0., 8., nbins, 0., nbins);
1551  subStatus(hist);
1552  ppmCrateModule(hist, firstCrate, lastCrate, 0, false);
1553  return hist;
1554 }
1555 
1556 // Book PPM ASIC errors vs crate/module
1557 
1559  const std::string& name, const std::string& title,
1560  int firstCrate, int lastCrate)
1561 {
1562  const int nbins = (lastCrate-firstCrate+1)*16;
1563  TH2F_LW* hist = book2F(name, title, 8, 0., 8., nbins, 0., nbins);
1564  ppmErrors(hist);
1565  ppmCrateModule(hist, firstCrate, lastCrate, 0, false);
1566  return hist;
1567 }
1568 
1569 //===========================================================================
1570 // Filling Utilities - General
1571 //===========================================================================
1572 
1573 // Get Minimum and Maximun bins and contents of 2D histogram
1574 
1576  int& minBinx, int& minBiny, int& maxBinx, int& maxBiny,
1577  double& minValue, double& maxValue)
1578 {
1579  //NB. this ignores bins with content & error = 0
1580  minBinx = 1;
1581  minBiny = 1;
1582  maxBinx = 1;
1583  maxBiny = 1;
1584  minValue = 0.;
1585  maxValue = 0.;
1586  bool found = false;
1587  unsigned int ix = 0;
1588  unsigned int iy = 0;
1589  double content = 0.;
1590  double error = 0.;
1591  hist->resetActiveBinLoop();
1592  while(hist->getNextActiveBin(ix, iy, content, error)) {
1593  if (!found) {
1594  minBinx = ix;
1595  minBiny = iy;
1596  maxBinx = ix;
1597  maxBiny = iy;
1598  minValue = content;
1599  maxValue = content;
1600  found = true;
1601  } else {
1602  if (content < minValue) {
1603  minValue = content;
1604  minBinx = ix;
1605  minBiny = iy;
1606  } else if (content > maxValue) {
1607  maxValue = content;
1608  maxBinx = ix;
1609  maxBiny = iy;
1610  }
1611  }
1612  }
1613  // return false if no active bins found
1614  return found;
1615 }
1616 
1617 // Get Minimum and Maximun bins and contents of 2D Profile histogram
1618 
1620  int& minBinx, int& minBiny, int& maxBinx, int& maxBiny,
1621  double& minValue, double& maxValue)
1622 {
1623  //NB. this ignores bins with no entries
1624  minBinx = 1;
1625  minBiny = 1;
1626  maxBinx = 1;
1627  maxBiny = 1;
1628  minValue = 0.;
1629  maxValue = 0.;
1630  bool found = false;
1631  const int xbins = hist->GetNbinsX();
1632  const int ybins = hist->GetNbinsY();
1633  for (int ix = 1; ix <= xbins; ++ix) {
1634  for (int iy = 1; iy <= ybins; ++iy) {
1635  double entries = 0.;
1636  double content = 0.;
1637  double error = 0.;
1638  hist->GetBinInfo(ix, iy, entries, content, error);
1639  if (entries > 0.) {
1640  if (!found) {
1641  minBinx = ix;
1642  minBiny = iy;
1643  maxBinx = ix;
1644  maxBiny = iy;
1645  minValue = content;
1646  maxValue = content;
1647  found = true;
1648  } else {
1649  if (content < minValue) {
1650  minValue = content;
1651  minBinx = ix;
1652  minBiny = iy;
1653  } else if (content > maxValue) {
1654  maxValue = content;
1655  maxBinx = ix;
1656  maxBiny = iy;
1657  }
1658  }
1659  }
1660  }
1661  }
1662  // return false if no entries found
1663  return found;
1664 }
1665 
1666 // Fill Error/Mismatch event number
1667 
1669 {
1670  const EventContext& ctx = Gaudi::Hive::currentContext();
1671  int eventNumber = ctx.eventID().event_number();
1672  if (eventNumber <= 0) return;
1673  const int biny = hist->GetYaxis()->FindBin(y);
1674  const int nbins = hist->GetNbinsX();
1675  double entries = hist->GetEntries();
1676  for (int binx = 1; binx <= nbins; ++binx) {
1677  const int val = hist->GetBinContent(binx, biny);
1678  if (val == eventNumber) break;
1679  else if (val == 0) {
1680  hist->SetBinContent(binx, biny, eventNumber);
1681  entries++;
1682  break;
1683  } else if (eventNumber < val) {
1684  for (int b = nbins; b > binx; --b) {
1685  const int v1 = hist->GetBinContent(b-1, biny);
1686  if (v1 == 0) continue;
1687  const int v2 = hist->GetBinContent(b, biny);
1688  if (v2 == 0) entries++;
1689  hist->SetBinContent(b, biny, v1);
1690  }
1691  hist->SetBinContent(binx, biny, eventNumber);
1692  break;
1693  }
1694  }
1695  hist->SetEntries(entries);
1696 }
1697 
1698 // Fill weighted thresholds 1D
1699 
1701  int nThresh, int nBits, int offset)
1702 {
1703  if (val) {
1704  const int mask = (1 << nBits) - 1;
1705  for (int thr = 0; thr < nThresh; ++thr) {
1706  const int hit = (val >> (nBits*thr)) & mask;
1707  if (hit) hist->Fill(thr + offset, hit);
1708  }
1709  }
1710 }
1711 
1712 // Fill weighted thresholds 2D, X axis
1713 
1715  int y, int nThresh, int nBits, int offset)
1716 {
1717  if (val) {
1718  const int mask = (1 << nBits) - 1;
1719  for (int thr = 0; thr < nThresh; ++thr) {
1720  const int hit = (val >> (nBits*thr)) & mask;
1721  if (hit) hist->Fill(thr + offset, y, hit);
1722  }
1723  }
1724 }
1725 
1726 // Fill weighted thresholds 2D, Y axis
1727 
1729  int val, int nThresh, int nBits, int offset)
1730 {
1731  if (val) {
1732  const int mask = (1 << nBits) - 1;
1733  for (int thr = 0; thr < nThresh; ++thr) {
1734  const int hit = (val >> (nBits*thr)) & mask;
1735  if (hit) hist->Fill(x, thr + offset, hit);
1736  }
1737  }
1738 }
1739 
1740 // Replace the contents of one 2D histogram with those of another
1741 
1743  LWHist2D* histFrom)
1744 {
1745  histTo->Reset();
1746  unsigned int ix = 0;
1747  unsigned int iy = 0;
1748  double content = 0.;
1749  double error = 0.;
1750  histFrom->resetActiveBinLoop();
1751  while (histFrom->getNextActiveBin(ix, iy, content, error)) {
1752  histTo->SetBinContentAndError(ix, iy, content, error);
1753  }
1754  double sumW = 0.;
1755  double sumW2 = 0.;
1756  double sumWX = 0.;
1757  double sumWX2 = 0.;
1758  double sumWY = 0.;
1759  double sumWY2 = 0.;
1760  double sumWXY = 0.;
1761  histFrom->getSums(sumW, sumW2, sumWX, sumWX2, sumWY, sumWY2, sumWXY);
1762  histTo->setSums(sumW, sumW2, sumWX, sumWX2, sumWY, sumWY2, sumWXY);
1763  histTo->SetEntries(histFrom->GetEntries());
1764 }
1765 
1766 // Replace the contents of one 2D Profile histogram with those of another
1767 
1769  TProfile2D_LW* histFrom)
1770 {
1771  histTo->Reset();
1772  const int xbins = histFrom->GetNbinsX();
1773  const int ybins = histFrom->GetNbinsY();
1774  for (int ix = 1; ix <= xbins; ++ix) {
1775  for (int iy = 1; iy <= ybins; ++iy) {
1776  double entries = 0.;
1777  double contentOut = 0.;
1778  double errorOut = 0.;
1779  histFrom->GetBinInfo(ix, iy, entries, contentOut, errorOut);
1780  if (entries > 0.) {
1781  const double contentIn = contentOut*entries;
1782  const double errorIn = sqrt(errorOut*errorOut*entries*entries
1783  + contentOut*contentOut*entries);
1784  histTo->SetBinInfo(ix, iy, entries, contentIn, errorIn);
1785  }
1786  }
1787  }
1788  double sumW = 0.;
1789  double sumW2 = 0.;
1790  double sumWX = 0.;
1791  double sumWX2 = 0.;
1792  double sumWY = 0.;
1793  double sumWY2 = 0.;
1794  double sumWXY = 0.;
1795  double sumWZ = 0.;
1796  double sumWZ2 = 0.;
1797  histFrom->getSums(sumW, sumW2, sumWX, sumWX2, sumWY, sumWY2, sumWXY,
1798  sumWZ, sumWZ2);
1799  histTo->setSums(sumW, sumW2, sumWX, sumWX2, sumWY, sumWY2, sumWXY,
1800  sumWZ, sumWZ2);
1801  histTo->SetEntries(histFrom->GetEntries());
1802 }
1803 
1804 //===========================================================================
1805 // Filling Utilities - CPM
1806 //===========================================================================
1807 
1808 // Fill CPM eta vs phi
1809 
1811  double phi, double weight)
1812 {
1813  const double phiMod = phi * m_phiScaleTT;
1814  hist->Fill(eta, phiMod, weight);
1815 }
1816 
1817 // Fill CPM RoI eta vs phi
1818 
1820  double phi, double weight)
1821 {
1822  const double phiMod = phi * m_phiScaleTT - 0.5;
1823  double etaMod = eta;
1824  if (m_shrinkEtaBins) etaMod -= 0.05;
1825  hist->Fill(etaMod, phiMod, weight);
1826 }
1827 
1828 //===========================================================================
1829 // Filling Utilities - JEM
1830 //===========================================================================
1831 
1832 // Fill JEM eta vs phi
1833 
1835  double phi, double weight)
1836 {
1837  double phiMod = phi * m_phiScaleJE;
1838  double etaMod = eta;
1839  const double absEta = fabs(eta);
1840  if (m_shrinkEtaBins && absEta > 2.4) {
1841  int offset = 1;
1842  if (absEta > 3.2) offset = 4;
1843  else if (absEta > 2.9) offset = 3;
1844  else if (absEta > 2.7) offset = 2;
1845  etaMod = 2.3 + 0.2*offset;
1846  if (eta < 0.) etaMod = -etaMod;
1847  }
1848  if (eta < -3.2 || eta > 3.2) {
1849  // Fill two bins for FCAL
1850  phiMod = floor(phiMod/2)*2. + 1.;
1851  hist->Fill(etaMod, phiMod + 0.5, weight);
1852  hist->Fill(etaMod, phiMod - 0.5, weight);
1853  } else hist->Fill(etaMod, phiMod, weight);
1854 }
1855 
1856 // Fill JEM RoI eta vs phi
1857 
1859  double phi, double weight)
1860 {
1861  const double phiMod = phi * m_phiScaleJE - 0.5;
1862  double etaMod = eta;
1863  const double absEta = fabs(eta);
1864  if (m_shrinkEtaBins && absEta > 2.3) {
1865  int offset = 1;
1866  if (absEta > 4.0) offset = 5;
1867  else if (absEta > 3.05) offset = 4;
1868  else if (absEta > 2.8) offset = 3;
1869  else if (absEta > 2.55) offset = 2;
1870  etaMod = 2.2 + 0.2*offset;
1871  if (eta < 0.) etaMod = -etaMod;
1872  }
1873  const double etaShift = (m_shrinkEtaBins) ? 0.1 : 0.;
1874  // JEPRoIDecoder returns eta=3.9 for both of the two forwardmost bins
1875  if (eta > 3.8 && eta < 4.0) {
1876  const double eta2 = (m_shrinkEtaBins) ? 3.2 : 4.05;
1877  hist->Fill(eta2 - etaShift, phiMod, weight);
1878  }
1879  hist->Fill(etaMod - etaShift, phiMod, weight);
1880 }
1881 
1882 // Fill JEM phi allowing for granularity varying with eta
1883 
1885  double eta, double phi, double weight)
1886 {
1887  const double halfBin = 1./(2.*m_phiScaleJE);
1888  if (eta < -3.2 || eta > 3.2) {
1889  // Fill two bins for FCAL
1890  hist->Fill(phi + halfBin, weight);
1891  hist->Fill(phi - halfBin, weight);
1892  } else hist->Fill(phi, weight);
1893 }
1894 
1895 //===========================================================================
1896 // Filling Utilities - PPM
1897 //===========================================================================
1898 
1899 // Fill PPM Em eta vs phi
1900 
1902  double phi, double weight)
1903 {
1904  double phiMod = phi * m_phiScaleTT;
1905  double etaMod = eta;
1906  const double absEta = fabs(eta);
1907  if (absEta > 3.2) {
1908  if (m_shrinkEtaBins) {
1909  etaMod = 2.9 + 0.1*(absEta-3.2)/0.425;
1910  if (eta < 0.) etaMod = -etaMod;
1911  }
1912  // Fill four bins in phi
1913  phiMod = floor(phiMod/4)*4. + 2.;
1914  hist->Fill(etaMod, phiMod + 1.5, weight);
1915  hist->Fill(etaMod, phiMod + 0.5, weight);
1916  hist->Fill(etaMod, phiMod - 0.5, weight);
1917  hist->Fill(etaMod, phiMod - 1.5, weight);
1918  } else if (absEta > 2.5) {
1919  if (m_shrinkEtaBins) {
1920  etaMod = (absEta > 3.1) ? 2.85 : 2.5 + (absEta-2.5)/2.;
1921  if (eta < 0.) etaMod = -etaMod;
1922  }
1923  // Fill two bins in phi
1924  phiMod = floor(phiMod/2)*2. + 1.;
1925  hist->Fill(etaMod, phiMod + 0.5, weight);
1926  hist->Fill(etaMod, phiMod - 0.5, weight);
1927  } else hist->Fill(eta, phiMod, weight);
1928 }
1929 
1930 // Fill PPM Had eta vs phi
1931 
1933  double phi, double weight)
1934 {
1935  // Use EM mapping - puts FCAL2 in left half of bin and FCAL3 in right half
1937 }
1938 
1939 // Fill PPM Em eta vs phi profile
1940 
1942  double eta, double phi, double z, double weight)
1943 {
1944  double phiMod = phi * m_phiScaleTT;
1945  double etaMod = eta;
1946  const double absEta = fabs(eta);
1947  if (absEta > 3.2) {
1948  if (m_shrinkEtaBins) {
1949  etaMod = 2.9 + 0.1*(absEta-3.2)/0.425;
1950  if (eta < 0.) etaMod = -etaMod;
1951  }
1952  // Fill four bins in phi
1953  phiMod = floor(phiMod/4)*4. + 2.;
1954  hist->Fill(etaMod, phiMod + 1.5, z, weight);
1955  hist->Fill(etaMod, phiMod + 0.5, z, weight);
1956  hist->Fill(etaMod, phiMod - 0.5, z, weight);
1957  hist->Fill(etaMod, phiMod - 1.5, z, weight);
1958  } else if (absEta > 2.5) {
1959  if (m_shrinkEtaBins) {
1960  etaMod = (absEta > 3.1) ? 2.85 : 2.5 + (absEta-2.5)/2.;
1961  if (eta < 0.) etaMod = -etaMod;
1962  }
1963  // Fill two bins in phi
1964  phiMod = floor(phiMod/2)*2. + 1.;
1965  hist->Fill(etaMod, phiMod + 0.5, z, weight);
1966  hist->Fill(etaMod, phiMod - 0.5, z, weight);
1967  } else hist->Fill(eta, phiMod, z, weight);
1968 }
1969 
1970 // Fill PPM Had eta vs phi profile
1971 
1973  double eta, double phi, double z, double weight)
1974 {
1975  // Use EM mapping - puts FCAL2 in left half of bin and FCAL3 in right half
1977 }
1978 
1979 // Fill PPM phi allowing for granularity varying with eta
1980 
1982  double eta, double phi, double weight)
1983 {
1984  const double halfBin = 1./(2.*m_phiScaleTT);
1985  const double absEta = fabs(eta);
1986  if (absEta > 3.2) {
1987  // Fill four bins in phi
1988  hist->Fill(phi + 3.*halfBin, weight);
1989  hist->Fill(phi + halfBin, weight);
1990  hist->Fill(phi - halfBin, weight);
1991  hist->Fill(phi - 3.*halfBin, weight);
1992  } else if (absEta > 2.5) {
1993  // Fill two bins in phi
1994  hist->Fill(phi + halfBin, weight);
1995  hist->Fill(phi - halfBin, weight);
1996  } else hist->Fill(phi, weight);
1997 }
1998 
1999 // Fill PPM phi profile allowing for granularity varying with eta
2000 
2002  double eta, double phi, double z, double weight)
2003 {
2004  const double halfBin = 1./(2.*m_phiScaleTT);
2005  const double absEta = fabs(eta);
2006  if (absEta > 3.2) {
2007  // Fill four bins in phi
2008  hist->Fill(phi + 3.*halfBin, z, weight);
2009  hist->Fill(phi + halfBin, z, weight);
2010  hist->Fill(phi - halfBin, z, weight);
2011  hist->Fill(phi - 3.*halfBin, z, weight);
2012  } else if (absEta > 2.5) {
2013  // Fill two bins in phi
2014  hist->Fill(phi + halfBin, z, weight);
2015  hist->Fill(phi - halfBin, z, weight);
2016  } else hist->Fill(phi, z, weight);
2017 }
2018 
2019 // Find bin in Em eta vs phi
2020 
2022  double eta, double phi, int& binx, int& biny)
2023 {
2024  double phiMod = phi * m_phiScaleTT;
2025  if (eta < -2.5 || eta > 2.5) phiMod += 0.5;
2026  double etaMod = eta;
2027  if (m_shrinkEtaBins) {
2028  const double absEta = fabs(eta);
2029  if (absEta > 3.2) {
2030  etaMod = 2.9 + 0.1*(absEta-3.2)/0.425;
2031  if (eta < 0.) etaMod = -etaMod;
2032  } else if (absEta > 2.5) {
2033  etaMod = (absEta > 3.1) ? 2.85 : 2.5 + (absEta-2.5)/2.;
2034  if (eta < 0.) etaMod = -etaMod;
2035  }
2036  }
2037  binx = hist->GetXaxis()->FindBin(etaMod);
2038  biny = hist->GetYaxis()->FindBin(phiMod);
2039 }
2040 
2041 // Find bin in Had eta vs phi
2042 
2044  double eta, double phi, int& binx, int& biny)
2045 {
2046  findBinPPMEmEtaVsPhi(hist, eta, phi, binx, biny);
2047 }
2048 
2049 // Set bin content and optionally error in Em eta vs phi
2050 
2052  int binx, int biny, double content, double error)
2053 {
2054  int nbin = 1;
2055  if (binx <= 4 || binx >= 63) nbin = 4; // |eta|>3.2
2056  else if (binx <= 8 || binx >= 59) nbin = 2; // 2.5<|eta|<3.2
2057  const int binyBase = ((biny-1)/nbin)*nbin+1;
2058  for (int i = 0; i < nbin; ++i) {
2059  if (error >= 0.) {
2060  hist->SetBinContentAndError(binx, binyBase+i, content, error);
2061  } else hist->SetBinContent(binx, binyBase+i, content);
2062  }
2063 }
2064 
2065 // Set bin content and optionally error in Had eta vs phi
2066 
2068  int binx, int biny, double content, double error)
2069 {
2070  setBinPPMEmEtaVsPhi(hist, binx, biny, content, error);
2071 }
2072 
2073 //===========================================================================
2074 // Merge Utilities
2075 //===========================================================================
2076 
2077 // Scale histogram quantities by number of events for weightedAverage merge
2078 // Used for eg. DB status plots which are just filled on the first event
2079 // Call from procHistograms.
2080 
2081 // Obsolete - superceded by lowerLB merge method.
2082 
2084 {
2085  unsigned int entries = hist->GetEntries();
2086  if (entries > 0 && nevents > 0) {
2087  unsigned int ix = 0;
2088  unsigned int iy = 0;
2089  double content = 0.;
2090  double error = 0.;
2091  hist->resetActiveBinLoop();
2092  while (hist->getNextActiveBin(ix, iy, content, error)) {
2093  hist->SetBinError(ix, iy, 1./sqrt(nevents));
2094  }
2095  } else hist->SetBinError(1, 1, 0.); // merge always creates sumw2 array
2096  hist->setSums(0., 0., 0., 0., 0., 0., 0.); // to force recomputation
2097  hist->SetEntries(nevents*entries);
2098 }
2099 
2100 // Compute efficiencies and errors for perBinEffPerCent merge method
2101 // Call from procHistograms.
2102 
2104  LWHist* lw3) {
2105  TH1* hist1 = lw1->getROOTHistBase(); // denominator
2106  TH1* hist2 = lw2->getROOTHistBase(); // numerator
2107  TH1* hist3 = lw3->getROOTHistBase(); // % efficiency
2108  hist3->Sumw2();
2109  const double OneSigOneSided = 0.159;
2110  int nbins = hist3->GetNbinsX() + 2;
2111  if (hist3->GetDimension() == 2) nbins *= (hist3->GetNbinsY() + 2);
2112  for (int bin = 0; bin < nbins; ++bin) {
2113  double denom = hist1->GetBinContent(bin);
2114  if (denom == 0.) continue;
2115  float eff = hist2->GetBinContent(bin)/denom;
2116  float err = 0.;
2117  if (eff == 0. || eff > 0.99) {
2118  err = 1. - std::pow(OneSigOneSided, 1. / denom);
2119  } else {
2120  err = std::sqrt(eff * (1. - eff) / denom);
2121  }
2122  hist3->SetBinContent(bin, eff*100.);
2123  hist3->SetBinError(bin, err*100.);
2124  }
2125  hist3->SetEntries(hist1->GetEntries());
2126  if (hist3->GetDimension() == 1) {
2127  hist3->SetMinimum(0.);
2128  hist3->SetMaximum(110.);
2129  }
2130 }
2131 // ============================================================================
2132 } // end namespace
2133 // ============================================================================
LVL1::TrigT1CaloLWHistogramTool::numberPairs2
void numberPairs2(LWHist *hist, int firstMin, int firstMax, int secondMin, int secondMax, int step=1, int offset=0, bool xAxis=true)
Label bins with number pairs without skipping bins when stepping.
Definition: TrigT1CaloLWHistogramTool.cxx:128
LVL1::TrigT1CaloLWHistogramTool::jetEtThresholds
void jetEtThresholds(LWHist *hist, int offset=0, bool xAxis=true)
Label bins with JetEt threshold names.
Definition: TrigT1CaloLWHistogramTool.cxx:528
LVL1::TrigT1CaloLWHistogramTool::bookSumEtThresholds
TH1F_LW * bookSumEtThresholds(const std::string &name, const std::string &title)
Book JEM SumEt thresholds.
Definition: TrigT1CaloLWHistogramTool.cxx:1291
LVL1::TrigT1CaloLWHistogramTool::bookProfile
TProfile_LW * bookProfile(const std::string &name, const std::string &title, int nx, double xmin, double xmax)
Book and register a 1D profile histogram.
Definition: TrigT1CaloLWHistogramTool.cxx:626
LVL1::TrigT1CaloLWHistogramTool::bookTH2F
TH2F * bookTH2F(const std::string &name, const std::string &title, int nx, double xmin, double xmax, int ny, double ymin, double ymax)
Book and register a 2D histogram.
Definition: TrigT1CaloLWHistogramTool.cxx:779
LWHist
Definition: LWHist.h:26
python.SystemOfUnits.second
int second
Definition: SystemOfUnits.py:120
LVL1::TrigT1CaloLWHistogramTool::bookCPMCrateModuleVsCMX
TH2F_LW * bookCPMCrateModuleVsCMX(const std::string &name, const std::string &title)
Book CPM crate/module vs CMX.
Definition: TrigT1CaloLWHistogramTool.cxx:956
CTPConfig.h
LVL1::TrigT1CaloLWHistogramTool::thresholds
void thresholds(LWHist *hist, const std::string &type, int offset=0, bool xAxis=true)
Label bins with threshold names.
Definition: TrigT1CaloLWHistogramTool.cxx:248
LVL1::TrigT1CaloLWHistogramTool::bookJEMEta
TH1F_LW * bookJEMEta(const std::string &name, const std::string &title)
Book JEM eta.
Definition: TrigT1CaloLWHistogramTool.cxx:1111
LVL1::TrigT1CaloLWHistogramTool::bookPPMHadEta
TH1F_LW * bookPPMHadEta(const std::string &name, const std::string &title)
Book PPM Had eta.
Definition: TrigT1CaloLWHistogramTool.cxx:1361
TrigConf::L1DataDef::typeConfig
static TriggerTypeConfig & typeConfig(TriggerType tt)
Definition: L1DataDef.cxx:145
TH1F_LW.h
ymin
double ymin
Definition: listroot.cxx:63
TProfile2D_LW::GetEntries
virtual unsigned GetEntries() const override
Definition: TProfile2D_LW.cxx:272
LVL1::TrigT1CaloLWHistogramTool::bookCPMCrateModuleVsChipLocalCoord
TH2F_LW * bookCPMCrateModuleVsChipLocalCoord(const std::string &name, const std::string &title)
Book CPM crate/module vs chip/local coordinate (3bits/3bits)
Definition: TrigT1CaloLWHistogramTool.cxx:808
TH2F_LW.h
sendEI_SPB.ch
ch
Definition: sendEI_SPB.py:35
LVL1::TrigT1CaloLWHistogramTool::bookCPMModuleVsCrate
TH2F_LW * bookCPMModuleVsCrate(const std::string &name, const std::string &title)
Book CPM module vs crate.
Definition: TrigT1CaloLWHistogramTool.cxx:931
LWHist::SetEntries
virtual void SetEntries(unsigned)=0
LVL1::TrigT1CaloLWHistogramTool::bookCPMCrateModuleVsThreshold
TH2F_LW * bookCPMCrateModuleVsThreshold(const std::string &name, const std::string &title)
Book CPM crate/module vs thresholds.
Definition: TrigT1CaloLWHistogramTool.cxx:848
LVL1::DataError
Error data.
Definition: DataError.h:27
get_generator_info.result
result
Definition: get_generator_info.py:21
LVL1::TrigT1CaloLWHistogramTool::fillCPMRoIEtaVsPhi
void fillCPMRoIEtaVsPhi(LWHist2D *hist, double eta, double phi, double weight=1.)
Fill CPM RoI eta vs phi.
Definition: TrigT1CaloLWHistogramTool.cxx:1819
maxValue
#define maxValue(current, test)
Definition: CompoundLayerMaterialCreator.h:22
max
#define max(a, b)
Definition: cfImp.cxx:41
LVL1::TrigT1CaloLWHistogramTool::bookJEMRoIEtaVsPhi
TH2F_LW * bookJEMRoIEtaVsPhi(const std::string &name, const std::string &title)
Book JEM RoI eta vs phi.
Definition: TrigT1CaloLWHistogramTool.cxx:1167
ParticleGun_SamplingFraction.eta2
eta2
Definition: ParticleGun_SamplingFraction.py:96
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
LVL1::TrigT1CaloLWHistogramTool::bookPPMHadEtaVsPhi
TH2F_LW * bookPPMHadEtaVsPhi(const std::string &name, const std::string &title)
Book PPM Had eta vs phi.
Definition: TrigT1CaloLWHistogramTool.cxx:1427
LVL1::TrigT1CaloLWHistogramTool::numbers
void numbers(LWHist *hist, int min, int max, int step=1, int offset=0, bool xAxis=true)
Label bins with numbers.
Definition: TrigT1CaloLWHistogramTool.cxx:146
LVL1::TrigT1CaloLWHistogramTool::bookMissingEtThresholds
TH1F_LW * bookMissingEtThresholds(const std::string &name, const std::string &title)
Book JEM MissingEt thresholds.
Definition: TrigT1CaloLWHistogramTool.cxx:1280
LVL1::TrigT1CaloLWHistogramTool::fillJEMPhi
void fillJEMPhi(LWHist1D *hist, double eta, double phi, double weight=1.)
Fill JEM phi allowing for granularity varying with eta.
Definition: TrigT1CaloLWHistogramTool.cxx:1884
TH1F_LW::create
static TH1F_LW * create(const char *name, const char *title, unsigned nbinsx, const double &xlow, const double &xup)
Definition: TH1F_LW.cxx:33
TH2F
Definition: rootspy.cxx:420
LVL1::TrigT1CaloLWHistogramTool::setBinPPMEmEtaVsPhi
void setBinPPMEmEtaVsPhi(LWHist2D *hist, int binx, int biny, double content, double error=-1.)
Set bin content and optionally error in Em eta vs phi.
Definition: TrigT1CaloLWHistogramTool.cxx:2051
TProfile2D_LW::SetBinInfo
void SetBinInfo(unsigned binx, unsigned biny, const double &entries, const double &content, const double &error)
Definition: TProfile2D_LW.cxx:341
LVL1::TrigT1CaloLWHistogramTool::bookEventNumbers
TH2I_LW * bookEventNumbers(const std::string &name, const std::string &title, int ny, double ymin, double ymax)
Book and register a 2D histogram containing event numbers as bin contents.
Definition: TrigT1CaloLWHistogramTool.cxx:743
LVL1::TrigT1CaloLWHistogramTool::thresholdString
std::string thresholdString(int val, int nThresh, int nBits=1)
Put threshold hit values into a string suitable for printing.
Definition: TrigT1CaloLWHistogramTool.cxx:264
LVL1::TrigT1CaloLWHistogramTool::bookCPMCrateModuleVsFPGA
TH2F_LW * bookCPMCrateModuleVsFPGA(const std::string &name, const std::string &title)
Book CPM crate/module vs FPGA.
Definition: TrigT1CaloLWHistogramTool.cxx:830
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
PlotCalibFromCool.label
label
Definition: PlotCalibFromCool.py:78
LVL1::TrigT1CaloLWHistogramTool::replaceContents
void replaceContents(LWHist2D *histTo, LWHist2D *histFrom)
Replace the contents of one 2D histogram with those of another.
Definition: TrigT1CaloLWHistogramTool.cxx:1742
LVL1::TrigT1CaloLWHistogramTool::thresholdMaskTau
unsigned int thresholdMaskTau()
Definition: TrigT1CaloLWHistogramTool.cxx:358
LVL1::TrigT1CaloLWHistogramTool::jemCrateModule
void jemCrateModule(LWHist *hist, int offset=0, bool xAxis=true)
Label bins with JEM crate/module.
Definition: TrigT1CaloLWHistogramTool.cxx:443
plotmaker.hist
hist
Definition: plotmaker.py:148
LVL1::TrigT1CaloLWHistogramTool::bookJEMCrateModuleVsThresholds
TH2F_LW * bookJEMCrateModuleVsThresholds(const std::string &name, const std::string &title)
Book JEM crate/module vs thresholds.
Definition: TrigT1CaloLWHistogramTool.cxx:1077
LVL1::TrigT1CaloLWHistogramTool::cpmCrateCMX
void cpmCrateCMX(LWHist *hist, int offset=0, bool xAxis=true)
Label bins with CPM crate/CMX.
Definition: TrigT1CaloLWHistogramTool.cxx:407
LVL1::TrigT1CaloLWHistogramTool::cpmTobChipLocalCoord
void cpmTobChipLocalCoord(LWHist *hist, int offset=0, bool xAxis=true)
Label bins with CMX-CP TOB chip/local coordinate (4bit/2bit)
Definition: TrigT1CaloLWHistogramTool.cxx:381
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
yodamerge_tmp.axis
list axis
Definition: yodamerge_tmp.py:241
LVL1::TrigT1CaloLWHistogramTool::bookProfilePPMCrateModuleVsSubmoduleChannel
TProfile2D_LW * bookProfilePPMCrateModuleVsSubmoduleChannel(const std::string &name, const std::string &title, int firstCrate, int lastCrate)
Book PPM Crate/Module vs Submodule/Channel profile.
Definition: TrigT1CaloLWHistogramTool.cxx:1531
LVL1::TrigT1CaloLWHistogramTool::thresholdsSame
int thresholdsSame(int val1, int val2, int nThresh, int nBits)
Flag which threshold hit values are non-zero and the same.
Definition: TrigT1CaloLWHistogramTool.cxx:279
skel.it
it
Definition: skel.GENtoEVGEN.py:423
PixelAthClusterMonAlgCfg.ybins
ybins
Definition: PixelAthClusterMonAlgCfg.py:163
M_PI
#define M_PI
Definition: ActiveFraction.h:11
bin
Definition: BinsDiffFromStripMedian.h:43
LVL1::QuadLinear::Expand
static unsigned int Expand(int Code)
Uncompress data.
Definition: QuadLinear.cxx:37
LWHist1D.h
LVL1::TrigT1CaloLWHistogramTool::bookCPMSubStatusVsCrateModule
TH2F_LW * bookCPMSubStatusVsCrateModule(const std::string &name, const std::string &title)
Book CPM sub-status errors vs crate/module.
Definition: TrigT1CaloLWHistogramTool.cxx:968
LVL1::TrigT1CaloLWHistogramTool::bookPPMCrateModuleVsSubmoduleChannel
TH2F_LW * bookPPMCrateModuleVsSubmoduleChannel(const std::string &name, const std::string &title, int firstCrate, int lastCrate)
Book PPM Crate/Module vs Submodule/Channel.
Definition: TrigT1CaloLWHistogramTool.cxx:1517
LWHist2D::getNextActiveBin
virtual bool getNextActiveBin(unsigned &binx, unsigned &biny, double &content, double &error)=0
LVL1::TrigT1CaloLWHistogramTool::bookCPMSumVsThreshold
TH2F_LW * bookCPMSumVsThreshold(const std::string &name, const std::string &title)
Book CPM Sum vs Threshold.
Definition: TrigT1CaloLWHistogramTool.cxx:1006
LVL1::TrigT1CaloLWHistogramTool::bookJEMQuadLinear
TH1F_LW * bookJEMQuadLinear(const std::string &name, const std::string &title, int scale=1)
Book JEM energy with bins matching QuadLinear encoding.
Definition: TrigT1CaloLWHistogramTool.cxx:1206
LVL1::TrigT1CaloLWHistogramTool::~TrigT1CaloLWHistogramTool
virtual ~TrigT1CaloLWHistogramTool()
Definition: TrigT1CaloLWHistogramTool.cxx:59
Menu.h
TProfile_LW.h
LWHist1D
Definition: LWHist1D.h:23
LVL1::TrigT1CaloLWHistogramTool::intDoubleString
std::string intDoubleString(int num, double val, int precision=2)
Return int/double pair as a string.
Definition: TrigT1CaloLWHistogramTool.cxx:97
LVL1::TrigT1CaloLWHistogramTool::book2I
TH2I_LW * book2I(const std::string &name, const std::string &title, int nx, double xmin, double xmax, int ny, double ymin, double ymax)
Book and register a 2D histogram of integers displayed as text.
Definition: TrigT1CaloLWHistogramTool.cxx:729
LVL1::DataError::GLinkParity
@ GLinkParity
Definition: DataError.h:40
TrigConf::Menu::thresholdVector
const std::vector< TriggerThreshold * > & thresholdVector() const
Definition: Menu.cxx:123
TrigT1CaloLWHistogramTool.h
TProfile2D_LW::create
static TProfile2D_LW * create(const char *name, const char *title, unsigned nbinsx, const double &xlow, const double &xup, unsigned nbinsy, const double &ylow, const double &yup, const char *option=" ")
Definition: TProfile2D_LW.cxx:32
LVL1::TrigT1CaloLWHistogramTool::fillPPMEmEtaVsPhi
void fillPPMEmEtaVsPhi(LWHist2D *hist, double eta, double phi, double weight=1.)
Fill PPM Em eta vs phi.
Definition: TrigT1CaloLWHistogramTool.cxx:1901
yodamerge_tmp.scale
scale
Definition: yodamerge_tmp.py:138
TProfile2D_LW::SetEntries
virtual void SetEntries(unsigned) override
Definition: TProfile2D_LW.cxx:279
TProfile_LW
Definition: TProfile_LW.h:24
python.TrigEgammaMonitorHelper.TH2F
def TH2F(name, title, nxbins, bins_par2, bins_par3, bins_par4, bins_par5=None, bins_par6=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:45
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
x
#define x
LVL1::TrigT1CaloLWHistogramTool::mainJetThresholds
void mainJetThresholds(LWHist *hist, int offset=0, bool xAxis=true)
Label bins with Main Jet threshold names.
Definition: TrigT1CaloLWHistogramTool.cxx:504
LVL1::TrigT1CaloLWHistogramTool::bookCPMEventVsCrateModule
TH2I_LW * bookCPMEventVsCrateModule(const std::string &name, const std::string &title)
Book CPM events with error/mismatch vs crate/module.
Definition: TrigT1CaloLWHistogramTool.cxx:921
LVL1::TrigT1CaloLWHistogramTool::bookCPMSumCMX
TH1F_LW * bookCPMSumCMX(const std::string &name, const std::string &title)
Book CPM Sum/CMX.
Definition: TrigT1CaloLWHistogramTool.cxx:979
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:200
TProfile2D_LW::Reset
virtual void Reset() override
Definition: TProfile2D_LW.cxx:204
LVL1::TrigT1CaloLWHistogramTool::findBinPPMEmEtaVsPhi
void findBinPPMEmEtaVsPhi(LWHist *hist, double eta, double phi, int &binx, int &biny)
Find bin in Em eta vs phi.
Definition: TrigT1CaloLWHistogramTool.cxx:2021
LVL1::TrigT1CaloLWHistogramTool::ppmCrateModule
void ppmCrateModule(LWHist *hist, int firstCrate, int lastCrate, int offset=0, bool xAxis=true)
Label bins with PPM crate/module.
Definition: TrigT1CaloLWHistogramTool.cxx:565
LVL1::TrigT1CaloLWHistogramTool::bookCPMRoIEtaVsPhi
TH2F_LW * bookCPMRoIEtaVsPhi(const std::string &name, const std::string &title)
Book CPM RoI eta vs phi.
Definition: TrigT1CaloLWHistogramTool.cxx:888
LVL1::TrigT1CaloLWHistogramTool::thresholdsDiff
int thresholdsDiff(int val1, int val2, int nThresh, int nBits)
Flag which threshold hit values are different.
Definition: TrigT1CaloLWHistogramTool.cxx:294
SCT_CalibAlgs::nbins
@ nbins
Definition: SCT_CalibNumbers.h:10
grepfile.content
string content
Definition: grepfile.py:56
TrigConf::L1DataDef::stringAsType
static TriggerType stringAsType(const std::string &type)
Definition: L1DataDef.h:62
ILVL1ConfigSvc.h
LVL1::TrigT1CaloLWHistogramTool::subStatus
void subStatus(LWHist *hist, int offset=0, bool xAxis=true)
Label bins with sub-status error bit names.
Definition: TrigT1CaloLWHistogramTool.cxx:179
LVL1::TrigT1CaloLWHistogramTool::m_shrinkEtaBins
bool m_shrinkEtaBins
Shrink eta bins to same size flag.
Definition: TrigT1CaloLWHistogramTool.h:500
TrigConf::L1DataDef
Definition: L1DataDef.h:27
TH1F_LW
Definition: TH1F_LW.h:23
LVL1::TrigT1CaloLWHistogramTool::m_eventSamples
int m_eventSamples
Number of Error Event Number Samples.
Definition: TrigT1CaloLWHistogramTool.h:498
LVL1::TrigT1CaloLWHistogramTool::bookJEMEventVsCrateModule
TH2I_LW * bookJEMEventVsCrateModule(const std::string &name, const std::string &title)
Book JEM events with error/mismatch vs crate/module.
Definition: TrigT1CaloLWHistogramTool.cxx:1088
dqt_zlumi_pandas.err
err
Definition: dqt_zlumi_pandas.py:193
LVL1::TrigT1CaloLWHistogramTool::bookPPMEmEtaVsPhi
TH2F_LW * bookPPMEmEtaVsPhi(const std::string &name, const std::string &title)
Book PPM Em eta vs phi.
Definition: TrigT1CaloLWHistogramTool.cxx:1380
TH1::SetBinContent
void SetBinContent(int, double)
Definition: rootspy.cxx:301
TProfile_LW::create
static TProfile_LW * create(const char *name, const char *title, unsigned nbinsx, const double &xlow, const double &xup, const char *option=" ")
Definition: TProfile_LW.cxx:32
LVL1::TrigT1CaloLWHistogramTool::thresholdNames
bool thresholdNames(const std::string &type, std::vector< std::string > &names)
Get list of threshold names for given type.
Definition: TrigT1CaloLWHistogramTool.cxx:193
lumiFormat.i
int i
Definition: lumiFormat.py:92
xmin
double xmin
Definition: listroot.cxx:60
z
#define z
ReadCellNoiseFromCool.chan
chan
Definition: ReadCellNoiseFromCool.py:52
LVL1::TrigT1CaloLWHistogramTool::fillJEMEtaVsPhi
void fillJEMEtaVsPhi(LWHist2D *hist, double eta, double phi, double weight=1.)
Fill JEM eta vs phi.
Definition: TrigT1CaloLWHistogramTool.cxx:1834
TH2I_LW::create
static TH2I_LW * create(const char *name, const char *title, unsigned nbinsx, const double &xmin, const double &xmax, unsigned nbinsy, const double &ymin, const double &ymax)
Definition: TH2I_LW.cxx:33
TrigConf::L1DataDef::TriggerTypeConfig
Definition: L1DataDef.h:42
LVL1::TrigT1CaloLWHistogramTool::bookJEMSubStatusVsCrateModule
TH2F_LW * bookJEMSubStatusVsCrateModule(const std::string &name, const std::string &title)
Book JEM sub-status errors vs crate/module.
Definition: TrigT1CaloLWHistogramTool.cxx:1315
LVL1::TrigT1CaloLWHistogramTool::efficienciesForMerge
void efficienciesForMerge(LWHist *lw1, LWHist *lw2, LWHist *lw3)
Compute efficiencies and errors for perBinEffPerCent merge method.
Definition: TrigT1CaloLWHistogramTool.cxx:2103
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
LVL1::TrigT1CaloLWHistogramTool::fillThresholds
void fillThresholds(LWHist1D *hist, int val, int nThresh, int nBits, int offset=0)
Fill weighted thresholds 1D.
Definition: TrigT1CaloLWHistogramTool.cxx:1700
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
python.subdetectors.mmg.names
names
Definition: mmg.py:8
LVL1::TrigT1CaloLWHistogramTool::splitLine
std::string splitLine(const std::string &word, bool xAxis=true)
Split long names for Y axis.
Definition: TrigT1CaloLWHistogramTool.cxx:161
LVL1::TrigT1CaloLWHistogramTool::m_phiScaleJE
double m_phiScaleJE
Phi scale for jet element eta/phi plots.
Definition: TrigT1CaloLWHistogramTool.h:496
LVL1::TrigT1CaloLWHistogramTool::bookCPMCrateModuleVsTobChipLocalCoord
TH2F_LW * bookCPMCrateModuleVsTobChipLocalCoord(const std::string &name, const std::string &title)
Book CPM crate/module vs TOB chip/local coordinate (4bits/2bits)
Definition: TrigT1CaloLWHistogramTool.cxx:819
covarianceTool.title
title
Definition: covarianceTool.py:542
LVL1::TrigT1CaloLWHistogramTool::m_phiScaleTT
double m_phiScaleTT
Phi scale for trigger tower eta/phi plots.
Definition: TrigT1CaloLWHistogramTool.h:494
TH2I_LW.h
LVL1::TrigT1CaloLWHistogramTool::missingEtSigThresholds
void missingEtSigThresholds(LWHist *hist, int offset=0, bool xAxis=true)
Label bins with MissingEtSig threshold names.
Definition: TrigT1CaloLWHistogramTool.cxx:552
LVL1::TrigT1CaloLWHistogramTool::getMinMaxBin
bool getMinMaxBin(LWHist2D *hist, int &minBinx, int &minBiny, int &maxBinx, int &maxBiny, double &minValue, double &maxValue)
Get Minimum and Maximun bins and contents of 2D histogram.
Definition: TrigT1CaloLWHistogramTool.cxx:1575
LVL1::TrigT1CaloLWHistogramTool::bookJEMModuleVsCrate
TH2F_LW * bookJEMModuleVsCrate(const std::string &name, const std::string &title)
Book JEM module Vs crate.
Definition: TrigT1CaloLWHistogramTool.cxx:1098
LVL1::TrigT1CaloLWHistogramTool::jemFrameLoc
void jemFrameLoc(LWHist *hist, int offset=0, bool xAxis=true)
Label bins with JEM frame/local coord.
Definition: TrigT1CaloLWHistogramTool.cxx:479
LVL1::TrigT1CaloLWHistogramTool::forwardJetThresholds
void forwardJetThresholds(LWHist *hist, int offset=0, bool xAxis=true)
Label bins with Forward Jet threshold names.
Definition: TrigT1CaloLWHistogramTool.cxx:520
xAOD::eventNumber
eventNumber
Definition: EventInfo_v1.cxx:124
TriggerThreshold.h
LVL1::TrigT1CaloLWHistogramTool::fillCPMEtaVsPhi
void fillCPMEtaVsPhi(LWHist2D *hist, double eta, double phi, double weight=1.)
Fill CPM eta vs phi.
Definition: TrigT1CaloLWHistogramTool.cxx:1810
LVL1::TrigT1CaloLWHistogramTool::backwardJetThresholds
void backwardJetThresholds(LWHist *hist, int offset=0, bool xAxis=true)
Label bins with Backward Jet threshold names.
Definition: TrigT1CaloLWHistogramTool.cxx:512
LVL1::TrigT1CaloLWHistogramTool::bookBackwardJetThresholds
TH1F_LW * bookBackwardJetThresholds(const std::string &name, const std::string &title)
Book JEM backward jet thresholds.
Definition: TrigT1CaloLWHistogramTool.cxx:1247
LWHist2D::resetActiveBinLoop
virtual void resetActiveBinLoop()=0
LVL1::TrigT1CaloLWHistogramTool::fillPPMHadEtaVsPhi
void fillPPMHadEtaVsPhi(LWHist2D *hist, double eta, double phi, double weight=1.)
Fill PPM Had eta vs phi.
Definition: TrigT1CaloLWHistogramTool.cxx:1932
LVL1::TrigT1CaloLWHistogramTool::fillThresholdsVsY
void fillThresholdsVsY(LWHist2D *hist, int val, int y, int nThresh, int nBits, int offset=0)
Fill weighted thresholds 2D, X axis.
Definition: TrigT1CaloLWHistogramTool.cxx:1714
LVL1::TrigT1CaloLWHistogramTool::bookPPMErrorsVsCrateModule
TH2F_LW * bookPPMErrorsVsCrateModule(const std::string &name, const std::string &title, int firstCrate, int lastCrate)
Book PPM ASIC errors vs crate/module.
Definition: TrigT1CaloLWHistogramTool.cxx:1558
TProfile2D_LW::setSums
void setSums(const double &sumW, const double &sumW2, const double &sumWX, const double &sumWX2, const double &sumWY, const double &sumWY2, const double &sumWXY, const double &sumWZ, const double &sumWZ2)
Definition: TProfile2D_LW.cxx:306
LVL1::TrigT1CaloLWHistogramTool::setBinPPMHadEtaVsPhi
void setBinPPMHadEtaVsPhi(LWHist2D *hist, int binx, int biny, double content, double error=-1.)
Set bin content and optionally error in Had eta vs phi.
Definition: TrigT1CaloLWHistogramTool.cxx:2067
LVL1::TrigT1CaloLWHistogramTool::finalize
virtual StatusCode finalize()
Definition: TrigT1CaloLWHistogramTool.cxx:86
TProfile2D_LW::getSums
void getSums(double &sumW, double &sumW2, double &sumWX, double &sumWX2, double &sumWY, double &sumWY2, double &sumWXY, double &sumWZ, double &sumWZ2) const
Definition: TProfile2D_LW.cxx:281
compute_lumi.denom
denom
Definition: compute_lumi.py:76
DataError.h
LVL1::TrigT1CaloLWHistogramTool::cpmThresholds
void cpmThresholds(LWHist *hist, int offset=0, bool xAxis=true)
Label bins with CPM RoI threshold names.
Definition: TrigT1CaloLWHistogramTool.cxx:431
TH1::SetBinError
void SetBinError(int, double)
Definition: rootspy.cxx:304
DerivationFramework::TriggerMatchingUtils::sorted
std::vector< typename T::value_type > sorted(T begin, T end)
Helper function to create a sorted vector from an unsorted one.
ManagedMonitorToolBase::MonGroup::regHist
StatusCode regHist(TH1 *h)
Registers a TH1 (including TH2, TH3, and TProfile) to be included in the output stream using logical ...
Definition: ManagedMonitorToolBase.cxx:195
LVL1::TrigT1CaloLWHistogramTool::jemThresholds
void jemThresholds(LWHist *hist, int offset=0, bool xAxis=true)
Label bins with JEM RoI threshold names.
Definition: TrigT1CaloLWHistogramTool.cxx:491
TrigConf::name
Definition: HLTChainList.h:35
LWHist2D
Definition: LWHist2D.h:25
LVL1::TrigT1CaloLWHistogramTool::findBinPPMHadEtaVsPhi
void findBinPPMHadEtaVsPhi(LWHist *hist, double eta, double phi, int &binx, int &biny)
Find bin in Had eta vs phi.
Definition: TrigT1CaloLWHistogramTool.cxx:2043
min
#define min(a, b)
Definition: cfImp.cxx:40
LVL1::TrigT1CaloLWHistogramTool::bookPPMEmEta
TH1F_LW * bookPPMEmEta(const std::string &name, const std::string &title)
Book PPM Em eta.
Definition: TrigT1CaloLWHistogramTool.cxx:1342
LVL1::TrigT1CaloLWHistogramTool::registerHist
void registerHist(LWHist *hist)
Register a histogram.
Definition: TrigT1CaloLWHistogramTool.cxx:756
LWHist::LWHistAxis
Definition: LWHist.h:109
trigbs_pickEvents.num
num
Definition: trigbs_pickEvents.py:76
TProfile2D_LW::GetNbinsY
unsigned GetNbinsY() const
Definition: TProfile2D_LW.cxx:265
LVL1::TrigT1CaloLWHistogramTool::bookTH1F
TH1F * bookTH1F(const std::string &name, const std::string &title, int nx, double xmin, double xmax)
ROOT versions.
Definition: TrigT1CaloLWHistogramTool.cxx:768
LVL1::TrigT1CaloLWHistogramTool::cpmCrateModule
void cpmCrateModule(LWHist *hist, int offset=0, bool xAxis=true)
Label bins with CPM crate/module.
Definition: TrigT1CaloLWHistogramTool.cxx:419
TProfile2D_LW::GetBinInfo
void GetBinInfo(unsigned binx, unsigned biny, double &entries, double &content, double &error) const
Definition: TProfile2D_LW.cxx:329
LVL1::TrigT1CaloLWHistogramTool::numberPairs
void numberPairs(LWHist *hist, int firstMin, int firstMax, int secondMin, int secondMax, int step=1, int offset=0, bool xAxis=true)
Label bins with number pairs.
Definition: TrigT1CaloLWHistogramTool.cxx:109
LVL1::TrigT1CaloLWHistogramTool::book1F
TH1F_LW * book1F(const std::string &name, const std::string &title, int nx, double xmin, double xmax)
Book and register a 1D histogram.
Definition: TrigT1CaloLWHistogramTool.cxx:604
CompareRootFiles.hist1
hist1
Definition: CompareRootFiles.py:36
TH2I_LW
Definition: TH2I_LW.h:23
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
xAOD::phiBin
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setPhiMap phiBin
Definition: L2StandAloneMuon_v2.cxx:144
LVL1::TrigT1CaloLWHistogramTool::fillJEMRoIEtaVsPhi
void fillJEMRoIEtaVsPhi(LWHist2D *hist, double eta, double phi, double weight=1.)
Fill JEM RoI eta vs phi.
Definition: TrigT1CaloLWHistogramTool.cxx:1858
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
QuadLinear.h
TH2F_LW::create
static TH2F_LW * create(const char *name, const char *title, unsigned nbinsx, const double &xmin, const double &xmax, unsigned nbinsy, const double &ymin, const double &ymax)
Definition: TH2F_LW.cxx:33
LVL1::TrigT1CaloLWHistogramTool::ppmSubmoduleChannel
void ppmSubmoduleChannel(LWHist *hist, int offset=0, bool xAxis=true)
Label bins with PPM submodule/channel.
Definition: TrigT1CaloLWHistogramTool.cxx:590
plotBeamSpotVxVal.bin
int bin
Definition: plotBeamSpotVxVal.py:83
LVL1::TrigT1CaloLWHistogramTool::bookJetEtThresholds
TH1F_LW * bookJetEtThresholds(const std::string &name, const std::string &title)
Book JEM JetEt thresholds.
Definition: TrigT1CaloLWHistogramTool.cxx:1269
TProfile2D_LW.h
LVL1::TrigT1CaloLWHistogramTool::bookJEMSubStatusVsCrate
TH2F_LW * bookJEMSubStatusVsCrate(const std::string &name, const std::string &title)
Book JEM sub-status errors vs crate.
Definition: TrigT1CaloLWHistogramTool.cxx:1326
TH1::Sumw2
void Sumw2()
Definition: rootspy.cxx:284
TrigConf::L1DataDef::UNDEF
@ UNDEF
Definition: L1DataDef.h:39
TProfile2D_LW
Definition: TProfile2D_LW.h:24
LVL1::TrigT1CaloLWHistogramTool::bookProfilePPMEmEtaVsPhi
TProfile2D_LW * bookProfilePPMEmEtaVsPhi(const std::string &name, const std::string &title)
Book PPM Em eta vs phi profile.
Definition: TrigT1CaloLWHistogramTool.cxx:1442
LVL1::DataError::ChannelDisabled
@ ChannelDisabled
Definition: DataError.h:33
LVL1::TrigT1CaloLWHistogramTool::bookForwardJetThresholds
TH1F_LW * bookForwardJetThresholds(const std::string &name, const std::string &title)
Book JEM forward jet thresholds.
Definition: TrigT1CaloLWHistogramTool.cxx:1258
LArCellBinning.xbins
int xbins
Definition: LArCellBinning.py:163
L1DataDef.h
TProfile2D_LW::GetNbinsX
unsigned GetNbinsX() const
Definition: TProfile2D_LW.cxx:264
ReadCellNoiseFromCoolCompare.v2
v2
Definition: ReadCellNoiseFromCoolCompare.py:364
LVL1::TrigT1CaloLWHistogramTool::jemCMXCrateModule
void jemCMXCrateModule(LWHist *hist, int offset=0, bool xAxis=true)
Label bins with JEM/CMX crate/module.
Definition: TrigT1CaloLWHistogramTool.cxx:455
LWHist::Reset
virtual void Reset()=0
LVL1::TrigT1CaloLWHistogramTool::bookMainJetThresholds
TH1F_LW * bookMainJetThresholds(const std::string &name, const std::string &title)
Book JEM main jet thresholds.
Definition: TrigT1CaloLWHistogramTool.cxx:1236
LWHist::GetEntries
virtual unsigned GetEntries() const =0
LVL1::TrigT1CaloLWHistogramTool::m_monGroup
ManagedMonitorToolBase::MonGroup * m_monGroup
Current MonGroup or 0 if not wanted.
Definition: TrigT1CaloLWHistogramTool.h:492
LVL1::TrigT1CaloLWHistogramTool::bookMissingEtSigThresholds
TH1F_LW * bookMissingEtSigThresholds(const std::string &name, const std::string &title)
Book JEM MissingEtSig thresholds.
Definition: TrigT1CaloLWHistogramTool.cxx:1303
TrigConf::L1DataDef::TriggerTypeConfig::max
unsigned int max
Definition: L1DataDef.h:47
ConvertOldUJHistosToNewHistos.jetType
string jetType
Definition: ConvertOldUJHistosToNewHistos.py:121
TrigConf::L1DataDef::TriggerType
TriggerType
Definition: L1DataDef.h:30
y
#define y
TH1F
Definition: rootspy.cxx:320
CondAlgsOpts.found
int found
Definition: CondAlgsOpts.py:101
TrigConf::CTPConfig::menu
const Menu & menu() const
Definition: CTPConfig.h:38
LVL1::TrigT1CaloLWHistogramTool::thresholdMask
unsigned int thresholdMask(const std::string &type)
Get threshold bit mask for given type.
Definition: TrigT1CaloLWHistogramTool.cxx:310
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
LVL1::TrigT1CaloLWHistogramTool::TrigT1CaloLWHistogramTool
TrigT1CaloLWHistogramTool(const std::string &name)
Definition: TrigT1CaloLWHistogramTool.cxx:43
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TH1
Definition: rootspy.cxx:268
DeMoScan.first
bool first
Definition: DeMoScan.py:534
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
LWHist2D::getSums
virtual void getSums(double &sumW, double &sumW2, double &sumWX, double &sumWX2, double &sumWY, double &sumWY2, double &sumWXY) const =0
LVL1::TrigT1CaloLWHistogramTool::bookProfilePPMHadEtaVsPhi
TProfile2D_LW * bookProfilePPMHadEtaVsPhi(const std::string &name, const std::string &title)
Book PPM Had eta vs phi profile.
Definition: TrigT1CaloLWHistogramTool.cxx:1490
xmax
double xmax
Definition: listroot.cxx:61
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
TauGNNUtils::Variables::absEta
bool absEta(const xAOD::TauJet &tau, double &out)
Definition: TauGNNUtils.cxx:232
entries
double entries
Definition: listroot.cxx:49
LVL1::TrigT1CaloLWHistogramTool::bookJEMEtaVsPhi
TH2F_LW * bookJEMEtaVsPhi(const std::string &name, const std::string &title)
Book JEM eta vs phi.
Definition: TrigT1CaloLWHistogramTool.cxx:1126
TrigConf::CTPConfig
Definition: CTPConfig.h:27
LArCellBinning.step
step
Definition: LArCellBinning.py:158
LVL1::TrigT1CaloLWHistogramTool::bookCPMEtaVsPhi
TH2F_LW * bookCPMEtaVsPhi(const std::string &name, const std::string &title)
Book CPM eta vs phi.
Definition: TrigT1CaloLWHistogramTool.cxx:859
LVL1::TrigT1CaloLWHistogramTool::ppmErrors
void ppmErrors(LWHist *hist, int offset=0, bool xAxis=true)
Label bins with PPM error bit names.
Definition: TrigT1CaloLWHistogramTool.cxx:577
LVL1::TrigT1CaloLWHistogramTool::missingEtThresholds
void missingEtThresholds(LWHist *hist, int offset=0, bool xAxis=true)
Label bins with MissingEt threshold names.
Definition: TrigT1CaloLWHistogramTool.cxx:536
LVL1::TrigT1CaloLWHistogramTool::m_configSvc
ServiceHandle< TrigConf::ILVL1ConfigSvc > m_configSvc
Trigger configuration service for threshold names.
Definition: TrigT1CaloLWHistogramTool.h:490
dqt_zlumi_alleff_HIST.eff
int eff
Definition: dqt_zlumi_alleff_HIST.py:113
LArG4GenerateShowerLib.nevents
nevents
Definition: LArG4GenerateShowerLib.py:19
LVL1::TrigT1CaloLWHistogramTool::bookPPMEventVsCrateModule
TH2I_LW * bookPPMEventVsCrateModule(const std::string &name, const std::string &title, int firstCrate, int lastCrate)
Book PPM events with error/mismatch vs crate/module.
Definition: TrigT1CaloLWHistogramTool.cxx:1505
LWHist2D::SetBinContentAndError
virtual void SetBinContentAndError(unsigned binx, unsigned biny, const double &content, const double &error)=0
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
LVL1::TrigT1CaloLWHistogramTool::scaleForMerge
void scaleForMerge(LWHist2D *hist, int nevents)
Scale histogram quantities by number of events for weightedAverage merge.
Definition: TrigT1CaloLWHistogramTool.cxx:2083
TH2F_LW
Definition: TH2F_LW.h:23
LVL1::TrigT1CaloLWHistogramTool::cpmCMXCrateModule
void cpmCMXCrateModule(LWHist *hist, int offset=0, bool xAxis=true)
Label bins with CPM/CMX crate/module.
Definition: TrigT1CaloLWHistogramTool.cxx:393
LVL1::TrigT1CaloLWHistogramTool::bookPPMSubStatusVsCrateModule
TH2F_LW * bookPPMSubStatusVsCrateModule(const std::string &name, const std::string &title, int firstCrate, int lastCrate)
Book PPM SubStatus vs crate/module.
Definition: TrigT1CaloLWHistogramTool.cxx:1545
LVL1::TrigT1CaloLWHistogramTool::bookProfile2D
TProfile2D_LW * bookProfile2D(const std::string &name, const std::string &title, int nx, double xmin, double xmax, int ny, double ymin, double ymax)
Book and register a 2D profile histogram.
Definition: TrigT1CaloLWHistogramTool.cxx:690
fillSCTHists.etaMod
etaMod
Definition: fillSCTHists.py:23
LVL1::TrigT1CaloLWHistogramTool::fillXVsThresholds
void fillXVsThresholds(LWHist2D *hist, int x, int val, int nThresh, int nBits, int offset=0)
Fill weighted thresholds 2D, Y axis.
Definition: TrigT1CaloLWHistogramTool.cxx:1728
LVL1::TrigT1CaloLWHistogramTool::fillEventNumber
void fillEventNumber(LWHist2D *hist, double y)
Fill Error/Mismatch event number.
Definition: TrigT1CaloLWHistogramTool.cxx:1668
LVL1::TrigT1CaloLWHistogramTool::fillPPMPhi
void fillPPMPhi(LWHist1D *hist, double eta, double phi, double weight=1.)
Fill PPM phi allowing for granularity varying with eta.
Definition: TrigT1CaloLWHistogramTool.cxx:1981
LVL1::TrigT1CaloLWHistogramTool::initialize
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
Definition: TrigT1CaloLWHistogramTool.cxx:65
LWHist::getROOTHistBase
virtual TH1 * getROOTHistBase()=0
error
Definition: IImpactPoint3dEstimator.h:70
LVL1::TrigT1CaloLWHistogramTool::book2F
TH2F_LW * book2F(const std::string &name, const std::string &title, int nx, double xmin, double xmax, int ny, double ymin, double ymax)
Book and register a 2D histogram.
Definition: TrigT1CaloLWHistogramTool.cxx:648
LVL1::TrigT1CaloLWHistogramTool::bookCPMModuleVsCrateCMX
TH2F_LW * bookCPMModuleVsCrateCMX(const std::string &name, const std::string &title)
Book CPM module vs crate/CMX.
Definition: TrigT1CaloLWHistogramTool.cxx:944
minValue
#define minValue(current, test)
Definition: CompoundLayerMaterialCreator.h:21
TileDCSDataPlotter.tt
tt
Definition: TileDCSDataPlotter.py:874
LVL1::TrigT1CaloLWHistogramTool::sumEtThresholds
void sumEtThresholds(LWHist *hist, int offset=0, bool xAxis=true)
Label bins with SumEt threshold names.
Definition: TrigT1CaloLWHistogramTool.cxx:544
LWHist.h
LVL1::TrigT1CaloLWHistogramTool::thresholdMaskEm
unsigned int thresholdMaskEm()
Definition: TrigT1CaloLWHistogramTool.cxx:351
python.SystemOfUnits.rad
int rad
Definition: SystemOfUnits.py:111
LVL1::TrigT1CaloLWHistogramTool::jemCrateCMX
void jemCrateCMX(LWHist *hist, int offset=0, bool xAxis=true)
Label bins with JEM crate/CMX.
Definition: TrigT1CaloLWHistogramTool.cxx:467
LVL1::TrigT1CaloLWHistogramTool::cpmChipLocalCoord
void cpmChipLocalCoord(LWHist *hist, int offset=0, bool xAxis=true)
Label bins with CPM chip/local coordinate (3bit/3bit)
Definition: TrigT1CaloLWHistogramTool.cxx:369
ymax
double ymax
Definition: listroot.cxx:64
LVL1::TrigT1CaloLWHistogramTool::bookJEMCrateModuleVsFrameLoc
TH2F_LW * bookJEMCrateModuleVsFrameLoc(const std::string &name, const std::string &title)
Book JEM crate/module vs frame/local coord.
Definition: TrigT1CaloLWHistogramTool.cxx:1066
CompareRootFiles.hist2
hist2
Definition: CompareRootFiles.py:37
LWHist2D.h
LWHist2D::setSums
virtual void setSums(const double &sumW, const double &sumW2, const double &sumWX, const double &sumWX2, const double &sumWY, const double &sumWY2, const double &sumWXY)=0
LVL1::TrigT1CaloLWHistogramTool::bookJEMCrateModuleVsExEyEt
TH2F_LW * bookJEMCrateModuleVsExEyEt(const std::string &name, const std::string &title)
Book JEM crate/module vs EX,Ey,Et.
Definition: TrigT1CaloLWHistogramTool.cxx:1052