]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/EBYE/AliBalance.h
Modifications in the output of the BF task (merging) - Michael Weber
[u/mrichter/AliRoot.git] / PWG2 / EBYE / AliBalance.h
1 #ifndef ALIBALANCE_H
2 #define ALIBALANCE_H
3 /*  See cxx source for full Copyright notice */
4
5
6 /* $Id$ */
7
8 //-------------------------------------------------------------------------
9 //                          Class AliBalance
10 //   This is the class for the Balance Function analysis
11 //
12 //    Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch
13 //-------------------------------------------------------------------------
14
15 #include <TObject.h>
16 #include "TString.h"
17
18 #define ANALYSIS_TYPES  7
19 #define MAXIMUM_NUMBER_OF_STEPS 1024
20
21 class TGraphErrors;
22 class TObjArray;
23 class TH1D;
24
25 const TString gBFAnalysisType[ANALYSIS_TYPES] = {"y","eta","qlong","qout","qside","qinv","phi"};
26
27 class AliBalance : public TObject {
28  public:
29   enum EAnalysisType {
30     kRapidity = 0, 
31     kEta      = 1, 
32     kQlong    = 2, 
33     kQout     = 3, 
34     kQside    = 4, 
35     kQinv     = 5, 
36     kPhi      = 6 
37   };
38
39   AliBalance();
40   AliBalance(const AliBalance& balance);
41   ~AliBalance();
42   
43   //void SetNumberOfBins(Int_t ibin, Int_t ibins);
44   void SetAnalysisLevel(const char* analysisLevel) {
45     fAnalysisLevel = analysisLevel;}
46   void SetShuffle(Bool_t shuffle) {bShuffle = shuffle;}
47   void SetInterval(Int_t iAnalysisType, Double_t p1Start, Double_t p1Stop,
48                    Int_t ibins, Double_t p2Start, Double_t p2Stop);
49   void SetNp(Int_t analysisType, Double_t NpSet)   { fNp[analysisType] = NpSet; }
50   void SetNn(Int_t analysisType, Double_t NnSet)   { fNn[analysisType] = NnSet; }
51   void SetNpp(Int_t analysisType, Int_t ibin, Double_t NppSet) { if(ibin > -1 && ibin < MAXIMUM_NUMBER_OF_STEPS) fNpp[analysisType][ibin] = NppSet; }
52   void SetNpn(Int_t analysisType, Int_t ibin, Double_t NpnSet) { if(ibin > -1 && ibin < MAXIMUM_NUMBER_OF_STEPS) fNpn[analysisType][ibin] = NpnSet; }
53   void SetNnp(Int_t analysisType, Int_t ibin, Double_t NnpSet) { if(ibin > -1 && ibin < MAXIMUM_NUMBER_OF_STEPS) fNnp[analysisType][ibin] = NnpSet; }
54   void SetNnn(Int_t analysisType, Int_t ibin, Double_t NnnSet) { if(ibin > -1 && ibin < MAXIMUM_NUMBER_OF_STEPS) fNnn[analysisType][ibin] = NnnSet; }
55
56   void InitHistograms(void);
57
58   const char* GetAnalysisLevel() {return fAnalysisLevel.Data();}
59   Int_t GetNumberOfAnalyzedEvent() {return fAnalyzedEvents;}
60
61   Int_t GetNumberOfBins(Int_t ibin) {return fNumberOfBins[ibin];}
62   Double_t GetP1Start(Int_t ibin){return fP1Start[ibin];}
63   Double_t GetP1Stop(Int_t ibin){return fP1Stop[ibin];}   
64   Double_t GetP2Start(Int_t ibin){return fP2Start[ibin];}
65   Double_t GetP2Stop(Int_t ibin){return fP2Stop[ibin];}    
66  
67   Double_t GetNp(Int_t analysisType) const { return 1.0*fNp[analysisType]; }
68   Double_t GetNn(Int_t analysisType) const { return 1.0*fNn[analysisType]; }
69   Double_t GetNnn(Int_t analysisType, Int_t p2) const { 
70     return 1.0*fNnn[analysisType][p2]; }
71   Double_t GetNpp(Int_t analysisType, Int_t p2) const { 
72     return 1.0*fNpp[analysisType][p2]; }
73   Double_t GetNpn(Int_t analysisType, Int_t p2) const { 
74     return 1.0*fNpn[analysisType][p2]; }  
75   Double_t GetNnp(Int_t analysisType, Int_t p2) const { 
76     return 1.0*fNnp[analysisType][p2]; }
77
78   void CalculateBalance(TObjArray *gTrackArray);
79   
80   Double_t GetBalance(Int_t a, Int_t p2);
81   Double_t GetError(Int_t a, Int_t p2);
82
83   TH1D *GetHistNp(Int_t iAnalysisType) { return fHistP[iAnalysisType];}
84   TH1D *GetHistNn(Int_t iAnalysisType) { return fHistN[iAnalysisType];}
85   TH1D *GetHistNpn(Int_t iAnalysisType) { return fHistPN[iAnalysisType];}
86   TH1D *GetHistNnp(Int_t iAnalysisType) { return fHistNP[iAnalysisType];}
87   TH1D *GetHistNpp(Int_t iAnalysisType) { return fHistPP[iAnalysisType];}
88   TH1D *GetHistNnn(Int_t iAnalysisType) { return fHistNN[iAnalysisType];}
89
90   void PrintAnalysisSettings();
91   TGraphErrors *drawBalance(Int_t fAnalysisType);
92   void SetGraphTitle(TGraphErrors *gr, Int_t fAnalysisType);
93
94   void SetHistNp(Int_t iAnalysisType, TH1D *gHist) { 
95     fHistP[iAnalysisType] = gHist;}
96   void SetHistNn(Int_t iAnalysisType, TH1D *gHist) { 
97     fHistN[iAnalysisType] = gHist;}
98   void SetHistNpn(Int_t iAnalysisType, TH1D *gHist) { 
99     fHistPN[iAnalysisType] = gHist;}
100   void SetHistNnp(Int_t iAnalysisType, TH1D *gHist) { 
101     fHistNP[iAnalysisType] = gHist;}
102   void SetHistNpp(Int_t iAnalysisType, TH1D *gHist) { 
103     fHistPP[iAnalysisType] = gHist;}
104   void SetHistNnn(Int_t iAnalysisType, TH1D *gHist) { 
105     fHistNN[iAnalysisType] = gHist;}
106
107   TH1D *GetBalanceFunctionHistogram(Int_t iAnalysisType);
108   void PrintResults(Int_t iAnalysisType, TH1D *gHist);
109
110  private:
111
112   Bool_t bShuffle; //shuffled balance function object
113   TString fAnalysisLevel; //ESD, AOD or MC
114   Int_t fAnalyzedEvents; //number of events that have been analyzed
115
116   Int_t fNumberOfBins[ANALYSIS_TYPES]; //number of bins of the analyzed interval
117   Double_t fP1Start[ANALYSIS_TYPES];
118   Double_t fP1Stop[ANALYSIS_TYPES];
119   Double_t fP2Start[ANALYSIS_TYPES];
120   Double_t fP2Stop[ANALYSIS_TYPES];
121   Double_t fP2Step[ANALYSIS_TYPES]; 
122         
123   Double_t fNnn[ANALYSIS_TYPES][MAXIMUM_NUMBER_OF_STEPS]; //N(--)
124   Double_t fNpp[ANALYSIS_TYPES][MAXIMUM_NUMBER_OF_STEPS]; //N(++)
125   Double_t fNpn[ANALYSIS_TYPES][MAXIMUM_NUMBER_OF_STEPS]; //N(+-)
126   Double_t fNnp[ANALYSIS_TYPES][MAXIMUM_NUMBER_OF_STEPS]; //N(-+)
127   Double_t fNn[ANALYSIS_TYPES], fNp[ANALYSIS_TYPES]; //number of pos./neg. inside the analyzed interval
128   
129   Double_t fB[ANALYSIS_TYPES][MAXIMUM_NUMBER_OF_STEPS]; //BF matrix
130   Double_t ferror[ANALYSIS_TYPES][MAXIMUM_NUMBER_OF_STEPS]; //error of the BF
131   
132   TH1D *fHistP[ANALYSIS_TYPES]; //N+
133   TH1D *fHistN[ANALYSIS_TYPES]; //N-
134   TH1D *fHistPN[ANALYSIS_TYPES]; //N+-
135   TH1D *fHistNP[ANALYSIS_TYPES]; //N-+
136   TH1D *fHistPP[ANALYSIS_TYPES]; //N++
137   TH1D *fHistNN[ANALYSIS_TYPES]; //N--
138
139   AliBalance & operator=(const AliBalance & ) {return *this;}
140
141   ClassDef(AliBalance, 3)
142 };
143
144 #endif