]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG/FLOW/Base/AliFlowMSPHistograms.h
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWG / FLOW / Base / AliFlowMSPHistograms.h
CommitLineData
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
13class AliFlowMSPHistograms : public TNamed
14{
15public:
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
7b5556ef 50 AliFlowMSPHistograms &operator=(const AliFlowMSPHistograms &x);
51
52 TObject *Clone(const char *n=0)const; // Create a copy of this object
dc8ba4dd 53
54private:
55 TObjArray fVarNames; // Names of variables being correlated
56 TObjArray fPAvg; // Averages of single variables
57 TObjArray fPProd; // Products of each combination of two variables
58 TString fXName; // Name of X axis for differential correlations
59
60 inline TProfile *Avg(const int i)const{return (TProfile *)(fPAvg[i]);}; // Index in average profile list
61 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)
62 inline TProfile *Prod(const int i, const int j)const{return (TProfile *)(fPProd[Idx(i,j)]);}; // Index in product profile list
63
64 double Covariance(double a, double b, double ab, double wa, double wb ,double wab)const; // Calculate weighted covariance from averages and sums of products
65
66 void UpdateTitles(int i=-1); // Generate the profile titles from the parameter names and X variable name
67
68 ClassDef(AliFlowMSPHistograms,1);
69};
70
71#endif