Introduction of the Copyright and cvs Log
[u/mrichter/AliRoot.git] / RALICE / AliSample.h
d88f97cc 1#ifndef ALISAMPLE_H
2#define ALISAMPLE_H
4// Class AliSample
5// Perform statistics on various multi-dimensional data samples
6// A data sample can be filled using the "Enter" and/or "Remove" functions,
7// whereas the "Reset" function resets the complete sample to 'empty'.
8// The info which can be extracted from a certain data sample are the
9// sum, mean, variance, sigma, covariance and correlation.
10// The "Info" function provides all statistics data for a certain sample.
11// The variables for which these stat. parameters have to be calculated
12// are indicated by the index of the variable which is passed as an
13// argument to the various member functions.
14// The index convention for a data point (x,y) is : x=1 y=2
16// Example :
17// ---------
18// For an AliSample s a data point (x,y) can be entered as s.Enter(x,y) and
19// the mean_x can be obtained as s.GetMean(1) whereas the mean_y is obtained
20// via s.GetMean(2).
21// The correlation between x and y is available via s.GetCor(1,2).
22// The x-statistics are obtained via s.Info(1), y-statistics via s.Info(2),
23// and the covariance and correlation between x and y via s.Info(1,2).
24// All statistics of a sample are obtained via s.Info().
26//--- NvE 30-mar-1996 CERN Geneva
29#include <math.h>
30#include <iostream.h>
32#include "Rtypes.h"
34class AliSample
36 public:
37 AliSample(); // Default constructor
38 virtual ~AliSample(); // Default destructor
39 void Reset(); // Reset complete statistics
40 void Enter(Float_t x); // Enter value for 1-dim. sample
41 void Remove(Float_t x); // Remove value from 1-dim. sample
42 void Enter(Float_t x, Float_t y); // Enter value for 2-dim. sample
43 void Remove(Float_t x, Float_t y); // Remove value from 2-dim. sample
44 void Enter(Float_t x, Float_t y, Float_t z); // Enter value for 3-dim. sample
45 void Remove(Float_t x, Float_t y, Float_t z); // Remove value from 3-dim. sample
46 Int_t GetDimension(); // Provide dimension of the sample
47 Int_t GetN(); // Provide the number of entries
48 Float_t GetSum(Int_t i); // Provide sum for i-th variable
49 Float_t GetMean(Int_t i); // Provide mean for i-th variable
50 Float_t GetVar(Int_t i); // Provide variance for i-th variable
51 Float_t GetSigma(Int_t i); // Standard deviation for i-th variable
52 Float_t GetCov(Int_t i, Int_t j); // Covariance for i-th and j-th variable
53 Float_t GetCor(Int_t i, Int_t j); // Correlation for i-th and j-th variable
54 void Info(); // Stat. info for the complete sample
55 void Info(Int_t i); // Stat. info for the i-th variable
56 void Info(Int_t i, Int_t j); // Stat. info for i-th and j-th variable
58 private:
59 Int_t fDim; // Dimension of the sample
60 Int_t fN; // Number of entries of the sample
61 enum {fMaxdim=3}; // Maximum supported dimension
62 char fNames[fMaxdim]; // Variable names i.e. X,Y,Z
63 Float_t fSum[fMaxdim]; // Total sum for each variable
64 Float_t fSum2[fMaxdim][fMaxdim]; // Total sum**2 for each variable
65 void Compute(); // Compute the various quantities
66 Float_t fMean[fMaxdim]; // Mean for each variable
67 Float_t fVar[fMaxdim]; // Variation for each variable
68 Float_t fSigma[fMaxdim]; // Standard deviation for each variable
69 Float_t fCov[fMaxdim][fMaxdim]; // Covariances of pairs of variables
70 Float_t fCor[fMaxdim][fMaxdim]; // Correlations of pairs of variables