ATLAS Offline Software
Loading...
Searching...
No Matches
LArSamples::ScaledErrorData Class Reference

#include <ScaledErrorData.h>

Inheritance diagram for LArSamples::ScaledErrorData:
Collaboration diagram for LArSamples::ScaledErrorData:

Public Member Functions

 ScaledErrorData (const ShapeErrorData &sed, double scale=1, double time=0)
 Constructor.
 ScaledErrorData (const ScaledErrorData &other)
virtual ~ScaledErrorData ()
double scale () const
double time () const
const TVectorD offsets (int first=-1, int last=-1) const
const CovMatrix errors (int first=-1, int last=-1) const
unsigned int nSamples () const
const TVectorD & xi () const
const TVectorD xi (int first, int last) const
const TVectorD & xip () const
const TVectorD xip (int first, int last) const
const CovMatrix & xiErr () const
const CovMatrix xiErr (int first, int last) const
const CovMatrix & xipErr () const
const CovMatrix xipErr (int first, int last) const
int lwb () const
int upb () const
double tbar () const
int n () const
std::unique_ptr< ShapeErrorData > add (const ShapeErrorData &other) const
ShapeErrorType shapeErrorType () const
void setShapeErrorType (ShapeErrorType type)
bool isInRange (int i) const
bool hasSameRange (int lw, int up) const
bool hasSameRange (const IndexRange &other) const
bool hasSameRange (const TVectorD &v) const
bool providesRange (int lw, int up) const
bool providesRange (const IndexRange &other) const
bool providesRange (const TVectorD &v) const
TString rangeStr () const
int commonLwb (const IndexRange &other) const
int commonUpb (const IndexRange &other) const
bool checkRange (int &l, int &h) const

Private Attributes

double m_scale
double m_time
TVectorD m_xi
TVectorD m_xip
CovMatrix m_xiErr
CovMatrix m_xipErr
double m_tbar {}
int m_n {}
ShapeErrorType m_shapeErrorType {CellShapeError}

Detailed Description

Definition at line 17 of file ScaledErrorData.h.

Constructor & Destructor Documentation

◆ ScaledErrorData() [1/2]

LArSamples::ScaledErrorData::ScaledErrorData ( const ShapeErrorData & sed,
double scale = 1,
double time = 0 )
inline

Constructor.

Definition at line 22 of file ScaledErrorData.h.

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.

◆ ScaledErrorData() [2/2]

LArSamples::ScaledErrorData::ScaledErrorData ( const ScaledErrorData & other)
inline

Definition at line 25 of file ScaledErrorData.h.

25 :
26 ShapeErrorData(other), m_scale(other.m_scale), m_time(other.m_time) { }

◆ ~ScaledErrorData()

virtual LArSamples::ScaledErrorData::~ScaledErrorData ( )
inlinevirtual

Definition at line 28 of file ScaledErrorData.h.

28{ }

Member Function Documentation

◆ add()

std::unique_ptr< ShapeErrorData > ShapeErrorData::add ( const ShapeErrorData & other) const
inherited

Definition at line 58 of file ShapeErrorData.cxx.

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 std::make_unique<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
const TVectorD & xi() const
const TVectorD & xip() const
const CovMatrix & xipErr() const
const CovMatrix & xiErr() const

◆ checkRange()

bool IndexRange::checkRange ( int & l,
int & h ) const
inherited

Definition at line 14 of file IndexRange.cxx.

15{
16 if (l < 0)
17 l = lwb();
18 else if (!isInRange(l)) {
19 cout << "IndexRange::checkRange : lower bound " << l << " is out of bounds" << endl;
20 return false;
21 }
22
23 if (h < 0)
24 h = upb();
25 else if (!isInRange(h)) {
26 cout << "IndexRange::checkRange : upper bound " << h << " is out of bounds" << endl;
27 return false;
28 }
29
30 return true;
31}
virtual int lwb() const =0
bool isInRange(int i) const
Definition IndexRange.h:27
virtual int upb() const =0
l
Printing final latex table to .tex output file.

◆ commonLwb()

int LArSamples::IndexRange::commonLwb ( const IndexRange & other) const
inlineinherited

Definition at line 39 of file IndexRange.h.

39{ return (other.lwb() > lwb() ? other.lwb() : lwb()); }

