ATLAS Offline Software
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>
8 using std::cout;
9 using std::endl;
10 
11 using namespace LArSamples;
12 
13 
14 const 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 
25 const 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 
36 const 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 
47 const 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 }
LArSamples::ShapeErrorData::add
ShapeErrorData * add(const ShapeErrorData &other) const
Definition: ShapeErrorData.cxx:58
LArSamples::CovMatrix
TMatrixTSym< double > CovMatrix
Definition: LArCalorimeter/LArCafJobs/LArCafJobs/Definitions.h:11
LArSamples::IndexRange::checkRange
bool checkRange(int &l, int &h) const
Definition: IndexRange.cxx:14
LArSamples
Definition: AbsShape.h:24
LArSamples::IndexRange::commonUpb
int commonUpb(const IndexRange &other) const
Definition: IndexRange.h:40
LArSamples::ShapeErrorData::xip
const TVectorD & xip() const
Definition: ShapeErrorData.h:41
LArSamples::ShapeErrorData::m_xipErr
CovMatrix m_xipErr
Definition: ShapeErrorData.h:64
LArSamples::ShapeErrorData::xipErr
const CovMatrix & xipErr() const
Definition: ShapeErrorData.h:43
LArSamples::ShapeErrorData::m_xi
TVectorD m_xi
Definition: ShapeErrorData.h:63
LArSamples::ShapeErrorData::xiErr
const CovMatrix & xiErr() const
Definition: ShapeErrorData.h:42
LArSamples::IndexRange::commonLwb
int commonLwb(const IndexRange &other) const
Definition: IndexRange.h:39
LArSamples::ShapeErrorData::n
int n() const
Definition: ShapeErrorData.h:54
LArSamples::ShapeErrorData::m_xip
TVectorD m_xip
Definition: ShapeErrorData.h:63
LArSamples::ShapeErrorData::ShapeErrorData
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
Definition: ShapeErrorData.h:24
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
LArSamples::ShapeErrorData::m_xiErr
CovMatrix m_xiErr
Definition: ShapeErrorData.h:64
DeMoScan.first
bool first
Definition: DeMoScan.py:536
ShapeErrorData.h
LArSamples::ShapeErrorData
Definition: ShapeErrorData.h:19
LArSamples::ShapeErrorData::xi
const TVectorD & xi() const
Definition: ShapeErrorData.h:40