yoda is hosted by Hepforge, IPPP Durham
YODA - Yet more Objects for Data Analysis  1.9.0
YODA::Scatter3D Class Reference

A very generic data type which is just a collection of 3D data points with errors. More...

#include <Scatter3D.h>

Inheritance diagram for YODA::Scatter3D:
YODA::AnalysisObject YODA::Scatter< N > YODA::AnalysisObject

Public Types

typedef Point3D Point
 Types of the native Point3D collection. More...
 
typedef Utils::sortedvector< Point3DPoints
 
typedef std::shared_ptr< Scatter3DPtr
 
- Public Types inherited from YODA::AnalysisObject
typedef std::map< std::string, std::string > Annotations
 Collection type for annotations, as a string-string map. More...
 
- Public Types inherited from YODA::Scatter< N >
typedef Utils::ndarray< double, N > NdVal
 
typedef Utils::ndarray< std::pair< double, double >, N > NdValPair
 
typedef Utils::sortedvector< Point< N > > Points
 
typedef std::shared_ptr< ScatterPtr
 

Public Member Functions

size_t dim () const
 Dimension of this data object. More...
 
void parseVariations ()
 
std::vector< std::string > variations () const
 Get the list of variations stored in the points. More...
 
void combineWith (const Scatter3D &other)
 
void combineWith (const std::vector< Scatter3D > &others)
 
bool operator== (const Scatter3D &other)
 Equality operator. More...
 
bool operator!= (const Scatter3D &other)
 Non-equality operator. More...
 
Constructors
 Scatter3D (const std::string &path="", const std::string &title="")
 Empty constructor. More...
 
 Scatter3D (const Points &points, const std::string &path="", const std::string &title="")
 Constructor from a set of points. More...
 
 Scatter3D (const std::vector< double > &x, const std::vector< double > &y, const std::vector< double > &z, const std::string &path="", const std::string &title="")
 Constructor from vectors of values with no errors. More...
 
 Scatter3D (const std::vector< double > &x, const std::vector< double > &y, const std::vector< double > &z, const std::vector< std::pair< double, double > > &ex, const std::vector< std::pair< double, double > > &ey, const std::vector< std::pair< double, double > > &ez, const std::string &path="", const std::string &title="")
 Constructor from vectors of values with asymmetric errors on both x and y. More...
 
 Scatter3D (const std::vector< double > &x, const std::vector< double > &y, const std::vector< double > z, const std::vector< double > &exminus, const std::vector< double > &explus, const std::vector< double > &eyminus, const std::vector< double > &eyplus, const std::vector< double > &ezminus, const std::vector< double > &ezplus, const std::string &path="", const std::string &title="")
 Constructor from vectors of values with completely explicit asymmetric errors. More...
 
 Scatter3D (const Scatter3D &s3, const std::string &path="")
 
Scatter3Doperator= (const Scatter3D &s3)
 Assignment operator. More...
 
Scatter3D clone () const
 Make a copy on the stack. More...
 
Scatter3Dnewclone () const
 Make a copy on the heap, via 'new'. More...
 
Modifiers
void reset ()
 Clear all points. More...
 
void scaleX (double scalex)
 Scaling of x axis. More...
 
void scaleY (double scaley)
 Scaling of y axis. More...
 
void scaleZ (double scalez)
 Scaling of z axis. More...
 
void scaleXYZ (double scalex, double scaley, double scalez)
 Scaling of all three axes. More...
 
void scale (size_t i, double scale)
 Scaling along direction i. More...
 
Point accessors
size_t numPoints () const
 Number of points in the scatter. More...
 
Pointspoints ()
 Get the collection of points (non-const) More...
 
const Pointspoints () const
 Get the collection of points (const) More...
 
Point3Dpoint (size_t index)
 Get a reference to the point with index index. More...
 
const Point3Dpoint (size_t index) const
 Get the point with index index (const version) More...
 
Point inserters
void addPoint (const Point3D &pt)
 Insert a new point. More...
 
void addPoint (double x, double y, double z)
 Insert a new point, defined as the x/y/z value triplet and no errors. More...
 
void addPoint (double x, double y, double z, double ex, double ey, double ez)
 Insert a new point, defined as the x/y/z value triplet and symmetric errors. More...
 