◆ commonUpb()

int LArSamples::IndexRange::commonUpb ( const IndexRange & other) const
inlineinherited

Definition at line 40 of file IndexRange.h.

40{ return (other.upb() < upb() ? other.upb() : upb()); }

◆ errors()

const CovMatrix ScaledErrorData::errors ( int first = -1,
int last = -1 ) const

Definition at line 31 of file ScaledErrorData.cxx.

32{
33 if (!checkRange(first, last)) {
34 cout << "ScaledErrorData::errors : range error" << endl;
35 return CovMatrix();
36 }
37
39 double t = time() - tbar() /*- Definitions::samplingTime(lwb())*/;
40 errors += t*t*xipErr();
41 errors *= scale()*scale();
42
43 return errors.GetSub(first, last, first, last, "I"); // "I" => indexed as [first, last]
44}
bool checkRange(int &l, int &h) const
const CovMatrix errors(int first=-1, int last=-1) const

◆ hasSameRange() [1/3]

bool LArSamples::IndexRange::hasSameRange ( const IndexRange & other) const
inlineinherited

Definition at line 30 of file IndexRange.h.

30{ return hasSameRange(other.lwb(), other.upb()); }
bool hasSameRange(int lw, int up) const
Definition IndexRange.h:29

◆ hasSameRange() [2/3]

bool LArSamples::IndexRange::hasSameRange ( const TVectorD & v) const
inlineinherited

Definition at line 31 of file IndexRange.h.

31{ return hasSameRange(v.GetLwb(), v.GetUpb()); }

◆ hasSameRange() [3/3]

bool LArSamples::IndexRange::hasSameRange ( int lw,
int up ) const
inlineinherited

Definition at line 29 of file IndexRange.h.

29{ return (lwb() == lw && upb() == up); }

◆ isInRange()

bool LArSamples::IndexRange::isInRange ( int i) const
inlineinherited

Definition at line 27 of file IndexRange.h.

27{ return (i >= lwb() && i <= upb()); }

◆ lwb()

int LArSamples::ShapeErrorData::lwb ( ) const
inlinevirtualinherited

Implements LArSamples::IndexRange.

Definition at line 45 of file ShapeErrorData.h.

45{ return m_xi.GetLwb(); }

◆ n()

int LArSamples::ShapeErrorData::n ( ) const
inlineinherited

Definition at line 54 of file ShapeErrorData.h.

◆ nSamples()

unsigned int LArSamples::ShapeErrorData::nSamples ( ) const
inlineinherited
Returns
size

Definition at line 38 of file ShapeErrorData.h.

38{ return m_xi.GetNrows(); }

◆ offsets()

const TVectorD ScaledErrorData::offsets ( int first = -1,
int last = -1 ) const

Definition at line 14 of file ScaledErrorData.cxx.

15{
16 if (!checkRange(first, last)) {
17 cout << "ScaledErrorData::offsets : range error" << endl;
18 return TVectorD();
19 }
20
21 TVectorD offsets = xi();
22
23 double t = time() - tbar() /*- Definitions::samplingTime(lwb())*/;
24 offsets -= t*xip();
25 offsets *= scale();
26
27 return offsets.GetSub(first, last, "I"); // "I" => indexed as [first, last]
28}
const TVectorD offsets(int first=-1, int last=-1) const

◆ providesRange() [1/3]

bool LArSamples::IndexRange::providesRange ( const IndexRange & other) const
inlineinherited

Definition at line 34 of file IndexRange.h.

34{ return providesRange(other.lwb(), other.upb()); }
bool providesRange(int lw, int up) const
Definition IndexRange.h:33

◆ providesRange() [2/3]

bool LArSamples::IndexRange::providesRange ( const TVectorD & v) const
inlineinherited

Definition at line 35 of file IndexRange.h.

35{ return providesRange(v.GetLwb(), v.GetUpb()); }

◆ providesRange() [3/3]

bool LArSamples::IndexRange::providesRange ( int lw,
int up ) const
inlineinherited

Definition at line 33 of file IndexRange.h.

33{ return (lwb() <= lw && upb() >= up); }

◆ rangeStr()

TString LArSamples::IndexRange::rangeStr ( ) const
inlineinherited

Definition at line 37 of file IndexRange.h.

