SynAPSE  0.6.0
Synergistic Analysis of Phase Space Evolution
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
TDE.hh
1 #ifndef TDE_HH
2 #define TDE_HH
3 
4 // C++ includes
5 #include <iostream>
6 #include <ctime>
7 #include <cmath>
8 #include <vector>
9 #include <map>
10 
11 // Additional includes
12 #include "Voronoi.hh"
13 #include "Interpolator.hh"
14 #include "Assert.hh"
15 
22 class TDE {
23  public:
25  TDE();
26 
35  TDE(std::vector<std::vector<double>> points,
36  const bool interp=true,
37  const bool bounded=true,
38  const double alpha=0.,
39  const double eps=1e-6);
40 
42  TDE(const TDE& tde);
43 
45  TDE& operator=(const TDE& tde);
46 
51  double operator()(const std::vector<double>& v) const { return Evaluate(v); }
52 
57  double operator()(const double& v) const { return Evaluate(v); }
58 
63  double operator()(const double* v) const { return Evaluate(v); }
64 
66  ~TDE();
67 
72  double Evaluate(const std::vector<double>& v) const;
73 
78  double Evaluate(const double& v) const;
79 
84  double Evaluate(const double* v) const;
85 
87  void Initialize();
88 
90  const std::vector<std::vector<double>>& GetPointArray() const { return _vor.GetPointArray(); }
91 
93  const std::vector<double>& GetVertex(const size_t i) const { return _vor.GetPoint(i); }
94 
96  const std::vector<Hull>& GetCellArray() const { return _vor.GetCellArray(); }
97 
99  const Hull& GetCell(const size_t i) const { return _vor.GetCell(i); }
100 
102  const size_t& GetDimension() const { return _vor.GetDimension(); }
103 
105  const bool& IsBounded() const { return _vor.IsBounded(); }
106 
108  TPolyLine* BoundingBox() const { return _vor.BoundingBox(); }
109 
111  std::vector<TPolyLine*> Polygons() const { return _vor.Polygons(); }
112 
114  TH2Poly* DensityProfile() const { return _vor.DensityProfile(); }
115 
122  void Draw(std::string name="",
123  bool color=true,
124  bool points=false,
125  bool axes=false) const { _vor.Draw(name, color, points, axes); }
126 
128  std::vector<TPolyLine*> Meshing() const;
129 
130  private:
131 
134  std::vector<double> _weights;
135  bool _interp;
136 };
137 
138 #endif
Data stucture of a convex hull.
Definition: Hull.hh:25
const std::vector< double > & GetPoint(const size_t i) const
Returns a specific vertex.
Definition: Voronoi.hh:92
~TDE()
Destructor.
Definition: TDE.cc:53
bool _interp
Apply simplexial interpolation if true.
Definition: TDE.hh:135
const std::vector< Hull > & GetCellArray() const
Returns the array of cells corresponding to the array of vertice.
Definition: Voronoi.hh:95
TH2Poly * DensityProfile() const
Returns a histogram where each bin is a cell and its content is its density.
Definition: TDE.hh:114
const std::vector< double > & GetVertex(const size_t i) const
Returns a specific vertex.
Definition: TDE.hh:93
TPolyLine * BoundingBox() const
Returns a rectangle to be drawn in ROOT (only 2D)
Definition: TDE.hh:108
const bool & IsBounded() const
Returns true if box points have been added.
Definition: Voronoi.hh:104
double operator()(const std::vector< double > &v) const
Overloaded function operator, calls Evaluate.
Definition: TDE.hh:51
std::vector< TPolyLine * > Polygons() const
Returns an array of polygons to be drawn in ROOT (only 2D)
Definition: TDE.hh:111
const bool & IsBounded() const
Returns true if box points have been added.
Definition: TDE.hh:105
std::vector< double > _weights
Weights of each of the point, if repetition.
Definition: TDE.hh:134
const Hull & GetCell(const size_t i) const
Returns a specific cell.
Definition: Voronoi.hh:98
double Evaluate(const std::vector< double > &v) const
Performs the density estimation at an n-point v.
Definition: TDE.cc:76
std::vector< TPolyLine * > Polygons() const
Returns an array of polygons to be drawn in ROOT (only 2D)
Definition: Voronoi.cc:425
Computes the Tesselation Density Estimator (TDE) of a set of points.
Definition: TDE.hh:22
Interpolates between discrete samples of a scalar field.
Definition: Interpolator.hh:22
void Initialize()
Initializes the interpolator if requested.
Definition: TDE.cc:55
const std::vector< std::vector< double > > & GetPointArray() const
Returns the array of points on which the triangulation is constructed.
Definition: Voronoi.hh:89
Computes the Voronoi tessellation of a set of points.
Definition: Voronoi.hh:53
const size_t & GetDimension() const
Returns the dimension of the tesselated space.
Definition: Voronoi.hh:101
Voronoi _vor
Voronoi tesselation of the space.
Definition: TDE.hh:132
const Hull & GetCell(const size_t i) const
Returns a specific cell.
Definition: TDE.hh:99
void Draw(std::string name="", bool color=true, bool points=false, bool axes=false) const
Draws the Voronoi tesselation on a canvas.
Definition: Voronoi.cc:485
void Draw(std::string name="", bool color=true, bool points=false, bool axes=false) const
Draws the underlying Voronoi tesselation on a canvas.
Definition: TDE.hh:122
const size_t & GetDimension() const
Returns the dimension of the tesselated space.
Definition: TDE.hh:102
TDE()
Default constructor, initilizes everything to 0.
Definition: TDE.cc:3
std::vector< TPolyLine * > Meshing() const
Returns the meshing, used to build the interpolation, as polygons.
Definition: TDE.cc:101
double operator()(const double &v) const
Overloaded function operator, calls Evaluate.
Definition: TDE.hh:57
const std::vector< std::vector< double > > & GetPointArray() const
Returns the array of points on which the triangulation is constructed.
Definition: TDE.hh:90
double operator()(const double *v) const
Overloaded function operator, calls Evaluate.
Definition: TDE.hh:63
Interpolator _int
Simplexial interpolator.
Definition: TDE.hh:133
TDE & operator=(const TDE &tde)
Equality operator.
Definition: TDE.cc:41
TPolyLine * BoundingBox() const
Returns a rectangle to be drawn in ROOT (only 2D)
Definition: Voronoi.cc:401
TH2Poly * DensityProfile() const
Returns a histogram where each bin is a cell and its content is its density.
Definition: Voronoi.cc:439
const std::vector< Hull > & GetCellArray() const
Returns the array of cells corresponding to the array of points.
Definition: TDE.hh:96