void addPoint (double x, double y, double z, const std::pair< double, double > &ex, const std::pair< double, double > &ey, const std::pair< double, double > &ez)
 Insert a new point, defined as the x/y/z value triplet and asymmetric error pairs. More...
 
void addPoint (double x, double y, double z, double exminus, double explus, double eyminus, double eyplus, double ezminus, double ezplus)
 Insert a new point, defined as the x/y/z value triplet and asymmetric errors. More...
 
void addPoints (const Points &pts)
 Insert a collection of new points. More...
 
Point removers
void rmPoint (size_t index)
 Remove the point with index index. More...
 
- Public Member Functions inherited from YODA::AnalysisObject
 AnalysisObject ()
 Default constructor. More...
 
 AnalysisObject (const std::string &type, const std::string &path, const std::string &title="")
 Constructor giving a type, a path and an optional title. More...
 
 AnalysisObject (const std::string &type, const std::string &path, const AnalysisObject &ao, const std::string &title="")
 Constructor giving a type, a path, another AO to copy annotation from, and an optional title. More...
 
virtual ~AnalysisObject ()
 Default destructor. More...
 
virtual AnalysisObjectoperator= (const AnalysisObject &ao)
 Default copy assignment operator. More...
 
void parseVariations ()
 
std::vector< std::string > annotations () const
 
bool hasAnnotation (const std::string &name) const
 Check if an annotation is defined. More...
 
const std::string & annotation (const std::string &name) const
 Get an annotation by name (as a string) More...
 
const std::string & annotation (const std::string &name, const std::string &defaultreturn) const
 Get an annotation by name (as a string) with a default in case the annotation is not found. More...
 
template<typename T >
const T annotation (const std::string &name) const
 Get an annotation by name (copied to another type) More...
 
template<typename T >
const T annotation (const std::string &name, const T &defaultreturn) const
 Get an annotation by name (copied to another type) with a default in case the annotation is not found. More...
 
void setAnnotation (const std::string &name, const std::string &value)
 Add or set a string-valued annotation by name. More...
 
void setAnnotation (const std::string &name, double value)
 Add or set a double-valued annotation by name. More...
 
void setAnnotation (const std::string &name, float value)
 Add or set a float-valued annotation by name. More...
 
void setAnnotation (const std::string &name, long double value)
 Add or set a long-double-valued annotation by name. More...
 
template<typename T >
void setAnnotation (const std::string &name, const T &value)
 Add or set an annotation by name (templated for remaining types) More...
 
void setAnnotations (const Annotations &anns)
 Set all annotations at once. More...
 
template<typename T >
void addAnnotation (const std::string &name, const T &value)
 Add or set an annotation by name. More...
 
void rmAnnotation (const std::string &name)
 Delete an annotation by name. More...
 
void clearAnnotations ()
 Delete an annotation by name. More...
 
const std::string title () const
 Get the AO title. More...
 
void setTitle (const std::string &title)
 Set the AO title. More...
 
const std::string path () const
 Get the AO path. More...
 
void setPath (const std::string &path)
 
const std::string name () const
 
virtual std::string type () const
 Get name of the analysis object type. More...
 
- Public Member Functions inherited from YODA::Scatter< N >
virtual ~Scatter ()
 Virtual destructor for inheritance. More...
 
void reset ()
 Clear all points. More...
 
void scale (const NdVal &scales)
 Scaling. More...
 
virtual void rmPoints (std::vector< size_t > indices)
 Safely remove the points with indices indices. More...
 
 Scatter (const std::string &path="", const std::string &title="")
 Empty constructor. More...
 
 Scatter (const Points &points, const std::string &path="", const std::string &title="")
 Constructor from a set of points. More...
 
 Scatter (const std::vector< NdVal > &positions, const std::string &path="", const std::string &title="")
 Constructor from a vector of position values with no errors. More...
 
 Scatter (const std::vector< NdVal > &positions, const std::vector< NdVal > &errors, const std::string &path="", const std::string &title="")
 Constructor from vectors of values for positions and a single set of symmetric errors. More...
 
 Scatter (const Scatter< N > &s, const std::string &path="")
 Copy constructor with optional new path. More...
 
Scatter< N > & operator= (const Scatter< N > &s)
 Assignment operator. More...
 
