Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:21:55

0001 // @(#)root/mathcore:$Id$
0002 // Author: David Gonzalez Maline Wed Aug 28 15:23:43 2009
0003 
0004 /**********************************************************************
0005  *                                                                    *
0006  * Copyright (c) 2006  LCG ROOT Math Team, CERN/PH-SFT                *
0007  *                                                                    *
0008  *                                                                    *
0009  **********************************************************************/
0010 
0011 // Header file for class SparseData
0012 
0013 #ifndef ROOT_Fit_SparseData
0014 #define ROOT_Fit_SparseData
0015 
0016 #include "Fit/BinData.h"
0017 #include <vector>
0018 #include <memory>
0019 
0020 namespace ROOT {
0021 
0022    namespace Fit {
0023 
0024       // This is a proxy to a std::list<Box>
0025       class ProxyListBox;
0026 
0027       /**
0028          SparseData class representing the data of a THNSparse histogram
0029          The data needs to be converted to a BinData class before fitting using
0030          the GetBinData functions.
0031 
0032          @ingroup FitData
0033       */
0034 
0035       class SparseData : public FitData  {
0036       public:
0037          /// Constructor with a vector
0038          SparseData(std::vector<double>& min, std::vector<double>& max);
0039 
0040          /// Constructor with a dimension and two arrays
0041          SparseData(const unsigned int dim, double min[], double max[]);
0042 
0043          /// Copy constructor
0044          SparseData(const SparseData & rhs);
0045 
0046          /// Destructor
0047          ~SparseData() override;
0048 
0049          /// Assignment operator
0050          SparseData & operator=(const SparseData & rhs);
0051 
0052          /// Returns the number of points stored
0053          unsigned int NPoints() const;
0054          /// Returns the dimension of the object (bins)
0055          unsigned int NDim() const;
0056 
0057          /// Adds a new bin specified by the vectors
0058          void Add(std::vector<double>& min, std::vector<double>& max,
0059                   const double content, const double error = 1.0);
0060 
0061          void GetPoint(const unsigned int i,
0062                        std::vector<double>& min, std::vector<double>&max,
0063                        double& content, double& error);
0064 
0065          /// Debug method to print the list of bins stored
0066          void PrintList() const;
0067 
0068          /// Transforms the data into a ROOT::Fit::BinData structure
0069          void GetBinData(BinData&) const;
0070          /// Same as before, but returning a BinData with integral format (containing bin edges)
0071          void GetBinDataIntegral(BinData&) const;
0072          /// Same as before, but including zero content bins
0073          void GetBinDataNoZeros(BinData&) const;
0074 
0075       private :
0076          std::unique_ptr<ProxyListBox> fList;
0077       };
0078 
0079    } // end namespace Fit
0080 
0081 } // end namespace ROOT
0082 
0083 
0084 
0085 #endif /* ROOT_Fit_SparseData */