Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
SparseData.h
Go to the documentation of this file.
1// @(#)root/mathcore:$Id$
2// Author: David Gonzalez Maline Wed Aug 28 15:23:43 2009
3
4/**********************************************************************
5 * *
6 * Copyright (c) 2006 LCG ROOT Math Team, CERN/PH-SFT *
7 * *
8 * *
9 **********************************************************************/
10
11// Header file for class SparseData
12
13#ifndef ROOT_Fit_SparseData
14#define ROOT_Fit_SparseData
15
16#include "Fit/BinData.h"
17#include <vector>
18#include <memory>
19
20namespace ROOT {
21
22 namespace Fit {
23
24 // This is a proxy to a std::list<Box>
25 class ProxyListBox;
26
27 /**
28 SparseData class representing the data of a THNSparse histogram
29 The data needs to be converted to a BinData class before fitting using
30 the GetBinData functions.
31
32 @ingroup FitData
33 */
34
35 class SparseData : public FitData {
36 public:
37 /// Constructor with a vector
38 SparseData(std::vector<double>& min, std::vector<double>& max);
39
40 /// Constructor with a dimension and two arrays
41 SparseData(const unsigned int dim, double min[], double max[]);
42
43 /// Copy constructor
44 SparseData(const SparseData & rhs);
45
46 /// Destructor
47 ~SparseData() override;
48
49 /// Assignment operator
50 SparseData & operator=(const SparseData & rhs);
51
52 /// Returns the number of points stored
53 unsigned int NPoints() const;
54 /// Returns the dimension of the object (bins)
55 unsigned int NDim() const;
56
57 /// Adds a new bin specified by the vectors
58 void Add(std::vector<double>& min, std::vector<double>& max,
59 const double content, const double error = 1.0);
60
61 void GetPoint(const unsigned int i,
62 std::vector<double>& min, std::vector<double>&max,
63 double& content, double& error);
64
65 /// Debug method to print the list of bins stored
66 void PrintList() const;
67
68 /// Transforms the data into a ROOT::Fit::BinData structure
69 void GetBinData(BinData&) const;
70 /// Same as before, but returning a BinData with integral format (containing bin edges)
71 void GetBinDataIntegral(BinData&) const;
72 /// Same as before, but including zero content bins
73 void GetBinDataNoZeros(BinData&) const;
74
75 private :
76 std::unique_ptr<ProxyListBox> fList;
77 };
78
79 } // end namespace Fit
80
81} // end namespace ROOT
82
83
84
85#endif /* ROOT_Fit_SparseData */
Class describing the binned data sets : vectors of x coordinates, y values and optionally error on y ...
Definition BinData.h:52
Base class for all the fit data types: Stores the coordinates and the DataOptions.
Definition FitData.h:56
SparseData class representing the data of a THNSparse histogram The data needs to be converted to a B...
Definition SparseData.h:35
std::unique_ptr< ProxyListBox > fList
Definition SparseData.h:76
void Add(std::vector< double > &min, std::vector< double > &max, const double content, const double error=1.0)
Adds a new bin specified by the vectors.
unsigned int NDim() const
Returns the dimension of the object (bins)
void GetPoint(const unsigned int i, std::vector< double > &min, std::vector< double > &max, double &content, double &error)
unsigned int NPoints() const
Returns the number of points stored.
void GetBinDataNoZeros(BinData &) const
Same as before, but including zero content bins.
SparseData & operator=(const SparseData &rhs)
Assignment operator.
void PrintList() const
Debug method to print the list of bins stored.
void GetBinData(BinData &) const
Transforms the data into a ROOT::Fit::BinData structure.
~SparseData() override
Destructor.
void GetBinDataIntegral(BinData &) const
Same as before, but returning a BinData with integral format (containing bin edges)
TFitResultPtr Fit(FitObject *h1, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption, const char *goption, ROOT::Fit::DataRange &range)
Definition HFitImpl.cxx:133
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.