Scatter< N > clone () const
 Make a copy on the stack. More...
 
Scatter< N > * newclone () const
 Make a copy on the heap, via 'new'. More...
 
size_t numPoints () const
 Number of points in the scatter. More...
 
Pointspoints ()
 Get the collection of points. More...
 
const Pointspoints () const
 Get the collection of points (const version) More...
 
Point< N > & point (size_t index)
 Get a reference to the point with index index. More...
 
const Point< N > & point (size_t index) const
 Get the point with index index (const version) More...
 
Scatter< N > & addPoint (const Point< N > &pt)
 Insert a new point. More...
 
Scatter< N > & addPoint (const NdVal &pos)
 Insert a new point, from a position array. More...
 
Scatter< N > & addPoints (Points pts)
 Insert a collection of new points. More...
 
Scatter< N > & combineWith (const Scatter< N > &other)
 
Scatter< N > & combineWith (const std::vector< Scatter< N > > &others)
 

Detailed Description

A very generic data type which is just a collection of 3D data points with errors.

Definition at line 25 of file Scatter3D.h.

Member Typedef Documentation

◆ Point

Types of the native Point3D collection.

Definition at line 29 of file Scatter3D.h.

◆ Points

typedef Utils::sortedvector<Point3D> YODA::Scatter3D::Points

Definition at line 30 of file Scatter3D.h.

◆ Ptr

typedef std::shared_ptr<Scatter3D> YODA::Scatter3D::Ptr

Definition at line 31 of file Scatter3D.h.

Constructor & Destructor Documentation

◆ Scatter3D() [1/6]

YODA::Scatter3D::Scatter3D ( const std::string &  path = "",
const std::string &  title = "" 
)
inline

Empty constructor.

Definition at line 38 of file Scatter3D.h.

Referenced by clone(), YODA::mkScatter(), and newclone().

39  : AnalysisObject("Scatter3D", path, title)
40  { }
AnalysisObject()
Default constructor.
const std::string path() const
Get the AO path.
const std::string title() const
Get the AO title.

◆ Scatter3D() [2/6]

YODA::Scatter3D::Scatter3D ( const Points points,
const std::string &  path = "",
const std::string &  title = "" 
)
inline

Constructor from a set of points.

Definition at line 44 of file Scatter3D.h.

46  : AnalysisObject("Scatter3D", path, title),
47  _points(points)
48  {
49  std::sort(_points.begin(), _points.end());
50  }
AnalysisObject()
Default constructor.
const std::string path() const
Get the AO path.
const std::string title() const
Get the AO title.
Points & points()
Get the collection of points (non-const)
Definition: Scatter3D.h:209

◆ Scatter3D() [3/6]

YODA::Scatter3D::Scatter3D ( const std::vector< double > &  x,
const std::vector< double > &  y,
const std::vector< double > &  z,
const std::string &  path = "",
const std::string &  title = "" 
)
inline

Constructor from vectors of values with no errors.

Definition at line 54 of file Scatter3D.h.

References addPoint().

59  : AnalysisObject("Scatter3D", path, title)
60  {
61  if (x.size() != y.size() || y.size() != z.size()) {
62  throw RangeError("There are different numbers of x, y, and z values in the provided vectors.");
63  }
64  const std::pair<double,double> nullerr = std::make_pair(0.0, 0.0);
65  for (size_t i = 0; i < x.size(); ++i) {
66  addPoint(Point3D(x[i], y[i], z[i], nullerr, nullerr, nullerr));
67  }
68  std::sort(_points.begin(), _points.end());
69  }
AnalysisObject()
Default constructor.
const std::string path() const
Get the AO path.
const std::string title() const
Get the AO title.
void addPoint(const Point3D &pt)
Insert a new point.
Definition: Scatter3D.h:240

◆ Scatter3D() [4/6]

YODA::Scatter3D::Scatter3D ( const std::vector< double > &  x,
const std::vector< double > &  y,
const std::vector< double > &  z,
const std::vector< std::pair< double, double > > &  ex,
const std::vector< std::pair< double, double > > &  ey,
const std::vector< std::pair< double, double > > &  ez,
const std::string &  path = "",
const std::string &  title = "" 
)
inline