37{ return Form("[%d, %d]", lwb(), upb()); }

◆ scale()

double LArSamples::ScaledErrorData::scale ( ) const
inline

Definition at line 30 of file ScaledErrorData.h.

30{ return m_scale; }

◆ setShapeErrorType()

void LArSamples::ShapeErrorData::setShapeErrorType ( ShapeErrorType type)
inlineinherited

◆ shapeErrorType()

ShapeErrorType LArSamples::ShapeErrorData::shapeErrorType ( ) const
inlineinherited

Definition at line 58 of file ShapeErrorData.h.

58{ return m_shapeErrorType; }

◆ tbar()

double LArSamples::ShapeErrorData::tbar ( ) const
inlineinherited

Definition at line 53 of file ShapeErrorData.h.

53{ return m_tbar; }

◆ time()

double LArSamples::ScaledErrorData::time ( ) const
inline

Definition at line 31 of file ScaledErrorData.h.

31{ return m_time; }

◆ upb()

int LArSamples::ShapeErrorData::upb ( ) const
inlinevirtualinherited

Implements LArSamples::IndexRange.

Definition at line 46 of file ShapeErrorData.h.

46{ return m_xi.GetUpb(); }

◆ xi() [1/2]

const TVectorD & LArSamples::ShapeErrorData::xi ( ) const
inlineinherited

Definition at line 40 of file ShapeErrorData.h.

40{ return m_xi; }

◆ xi() [2/2]

const TVectorD ShapeErrorData::xi ( int first,
int last ) const
inherited

Definition at line 14 of file ShapeErrorData.cxx.

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}

◆ xiErr() [1/2]

const CovMatrix & LArSamples::ShapeErrorData::xiErr ( ) const
inlineinherited

Definition at line 42 of file ShapeErrorData.h.

42{ return m_xiErr; }

◆ xiErr() [2/2]

const CovMatrix ShapeErrorData::xiErr ( int first,
int last ) const
inherited

Definition at line 36 of file ShapeErrorData.cxx.

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}

◆ xip() [1/2]

const TVectorD & LArSamples::ShapeErrorData::xip ( ) const
inlineinherited

Definition at line 41 of file ShapeErrorData.h.

41{ return m_xip; }

◆ xip() [2/2]

const TVectorD ShapeErrorData::xip ( int first,
int last ) const
inherited

Definition at line 25 of file ShapeErrorData.cxx.

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}

◆ xipErr() [1/2]

const CovMatrix & LArSamples::ShapeErrorData::xipErr ( ) const
inlineinherited

Definition at line 43 of file ShapeErrorData.h.

43{ return m_xipErr; }

◆ xipErr() [2/2]

const CovMatrix ShapeErrorData::xipErr ( int first,
int last ) const
inherited

Definition at line 47 of file ShapeErrorData.cxx.

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}

Member Data Documentation

◆ m_n

int LArSamples::ShapeErrorData::m_n {}
privateinherited

Definition at line 66 of file ShapeErrorData.h.

66{};

◆ m_scale

double LArSamples::ScaledErrorData::m_scale
private

Definition at line 38 of file ScaledErrorData.h.

◆ m_shapeErrorType

ShapeErrorType LArSamples::ShapeErrorData::m_shapeErrorType {CellShapeError}
privateinherited

◆ m_tbar

double LArSamples::ShapeErrorData::m_tbar {}
privateinherited

Definition at line 65 of file ShapeErrorData.h.

65{};

◆ m_time

double LArSamples::ScaledErrorData::m_time
private

Definition at line 38 of file ScaledErrorData.h.

◆ m_xi

TVectorD LArSamples::ShapeErrorData::m_xi
privateinherited

Definition at line 63 of file ShapeErrorData.h.

◆ m_xiErr

CovMatrix LArSamples::ShapeErrorData::m_xiErr
privateinherited

Definition at line 64 of file ShapeErrorData.h.

◆ m_xip

TVectorD LArSamples::ShapeErrorData::m_xip
privateinherited

Definition at line 63 of file ShapeErrorData.h.

◆ m_xipErr

CovMatrix LArSamples::ShapeErrorData::m_xipErr
privateinherited

Definition at line 64 of file ShapeErrorData.h.


The documentation for this class was generated from the following files: