]>
Commit | Line | Data |
---|---|---|
dc8ba4dd | 1 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * |
2 | * See cxx source for full Copyright notice */ | |
3 | /* $Id$ */ | |
4 | ||
5 | #ifndef ALIFLOWMSPHISTOGRAMS_H | |
6 | #define ALIFLOWMSPHISTOGRAMS_H | |
7 | ||
8 | #include <TNamed.h> | |
9 | #include <TObjArray.h> | |
10 | #include <TProfile.h> | |
11 | #include <TString.h> | |
12 | ||
13 | class AliFlowMSPHistograms : public TNamed | |
14 | { | |
15 | public: | |
16 | AliFlowMSPHistograms(); // Default constructor for root IO | |
17 | AliFlowMSPHistograms(const AliFlowMSPHistograms &x); // Copy constructor | |
18 | AliFlowMSPHistograms(const int dim, const char *name, const int nBins, const double xmin, const double xmax); // See Init | |
19 | AliFlowMSPHistograms(const int dim, const char *name, const int nBins, const double *xBins); // See Init | |
20 | ~AliFlowMSPHistograms(); // Destructor | |
21 | ||
22 | void Init(const int dim, const char *name, const int nBins, const double xmin, const double xmax); // Redefine all private members | |
23 | void Init(const int dim, const char *name, const int nBins, const double *xBins); // Redefine all private members | |
24 | void SetVarName(const char *name, const int i); // Set name of a variable | |
25 | void SetVarName(const TString name, const int i); // Set name of a variable | |
26 | const char *VarName(const int i)const; // Get name of a variable | |
27 | void SetXName(const char *name){fXName=name;}; // Set name of x-axis | |
28 | const char *XName()const{return fXName.Data();}; // Get name of x-axis | |
29 | void Fill(const double x, const double *par, const double *wpar); // Fill all profiles for bin FindBin(x) | |
30 | ||
31 | //Bool_t IsFolder() const { return kFALSE; }; // Tells browser that this is a folder | |
32 | //void Print(Option_t *opt) const; // Prints a message ... | |
33 | //void Browse(TBrowser *b) {}; // Allows the browser to see the contents | |
34 | ||
35 | int NVars()const{return fPAvg.GetEntriesFast();}; // Number of variables | |
36 | int Nbins()const{return Avg(0)->GetNbinsX();}; // Number of bins in x | |
37 | double XLow()const{return Avg(0)->GetBinLowEdge(1);}; // Lower end of x range | |
38 | double XHigh()const{return XLow()+Nbins()*Avg(0)->GetBinWidth(1);}; // Upper end of xrange | |
39 | int FindBin(const double x)const{return Avg(0)->FindBin(x);}; // Get bin number from x value | |
40 | ||
41 | double Average(const int bin, const int ivar)const; // Get weighted average from the accumulated TProfile bin | |
42 | double Average(const int ivar)const{return Average(0,ivar);}; // Weighted average summed over all bins | |
43 | double Covariance(const int bin, const int ivar, const int jvar)const; // Calculate covariance of two average variables | |
44 | double Covariance(const int ivar, const int jvar)const{return Covariance(0,ivar,jvar);}; // Covariance summing all X bins | |
45 | double Variance(const int bin, const int ivar)const{return Covariance(bin, ivar, ivar);}; // Calculate Variance of an average | |
46 | double Variance(const int ivar)const{return Covariance(0, ivar, ivar);}; // Calculate Variance of bin average | |
47 | ||
48 | Long64_t Merge(TCollection *); // Merge all objects in the collection into this | |
49 | AliFlowMSPHistograms &operator+=(const AliFlowMSPHistograms &x); // Merge this with another AliFlowMSPHistograms object | |
50 | ||
51 | private: | |
52 | TObjArray fVarNames; // Names of variables being correlated | |
53 | TObjArray fPAvg; // Averages of single variables | |
54 | TObjArray fPProd; // Products of each combination of two variables | |
55 | TString fXName; // Name of X axis for differential correlations | |
56 | ||
57 | inline TProfile *Avg(const int i)const{return (TProfile *)(fPAvg[i]);}; // Index in average profile list | |
58 | inline int Idx(const int i, const int j)const{return (j<=i?((i*(i+1))>>1)+j:((j*(j+1))>>1)+i);}; // Calculate index in linear array (j<=i) | |
59 | inline TProfile *Prod(const int i, const int j)const{return (TProfile *)(fPProd[Idx(i,j)]);}; // Index in product profile list | |
60 | ||
61 | double Covariance(double a, double b, double ab, double wa, double wb ,double wab)const; // Calculate weighted covariance from averages and sums of products | |
62 | ||
63 | void UpdateTitles(int i=-1); // Generate the profile titles from the parameter names and X variable name | |
64 | ||
65 | ClassDef(AliFlowMSPHistograms,1); | |
66 | }; | |
67 | ||
68 | #endif |