Constructor from vectors of values with asymmetric errors on both x and y.

Definition at line 73 of file Scatter3D.h.

References addPoint().

76  : AnalysisObject("Scatter3D", path, title)
77  {
78  if (x.size() != y.size() || y.size() != z.size()) {
79  throw RangeError("There are different numbers of x, y, and z values in the provided vectors.");
80  }
81  if (x.size() != ex.size() || y.size() != ey.size() || z.size() != ez.size()) {
82  throw RangeError("The sizes of the provided error vectors don't match the corresponding x, y, or z value vectors.");
83  }
84  for (size_t i = 0; i < x.size(); ++i) {
85  addPoint(Point3D(x[i], y[i], z[i], ex[i], ey[i], ez[i]));
86  }
87  std::sort(_points.begin(), _points.end());
88  }
AnalysisObject()
Default constructor.
const std::string path() const
Get the AO path.
const std::string title() const
Get the AO title.
void addPoint(const Point3D &pt)
Insert a new point.
Definition: Scatter3D.h:240

◆ Scatter3D() [5/6]

YODA::Scatter3D::Scatter3D ( const std::vector< double > &  x,
const std::vector< double > &  y,
const std::vector< double >  z,
const std::vector< double > &  exminus,
const std::vector< double > &  explus,
const std::vector< double > &  eyminus,
const std::vector< double > &  eyplus,
const std::vector< double > &  ezminus,
const std::vector< double > &  ezplus,
const std::string &  path = "",
const std::string &  title = "" 
)
inline

Constructor from vectors of values with completely explicit asymmetric errors.

Definition at line 92 of file Scatter3D.h.

References addPoint().

100  : AnalysisObject("Scatter3D", path, title)
101  {
102  if(x.size() != y.size() || y.size() != z.size() ||
103  x.size() != exminus.size() || x.size() != explus.size() ||
104  y.size() != eyminus.size() || y.size() != eyplus.size() ||
105  z.size() != ezminus.size() || z.size() != ezplus.size())
106  throw RangeError("There are either different amounts of points on x/y/z vectors or not every of these vectors has properly defined error vectors!");
107 
108  for (size_t i = 0; i < x.size(); ++i) {
109  addPoint(Point3D(x[i], y[i], z[i], exminus[i], explus[i], eyminus[i], eyplus[i], ezminus[i], ezplus[i]));
110  }
111 
112  std::sort(_points.begin(), _points.end());
113  }
AnalysisObject()
Default constructor.
const std::string path() const
Get the AO path.
const std::string title() const
Get the AO title.
void addPoint(const Point3D &pt)
Insert a new point.
Definition: Scatter3D.h:240

◆ Scatter3D() [6/6]

YODA::Scatter3D::Scatter3D ( const Scatter3D s3,
const std::string &  path = "" 
)
inline

Copy constructor with optional new path

Todo:
Also allow title setting from the constructor?

Definition at line 118 of file Scatter3D.h.

References YODA::AnalysisObject::annotation(), YODA::AnalysisObject::annotations(), and YODA::AnalysisObject::setAnnotation().

119  : AnalysisObject("Scatter3D", (path.size() == 0) ? s3.path() : path, s3, s3.title()),
120  _points(s3._points)
121  {
122  for ( auto &ann : annotations()){
123  setAnnotation(ann, annotation(ann));
124  }
125  }
AnalysisObject()
Default constructor.
const std::string path() const
Get the AO path.
const std::string & annotation(const std::string &name) const
Get an annotation by name (as a string)
void setAnnotation(const std::string &name, const std::string &value)
Add or set a string-valued annotation by name.
std::vector< std::string > annotations() const

Member Function Documentation

◆ addPoint() [1/5]

void YODA::Scatter3D::addPoint ( const Point3D pt)
inline

Insert a new point.

Definition at line 240 of file Scatter3D.h.

Referenced by addPoints(), YODA::divide(), YODA::mkScatter(), Scatter3D(), and YODA::toScatter3D().

240  {
241  _points.insert(pt);
242  }

◆ addPoint() [2/5]

void YODA::Scatter3D::addPoint ( double  x,
double  y,
double  z 
)
inline

Insert a new point, defined as the x/y/z value triplet and no errors.

