Jpp  master_rocky-43-ge265d140c
the software that should make you happy
JGraphErrors.hh
Go to the documentation of this file.
1 #ifndef __JROOT__JGRAPHERRORS__
2 #define __JROOT__JGRAPHERRORS__
3 
4 #include <vector>
5 
6 #include "TGraphErrors.h"
7 
8 /**
9  * \author mdejong
10  */
11 
12 namespace JROOT {}
13 namespace JPP { using namespace JROOT; }
14 
15 namespace JROOT {
16 
17 
18  /**
19  * Data structure for graph data.
20  */
21  struct JGraphErrors_t {
22  /**
23  * Put data.
24  *
25  * \param x abscissa value
26  * \param y ordinate value
27  * \param ex abscissa error
28  * \param ey ordinate error
29  */
30  void put(const Double_t x, const Double_t y,
31  const Double_t ex, const Double_t ey)
32  {
33  X .push_back(x);
34  Y .push_back(y);
35  DX.push_back(ex);
36  DY.push_back(ey);
37  }
38 
39  std::vector<Double_t> X; //!< abscissa values
40  std::vector<Double_t> Y; //!< ordinate values
41  std::vector<Double_t> DX; //!< abscissa errors
42  std::vector<Double_t> DY; //!< ordinate errors
43  };
44 
45 
46  /**
47  * Auxiliary data structure to build TGraphErrors.
48  */
49  struct JGraphErrors :
50  public TGraphErrors
51  {
52  /**
53  * Constructor.
54  *
55  * \param graph graph data
56  * \param name graph name
57  */
58  JGraphErrors(const JGraphErrors_t& graph, const char* name) :
59  TGraphErrors(graph.X .size(),
60  graph.X .data(),
61  graph.Y .data(),
62  graph.DX.data(),
63  graph.DY.data())
64  {
65  SetName(name);
66  }
67  };
68 }
69 
70 #endif
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary classes and methods for ROOT I/O.
Data structure for graph data.
Definition: JGraphErrors.hh:21
std::vector< Double_t > DX
abscissa errors
Definition: JGraphErrors.hh:41
std::vector< Double_t > Y
ordinate values
Definition: JGraphErrors.hh:40
std::vector< Double_t > DY
ordinate errors
Definition: JGraphErrors.hh:42
std::vector< Double_t > X
abscissa values
Definition: JGraphErrors.hh:39
void put(const Double_t x, const Double_t y, const Double_t ex, const Double_t ey)
Put data.
Definition: JGraphErrors.hh:30
Auxiliary data structure to build TGraphErrors.
Definition: JGraphErrors.hh:51
JGraphErrors(const JGraphErrors_t &graph, const char *name)
Constructor.
Definition: JGraphErrors.hh:58