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