Definition at line 245 of file Scatter3D.h.

References YODA::Point< N >::setParent().

245  {
246  Point3D thisPoint = Point3D(x, y, z);
247  thisPoint.setParent(this);
248  _points.insert(thisPoint);
249  }

◆ addPoint() [3/5]

void YODA::Scatter3D::addPoint ( double  x,
double  y,
double  z,
double  ex,
double  ey,
double  ez 
)
inline

Insert a new point, defined as the x/y/z value triplet and symmetric errors.

Definition at line 252 of file Scatter3D.h.

References YODA::Point< N >::setParent().

253  {
254  Point3D thisPoint = Point3D(x, y, z, ex, ey, ez);
255  thisPoint.setParent(this);
256  _points.insert(thisPoint);
257  }

◆ addPoint() [4/5]

void YODA::Scatter3D::addPoint ( double  x,
double  y,
double  z,
const std::pair< double, double > &  ex,
const std::pair< double, double > &  ey,
const std::pair< double, double > &  ez 
)
inline

Insert a new point, defined as the x/y/z value triplet and asymmetric error pairs.

Definition at line 260 of file Scatter3D.h.

References YODA::Point< N >::setParent().

261  {
262  Point3D thisPoint = Point3D(x, y, z, ex, ey, ez);
263  thisPoint.setParent(this);
264  _points.insert(thisPoint);
265  }

◆ addPoint() [5/5]

void YODA::Scatter3D::addPoint ( double  x,
double  y,
double  z,
double  exminus,
double  explus,
double  eyminus,
double  eyplus,
double  ezminus,
double  ezplus 
)
inline

Insert a new point, defined as the x/y/z value triplet and asymmetric errors.

Definition at line 268 of file Scatter3D.h.

References YODA::Point< N >::setParent().

271  {
272  Point3D thisPoint = Point3D(x, y, z, exminus, explus, eyminus, eyplus, ezminus, ezplus);
273  thisPoint.setParent(this);
274  _points.insert(thisPoint);
275  }

◆ addPoints()

void YODA::Scatter3D::addPoints ( const Points pts)
inline

Insert a collection of new points.

Definition at line 278 of file Scatter3D.h.

References addPoint().

Referenced by combineWith().

278  {
279  for (const Point3D& pt : pts) addPoint(pt);
280  }
void addPoint(const Point3D &pt)
Insert a new point.
Definition: Scatter3D.h:240

◆ clone()

Scatter3D YODA::Scatter3D::clone ( ) const
inline

Make a copy on the stack.

Definition at line 135 of file Scatter3D.h.

References Scatter3D().

135  {
136  return Scatter3D(*this);
137  }
Scatter3D(const std::string &path="", const std::string &title="")
Empty constructor.
Definition: Scatter3D.h:38

◆ combineWith() [1/2]

void YODA::Scatter3D::combineWith ( const Scatter3D other)
inline
Todo:
Better name?

Definition at line 304 of file Scatter3D.h.

References addPoints(), and points().

Referenced by YODA::combine(), and combineWith().

304  {
305  addPoints(other.points());
306  //return *this;
307  }
void addPoints(const Points &pts)
Insert a collection of new points.
Definition: Scatter3D.h:278

◆ combineWith() [2/2]

void YODA::Scatter3D::combineWith ( const std::vector< Scatter3D > &  others)
inline
Todo:

Better name?

Convert to accept a Range or generic

Definition at line 312 of file Scatter3D.h.

References combineWith().

312  {
313  for (const Scatter3D& s : others) combineWith(s);
314  }
void combineWith(const Scatter3D &other)
Definition: Scatter3D.h:304
Scatter3D(const std::string &path="", const std::string &title="")
Empty constructor.
Definition: Scatter3D.h:38

◆ dim()

size_t YODA::Scatter3D::dim ( ) const
inlinevirtual

Dimension of this data object.

Implements YODA::AnalysisObject.

Definition at line 148 of file Scatter3D.h.

148 { return 3; }

◆ newclone()

Scatter3D* YODA::Scatter3D::newclone ( ) const
inlinevirtual

Make a copy on the heap, via 'new'.

Implements YODA::AnalysisObject.

Definition at line 140 of file Scatter3D.h.

References Scatter3D().

