]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RALICE/AliSample.h
Coverity corrections.
[u/mrichter/AliRoot.git] / RALICE / AliSample.h
1 #ifndef ALISAMPLE_H
2 #define ALISAMPLE_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 // $Id$
7
8 #include <math.h>
9
10 #include "Rtypes.h"
11 #include "TArrayF.h"
12 #include "TH1.h"
13  
14 class AliSample
15 {
16  public:
17   AliSample();                                  // Default constructor
18   virtual ~AliSample();                         // Default destructor
19   void Reset();                                 // Reset complete statistics
20   void Enter(Float_t x);                        // Enter value for 1-dim. sample
21   void Remove(Float_t x);                       // Remove value from 1-dim. sample
22   void Enter(Float_t x, Float_t y);             // Enter value for 2-dim. sample
23   void Remove(Float_t x, Float_t y);            // Remove value from 2-dim. sample
24   void Enter(Float_t x, Float_t y, Float_t z);  // Enter value for 3-dim. sample
25   void Remove(Float_t x, Float_t y, Float_t z); // Remove value from 3-dim. sample
26   Int_t GetDimension() const;                   // Provide dimension of the sample
27   Int_t GetN() const;                           // Provide the number of entries
28   Float_t GetSum(Int_t i) const;                // Provide sum for i-th variable
29   Float_t GetMean(Int_t i) const;               // Provide mean for i-th variable
30   Float_t GetVar(Int_t i) const;                // Provide variance for i-th variable
31   Float_t GetSigma(Int_t i) const;              // Standard deviation for i-th variable
32   Float_t GetCov(Int_t i, Int_t j) const;       // Covariance for i-th and j-th variable
33   Float_t GetCor(Int_t i, Int_t j) const;       // Correlation for i-th and j-th variable
34   Float_t GetMedian(Int_t i);                   // Provide median for i-th variable
35   Float_t GetSpread(Int_t i);                   // Provide spread w.r.t. the median for i-th variable
36   Float_t GetMinimum(Int_t i) const;            // Provide the minimum value for i-th variable
37   Float_t GetMaximum(Int_t i) const;            // Provide the maximum value for i-th variable
38   void Data();                                  // Stat. info for the complete sample
39   void Data(Int_t i);                           // Stat. info for the i-th variable
40   void Data(Int_t i, Int_t j) const;            // Stat. info for i-th and j-th variable
41   void SetStoreMode(Int_t mode=1);              // Set mode for storage of all entered data
42   Int_t GetStoreMode() const;                   // Provide storage mode of all entered data
43   Double_t GetMedian(TH1* histo,Int_t mode=1) const; // Provide median from the specified 1D histogram
44   Double_t GetSpread(TH1* histo,Int_t mode=1) const; // Provide spread w.r.t. the median from the 1D histo
45  
46  private:
47   Int_t fDim;                      // Dimension of the sample
48   Int_t fN;                        // Number of entries of the sample
49   enum  {fMaxdim=3};               // Maximum supported dimension
50   char  fNames[fMaxdim];           // Variable names i.e. X,Y,Z
51   Float_t fSum[fMaxdim];           // Total sum for each variable
52   Float_t fSum2[fMaxdim][fMaxdim]; // Total sum**2 for each variable
53   void  Compute();                 // Compute the various quantities
54   Float_t fMean[fMaxdim];          // Mean for each variable
55   Float_t fVar[fMaxdim];           // Variation for each variable
56   Float_t fSigma[fMaxdim];         // Standard deviation for each variable
57   Float_t fCov[fMaxdim][fMaxdim];  // Covariances of pairs of variables
58   Float_t fCor[fMaxdim][fMaxdim];  // Correlations of pairs of variables
59   Float_t fMin[fMaxdim];           // Minimum value for each variable
60   Float_t fMax[fMaxdim];           // Maximum value for each variable
61   Int_t fRemove;                   // Flag to indicate that some entry has been removed
62   Int_t fStore;                    // Flag to denote storage of all entered data 
63   TArrayF* fX;                     // Storage array for the 1st variable (e.g. X)
64   TArrayF* fY;                     // Storage array for the 2nd variable (e.g. Y)
65   TArrayF* fZ;                     // Storage array for the 3rd variable (e.g. Z)
66   TArrayF* fArr;                   // Temp. storage array for ordering
67
68  ClassDef(AliSample,0) // Statistics tools for various multi-dimensional data samples.
69 };
70 #endif