yoda is hosted by Hepforge, IPPP Durham
YODA - Yet more Objects for Data Analysis  1.9.0
Point.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // This file is part of YODA -- Yet more Objects for Data Analysis
4 // Copyright (C) 2008-2021 The YODA collaboration (see AUTHORS for details)
5 //
6 #ifndef YODA_POINT_H
7 #define YODA_POINT_H
8 
9 #include "YODA/AnalysisObject.h"
10 #include "YODA/Scatter.h"
11 
12 namespace YODA {
13 
14 
16  class Point {
17  public:
18 
19  typedef std::pair<double,double> ValuePair;
20 
21 
23  virtual ~Point() {};
24 
25 
28 
30  virtual size_t dim() = 0;
31 
33  virtual double val(size_t i) const = 0;
35  virtual void setVal(size_t i, double val) = 0;
36 
38 
39 
42 
44  virtual const std::pair<double,double>& errs(size_t i, std::string source="") const = 0;
46  virtual void setErr(size_t i, double e, std::string source="") = 0;
48  virtual void setErrs(size_t i, double e, std::string source="") { return setErr(i,e, source); }
50  virtual void setErrs(size_t i, double eminus, double eplus, std::string source="") = 0;
52  virtual void setErrs(size_t i, std::pair<double,double>& e, std::string source="") = 0;
53 
55  virtual double errMinus(size_t i, std::string source="") const = 0;
57  virtual void setErrMinus(size_t i, double eminus, std::string source="") = 0;
58 
60  virtual double errPlus(size_t i, std::string source="") const = 0;
62  virtual void setErrPlus(size_t i, double eplus, std::string source="") = 0;
63 
65  virtual double errAvg(size_t i, std::string source="") const = 0;
66 
67  // /// Get value minus negative error for direction @a i
68  // double min(size_t i) const = 0;
69  // /// Get value plus positive error for direction @a i
70  // double max(size_t i) const = 0;
71 
73 
74 
80 
82  virtual const std::map< std::string, std::pair<double,double>> & errMap() const =0;
83 
85  virtual void getVariationsFromParent() const = 0;
86 
88 
89 
92 
94  virtual void set(size_t i, double val, double e, std::string source="") = 0;
96  virtual void set(size_t i, double val, double eminus, double eplus, std::string source="") = 0;
98  virtual void set(size_t i, double val, std::pair<double,double>& e, std::string source="") = 0;
99 
101 
102 
105 
106  // /// Scaling of direction @a i
107  virtual void scale(size_t i, double scale) = 0;
108 
110 
112 
113 
114  void setParent(Scatter* parent){
115  _parent = parent;
116  }
117 
118  template <typename T=Scatter>
119  T* getParent() const{
120  return dynamic_cast<T*>(_parent);
121  }
122 
123 
124  private:
125 
127  Scatter* _parent = nullptr;
128 
129  };
130 
131 
132 }
133 
134 #endif
virtual const std::map< std::string, std::pair< double, double > > & errMap() const =0
Get the error map for the highest dimension.
Base class for all Point*Ds, providing generic access to their numerical properties.
Definition: Point.h:16
virtual void setErrPlus(size_t i, double eplus, std::string source="")=0
Set positive error for direction i.
virtual double errPlus(size_t i, std::string source="") const =0
Get positive error value for direction i.
virtual ~Point()
Virtual destructor for inheritance.
Definition: Point.h:23
Errors & errs()
Get error values.
Definition: PointND.h:116
virtual size_t dim()=0
Space dimension of the point.
void setParent(Scatter *parent)
Definition: Point.h:114
virtual double errAvg(size_t i, std::string source="") const =0
Get average error value for direction i.
virtual void setErr(size_t i, double e, std::string source="")=0
Set symmetric error for direction i.
virtual void setErrs(size_t i, double e, std::string source="")
Set symmetric error for direction i (alias)
Definition: Point.h:48
T * getParent() const
Definition: Point.h:119
virtual void scale(size_t i, double scale)=0
virtual void setErrMinus(size_t i, double eminus, std::string source="")=0
Set negative error for direction i.
virtual double errMinus(size_t i, std::string source="") const =0
Get negative error value for direction i.
virtual double val(size_t i) const =0
Get the point value for direction i.
virtual void setVal(size_t i, double val)=0
Set the point value for direction i.
A base class for common operations on scatter types (Scatter1D, etc.)
Definition: Scatter.h:15
std::pair< double, double > ValuePair
Definition: Point.h:19
virtual void getVariationsFromParent() const =0
Parse the variations annotation on the parent scatter.