Referenced by YODA::toNewScatter3D().

140  {
141  return new Scatter3D(*this);
142  }
Scatter3D(const std::string &path="", const std::string &title="")
Empty constructor.
Definition: Scatter3D.h:38

◆ numPoints()

size_t YODA::Scatter3D::numPoints ( ) const
inlinevirtual

Number of points in the scatter.

Implements YODA::Scatter< N >.

Definition at line 203 of file Scatter3D.h.

Referenced by YODA::divide(), YODA::mkScatter(), parseVariations(), point(), YODA::transformX(), YODA::transformY(), and YODA::transformZ().

203  {
204  return _points.size();
205  }

◆ operator!=()

bool YODA::Scatter3D::operator!= ( const Scatter3D other)
inline

Non-equality operator.

Definition at line 323 of file Scatter3D.h.

References operator==().

323  {
324  return ! operator == (other);
325  }
bool operator==(const Scatter3D &other)
Equality operator.
Definition: Scatter3D.h:318

◆ operator=()

Scatter3D& YODA::Scatter3D::operator= ( const Scatter3D s3)
inline

Assignment operator.

Definition at line 128 of file Scatter3D.h.

References YODA::AnalysisObject::operator=().

128  {
129  AnalysisObject::operator = (s3); //< AO treatment of paths etc.
130  _points = s3._points;
131  return *this;
132  }
virtual AnalysisObject & operator=(const AnalysisObject &ao)
Default copy assignment operator.

◆ operator==()

bool YODA::Scatter3D::operator== ( const Scatter3D other)
inline

Equality operator.

Definition at line 318 of file Scatter3D.h.

Referenced by operator!=().

318  {
319  return _points == other._points;
320  }

◆ parseVariations()

void YODA::Scatter3D::parseVariations ( )

Definition at line 123 of file Scatter3D.cc.

References YODA::AnalysisObject::annotation(), YODA::AnalysisObject::hasAnnotation(), numPoints(), YODA::Point3D::setZErrs(), and variations().

Referenced by scale().

123  {
124  if (this->_variationsParsed) { return; }
125  if (!(this->hasAnnotation("ErrorBreakdown"))) { return; }
126  YAML::Node errorBreakdown;
127  errorBreakdown = YAML::Load(this->annotation("ErrorBreakdown"));
128  if (errorBreakdown.size()) {
129  for (size_t thisPointIndex = 0; thisPointIndex < this->numPoints(); ++thisPointIndex) {
130  Point3D& thispoint = this->_points[thisPointIndex];
131  YAML::Node variations = errorBreakdown[thisPointIndex];
132  for (const auto& variation : variations) {
133  const std::string variationName = variation.first.as<std::string>();
134  double eyp = variation.second["up"].as<double>();
135  double eym = variation.second["dn"].as<double>();
136  thispoint.setZErrs(eym,eyp,variationName);
137  }
138  }
139  this->_variationsParsed = true;
140  }
141  }
size_t numPoints() const
Number of points in the scatter.
Definition: Scatter3D.h:203
std::vector< std::string > variations() const
Get the list of variations stored in the points.
Definition: Scatter3D.cc:145
const std::string & annotation(const std::string &name) const
Get an annotation by name (as a string)
bool hasAnnotation(const std::string &name) const
Check if an annotation is defined.

◆ point() [1/2]

Point3D& YODA::Scatter3D::point ( size_t  index)
inline

Get a reference to the point with index index.

Definition at line 221 of file Scatter3D.h.

References numPoints().

Referenced by YODA::efficiency(), YODA::transformX(), YODA::transformY(), YODA::transformZ(), and variations().

221  {
222  if (index >= numPoints()) throw RangeError("There is no point with this index");
223  return _points.at(index);
224  }
size_t numPoints() const
Number of points in the scatter.
Definition: Scatter3D.h:203

◆ point() [2/2]

const Point3D& YODA::Scatter3D::point ( size_t  index) const
inline

Get the point with index index (const version)

Definition at line 228 of file Scatter3D.h.

References numPoints().

228  {
229  if (index >= numPoints()) throw RangeError("There is no point with such index!");
230  return _points.at(index);
231  }
size_t numPoints() const
Number of points in the scatter.
Definition: Scatter3D.h:203

