ATLAS Offline Software
Loading...
Searching...
No Matches
ShapeErrorData.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7#include <iostream>
8using std::cout;
9using std::endl;
10
11using namespace LArSamples;
12
13
14const TVectorD ShapeErrorData::xi(int first, int last) const
15{
16 if (!checkRange(first, last)) {
17 cout << "ShapeErrorData::xi : range error" << endl;
18 return TVectorD();
19 }
20
21 return m_xi.GetSub(first, last, "I"); // "I" => indexed as [first, last]
22}
23
24
25const TVectorD ShapeErrorData::xip(int first, int last) const
26{
27 if (!checkRange(first, last)) {
28 cout << "ShapeErrorData::xip : range error" << endl;
29 return TVectorD();
30 }
31
32 return m_xip.GetSub(first, last, "I"); // "I" => indexed as [first, last]
33}
34
35
36const CovMatrix ShapeErrorData::xiErr(int first, int last) const
37{
38 if (!checkRange(first, last)) {
39 cout << "ShapeErrorData::xiErr : range error" << endl;
40 return CovMatrix();
41 }
42
43 return m_xiErr.GetSub(first, last, first, last, "I"); // "I" => indexed as [first, last]
44}
45
46
47const CovMatrix ShapeErrorData::xipErr(int first, int last) const
48{
49 if (!checkRange(first, last)) {
50 cout << "ShapeErrorData::xipErr : range error" << endl;
51 return CovMatrix();
52 }
53
54 return m_xipErr.GetSub(first, last, first, last, "I"); // "I" => indexed as [first, last]
55}
56
57
59{
60 int newLwb = commonLwb(other);
61 int newUpb = commonUpb(other);
62 if (newUpb < newLwb) return nullptr;
63 TVectorD newXi = xi(newLwb, newUpb) + other.xi(newLwb, newUpb);
64 TVectorD newXip = xip(newLwb, newUpb) + other.xip(newLwb, newUpb);
65 CovMatrix newXiErr = xiErr(newLwb, newUpb) + other.xiErr(newLwb, newUpb);
66 CovMatrix newXipErr = xipErr(newLwb, newUpb) + other.xipErr(newLwb, newUpb);
67 int newN = n() + other.n();
68 return new ShapeErrorData(newXi, newXip, newXiErr, newXipErr, newN);
69}
int commonLwb(const IndexRange &other) const
Definition IndexRange.h:39
int commonUpb(const IndexRange &other) const
Definition IndexRange.h:40
bool checkRange(int &l, int &h) const
const TVectorD & xi() const
const TVectorD & xip() const
const CovMatrix & xipErr() const
ShapeErrorData * add(const ShapeErrorData &other) const
const CovMatrix & xiErr() const
ShapeErrorData(const TVectorD &xi=TVectorD(), const TVectorD &xip=TVectorD(), const CovMatrix &xiErr=CovMatrix(), const CovMatrix &xipErr=CovMatrix(), double tbar=Definitions::none, int n=-1)
Constructor.