ATLAS Offline Software
Loading...
Searching...
No Matches
History.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6
9
11#include "LArSamplesMon/Data.h"
17#include "LArSamplesMon/OFC.h"
26#include "LArCafJobs/Geometry.h"
30
31#include "TString.h"
32#include "TMath.h"
33#include <iostream>
34#include <memory>
35
36using std::cout;
37using std::endl;
38
39using namespace LArSamples;
40
41
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{
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
56History::History(const std::vector<const Data*>& data, const CellInfo& info,
57 const std::vector<const EventData*>& eventData,
58 unsigned int hash, const AbsShapeErrorGetter* shapeErrorGetter)
61{
63 unsigned int i = 0;
64 for (const Data* pdata : m_data)
65 pdata->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
91const Data* History::data(unsigned int i) const
92{
93 if (i >= nData()) return nullptr;
94 return m_data[i];
95}
96
97
98const 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
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
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
164double 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
180double 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
196double 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
207OFC* 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
224bool 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
282History* 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++) {
307 const ShapeErrorData* sed = shapeErrorData(gain, (ShapeErrorType)i, res);
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) {
324 if (!sed) return nullptr;
325 sed->setShapeErrorType(shapeErrorType);
326 return sed;
327 }
328
329 if (shapeErrorType == RingShapeError) {
330 ShapeErrorData* sed = shapeErrorGetter()->phiSymShapeErrorData(cellInfo()->globalPhiRing(), gain, res);
331 if (!sed) return nullptr;
333 return sed;
334 }
335
336 if (shapeErrorType == LowGainRingShapeError || shapeErrorType == MedGainRingShapeError || shapeErrorType == HighGainRingShapeError) {
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
349const 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
366bool 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
376TVectorD 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;
382 CovMatrix errors;
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
391bool 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
402bool 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
413bool 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
439double History::allChi2(Chi2Params pars) const
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
453bool 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());
468 ShapeDrawer drawer(pars);
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
479 ShapeDrawer drawer(DataFirst | Legend);
480 return drawer.drawAndDelete("", dataShape, refShape);
481}
482
483
484bool 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
517 ShapeDrawer drawer(Legend);
518 return drawer.drawAndDelete(Form("%s (Normalized Shape, max at 1000)", cellInfo()->location(2).Data()), shapes, refShape, smpShape);
519}
520
521
522bool 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 }
539 ShapeDrawer drawer(DataFirst);
540 TString title = (rescale ? "Normalized " : "") + TString("residuals for %s");
541 return drawer.drawAndDelete(Form(title.Data(), cellInfo()->location(2).Data()), shapes);
542}
543
544
545SimpleShape* 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
556SimpleShape* 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;
562 CovMatrix errors;
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
574TString 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
604Residual* 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
613Residuals* 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
640double 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
658double 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}
@ Data
Definition BaseObject.h:11
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
std::pair< std::vector< unsigned int >, bool > res
virtual ShapeErrorData * shapeErrorData(unsigned int hash, CaloGain::CaloGain gain, const Residual *toExclude=0) const =0
virtual ShapeErrorData * phiSymShapeErrorData(short ring, CaloGain::CaloGain gain, const Residual *toExclude=0) const =0
storage of the time histories of all the cells
Definition Averager.h:23
TString location(int verbose=1) const
Definition CellInfo.cxx:139
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
int upb() const
Definition Chi2Calc.h:46
int lwb() const
Definition Chi2Calc.h:45
double chi2(const AbsShape &data, const AbsShape &reference, const ScaledErrorData *shapeError=0, int lwb=-1, int upb=-1)
Definition Chi2Calc.cxx:60
unsigned int nDof() const
Definition Chi2Calc.h:47
void add(const AbsShapeErrorGetter &getter)
void setRefit(bool refit=true)
Definition DataTweaker.h:39
void setFitParams(Chi2Params params)
Definition DataTweaker.h:40
Data * tweak(const Data &data, int evtIndex=-1) const
void setAdjust(bool adjust=true)
Definition DataTweaker.h:41
const DataContainer * dissolve()
Definition Data.cxx:56
bool add(const AbsShape &other)
void add(const DataContainer *data)
append data (takes ownership)
bool sum(SimpleShape *&sum, SimpleShape *&reference) const
Definition History.cxx:127
History * adjust() const
Definition History.cxx:259
OFC * ofc(unsigned int i, int lwb=-1, int upb=-1, double time=Definitions::none, bool useCorrs=true) const
Definition History.cxx:207
bool drawWithReference(int i, const TString &atlasTitle="") const
Definition History.cxx:453
TString description(unsigned int verbosity=1) const
Definition History.cxx:574
double chi2_k(int i, double k, int lwb=-1, int upb=-1, int chi2Params=DefaultChi2) const
Definition History.cxx:180
const ScaledErrorData * scaledErrorData(unsigned int i, double adcMax=-1, double time=Definitions::none, ShapeErrorType shapeErrorType=BestShapeError) const
Definition History.cxx:349
std::vector< const EventData * > m_eventData
Definition History.h:113
bool isValid() const
Definition History.cxx:152
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
History(const HistoryContainer &container, const std::vector< const EventData * > &eventData, unsigned int hash, const AbsShapeErrorGetter *shapeErrorGetter=0)
Constructor.
double chi2Anomaly(double chi2Cut, unsigned int nDof=3) const
Definition History.cxx:658
virtual ~History()
Definition History.cxx:69
bool drawSumWithReference() const
Definition History.cxx:474
bool allShape(GraphShape *&allData, SimpleShape *&allRef) const
Definition History.cxx:413
SimpleShape * deltaShape(unsigned int k, int lwb=-1, int upb=-1) const
Definition History.cxx:556
CellInfo m_cellInfo
Definition History.h:112
const std::vector< const EventData * > & eventData() const
Definition History.h:58
const AbsShapeErrorGetter * shapeErrorGetter() const
Definition History.h:88
unsigned int m_hash
Definition History.h:114
SimpleShape * referenceShape(unsigned int k, double adcMax=-1, double time=Definitions::none, bool samplesOnly=false) const
Definition History.cxx:545
bool refVal(unsigned int i, unsigned int sample, double &val, double &err) const
Definition History.cxx:224
Residuals * residuals(CaloGain::CaloGain gain=CaloGain::LARNGAIN, double absResTrunc=-1, bool correct=true, bool zeroTime=false) const
Definition History.cxx:613
bool residualOffset(unsigned int i, short sample, double &offset, double adcMax=-1, double time=Definitions::none) const
Definition History.cxx:391
bool delta(unsigned int i, unsigned int sample, double &del) const
Definition History.cxx:366
TVectorD deltas(unsigned int i, int lwb=-1, int upb=-1, bool correct=true) const
Definition History.cxx:376
Residual * residual(unsigned int k, bool correct=true, bool zeroTime=false) const
Definition History.cxx:604
Averager * calculatePedestal(int i) const
Definition History.cxx:584
const Interface * m_interface
Definition History.h:116
const CellInfo * cellInfo() const
Definition History.h:56
const AbsShapeErrorGetter * m_shapeErrorGetter
Definition History.h:115
const ShapeErrorData * shapeErrorData(CaloGain::CaloGain gain, ShapeErrorType shapeErrorType=BestShapeError, const Residual *res=0) const
Definition History.cxx:302
std::vector< const Data * > m_data
Definition History.h:111
const Data * data(unsigned int i) const
Definition History.cxx:91
HistoryContainer * dissolve()
Definition History.cxx:79
void setShapeErrorGetter(const AbsShapeErrorGetter *err) const
Definition History.h:87
bool drawResiduals(int k=-1, bool errors=true, bool rescale=true) const
Definition History.cxx:522
History * filter(const TString &cuts) const
Definition History.cxx:282
unsigned int nData() const
Definition History.h:51
History * refit(Chi2Params pars=DefaultChi2) const
Definition History.cxx:235
const Data * data_for_event(int event, int run=-1) const
Definition History.cxx:98
double allChi2(Chi2Params pars) const
Definition History.cxx:439
bool drawAllWithReference(bool refit=false) const
Definition History.cxx:484
unsigned int hash() const
Definition History.h:86
bool residualError(unsigned int i, short sample1, short sample2, double &offset, double adcMax=-1, double time=Definitions::none) const
Definition History.cxx:402
double upstreamEnergy(unsigned int k) const
Definition History.cxx:640
double maxChi2(int lwb=-1, int upb=-1, int chi2Params=DefaultChi2) const
Definition History.cxx:196
bool isInRange(int i) const
Definition IndexRange.h:27
const TVectorD offsets(int first=-1, int last=-1) const
const CovMatrix errors(int first=-1, int last=-1) const
void setShapeErrorType(ShapeErrorType type)
bool add(unsigned int k, double value, double error)
unsigned int nPoints() const
Definition SimpleShape.h:48
void set(unsigned int i, double value, double error=-1)
Definition SimpleShape.h:53
void setError(unsigned int i, double error)
Definition SimpleShape.h:54
double value(unsigned int i) const
Definition SimpleShape.h:49
int ts
Definition globals.cxx:24
@ LARMEDIUMGAIN
Definition CaloGain.h:18
@ LARLOWGAIN
Definition CaloGain.h:18
@ LARNGAIN
Definition CaloGain.h:19
@ LARHIGHGAIN
Definition CaloGain.h:18
@ DefaultChi2
Definition Chi2Calc.h:24
Definition run.py:1