]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGCF/EBYE/BalanceFunctions/AliBalanceEventMixing.h
Updates in the balance function code
[u/mrichter/AliRoot.git] / PWGCF / EBYE / BalanceFunctions / AliBalanceEventMixing.h
CommitLineData
fbe4a5ad 1#ifndef ALIBALANCEEVENTMIXING_H
2#define ALIBALANCEEVENTMIXING_H
3/* See cxx source for full Copyright notice */
4
5
6//-------------------------------------------------------------------------
7// Class AliBalanceEventMixing
8// This is the class for the Balance Function analysis
9//
10// Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch
11// Modified: Michael Weber, m.weber@cern.ch
12//-------------------------------------------------------------------------
13
c64cb1f6 14#include <vector>
fbe4a5ad 15#include <TObject.h>
16#include "TString.h"
17
c64cb1f6 18using std::vector;
19
fbe4a5ad 20#define ANALYSIS_TYPES 7
21#define MAXIMUM_NUMBER_OF_STEPS 1024
22
23class TGraphErrors;
24class TH1D;
25class TH2D;
26
27class AliBalanceEventMixing : 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 AliBalanceEventMixing();
40 AliBalanceEventMixing(const AliBalanceEventMixing& balance);
41 ~AliBalanceEventMixing();
42
43 void SetCentralityIdentifier(const char* centralityId) {
44 fCentralityId = centralityId;}
45
46 void SetAnalysisLevel(const char* analysisLevel) {
47 fAnalysisLevel = analysisLevel;}
9fd4b54e 48 void SetShuffle(Bool_t shuffle) {fShuffle = shuffle;}
49 void SetHBTcut(Bool_t HBTcut) {fHBTcut = HBTcut;}
50 void SetConversionCut(Bool_t ConversionCut) {fConversionCut = ConversionCut;}
fbe4a5ad 51 void SetInterval(Int_t iAnalysisType, Double_t p1Start, Double_t p1Stop,
52 Int_t ibins, Double_t p2Start, Double_t p2Stop);
53 void SetCentralityInterval(Double_t cStart, Double_t cStop) { fCentStart = cStart; fCentStop = cStop;};
54 void SetNp(Int_t analysisType, Double_t NpSet) { fNp[analysisType] = NpSet; }
55 void SetNn(Int_t analysisType, Double_t NnSet) { fNn[analysisType] = NnSet; }
56 void SetNpp(Int_t analysisType, Int_t ibin, Double_t NppSet) { if(ibin > -1 && ibin < MAXIMUM_NUMBER_OF_STEPS) fNpp[analysisType][ibin] = NppSet; }
57 void SetNpn(Int_t analysisType, Int_t ibin, Double_t NpnSet) { if(ibin > -1 && ibin < MAXIMUM_NUMBER_OF_STEPS) fNpn[analysisType][ibin] = NpnSet; }
58 void SetNnp(Int_t analysisType, Int_t ibin, Double_t NnpSet) { if(ibin > -1 && ibin < MAXIMUM_NUMBER_OF_STEPS) fNnp[analysisType][ibin] = NnpSet; }
59 void SetNnn(Int_t analysisType, Int_t ibin, Double_t NnnSet) { if(ibin > -1 && ibin < MAXIMUM_NUMBER_OF_STEPS) fNnn[analysisType][ibin] = NnnSet; }
60
61 void InitHistograms(void);
62
63 const char* GetAnalysisLevel() {return fAnalysisLevel.Data();}
9fd4b54e 64 Int_t GetNumberOfAnalyzedEvent() const {return fAnalyzedEvents;}
fbe4a5ad 65
9fd4b54e 66 Int_t GetNumberOfBins(Int_t ibin) const {return fNumberOfBins[ibin];}
67 Double_t GetP1Start(Int_t ibin) const {return fP1Start[ibin];}
68 Double_t GetP1Stop(Int_t ibin) const {return fP1Stop[ibin];}
69 Double_t GetP2Start(Int_t ibin) const {return fP2Start[ibin];}
70 Double_t GetP2Stop(Int_t ibin) const {return fP2Stop[ibin];}
fbe4a5ad 71
72 Double_t GetNp(Int_t analysisType) const { return 1.0*fNp[analysisType]; }
73 Double_t GetNn(Int_t analysisType) const { return 1.0*fNn[analysisType]; }
74 Double_t GetNnn(Int_t analysisType, Int_t p2) const {
75 return 1.0*fNnn[analysisType][p2]; }
76 Double_t GetNpp(Int_t analysisType, Int_t p2) const {
77 return 1.0*fNpp[analysisType][p2]; }
78 Double_t GetNpn(Int_t analysisType, Int_t p2) const {
79 return 1.0*fNpn[analysisType][p2]; }
80 Double_t GetNnp(Int_t analysisType, Int_t p2) const {
81 return 1.0*fNnp[analysisType][p2]; }
82
3f298f0b 83 void CalculateBalance(Float_t fCentrality, vector<Double_t> **chargeVector,Int_t iMainTrack = -1,Float_t bSign = 0.);
fbe4a5ad 84
85 Double_t GetBalance(Int_t a, Int_t p2);
86 Double_t GetError(Int_t a, Int_t p2);
87
9fd4b54e 88 TH2D *GetHistNp(Int_t iAnalysisType) const { return fHistP[iAnalysisType];}
89 TH2D *GetHistNn(Int_t iAnalysisType) const { return fHistN[iAnalysisType];}
90 TH2D *GetHistNpn(Int_t iAnalysisType) const { return fHistPN[iAnalysisType];}
91 TH2D *GetHistNnp(Int_t iAnalysisType) const { return fHistNP[iAnalysisType];}
92 TH2D *GetHistNpp(Int_t iAnalysisType) const { return fHistPP[iAnalysisType];}
93 TH2D *GetHistNnn(Int_t iAnalysisType) const { return fHistNN[iAnalysisType];}
fbe4a5ad 94
95 void PrintAnalysisSettings();
96 TGraphErrors *DrawBalance(Int_t fAnalysisType);
97
98 void SetHistNp(Int_t iAnalysisType, TH2D *gHist) {
99 fHistP[iAnalysisType] = gHist;}
100 void SetHistNn(Int_t iAnalysisType, TH2D *gHist) {
101 fHistN[iAnalysisType] = gHist;}
102 void SetHistNpn(Int_t iAnalysisType, TH2D *gHist) {
103 fHistPN[iAnalysisType] = gHist;}
104 void SetHistNnp(Int_t iAnalysisType, TH2D *gHist) {
105 fHistNP[iAnalysisType] = gHist;}
106 void SetHistNpp(Int_t iAnalysisType, TH2D *gHist) {
107 fHistPP[iAnalysisType] = gHist;}
108 void SetHistNnn(Int_t iAnalysisType, TH2D *gHist) {
109 fHistNN[iAnalysisType] = gHist;}
110
111 TH1D *GetBalanceFunctionHistogram(Int_t iAnalysisType,Double_t centrMin, Double_t centrMax, Double_t etaWindow = -1);
112 void PrintResults(Int_t iAnalysisType, TH1D *gHist);
113
114 private:
9fd4b54e 115 inline Float_t GetDPhiStar(Float_t phi1, Float_t pt1, Float_t charge1, Float_t phi2, Float_t pt2, Float_t charge2, Float_t radius, Float_t bSign);
3f298f0b 116
9fd4b54e 117 Bool_t fShuffle; //shuffled balance function object
118 Bool_t fHBTcut; // apply HBT like cuts
119 Bool_t fConversionCut; // apply conversion cuts
3f298f0b 120
fbe4a5ad 121 TString fAnalysisLevel; //ESD, AOD or MC
122 Int_t fAnalyzedEvents; //number of events that have been analyzed
123
124 TString fCentralityId;//Centrality identifier to be used for the histo naming
125
126 Int_t fNumberOfBins[ANALYSIS_TYPES];//number of bins of the analyzed interval
9fd4b54e 127 Double_t fP1Start[ANALYSIS_TYPES];//lower boundaries for single particle histograms
128 Double_t fP1Stop[ANALYSIS_TYPES];//upper boundaries for single particle histograms
129 Double_t fP2Start[ANALYSIS_TYPES];//lower boundaries for pair histograms
130 Double_t fP2Stop[ANALYSIS_TYPES];//upper boundaries for pair histograms
131 Double_t fP2Step[ANALYSIS_TYPES];//bin size for pair histograms
132 Double_t fCentStart;//lower boundary for centrality
133 Double_t fCentStop;//upper boundary for centrality
fbe4a5ad 134
135
136 Double_t fNnn[ANALYSIS_TYPES][MAXIMUM_NUMBER_OF_STEPS]; //N(--)
137 Double_t fNpp[ANALYSIS_TYPES][MAXIMUM_NUMBER_OF_STEPS]; //N(++)
138 Double_t fNpn[ANALYSIS_TYPES][MAXIMUM_NUMBER_OF_STEPS]; //N(+-)
139 Double_t fNnp[ANALYSIS_TYPES][MAXIMUM_NUMBER_OF_STEPS]; //N(-+)
140 Double_t fNn[ANALYSIS_TYPES], fNp[ANALYSIS_TYPES]; //number of pos./neg. inside the analyzed interval
141
142 Double_t fB[ANALYSIS_TYPES][MAXIMUM_NUMBER_OF_STEPS]; //BF matrix
143 Double_t ferror[ANALYSIS_TYPES][MAXIMUM_NUMBER_OF_STEPS]; //error of the BF
144
145 TH2D *fHistP[ANALYSIS_TYPES]; //N+
146 TH2D *fHistN[ANALYSIS_TYPES]; //N-
147 TH2D *fHistPN[ANALYSIS_TYPES]; //N+-
148 TH2D *fHistNP[ANALYSIS_TYPES]; //N-+
149 TH2D *fHistPP[ANALYSIS_TYPES]; //N++
150 TH2D *fHistNN[ANALYSIS_TYPES]; //N--
151
152 AliBalanceEventMixing & operator=(const AliBalanceEventMixing & ) {return *this;}
153
f8b2d882 154 ClassDef(AliBalanceEventMixing, 1)
fbe4a5ad 155};
156
3f298f0b 157Float_t AliBalanceEventMixing::GetDPhiStar(Float_t phi1, Float_t pt1, Float_t charge1, Float_t phi2, Float_t pt2, Float_t charge2, Float_t radius, Float_t bSign)
158{
159 //
160 // calculates dphistar
161 //
162
163 Float_t dphistar = phi1 - phi2 - charge1 * bSign * TMath::ASin(0.075 * radius / pt1) + charge2 * bSign * TMath::ASin(0.075 * radius / pt2);
164
165 static const Double_t kPi = TMath::Pi();
166
167 // circularity
168// if (dphistar > 2 * kPi)
169// dphistar -= 2 * kPi;
170// if (dphistar < -2 * kPi)
171// dphistar += 2 * kPi;
172
173 if (dphistar > kPi)
174 dphistar = kPi * 2 - dphistar;
175 if (dphistar < -kPi)
176 dphistar = -kPi * 2 - dphistar;
177 if (dphistar > kPi) // might look funny but is needed
178 dphistar = kPi * 2 - dphistar;
179
180 return dphistar;
181}
182
fbe4a5ad 183#endif