ATLAS Offline Software
History.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include "LArCafJobs/CellInfo.h"
8 #include "LArCafJobs/ShapeInfo.h"
9 
11 #include "LArSamplesMon/Data.h"
12 #include "LArCafJobs/SimpleShape.h"
17 #include "LArSamplesMon/OFC.h"
18 #include "LArCafJobs/Definitions.h"
20 #include "LArSamplesMon/Averager.h"
25 #include "LArSamplesMon/Residual.h"
26 #include "LArCafJobs/Geometry.h"
30 
31 #include "TString.h"
32 #include "TMath.h"
33 #include <iostream>
34 #include <memory>
35 
36 using std::cout;
37 using std::endl;
38 
39 using namespace LArSamples;
40 
41 
42 History::History(const HistoryContainer& container,
43  const std::vector<const EventData*>& eventData, unsigned hash,
44  const AbsShapeErrorGetter* shapeErrorGetter)
45  : m_cellInfo(*container.cellInfo()),
46  m_eventData(eventData),
47  m_hash(hash), m_shapeErrorGetter(shapeErrorGetter)
48 {
49  ClassCounts::incrementInstanceCount("History");
50  if (container.nDataContainers() != eventData.size()) return;
51  for (unsigned int i = 0; i < container.nDataContainers(); i++)
52  m_data.push_back(new Data(*container.dataContainer(i), *eventData[i], this, i));
53 }
54 
55 
56 History::History(const std::vector<const Data*>& data, const CellInfo& info,
57  const std::vector<const EventData*>& eventData,
58  unsigned int hash, const AbsShapeErrorGetter* shapeErrorGetter)
59  : m_data(data), m_cellInfo(info), m_eventData(eventData), m_hash(hash),
60  m_shapeErrorGetter(shapeErrorGetter)
61 {
63  unsigned int i = 0;
64  for (const Data* data : m_data)
65  data->setCallBacks(this, i);
66 }
67 
68 
70 {
72  for (const Data* data : m_data)
73  delete data;
74  for (const EventData* eventData : m_eventData)
75  delete eventData;
76 }
77 
78 
80 {
81  HistoryContainer* histCont = new HistoryContainer(new CellInfo(*cellInfo()));
82  for (unsigned int k = 0; k < nData(); k++) {
83  Data* newData = new Data(*data(k));
84  histCont->add(newData->dissolve());
85  }
86  delete this;
87  return histCont;
88 }
89 
90 
91 const Data* History::data(unsigned int i) const
92 {
93  if (i >= nData()) return nullptr;
94  return m_data[i];
95 }
96 
97 
98 const Data* History::data_for_event(int event, int run) const
99 {
100  for (unsigned int k = 0; k < nData(); k++) {
101  if (data(k)->event() != event) continue;
102  if (run > 0 && data(k)->run() != run) continue;
103  return data(k);
104  }
105  return nullptr;
106 }
107 
108 
109 const Data* History::data_for_event(const EventData& eventData) const
110 {
111  // turn off caching
112 
113  //if (m_dataForEvent.size() == 0)
114  // for (unsigned int k = 0; k < nData(); k++)
115  // m_dataForEvent[data(k)->event()] = std::make_pair(data(k)->run(), data(k));
116 
117  //std::unordered_map<int, std::pair<int, const Data*> >::const_iterator
118  // data = m_dataForEvent.find(eventData.event());
119  //if (data == m_dataForEvent.end()) return 0;
120  //if (data->second.first != eventData.run()) return data_for_event(eventData.event(), eventData.run()); // wrong run: revert to pedestrian method...
121  //return data->second.second;
122 
123  return data_for_event(eventData.event(), eventData.run());
124 }
125 
126 
128 {
129  reference = sum = nullptr;
130  if (nData() == 0) return false;
131 
132  sum = new SimpleShape(m_data[0]->nSamples());
133  reference = nullptr;
134 
135  for (unsigned int j = 0; j < nData(); j++) {
136  if (sum->nPoints() != m_data[j]->nSamples()) return false;
137  for (unsigned int k = 0; k < m_data[j]->nSamples(); k++)
138  sum->add(k, m_data[j]->pedestalSubtractedSample(k), m_data[j]->error(k));
139  SimpleShape* thisRef = referenceShape(j);
140  if (!thisRef) { delete sum; return false; }
141  if (reference) {
142  reference->add(*thisRef);
143  delete thisRef;
144  }
145  else reference = thisRef;
146  }
147 
148  return true;
149 }
150 
151 
152 bool History::isValid() const
153 {
154  if (!m_cellInfo.isValid()) return false;
155  if (nData() == 0) return false;
156 
157  for (const Data* data : m_data)
158  if (!data->isValid()) return false;
159 
160  return true;
161 }
162 
163 
164 double History::chi2(int i, int lwb, int upb, int chi2Params, ShapeErrorType shapeErrorType, unsigned int* nDof) const
165 {
167  if (!reference) return -1;
168  Chi2Calc c2c(chi2Params);
169  if ( m_data[i]->isDisconnected()) return -1;
170  const ScaledErrorData* sea = scaledErrorData(i, -1, Definitions::none, shapeErrorType);
171  if (!sea && shapeErrorType != NoShapeError && shapeErrorType != BestShapeError) return -1;
172  double chi2Value = c2c.chi2(*m_data[i], *reference, sea, lwb, upb);
173  if (nDof) *nDof = c2c.nDof();
174  if (sea) delete sea;
175  delete reference;
176  return chi2Value;
177 }
178 
179 
180 double History::chi2_k(int i, double k, int lwb, int upb, int chi2Params) const
181 {
182  const AbsShapeErrorGetter* oldGetter = shapeErrorGetter();
185  if (oldGetter) combGetter->add(*oldGetter);
186  combGetter->add(*uniGetter);
187  setShapeErrorGetter(combGetter);
188  double chi2Value = chi2(i, lwb, upb, chi2Params);
189  setShapeErrorGetter(oldGetter);
190  delete combGetter;
191  delete uniGetter;
192  return chi2Value;
193 }
194 
195 
196 double History::maxChi2(int lwb, int upb, int chi2Params) const
197 {
198  double maxChi2 = -2;
199  for (unsigned int i = 0; i < nData(); i++) {
200  double chi2Value = chi2(i, lwb, upb, chi2Params);
201  if (chi2Value > maxChi2) maxChi2 = chi2Value;
202  }
203  return maxChi2;
204 }
205 
206 
207 OFC* History::ofc(unsigned int k, int lwb, int upb, double time, bool withAutoCorr) const
208 {
209  if (k >= nData()) return nullptr;
210  if (Definitions::isNone(time)) {
211  time = data(k)->ofcTime();
212  //cout << "Using reference time = " << time << endl;
213  }
214  SimpleShape* reference = referenceShape(k, 1, time); // ADC=1 : we need a normalized shape
215  if (!reference) return nullptr;
216  OFC* result = new OFC(*reference, *m_data[k], lwb, upb, shapeErrorData(CaloGain::LARHIGHGAIN), withAutoCorr); // FixMe
217  delete reference;
218  if (!result) return nullptr;
219  if (result->g().GetNrows() == 0) { delete result; result = nullptr; }
220  return result;
221 }
222 
223 
224 bool History::refVal(unsigned int k, unsigned int sample, double& val, double& err) const
225 {
226  if (k >= nData()) return false;
228  if (!reference) return false;
229  if (reference->interpolate(m_data[k]->time(sample), val, err) != 0) { delete reference; return false; }
230  delete reference;
231  return true;
232 }
233 
234 
236 {
237  std::vector<const Data*> datas;
238  DataTweaker tw;
239  tw.setRefit(true);
240  tw.setFitParams(pars);
241 
242  for (unsigned int j = 0; j < nData(); j++) {
243  Data* refitData = tw.tweak(*data(j));
244  if (!refitData) {
245  for (unsigned int k = 0; k < datas.size(); k++) delete datas[k];
246  return nullptr;
247  }
248  datas.push_back(refitData);
249  }
250 
251  std::vector<const EventData*> eventData;
252  for (const EventData* event : m_eventData)
253  eventData.push_back(new EventData(*event));
254 
255  return new History(datas, *cellInfo(), eventData, hash(), shapeErrorGetter());
256 }
257 
258 
260 {
261  std::vector<const Data*> datas;
262  DataTweaker tw;
263  tw.setAdjust(true);
264 
265  for (unsigned int j = 0; j < nData(); j++) {
266  Data* newData = tw.tweak(*data(j));
267  if (!newData) {
268  for (unsigned int k = 0; k < datas.size(); k++) delete datas[k];
269  return nullptr;
270  }
271  datas.push_back(newData);
272  }
273 
274  std::vector<const EventData*> eventData;
275  for (const EventData* event : m_eventData)
276  eventData.push_back(new EventData(*event));
277 
278  return new History(datas, *cellInfo(), eventData, hash(), shapeErrorGetter());
279 }
280 
281 
282 History* History::filter(const TString& cuts) const
283 {
284  FilterParams f;
285  if (!f.set(cuts)) return nullptr;
286 
287  std::vector<const Data*> datas;
288 
289  for (unsigned int j = 0; j < nData(); j++) {
290  if (!f.pass(hash(), *this, j)) continue;
291  datas.push_back(new Data(*data(j)));
292  }
293 
294  std::vector<const EventData*> eventData;
295  for (const EventData* event : m_eventData)
296  eventData.push_back(new EventData(*event));
297 
298  return new History(datas, *cellInfo(), eventData, hash(), shapeErrorGetter());
299 }
300 
301 
303 {
304  if (shapeErrorType == NoShapeError || !shapeErrorGetter()) return nullptr;
305  if (shapeErrorType == BestShapeError) {
306  for (unsigned int i = 0; i < NShapeErrorTypes; i++) {
308  if (sed) return sed;
309  }
310  return nullptr;
311  }
312 
313  if (shapeErrorType == CellShapeError) {
315  if (!sed) return nullptr;
317  return sed;
318  }
319 
320  if (shapeErrorType == LowGainCellShapeError || shapeErrorType == MedGainCellShapeError || shapeErrorType == HighGainCellShapeError) {
321  CaloGain::CaloGain fbGain = (shapeErrorType == LowGainCellShapeError ? CaloGain::LARLOWGAIN :
324  if (!sed) return nullptr;
325  sed->setShapeErrorType(shapeErrorType);
326  return sed;
327  }
328 
329  if (shapeErrorType == RingShapeError) {
331  if (!sed) return nullptr;
333  return sed;
334  }
335 
336  if (shapeErrorType == LowGainRingShapeError || shapeErrorType == MedGainRingShapeError || shapeErrorType == HighGainRingShapeError) {
337  CaloGain::CaloGain fbGain = (shapeErrorType == LowGainRingShapeError ? CaloGain::LARLOWGAIN :
339  ShapeErrorData* sed = shapeErrorGetter()->phiSymShapeErrorData(cellInfo()->globalPhiRing(), fbGain, res);
340  if (!sed) return nullptr;
341  sed->setShapeErrorType(shapeErrorType);
342  return sed;
343  }
344 
345  return nullptr;
346 }
347 
348 
349 const ScaledErrorData* History::scaledErrorData(unsigned int k, double adcMax, double time,
350  ShapeErrorType shapeErrorType) const
351 {
352  if (shapeErrorType == NoShapeError || !shapeErrorGetter()) return nullptr;
353  if (k >= nData() || data(k)->adcMax() <= 0) return nullptr;
354 
355  const ShapeErrorData* sed = shapeErrorData(data(k)->gain(), shapeErrorType, residual(k, false));
356  if (!sed) return nullptr;
357 
358  double sf = (adcMax < 0 ? data(k)->adcMax() : adcMax);
359  double ts = (Definitions::isNone(time) ? data(k)->ofcTime() : time);
360  ScaledErrorData* sced = new ScaledErrorData(*sed, sf, ts);
361  delete sed;
362  return sced;
363 }
364 
365 
366 bool History::delta(unsigned int k, unsigned int sample, double& del) const
367 {
368  if (k >= nData()) return 0;
369  TVectorD dv = deltas(k, sample, sample);
370  if (dv.GetNrows() == 0) return false;
371  del = dv[sample];
372  return true;
373 }
374 
375 
376 TVectorD History::deltas(unsigned int k, int lwb, int upb, bool correct) const
377 {
378  if (k >= nData()) return TVectorD();
380  if (!reference) return TVectorD();
381  Chi2Calc c2c;
383  const ScaledErrorData* sea = (correct ? scaledErrorData(k) : nullptr);
384  TVectorD dv = c2c.deltas(*data(k), *reference, errors, sea, lwb, upb);
385  if (sea) delete sea;
386  delete reference;
387  return dv;
388 }
389 
390 
391 bool History::residualOffset(unsigned int k, short sample, double& offset, double adcMax, double time) const
392 {
393  const ScaledErrorData* sea = scaledErrorData(k, adcMax, time);
394  if (!sea) return false;
395  if (!sea->isInRange(sample)) { delete sea; return false; }
396  offset = sea->offsets()(sample);
397  delete sea;
398  return true;
399 }
400 
401 
402 bool History::residualError(unsigned int k, short sample1, short sample2, double& error, double adcMax, double time) const
403 {
404  const ScaledErrorData* sea = scaledErrorData(k, adcMax, time);
405  if (!sea) return false;
406  if (!sea->isInRange(sample1) || !sea->isInRange(sample2)) { delete sea; return false; }
407  error = sea->errors()(sample1, sample2);
408  delete sea;
409  return true;
410 }
411 
412 
413 bool History::allShape(GraphShape*& allData, SimpleShape*& allRef) const
414 {
415  allData = nullptr;
416  allRef = nullptr;
417 
418  for (unsigned int j = 0; j < nData(); j++) {
419  if ( m_data[j]->isDisconnected()) continue;
420  if (m_data[j]->adcMax() < 1) continue;
421  GraphShape* thisData = new GraphShape(*m_data[j], 1/m_data[j]->adcMax(), -m_data[j]->ofcTime());
422  if (allData) {
423  allData->add(*thisData);
424  delete thisData;
425  }
426  else allData = thisData;
427  SimpleShape* thisRef = referenceShape(j, 1); // normalized to 1, like the data
428  if (allRef) {
429  allRef->add(*thisRef);
430  delete thisRef;
431  }
432  else allRef = thisRef;
433  }
434 
435  return true;
436 }
437 
438 
440 {
441  Chi2Calc c2c(pars);
442 
443  GraphShape* allData = nullptr;
444  SimpleShape* allRef = nullptr;
445  if (!allShape(allData, allRef)) return -1;
446  double chi2Value = c2c.chi2(*allData, *allRef);
447  delete allData;
448  delete allRef;
449  return chi2Value;
450 }
451 
452 
453 bool History::drawWithReference(int k, const TString& atlasTitle) const
454 {
455  if ((unsigned int)k >= nData()) return false;
456  auto refShape = std::unique_ptr<SimpleShape>(referenceShape(k));
457  auto smpShape = std::unique_ptr<SimpleShape>(referenceShape(k, -1, Definitions::none, true));
458 
459  if (!refShape || !smpShape) return false;
460  int pars = DataFirst | Legend;
461  TString title = "";
462  if (atlasTitle != "") { // Make sure AtlasStyle is set in ROOT, otherwise will not be as pretty...
463  pars |= AtlasStyle;
464  title = atlasTitle;
465  }
466  else
467  title = Form("%s, run %d, event %d", cellInfo()->location(1).Data(), m_data[k]->run(), m_data[k]->event());
469  bool result = drawer.draw(title, m_data[k], refShape.get(), smpShape.get());
470  return result;
471 }
472 
473 
475 {
476  SimpleShape* dataShape, *refShape;
477  if (!sum(dataShape, refShape)) return false;
478 
480  return drawer.drawAndDelete("", dataShape, refShape);
481 }
482 
483 
484 bool History::drawAllWithReference(bool doRefit) const
485 {
486  if (!nData()) {
487  cout << "No data" << endl;
488  return false;
489  }
490 
491  if (doRefit) {
492  History* refitted_history = refit(DefaultChi2);
493  if (!refitted_history) return false;
494  bool result = refitted_history->drawAllWithReference(false);
495  delete refitted_history;
496  return result;
497  }
498 
499  // Use the shape of the gain of the first pulse...
500  SimpleShape* refShape = referenceShape(0, 1000, 0);
501  SimpleShape* smpShape = referenceShape(0, 1000, 0, true);
502  std::vector<const AbsShape*> shapes;
503 
504  for (unsigned int i = 0; i < nData(); i++) {
505  if (m_data[i]->adcMax() < 1) continue;
506  SimpleShape* shape = new SimpleShape(*m_data[i], 1000/m_data[i]->adcMax(), -m_data[i]->ofcTime());
507  const ScaledErrorData* sed = scaledErrorData(i, 1000);
508  if (sed) {
509  for (unsigned int k = 0; k < shape->nPoints(); k++)
510  if (sed->isInRange(k))
511  shape->set(k, shape->value(k) - sed->offsets()(k));
512  delete sed;
513  }
514  shapes.push_back(shape);
515  }
516 
518  return drawer.drawAndDelete(Form("%s (Normalized Shape, max at 1000)", cellInfo()->location(2).Data()), shapes, refShape, smpShape);
519 }
520 
521 
522 bool History::drawResiduals(int k, bool errors, bool rescale) const
523 {
524  std::vector<const AbsShape*> shapes;
525  for (unsigned int i = 0; i < nData(); i++) {
526  if (m_data[i]->adcMax() < 1) continue;
527  if (k >= 0 && k != (int)i) continue;
528  SimpleShape* shape = deltaShape(i);
529  if (!errors)
530  for (unsigned int idx = 0; idx < shape->nPoints(); idx++) shape->setError(idx, 0);
531  if (!shape) continue;
532  if (rescale) {
533  SimpleShape* scaled = new SimpleShape(*shape, 1/m_data[i]->adcMax(), 9.0*i/nData() - m_data[i]->ofcTime());
534  delete shape;
535  shape = scaled;
536  }
537  shapes.push_back(shape);
538  }
540  TString title = (rescale ? "Normalized " : "") + TString("residuals for %s");
541  return drawer.drawAndDelete(Form(title.Data(), cellInfo()->location(2).Data()), shapes);
542 }
543 
544 
545 SimpleShape* History::referenceShape(unsigned int k, double adcMax, double time,
546  bool samplesOnly) const
547 {
548  if (!cellInfo()->shape(m_data[k]->gain())) return nullptr;
549  if (adcMax < 0) adcMax = m_data[k]->adcMax();
550  if (Definitions::isNone(time)) time = m_data[k]->ofcTime();
551  SimpleShape* shape = new SimpleShape(*cellInfo()->shape(m_data[k]->gain()), adcMax, time, samplesOnly);
552  return shape;
553 }
554 
555 
556 SimpleShape* History::deltaShape(unsigned int k, int lwb, int upb) const
557 {
558  if (k >= nData()) return nullptr;
560  if (!reference) return nullptr;
561  Chi2Calc c2c;
563  const ScaledErrorData* sea = scaledErrorData(k);
564  TVectorD dv = c2c.deltas(*data(k), *reference, errors, sea, lwb, upb);
565  if (sea) delete sea;
566  delete reference;
567  if (dv.GetNrows() == 0) return nullptr;
568  SimpleShape* shape = new SimpleShape(dv.GetNrows(), Definitions::samplingInterval, data(k)->time(c2c.lwb()) + data(k)->ofcTime());
569  for (int l = c2c.lwb(); l <= c2c.upb(); l++) shape->set(l - c2c.lwb(), dv(l), TMath::Sqrt(errors(l, l)));
570  return shape;
571 }
572 
573 
574 TString History::description(unsigned int verbosity) const
575 {
576  TString desc = "";
577  for (unsigned int i = 0; i < nData(); i++)
578  desc += Form(" #%-2d : ", i) + data(i)->description(verbosity) + "\n";
579  if (desc == "") return desc;
580  return cellInfo()->location(2) + "\n" + desc;
581 }
582 
583 
585 {
586  Averager* avg = new Averager(1);
587  for (unsigned int k = 0; k < nData(); k++) {
588  if (i >= 0 && i != (int)k) continue;
590  if (!reference) continue;
591  double v,e;
592  for (unsigned int l = 0; l < data(k)->nPoints(); l++)
593  if (reference->interpolate(data(k)->time(l), v, e) == -1) { // we're before the ref shapeError
594  TVectorD ped(1);
595  ped(0) = data(k)->value(l);
596  avg->fill(ped);
597  }
598  delete reference;
599  }
600  return avg;
601 }
602 
603 
604 Residual* History::residual(unsigned int k, bool correct, bool zeroTime) const
605 {
606  if (k >= nData()) return nullptr;
607  TVectorD del = deltas(k, -1, -1, correct);
608  return new Residual(del, data(k)->run(), data(k)->event(), data(k)->adcMax(),
609  (zeroTime ? 0 : data(k)->ofcTime() /*- Definitions::samplingTime(del.GetLwb()) */));
610 }
611 
612 
613 Residuals* History::residuals(CaloGain::CaloGain gain, double absResCut, bool correct, bool zeroTime) const
614 {
615  Chi2Calc c2c;
616  CovMatrix dummyErrors;
617  auto residuals = std::make_unique<Residuals>();
618  for (unsigned int k = 0; k < nData(); k++) {
619  if (gain != CaloGain::LARNGAIN && data(k)->gain() != gain) continue;
620  auto res = std::unique_ptr<Residual>(residual(k, correct, zeroTime));
621  if (!res) { cout << "Error calculating residual for hash = " << m_hash << ", index = " << k << endl; return nullptr; }
622  if (residuals->size() > 0 && !residuals->hasSameRange(*res)) {
623  cout << "Warning for hash = " << m_hash << ", index = " << k << " : index interval changed from ["
624  << residuals->lwb() << ", " << residuals->upb() << "] to " << res->rangeStr() << endl;
625  return nullptr;
626  }
627  bool pass = true;
628  for (int i = res->lwb(); i < res->upb(); i++) {
629  if (absResCut > 0 && TMath::Abs(res->scaledDelta(i)) > absResCut) {
630  pass = false;
631  break;
632  }
633  }
634  if (pass) residuals->add(*res);
635  }
636  return residuals.release();
637 }
638 
639 
640 double History::upstreamEnergy(unsigned int k) const
641 {
642  if (!m_interface || !cellInfo()) return -1;
643  if (k >= nData() || !data(k)->eventData()) return -1;
644  std::vector<unsigned int> upstreamNeighbors;
645  if (!m_interface->firstNeighbors(hash(), upstreamNeighbors, cellInfo()->layer() - 1)) return -1;
646  if (upstreamNeighbors.empty()) return -1;
647  std::vector<const Data*> unData;
648  if (!m_interface->data(upstreamNeighbors, *data(k)->eventData(), unData)) return -1;
649  double upstreamE = 0;
650  for (const Data* data : unData) {
651  upstreamE += data->energy();
652  delete data;
653  }
654  return upstreamE;
655 }
656 
657 
658 double History::chi2Anomaly(double chi2Cut, unsigned int nDof) const
659 {
660  if (nData() == 0 || chi2Cut <= 0) return -1;
661  double nBadChi2 = 0;
662  for (unsigned int k = 0; k < nData(); k++) if (chi2(k) > chi2Cut) nBadChi2++;
663  double effBad = nBadChi2/nData();
664  double effRef = TMath::Prob(chi2Cut, nDof);
665  double dEff = sqrt(effRef*(1 - effRef))/sqrt(nData());
666  if (dEff == 0) dEff = 1/sqrt(nData());
667  return (effBad - effRef)/dEff;
668 }
LArSamples::Data::description
TString description(unsigned int verbosity=1) const
Definition: Data.cxx:514
grepfile.info
info
Definition: grepfile.py:38
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
LArSamples::LowGainRingShapeError
@ LowGainRingShapeError
Definition: LArCalorimeter/LArCafJobs/LArCafJobs/Definitions.h:24
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
LArSamples::History::data_for_event
const Data * data_for_event(int event, int run=-1) const
Definition: History.cxx:98
LArSamples::CellInfo::isValid
bool isValid() const
Definition: CellInfo.cxx:173
LArSamples::History::m_eventData
std::vector< const EventData * > m_eventData
Definition: History.h:113
LArSamples::Chi2Calc::deltas
TVectorD deltas(const AbsShape &data, const AbsShape &reference, CovMatrix &errors, const ScaledErrorData *shapeError=0, int lwb=-1, int upb=-1, bool noDataError=false)
Definition: Chi2Calc.cxx:36
LArSamples::History::hash
unsigned int hash() const
Definition: History.h:86
AbsShapeErrorGetter.h
get_generator_info.result
result
Definition: get_generator_info.py:21
PlotCalibFromCool.dv
dv
Definition: PlotCalibFromCool.py:762
LArSamples::DataTweaker::setRefit
void setRefit(bool refit=true)
Definition: DataTweaker.h:39
LArSamples::FilterParams
Definition: FilterParams.h:50
LArSamples::History::scaledErrorData
const ScaledErrorData * scaledErrorData(unsigned int i, double adcMax=-1, double time=Definitions::none, ShapeErrorType shapeErrorType=BestShapeError) const
Definition: History.cxx:349
ScaledErrorData.h
LArSamples::History::chi2Anomaly
double chi2Anomaly(double chi2Cut, unsigned int nDof=3) const
Definition: History.cxx:658
SimpleShape.h
LArSamples::History::cellInfo
const CellInfo * cellInfo() const
Definition: History.h:56
LArSamples::CovMatrix
TMatrixTSym< double > CovMatrix
Definition: LArCalorimeter/LArCafJobs/LArCafJobs/Definitions.h:11
LArSamples::History::referenceShape
SimpleShape * referenceShape(unsigned int k, double adcMax=-1, double time=Definitions::none, bool samplesOnly=false) const
Definition: History.cxx:545
LArSamples::HighGainCellShapeError
@ HighGainCellShapeError
Definition: LArCalorimeter/LArCafJobs/LArCafJobs/Definitions.h:22
LArSamples::DataTweaker::setAdjust
void setAdjust(bool adjust=true)
Definition: DataTweaker.h:41
LArSamples::Data::setCallBacks
void setCallBacks(const History *history, unsigned int index) const
Definition: Data.h:272
LArSamples::Data::adcMax
double adcMax() const
Definition: Data.h:124
Data
@ Data
Definition: BaseObject.h:11
m_data
std::vector< T > m_data
Definition: TrackTruthMatchingBaseAlg.cxx:660
Residual.h
LArSamples::History
Definition: History.h:35
LArSamples::History::m_data
std::vector< const Data * > m_data
Definition: History.h:111
LArSamples::HistoryContainer::dataContainer
const DataContainer * dataContainer(unsigned int i) const
Definition: HistoryContainer.h:41
LArSamples::History::~History
virtual ~History()
Definition: History.cxx:69
CaloCondBlobAlgs_fillNoiseFromASCII.gain
gain
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:110
UniformShapeErrorGetter.h
ClassCounts.h
LArSamples::IndexRange::hasSameRange
bool hasSameRange(int lw, int up) const
Definition: IndexRange.h:29
Geometry.h
LArSamples::SimpleShape
Definition: SimpleShape.h:25
LArSamples::Data::run
int run() const
Definition: Data.cxx:27
run
int run(int argc, char *argv[])
Definition: ttree2hdf5.cxx:28
LArSamples::AbsShapeErrorGetter::shapeErrorData
virtual ShapeErrorData * shapeErrorData(unsigned int hash, CaloGain::CaloGain gain, const Residual *toExclude=0) const =0
LArSamples::History::residuals
Residuals * residuals(CaloGain::CaloGain gain=CaloGain::LARNGAIN, double absResTrunc=-1, bool correct=true, bool zeroTime=false) const
Definition: History.cxx:613
LArSamples::Chi2Calc::lwb
int lwb() const
Definition: Chi2Calc.h:45
LArSamples::History::m_interface
const Interface * m_interface
Definition: History.h:116
OFC.h
LArSamples::SimpleShape::nPoints
unsigned int nPoints() const
Definition: SimpleShape.h:48
LArSamples::ShapeDrawer
Definition: ShapeDrawer.h:26
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
LArSamples
Definition: AbsShape.h:24
LArSamples::Chi2Params
Chi2Params
Definition: Chi2Calc.h:24
LArSamples::Data::ofcTime
double ofcTime() const
Definition: Data.h:111
reference
Definition: hcg.cxx:437
LArSamples::History::residualError
bool residualError(unsigned int i, short sample1, short sample2, double &offset, double adcMax=-1, double time=Definitions::none) const
Definition: History.cxx:402
LArSamples::Averager
storage of the time histories of all the cells
Definition: Averager.h:23
LArSamples::History::filter
History * filter(const TString &cuts) const
Definition: History.cxx:282
LArSamples::History::allChi2
double allChi2(Chi2Params pars) const
Definition: History.cxx:439
yodamerge_tmp.rescale
rescale
Definition: yodamerge_tmp.py:198
LArSamples::History::ofc
OFC * ofc(unsigned int i, int lwb=-1, int upb=-1, double time=Definitions::none, bool useCorrs=true) const
Definition: History.cxx:207
CaloGain::LARNGAIN
@ LARNGAIN
Definition: CaloGain.h:19
Example_ReadSampleNoise.drawer
drawer
Definition: Example_ReadSampleNoise.py:39
Averager.h
LArSamples::MedGainCellShapeError
@ MedGainCellShapeError
Definition: LArCalorimeter/LArCafJobs/LArCafJobs/Definitions.h:22
LArSamples::AbsShapeErrorGetter
Definition: AbsShapeErrorGetter.h:23
LArSamples::CombinedShapeErrorGetter::add
void add(const AbsShapeErrorGetter &getter)
Definition: CombinedShapeErrorGetter.h:25
LArSamples::Data::event
int event() const
Definition: Data.cxx:28
ShapeInfo.h
LArSamples::GraphShape::add
bool add(const AbsShape &other)
Definition: GraphShape.cxx:26
LArSamples::History::deltaShape
SimpleShape * deltaShape(unsigned int k, int lwb=-1, int upb=-1) const
Definition: History.cxx:556
LArSamples::ScaledErrorData
Definition: ScaledErrorData.h:17
DataTweaker.h
LArSamples::History::maxChi2
double maxChi2(int lwb=-1, int upb=-1, int chi2Params=DefaultChi2) const
Definition: History.cxx:196
LArSamples::SimpleShape::add
bool add(unsigned int k, double value, double error)
Definition: SimpleShape.cxx:90
LArSamples::History::data
const Data * data(unsigned int i) const
Definition: History.cxx:91
LArSamples::SimpleShape::set
void set(unsigned int i, double value, double error=-1)
Definition: SimpleShape.h:53
LArSamples::Data::value
double value(unsigned int i) const
Definition: Data.h:146
LArSamples::Interface::firstNeighbors
bool firstNeighbors(unsigned int hash, std::vector< unsigned int > &hashes, short layer=-2) const
Definition: Interface.cxx:737
LArSamples::Chi2Calc
Definition: Chi2Calc.h:26
LArSamples::IndexRange::isInRange
bool isInRange(int i) const
Definition: IndexRange.h:27
LArSamples::History::residual
Residual * residual(unsigned int k, bool correct=true, bool zeroTime=false) const
Definition: History.cxx:604
CaloCondBlobAlgs_fillNoiseFromASCII.desc
desc
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:54
LArSamples::History::refit
History * refit(Chi2Params pars=DefaultChi2) const
Definition: History.cxx:235
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
FullCPAlgorithmsTest_eljob.sample
sample
Definition: FullCPAlgorithmsTest_eljob.py:113
dqt_zlumi_pandas.err
err
Definition: dqt_zlumi_pandas.py:182
GraphShape.h
LArSamples::History::allShape
bool allShape(GraphShape *&allData, SimpleShape *&allRef) const
Definition: History.cxx:413
lumiFormat.i
int i
Definition: lumiFormat.py:85
Recovery.avg
def avg(a, b)
Definition: Recovery.py:79
LArSamples::Definitions::none
static const double none
Definition: LArCalorimeter/LArCafJobs/LArCafJobs/Definitions.h:17
CombinedShapeErrorGetter.h
LArSamples::History::refVal
bool refVal(unsigned int i, unsigned int sample, double &val, double &err) const
Definition: History.cxx:224
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
LArSamples::ClassCounts::decrementInstanceCount
void decrementInstanceCount() const
Definition: LArCafJobs/LArCafJobs/ClassCounts.h:33
LArSamples::History::setShapeErrorGetter
void setShapeErrorGetter(const AbsShapeErrorGetter *err) const
Definition: History.h:87
covarianceTool.title
title
Definition: covarianceTool.py:542
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:14
LArSamples::History::drawSumWithReference
bool drawSumWithReference() const
Definition: History.cxx:474
LArSamples::CellInfo::location
TString location(int verbose=1) const
Definition: CellInfo.cxx:139
plotBeamSpotVert.cuts
string cuts
Definition: plotBeamSpotVert.py:93
LArSamples::History::chi2_k
double chi2_k(int i, double k, int lwb=-1, int upb=-1, int chi2Params=DefaultChi2) const
Definition: History.cxx:180
LArSamples::History::dissolve
HistoryContainer * dissolve()
Definition: History.cxx:79
LArSamples::ShapeErrorType
ShapeErrorType
Definition: LArCalorimeter/LArCafJobs/LArCafJobs/Definitions.h:21
LArSamples::BestShapeError
@ BestShapeError
Definition: LArCalorimeter/LArCafJobs/LArCafJobs/Definitions.h:25
hist_file_dump.f
f
Definition: hist_file_dump.py:135
ITk::EventData
InDet::SiSpacePointsSeedMakerEventData EventData
Definition: ITkSiSpacePointsSeedMaker.h:63
run
Definition: run.py:1
LArSamples::DataTweaker
Definition: DataTweaker.h:24
LArSamples::History::sum
bool sum(SimpleShape *&sum, SimpleShape *&reference) const
Definition: History.cxx:127
LArSamples::History::nData
unsigned int nData() const
Definition: History.h:51
LArSamples::History::chi2
double chi2(int i, int lwb=-1, int upb=-1, int chi2Params=DefaultChi2, ShapeErrorType shapeErrorType=BestShapeError, unsigned int *nDof=0) const
Definition: History.cxx:164
LArSamples::Residual
storage of a pulse shape residual set
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:29
LArSamples::History::drawResiduals
bool drawResiduals(int k=-1, bool errors=true, bool rescale=true) const
Definition: History.cxx:522
LArSamples::History::History
History(const HistoryContainer &container, const std::vector< const EventData * > &eventData, unsigned int hash, const AbsShapeErrorGetter *shapeErrorGetter=0)
Constructor
LArSamples::OFC
Definition: OFC.h:27
LArSamples::Residuals
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:72
LArSamples::DataTweaker::setFitParams
void setFitParams(Chi2Params params)
Definition: DataTweaker.h:40
mergePhysValFiles.errors
list errors
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:43
LArSamples::Data::nPoints
unsigned int nPoints() const
Definition: Data.h:144
LArSamples::History::delta
bool delta(unsigned int i, unsigned int sample, double &del) const
Definition: History.cxx:366
LArSamples::DataTweaker::tweak
Data * tweak(const Data &data, int evtIndex=-1) const
Definition: DataTweaker.cxx:47
HistoryContainer.h
LArSamples::NShapeErrorTypes
@ NShapeErrorTypes
Definition: LArCalorimeter/LArCafJobs/LArCafJobs/Definitions.h:25
LArSamples::Data
Definition: Data.h:72
LArSamples::ClassCounts::incrementInstanceCount
void incrementInstanceCount() const
Definition: LArCafJobs/LArCafJobs/ClassCounts.h:32
LArSamples::Data::dissolve
const DataContainer * dissolve()
Definition: Data.cxx:56
LArSamples::AtlasStyle
@ AtlasStyle
Definition: ShapeDrawer.h:22
LArSamples::History::calculatePedestal
Averager * calculatePedestal(int i) const
Definition: History.cxx:584
LArSamples::Data::gain
CaloGain::CaloGain gain() const
Definition: Data.h:85
covarianceTool.verbosity
verbosity
Definition: covarianceTool.py:513
CaloGain::LARHIGHGAIN
@ LARHIGHGAIN
Definition: CaloGain.h:18
LArSamples::CellInfo
Definition: CellInfo.h:31
LArSamples::ShapeErrorData::setShapeErrorType
void setShapeErrorType(ShapeErrorType type)
Definition: ShapeErrorData.h:59
CaloGain::CaloGain
CaloGain
Definition: CaloGain.h:11
Example_ReadSampleNoise.ped
ped
Definition: Example_ReadSampleNoise.py:45
LArSamples::History::m_cellInfo
CellInfo m_cellInfo
Definition: History.h:112
LArSamples::History::shapeErrorGetter
const AbsShapeErrorGetter * shapeErrorGetter() const
Definition: History.h:88
LArSamples::DefaultChi2
@ DefaultChi2
Definition: Chi2Calc.h:24
python.PyAthena.v
v
Definition: PyAthena.py:154
CaloGain::LARMEDIUMGAIN
@ LARMEDIUMGAIN
Definition: CaloGain.h:18
LArSamples::History::drawAllWithReference
bool drawAllWithReference(bool refit=false) const
Definition: History.cxx:484
LArSamples::History::shapeErrorData
const ShapeErrorData * shapeErrorData(CaloGain::CaloGain gain, ShapeErrorType shapeErrorType=BestShapeError, const Residual *res=0) const
Definition: History.cxx:302
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
mapkey::sf
@ sf
Definition: TElectronEfficiencyCorrectionTool.cxx:38
LArSamples::HistoryContainer
Definition: HistoryContainer.h:29
LArSamples::Residuals::size
unsigned int size() const
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:80
LArSamples::Residuals::add
bool add(const Residual &residual)
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:86
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
ShapeDrawer.h
LArSamples::History::upstreamEnergy
double upstreamEnergy(unsigned int k) const
Definition: History.cxx:640
LArSamples::HistoryContainer::add
void add(const DataContainer *data)
append data (takes ownership)
Definition: HistoryContainer.h:46
LArSamples::SimpleShape::setError
void setError(unsigned int i, double error)
Definition: SimpleShape.h:54
LArSamples::History::adjust
History * adjust() const
Definition: History.cxx:259
LArSamples::GraphShape
Definition: GraphShape.h:32
dq_make_web_display.reference
reference
Definition: dq_make_web_display.py:44
LArSamples::History::deltas
TVectorD deltas(unsigned int i, int lwb=-1, int upb=-1, bool correct=true) const
Definition: History.cxx:376
LArSamples::CombinedShapeErrorGetter
Definition: CombinedShapeErrorGetter.h:18
LArSamples::LowGainCellShapeError
@ LowGainCellShapeError
Definition: LArCalorimeter/LArCafJobs/LArCafJobs/Definitions.h:22
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
LArSamples::Definitions::isNone
static bool isNone(double x)
Definition: LArCalorimeter/LArCafJobs/LArCafJobs/Definitions.h:18
LArSamples::History::drawWithReference
bool drawWithReference(int i, const TString &atlasTitle="") const
Definition: History.cxx:453
LArSamples::Interface::data
bool data(const std::vector< unsigned int > &hashes, const EventData &event, std::vector< const Data * > &data) const
Definition: Interface.cxx:762
LArSamples::History::residualOffset
bool residualOffset(unsigned int i, short sample, double &offset, double adcMax=-1, double time=Definitions::none) const
Definition: History.cxx:391
LArSamples::CellShapeError
@ CellShapeError
Definition: LArCalorimeter/LArCafJobs/LArCafJobs/Definitions.h:21
Definitions.h
Data.h
LArDigits2NtupleDumper.nSamples
nSamples
Definition: LArDigits2NtupleDumper.py:70
ShapeErrorData.h
LArSamples::History::m_hash
unsigned int m_hash
Definition: History.h:114
LArSamples::MedGainRingShapeError
@ MedGainRingShapeError
Definition: LArCalorimeter/LArCafJobs/LArCafJobs/Definitions.h:24
LArSamples::NoShapeError
@ NoShapeError
Definition: LArCalorimeter/LArCafJobs/LArCafJobs/Definitions.h:25
LArSamples::History::description
TString description(unsigned int verbosity=1) const
Definition: History.cxx:574
LArSamples::Residuals::upb
int upb() const
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:84
LArSamples::ShapeErrorData
Definition: ShapeErrorData.h:19
History.h
CaloGain::LARLOWGAIN
@ LARLOWGAIN
Definition: CaloGain.h:18
LArSamples::History::eventData
const std::vector< const EventData * > & eventData() const
Definition: History.h:58
LArSamples::FitterData::sed
const ScaledErrorData * sed
Definition: ShapeFitter.cxx:26
ShapeFitter.h
LArSamples::History::isValid
bool isValid() const
Definition: History.cxx:152
LArSamples::Legend
@ Legend
Definition: ShapeDrawer.h:22
LArSamples::Definitions::samplingInterval
static const unsigned int samplingInterval
Definition: LArCalorimeter/LArCafJobs/LArCafJobs/Definitions.h:15
python.CaloScaleNoiseConfig.ts
ts
Definition: CaloScaleNoiseConfig.py:86
LArSamples::Chi2Calc::nDof
unsigned int nDof() const
Definition: Chi2Calc.h:47
LArSamples::ScaledErrorData::errors
const CovMatrix errors(int first=-1, int last=-1) const
Definition: ScaledErrorData.cxx:31
ScaledShiftedShape.h
LArSamples::SimpleShape::value
double value(unsigned int i) const
Definition: SimpleShape.h:49
error
Definition: IImpactPoint3dEstimator.h:70
Interface.h
LArSamples::EventData
Definition: LArCalorimeter/LArCafJobs/LArCafJobs/EventData.h:29
CellInfo.h
LArSamples::Residuals::lwb
int lwb() const
Definition: LArCalorimeter/LArSamplesMon/LArSamplesMon/Residual.h:83
LArSamples::Chi2Calc::upb
int upb() const
Definition: Chi2Calc.h:46
LArSamples::RingShapeError
@ RingShapeError
Definition: LArCalorimeter/LArCafJobs/LArCafJobs/Definitions.h:23
LArSamples::AbsShapeErrorGetter::phiSymShapeErrorData
virtual ShapeErrorData * phiSymShapeErrorData(short ring, CaloGain::CaloGain gain, const Residual *toExclude=0) const =0
LArSamples::ScaledErrorData::offsets
const TVectorD offsets(int first=-1, int last=-1) const
Definition: ScaledErrorData.cxx:14
LArSamples::Data::energy
double energy() const
Definition: Data.h:108
LArSamples::DataFirst
@ DataFirst
Definition: ShapeDrawer.h:22
fitman.k
k
Definition: fitman.py:528
Legend
slightly more convenient legend class
Definition: computils.h:335
LArSamples::HighGainRingShapeError
@ HighGainRingShapeError
Definition: LArCalorimeter/LArCafJobs/LArCafJobs/Definitions.h:24
LArSamples::HistoryContainer::nDataContainers
unsigned int nDataContainers() const
Definition: HistoryContainer.h:40
LArSamples::Data::isValid
bool isValid() const
Definition: Data.cxx:154
LArSamples::Chi2Calc::chi2
double chi2(const AbsShape &data, const AbsShape &reference, const ScaledErrorData *shapeError=0, int lwb=-1, int upb=-1)
Definition: Chi2Calc.cxx:60
LArSamples::UniformShapeErrorGetter
Definition: UniformShapeErrorGetter.h:17