◆ points() [1/2]

Points& YODA::Scatter3D::points ( )
inline

Get the collection of points (non-const)

Definition at line 209 of file Scatter3D.h.

Referenced by combineWith(), YODA::Histo2D::Histo2D(), YODA::Profile2D::Profile2D(), and YODA::WriterFLAT::writeScatter3D().

209  {
210  return _points;
211  }

◆ points() [2/2]

const Points& YODA::Scatter3D::points ( ) const
inline

Get the collection of points (const)

Definition at line 215 of file Scatter3D.h.

215  {
216  return _points;
217  }

◆ reset()

void YODA::Scatter3D::reset ( )
inlinevirtual

Clear all points.

Implements YODA::AnalysisObject.

Definition at line 155 of file Scatter3D.h.

155  {
156  _points.clear();
157  }

◆ rmPoint()

void YODA::Scatter3D::rmPoint ( size_t  index)
inlinevirtual

Remove the point with index index.

Implements YODA::Scatter< N >.

Definition at line 289 of file Scatter3D.h.

289  {
290  _points.erase(_points.begin()+index);
291  }

◆ scale()

void YODA::Scatter3D::scale ( size_t  i,
double  scale 
)
inlinevirtual

Scaling along direction i.

Implements YODA::Scatter< N >.

Definition at line 180 of file Scatter3D.h.

References parseVariations(), scaleX(), scaleY(), scaleZ(), and variations().

180  {
181  switch (i) {
182  case 1: scaleX(scale); break;
183  case 2: scaleY(scale); break;
184  case 3: scaleZ(scale); break;
185  default: throw RangeError("Invalid axis int, must be in range 1..dim");
186  }
187  }
void scaleY(double scaley)
Scaling of y axis.
Definition: Scatter3D.h:165
void scaleX(double scalex)
Scaling of x axis.
Definition: Scatter3D.h:160
void scale(size_t i, double scale)
Scaling along direction i.
Definition: Scatter3D.h:180
void scaleZ(double scalez)
Scaling of z axis.
Definition: Scatter3D.h:170

◆ scaleX()

void YODA::Scatter3D::scaleX ( double  scalex)
inline

Scaling of x axis.

Definition at line 160 of file Scatter3D.h.

Referenced by scale().

160  {
161  for (Point3D& p : _points) p.scaleX(scalex);
162  }

◆ scaleXYZ()

void YODA::Scatter3D::scaleXYZ ( double  scalex,
double  scaley,
double  scalez 
)
inline

Scaling of all three axes.

Definition at line 175 of file Scatter3D.h.

175  {
176  for (Point3D& p : _points) p.scaleXYZ(scalex, scaley, scalez);
177  }

◆ scaleY()

void YODA::Scatter3D::scaleY ( double  scaley)
inline

Scaling of y axis.

Definition at line 165 of file Scatter3D.h.

Referenced by scale().

165  {
166  for (Point3D& p : _points) p.scaleY(scaley);
167  }

◆ scaleZ()

void YODA::Scatter3D::scaleZ ( double  scalez)
inline

Scaling of z axis.

Definition at line 170 of file Scatter3D.h.

Referenced by scale().

170  {
171  for (Point3D& p : _points) p.scaleZ(scalez);
172  }

◆ variations()

std::vector< std::string > YODA::Scatter3D::variations ( ) const
virtual

Get the list of variations stored in the points.

Todo:
Reduce duplication between Scatter types

Implements YODA::Scatter< N >.

Definition at line 145 of file Scatter3D.cc.

References YODA::Point3D::errMap(), and point().

Referenced by parseVariations(), and scale().

145  {
146  std::vector<std::string> vecvariations;
147  for (auto& point : this->_points) {
148  for (auto& it : point.errMap()) {
149  // if the variation is not already in the vector, add it!
150  if (std::find(vecvariations.begin(), vecvariations.end(), it.first) == vecvariations.end()) {
151  vecvariations.push_back(it.first);
152  }
153  }
154  }
155  return vecvariations;
156  }
Point3D & point(size_t index)
Get a reference to the point with index index.
Definition: Scatter3D.h:221
const std::map< std::string, std::pair< double, double > > & errMap() const
Get error map for direction i.
Definition: Point3D.h:478

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