thepeg is hosted by Hepforge, IPPP Durham
ThePEG  2.2.1
DataPoint.h
1 // -*- C++ -*-
2 //
3 // DataPoint.h is a part of ThePEG - Toolkit for HEP Event Generation
4 // Copyright (C) 1999-2019 Leif Lonnblad
5 //
6 // ThePEG is licenced under version 3 of the GPL, see COPYING for details.
7 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
8 //
9 #ifndef LWH_DataPoint_H
10 #define LWH_DataPoint_H
11 //
12 // This is the declaration of the DataPoint class representing
13 //
14 
15 
16 #include <limits>
17 #include <cmath>
18 #include <algorithm>
19 #include "AIDataPoint.h"
20 #include "Measurement.h"
21 
22 namespace LWH {
23 
24 using namespace AIDA;
25 
31 class DataPoint: public IDataPoint {
32 
33 public:
34 
38  DataPoint(int dim = 2)
39  : m(dim) {}
40 
44  DataPoint(const DataPoint & d)
45  : IDataPoint(d), m(d.m) {}
46 
50  DataPoint(const IDataPoint & id)
51  : m(id.dimension()) {
52  for ( int i = 0, N = m.size(); i < N; ++i )
53  m[i] = Measurement(id.coordinate(i)->value(),
54  id.coordinate(i)->errorPlus(),
55  id.coordinate(i)->errorMinus());
56  }
57 
61  DataPoint & operator=(const DataPoint &) = default;
62 
66  virtual ~DataPoint() {}
67 
73  int dimension() const {
74  return m.size();
75  }
76 
82  IMeasurement * coordinate(int coord) {
83  return &(m[coord]);
84  }
85 
91  const IMeasurement * coordinate(int coord) const {
92  return &(m[coord]);
93  }
94 
95  private:
96 
100  std::vector<Measurement> m;
101 
102 };
103 
104 }
105 
106 #endif /* LWH_DataPoint_H */
Basic user-level interface class for holding a single "measurement" with positive and negative errors...
Definition: Measurement.h:30
std::vector< Measurement > m
The included measurements.
Definition: DataPoint.h:100
IMeasurement * coordinate(int coord)
Get the IMeasurement for a given coordinate.
Definition: DataPoint.h:82
DataPoint(int dim=2)
Construct a data point with a given number of dimensions.
Definition: DataPoint.h:38
virtual ~DataPoint()
Destructor.
Definition: DataPoint.h:66
const IMeasurement * coordinate(int coord) const
Get the IMeasurement for a given coordinate.
Definition: DataPoint.h:91
int dimension() const
Get the dimension of the IDataPoint, i.e.
Definition: DataPoint.h:73
DataPoint(const DataPoint &d)
Copy constructor.
Definition: DataPoint.h:44
The LWH namespace contains a Light-Weight Histogram package which implements the most rudimentary his...
An DataPoint represents a binned histogram axis.
Definition: DataPoint.h:31
DataPoint(const IDataPoint &id)
Copy from any IDataPoint.
Definition: DataPoint.h:50