]>
Commit | Line | Data |
---|---|---|
0879e280 | 1 | /************************************************************************** |
2 | * Author: Panos Christakoglou. * | |
3 | * Contributors are mentioned in the code where appropriate. * | |
4 | * * | |
5 | * Permission to use, copy, modify and distribute this software and its * | |
6 | * documentation strictly for non-commercial purposes is hereby granted * | |
7 | * without fee, provided that the above copyright notice appears in all * | |
8 | * copies and that both the copyright notice and this permission notice * | |
9 | * appear in the supporting documentation. The authors make no claims * | |
10 | * about the suitability of this software for any purpose. It is * | |
11 | * provided "as is" without express or implied warranty. * | |
12 | **************************************************************************/ | |
13 | ||
14 | /* $Id: AliBalancePsi.cxx 54125 2012-01-24 21:07:41Z miweber $ */ | |
15 | ||
16 | //----------------------------------------------------------------- | |
17 | // Balance Function class | |
18 | // This is the class to deal with the Balance Function wrt Psi analysis | |
19 | // Origin: Panos Christakoglou, Nikhef, Panos.Christakoglou@cern.ch | |
20 | //----------------------------------------------------------------- | |
21 | ||
22 | ||
23 | //ROOT | |
24 | #include <Riostream.h> | |
621329de | 25 | #include <TCanvas.h> |
0879e280 | 26 | #include <TMath.h> |
27 | #include <TAxis.h> | |
28 | #include <TH2D.h> | |
29 | #include <TH3D.h> | |
30 | #include <TLorentzVector.h> | |
31 | #include <TObjArray.h> | |
32 | #include <TGraphErrors.h> | |
33 | #include <TString.h> | |
34 | ||
35 | #include "AliVParticle.h" | |
36 | #include "AliMCParticle.h" | |
37 | #include "AliESDtrack.h" | |
38 | #include "AliAODTrack.h" | |
9afe3098 | 39 | #include "AliTHn.h" |
0879e280 | 40 | |
41 | #include "AliBalancePsi.h" | |
42 | ||
43 | ClassImp(AliBalancePsi) | |
44 | ||
45 | //____________________________________________________________________// | |
46 | AliBalancePsi::AliBalancePsi() : | |
47 | TObject(), | |
9fd4b54e | 48 | fShuffle(kFALSE), |
0879e280 | 49 | fAnalysisLevel("ESD"), |
50 | fAnalyzedEvents(0) , | |
51 | fCentralityId(0) , | |
52 | fCentStart(0.), | |
53 | fCentStop(0.), | |
9afe3098 | 54 | fHistP(0), |
55 | fHistN(0), | |
56 | fHistPN(0), | |
57 | fHistNP(0), | |
58 | fHistPP(0), | |
59 | fHistNN(0), | |
60 | fPsiInterval(15.) { | |
0879e280 | 61 | // Default constructor |
0879e280 | 62 | } |
63 | ||
0879e280 | 64 | //____________________________________________________________________// |
65 | AliBalancePsi::AliBalancePsi(const AliBalancePsi& balance): | |
9fd4b54e | 66 | TObject(balance), fShuffle(balance.fShuffle), |
0879e280 | 67 | fAnalysisLevel(balance.fAnalysisLevel), |
68 | fAnalyzedEvents(balance.fAnalyzedEvents), | |
69 | fCentralityId(balance.fCentralityId), | |
70 | fCentStart(balance.fCentStart), | |
71 | fCentStop(balance.fCentStop), | |
9afe3098 | 72 | fHistP(balance.fHistP), |
73 | fHistN(balance.fHistN), | |
74 | fHistPN(balance.fHistPN), | |
75 | fHistNP(balance.fHistNP), | |
76 | fHistPP(balance.fHistPP), | |
77 | fHistNN(balance.fHistNN), | |
78 | fPsiInterval(balance.fPsiInterval) { | |
0879e280 | 79 | //copy constructor |
0879e280 | 80 | } |
81 | ||
82 | //____________________________________________________________________// | |
83 | AliBalancePsi::~AliBalancePsi() { | |
84 | // Destructor | |
9afe3098 | 85 | delete fHistP; |
86 | delete fHistN; | |
87 | delete fHistPN; | |
88 | delete fHistNP; | |
89 | delete fHistPP; | |
90 | delete fHistNN; | |
0879e280 | 91 | } |
92 | ||
93 | //____________________________________________________________________// | |
9afe3098 | 94 | void AliBalancePsi::InitHistograms() { |
95 | // single particle histograms | |
96 | Int_t anaSteps = 1; // analysis steps | |
9fd4b54e | 97 | Int_t iBinSingle[kTrackVariablesSingle]; // binning for track variables |
98 | Double_t* dBinsSingle[kTrackVariablesSingle]; // bins for track variables | |
99 | TString axisTitleSingle[kTrackVariablesSingle]; // axis titles for track variables | |
9afe3098 | 100 | |
101 | // two particle histograms | |
9fd4b54e | 102 | Int_t iBinPair[kTrackVariablesPair]; // binning for track variables |
103 | Double_t* dBinsPair[kTrackVariablesPair]; // bins for track variables | |
104 | TString axisTitlePair[kTrackVariablesPair]; // axis titles for track variables | |
9afe3098 | 105 | |
106 | //centrality | |
621329de | 107 | /*const Int_t kNCentralityBins = 9; |
9afe3098 | 108 | Double_t centralityBins[kNCentralityBins+1] = {0.,5.,10.,20.,30.,40.,50.,60.,70.,80.}; |
9afe3098 | 109 | iBinSingle[0] = kNCentralityBins; |
110 | dBinsSingle[0] = centralityBins; | |
111 | axisTitleSingle[0] = "Centrality percentile [%]"; | |
112 | iBinPair[0] = kNCentralityBins; | |
113 | dBinsPair[0] = centralityBins; | |
621329de | 114 | axisTitlePair[0] = "Centrality percentile [%]"; */ |
9afe3098 | 115 | |
6acdbcb2 | 116 | //Psi_2: -0.5->0.5 (in plane), 0.5->1.5 (intermediate), 1.5->2.5 (out of plane), 2.5->3.5 (all) |
117 | const Int_t kNPsi2Bins = 4; | |
118 | Double_t psi2Bins[kNPsi2Bins+1] = {-0.5,0.5,1.5,2.5,3.5}; | |
621329de | 119 | iBinSingle[0] = kNPsi2Bins; |
120 | dBinsSingle[0] = psi2Bins; | |
121 | axisTitleSingle[0] = "#phi - #Psi_{2} (a.u.)"; | |
122 | iBinPair[0] = kNPsi2Bins; | |
123 | dBinsPair[0] = psi2Bins; | |
124 | axisTitlePair[0] = "#phi - #Psi_{2} (a.u.)"; | |
9afe3098 | 125 | |
621329de | 126 | // delta eta |
127 | const Int_t kNDeltaEtaBins = 80; | |
9afe3098 | 128 | Double_t deltaEtaBins[kNDeltaEtaBins+1]; |
129 | for(Int_t i = 0; i < kNDeltaEtaBins+1; i++) | |
621329de | 130 | deltaEtaBins[i] = -2.0 + i * 0.05; |
131 | iBinPair[1] = kNDeltaEtaBins; | |
132 | dBinsPair[1] = deltaEtaBins; | |
133 | axisTitlePair[1] = "#Delta #eta"; | |
134 | ||
135 | // delta phi | |
9afe3098 | 136 | const Int_t kNDeltaPhiBins = 72; |
137 | Double_t deltaPhiBins[kNDeltaPhiBins+1]; | |
138 | for(Int_t i = 0; i < kNDeltaPhiBins+1; i++){ | |
139 | deltaPhiBins[i] = -180.0 + i * 5.; | |
140 | } | |
621329de | 141 | iBinPair[2] = kNDeltaPhiBins; |
142 | dBinsPair[2] = deltaPhiBins; | |
143 | axisTitlePair[2] = "#Delta #phi (#circ)"; | |
9afe3098 | 144 | |
a38fd7f3 | 145 | // pt(trigger-associated) |
8795e993 | 146 | const Int_t kNPtBins = 16; |
147 | Double_t ptBins[kNPtBins+1] = {0.2,0.6,1.0,1.5,2.0,2.5,3.0,3.5,4.0,5.0,6.0,7.0,8.0,10.,12.,15.,20.}; | |
148 | //for(Int_t i = 0; i < kNPtBins+1; i++){ | |
149 | //ptBins[i] = 0.2 + i * 0.5; | |
150 | //} | |
621329de | 151 | iBinSingle[1] = kNPtBins; |
152 | dBinsSingle[1] = ptBins; | |
153 | axisTitleSingle[1] = "p_{t}^{trig.} (GeV/c)"; | |
154 | ||
155 | iBinPair[3] = kNPtBins; | |
156 | dBinsPair[3] = ptBins; | |
157 | axisTitlePair[3] = "p_{t}^{trig.} (GeV/c)"; | |
a38fd7f3 | 158 | |
159 | iBinPair[4] = kNPtBins; | |
160 | dBinsPair[4] = ptBins; | |
621329de | 161 | axisTitlePair[4] = "p_{t}^{assoc.} (GeV/c)"; |
9afe3098 | 162 | |
163 | TString histName; | |
164 | //+ triggered particles | |
165 | histName = "fHistP"; | |
9fd4b54e | 166 | if(fShuffle) histName.Append("_shuffle"); |
9afe3098 | 167 | if(fCentralityId) histName += fCentralityId.Data(); |
9fd4b54e | 168 | fHistP = new AliTHn(histName.Data(),histName.Data(),anaSteps,kTrackVariablesSingle,iBinSingle); |
169 | for (Int_t j=0; j<kTrackVariablesSingle; j++) { | |
9afe3098 | 170 | fHistP->SetBinLimits(j, dBinsSingle[j]); |
171 | fHistP->SetVarTitle(j, axisTitleSingle[j]); | |
0879e280 | 172 | } |
9afe3098 | 173 | |
174 | //- triggered particles | |
175 | histName = "fHistN"; | |
9fd4b54e | 176 | if(fShuffle) histName.Append("_shuffle"); |
9afe3098 | 177 | if(fCentralityId) histName += fCentralityId.Data(); |
9fd4b54e | 178 | fHistN = new AliTHn(histName.Data(),histName.Data(),anaSteps,kTrackVariablesSingle,iBinSingle); |
179 | for (Int_t j=0; j<kTrackVariablesSingle; j++) { | |
9afe3098 | 180 | fHistN->SetBinLimits(j, dBinsSingle[j]); |
181 | fHistN->SetVarTitle(j, axisTitleSingle[j]); | |
0879e280 | 182 | } |
9afe3098 | 183 | |
184 | //+- pairs | |
185 | histName = "fHistPN"; | |
9fd4b54e | 186 | if(fShuffle) histName.Append("_shuffle"); |
9afe3098 | 187 | if(fCentralityId) histName += fCentralityId.Data(); |
9fd4b54e | 188 | fHistPN = new AliTHn(histName.Data(),histName.Data(),anaSteps, kTrackVariablesPair, iBinPair); |
189 | for (Int_t j=0; j<kTrackVariablesPair; j++) { | |
9afe3098 | 190 | fHistPN->SetBinLimits(j, dBinsPair[j]); |
191 | fHistPN->SetVarTitle(j, axisTitlePair[j]); | |
0879e280 | 192 | } |
0879e280 | 193 | |
9afe3098 | 194 | //-+ pairs |
195 | histName = "fHistNP"; | |
9fd4b54e | 196 | if(fShuffle) histName.Append("_shuffle"); |
9afe3098 | 197 | if(fCentralityId) histName += fCentralityId.Data(); |
9fd4b54e | 198 | fHistNP = new AliTHn(histName.Data(),histName.Data(),anaSteps, kTrackVariablesPair, iBinPair); |
199 | for (Int_t j=0; j<kTrackVariablesPair; j++) { | |
9afe3098 | 200 | fHistNP->SetBinLimits(j, dBinsPair[j]); |
201 | fHistNP->SetVarTitle(j, axisTitlePair[j]); | |
0879e280 | 202 | } |
0879e280 | 203 | |
9afe3098 | 204 | //++ pairs |
205 | histName = "fHistPP"; | |
9fd4b54e | 206 | if(fShuffle) histName.Append("_shuffle"); |
9afe3098 | 207 | if(fCentralityId) histName += fCentralityId.Data(); |
9fd4b54e | 208 | fHistPP = new AliTHn(histName.Data(),histName.Data(),anaSteps, kTrackVariablesPair, iBinPair); |
209 | for (Int_t j=0; j<kTrackVariablesPair; j++) { | |
9afe3098 | 210 | fHistPP->SetBinLimits(j, dBinsPair[j]); |
211 | fHistPP->SetVarTitle(j, axisTitlePair[j]); | |
212 | } | |
213 | ||
214 | //-- pairs | |
215 | histName = "fHistNN"; | |
9fd4b54e | 216 | if(fShuffle) histName.Append("_shuffle"); |
9afe3098 | 217 | if(fCentralityId) histName += fCentralityId.Data(); |
9fd4b54e | 218 | fHistNN = new AliTHn(histName.Data(),histName.Data(),anaSteps, kTrackVariablesPair, iBinPair); |
219 | for (Int_t j=0; j<kTrackVariablesPair; j++) { | |
9afe3098 | 220 | fHistNN->SetBinLimits(j, dBinsPair[j]); |
221 | fHistNN->SetVarTitle(j, axisTitlePair[j]); | |
0879e280 | 222 | } |
f06d59b3 | 223 | AliInfo("Finished setting up the AliTHn"); |
0879e280 | 224 | } |
225 | ||
226 | //____________________________________________________________________// | |
f06d59b3 | 227 | void AliBalancePsi::CalculateBalance(Double_t gReactionPlane, |
228 | TObjArray *particles, | |
229 | TObjArray *particlesMixed ) { | |
0879e280 | 230 | // Calculates the balance function |
231 | fAnalyzedEvents++; | |
0879e280 | 232 | |
233 | // Initialize histograms if not done yet | |
9afe3098 | 234 | if(!fHistPN){ |
0879e280 | 235 | AliWarning("Histograms not yet initialized! --> Will be done now"); |
236 | AliWarning("This works only in local mode --> Add 'gBalance->InitHistograms()' in your configBalanceFunction"); | |
237 | InitHistograms(); | |
238 | } | |
239 | ||
9fd4b54e | 240 | Double_t trackVariablesSingle[kTrackVariablesSingle]; |
241 | Double_t trackVariablesPair[kTrackVariablesPair]; | |
f06d59b3 | 242 | |
243 | if (!particles){ | |
244 | AliWarning("particles TObjArray is NULL pointer --> return"); | |
245 | return; | |
246 | } | |
9afe3098 | 247 | |
f06d59b3 | 248 | // define end of particle loops |
249 | Int_t iMax = particles->GetEntriesFast(); | |
250 | Int_t jMax = iMax; | |
251 | if (particlesMixed) | |
252 | jMax = particlesMixed->GetEntriesFast(); | |
253 | ||
254 | // Eta() is extremely time consuming, therefore cache it for the inner loop here: | |
255 | TObjArray* particlesSecond = (particlesMixed) ? particlesMixed : particles; | |
256 | ||
257 | TArrayF secondEta(jMax); | |
258 | TArrayF secondPhi(jMax); | |
259 | TArrayF secondPt(jMax); | |
260 | ||
261 | for (Int_t i=0; i<jMax; i++){ | |
262 | secondEta[i] = ((AliVParticle*) particlesSecond->At(i))->Eta(); | |
263 | secondPhi[i] = ((AliVParticle*) particlesSecond->At(i))->Phi(); | |
264 | secondPt[i] = ((AliVParticle*) particlesSecond->At(i))->Pt(); | |
265 | } | |
266 | ||
267 | // 1st particle loop | |
6acdbcb2 | 268 | for (Int_t i=0; i<iMax; i++) { |
269 | AliVParticle* firstParticle = (AliVParticle*) particles->At(i); | |
270 | ||
271 | // some optimization | |
272 | Float_t firstEta = firstParticle->Eta(); | |
273 | Float_t firstPhi = firstParticle->Phi(); | |
274 | Float_t firstPt = firstParticle->Pt(); | |
275 | ||
276 | // Event plane (determine psi bin) | |
277 | Double_t gPsiMinusPhi = 0.; | |
278 | Double_t gPsiMinusPhiBin = -10.; | |
279 | gPsiMinusPhi = TMath::Abs(firstPhi - gReactionPlane); | |
280 | //in-plane | |
281 | if((gPsiMinusPhi <= 7.5)|| | |
282 | ((172.5 <= gPsiMinusPhi)&&(gPsiMinusPhi <= 187.5))) | |
283 | gPsiMinusPhiBin = 0.0; | |
284 | //intermediate | |
285 | else if(((37.5 <= gPsiMinusPhi)&&(gPsiMinusPhi <= 52.5))|| | |
286 | ((127.5 <= gPsiMinusPhi)&&(gPsiMinusPhi <= 142.5))|| | |
287 | ((217.5 <= gPsiMinusPhi)&&(gPsiMinusPhi <= 232.5))|| | |
288 | ((307.5 <= gPsiMinusPhi)&&(gPsiMinusPhi <= 322.5))) | |
289 | gPsiMinusPhiBin = 1.0; | |
290 | //out of plane | |
291 | else if(((82.5 <= gPsiMinusPhi)&&(gPsiMinusPhi <= 97.5))|| | |
292 | ((262.5 <= gPsiMinusPhi)&&(gPsiMinusPhi <= 277.5))) | |
293 | gPsiMinusPhiBin = 2.0; | |
294 | //everything else | |
295 | else | |
296 | gPsiMinusPhiBin = 3.0; | |
297 | ||
298 | Short_t charge = (Short_t) firstParticle->Charge(); | |
299 | ||
300 | trackVariablesSingle[0] = gPsiMinusPhiBin; | |
301 | trackVariablesSingle[1] = firstPt; | |
302 | ||
303 | //fill single particle histograms | |
304 | if(charge > 0) fHistP->Fill(trackVariablesSingle,0,1.); | |
305 | else if(charge < 0) fHistN->Fill(trackVariablesSingle,0,1.); | |
306 | ||
307 | // 2nd particle loop (only for j < i for non double counting in the same pT region) | |
308 | // --> SAME pT region for trigger and assoc: NO double counting with this | |
309 | // --> DIFF pT region for trigger and assoc: Missing assoc. particles with j > i to a trigger i | |
310 | // --> can be handled afterwards by using assoc. as trigger as well ?! | |
a86235ae | 311 | for(Int_t j = 0; j < iMax; j++) { |
312 | ||
313 | if (particlesMixed && j == jMax-1 ) // if the mixed track number is smaller than the main event one | |
6acdbcb2 | 314 | break; |
a86235ae | 315 | |
316 | if(j == i) continue; // no auto correlations | |
9afe3098 | 317 | |
6acdbcb2 | 318 | AliVParticle* secondParticle = (AliVParticle*) particlesSecond->At(j); |
9afe3098 | 319 | |
6acdbcb2 | 320 | Short_t charge2 = (Short_t) secondParticle->Charge(); |
9afe3098 | 321 | |
6acdbcb2 | 322 | trackVariablesPair[0] = gPsiMinusPhiBin; |
323 | trackVariablesPair[1] = firstEta - secondEta[j]; // delta eta | |
324 | trackVariablesPair[2] = firstPhi - secondPhi[j]; // delta phi | |
325 | if (trackVariablesPair[2] > 180.) // delta phi between -180 and 180 | |
326 | trackVariablesPair[2] -= 360.; | |
327 | if (trackVariablesPair[2] < - 180.) | |
328 | trackVariablesPair[2] += 360.; | |
9afe3098 | 329 | |
6acdbcb2 | 330 | trackVariablesPair[3] = firstPt; // pt trigger |
331 | trackVariablesPair[4] = secondPt[j]; // pt | |
332 | // trackVariablesPair[5] = fCentrality; // centrality | |
9afe3098 | 333 | |
6acdbcb2 | 334 | if( charge > 0 && charge2 < 0) fHistPN->Fill(trackVariablesPair,0,1.); |
335 | else if( charge < 0 && charge2 > 0) fHistNP->Fill(trackVariablesPair,0,1.); | |
336 | else if( charge > 0 && charge2 > 0) fHistPP->Fill(trackVariablesPair,0,1.); | |
337 | else if( charge < 0 && charge2 < 0) fHistNN->Fill(trackVariablesPair,0,1.); | |
8795e993 | 338 | else { |
339 | //AliWarning(Form("Wrong charge combination: charge1 = %d and charge2 = %d",charge,charge2)); | |
340 | continue; | |
341 | } | |
6acdbcb2 | 342 | }//end of 2nd particle loop |
343 | }//end of 1st particle loop | |
0879e280 | 344 | } |
345 | ||
0879e280 | 346 | //____________________________________________________________________// |
9afe3098 | 347 | TH1D *AliBalancePsi::GetBalanceFunctionHistogram(Int_t iVariableSingle, |
348 | Int_t iVariablePair, | |
9afe3098 | 349 | Double_t psiMin, |
6acdbcb2 | 350 | Double_t psiMax, |
351 | Double_t ptTriggerMin, | |
352 | Double_t ptTriggerMax, | |
353 | Double_t ptAssociatedMin, | |
354 | Double_t ptAssociatedMax) { | |
9afe3098 | 355 | //Returns the BF histogram, extracted from the 6 AliTHn objects |
0879e280 | 356 | //(private members) of the AliBalancePsi class. |
621329de | 357 | //iVariableSingle: 0(phi-Psi), 1(pt-trigger) |
358 | //iVariablePair: 0(phi-Psi) 1(Delta eta), 2(Delta phi), 3(pt-trigger), 4(pt-associated | |
9afe3098 | 359 | // Psi_2 |
621329de | 360 | fHistP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); |
361 | fHistN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
362 | fHistPN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
363 | fHistNP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
364 | fHistPP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
365 | fHistNN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
9afe3098 | 366 | |
6acdbcb2 | 367 | // pt trigger |
368 | if((ptTriggerMin != -1.)&&(ptTriggerMax != -1.)) { | |
369 | fHistP->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
370 | fHistN->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
371 | fHistPN->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
372 | fHistNP->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
373 | fHistPP->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
374 | fHistNN->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
375 | } | |
376 | ||
377 | // pt associated | |
378 | if((ptAssociatedMin != -1.)&&(ptAssociatedMax != -1.)) { | |
379 | fHistPN->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax); | |
380 | fHistNP->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax); | |
381 | fHistPP->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax); | |
382 | fHistNN->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax); | |
383 | } | |
384 | ||
a38fd7f3 | 385 | //Printf("P:%lf - N:%lf - PN:%lf - NP:%lf - PP:%lf - NN:%lf",fHistP->GetEntries(0),fHistN->GetEntries(0),fHistPN->GetEntries(0),fHistNP->GetEntries(0),fHistPP->GetEntries(0),fHistNN->GetEntries(0)); |
386 | ||
9afe3098 | 387 | // Project into the wanted space (1st: analysis step, 2nd: axis) |
388 | TH1D* hTemp1 = (TH1D*)fHistPN->Project(0,iVariablePair); | |
389 | TH1D* hTemp2 = (TH1D*)fHistNP->Project(0,iVariablePair); | |
390 | TH1D* hTemp3 = (TH1D*)fHistPP->Project(0,iVariablePair); | |
391 | TH1D* hTemp4 = (TH1D*)fHistNN->Project(0,iVariablePair); | |
392 | TH1D* hTemp5 = (TH1D*)fHistP->Project(0,iVariableSingle); | |
393 | TH1D* hTemp6 = (TH1D*)fHistN->Project(0,iVariableSingle); | |
394 | ||
395 | TH1D *gHistBalanceFunctionHistogram = 0x0; | |
396 | if((hTemp1)&&(hTemp2)&&(hTemp3)&&(hTemp4)&&(hTemp5)&&(hTemp6)) { | |
397 | gHistBalanceFunctionHistogram = (TH1D*)hTemp1->Clone(); | |
398 | gHistBalanceFunctionHistogram->Reset(); | |
399 | ||
400 | switch(iVariablePair) { | |
621329de | 401 | case 1: |
9afe3098 | 402 | gHistBalanceFunctionHistogram->GetXaxis()->SetTitle("#Delta #eta"); |
403 | gHistBalanceFunctionHistogram->GetYaxis()->SetTitle("B(#Delta #eta)"); | |
404 | break; | |
621329de | 405 | case 2: |
9afe3098 | 406 | gHistBalanceFunctionHistogram->GetXaxis()->SetTitle("#Delta #phi (deg.)"); |
407 | gHistBalanceFunctionHistogram->GetYaxis()->SetTitle("B(#Delta #phi)"); | |
408 | break; | |
9afe3098 | 409 | default: |
410 | break; | |
411 | } | |
0879e280 | 412 | |
0879e280 | 413 | hTemp1->Sumw2(); |
414 | hTemp2->Sumw2(); | |
415 | hTemp3->Sumw2(); | |
416 | hTemp4->Sumw2(); | |
a38fd7f3 | 417 | hTemp1->Add(hTemp3,-1.); |
0879e280 | 418 | hTemp1->Scale(1./hTemp5->GetEntries()); |
a38fd7f3 | 419 | hTemp2->Add(hTemp4,-1.); |
0879e280 | 420 | hTemp2->Scale(1./hTemp6->GetEntries()); |
421 | gHistBalanceFunctionHistogram->Add(hTemp1,hTemp2,1.,1.); | |
9afe3098 | 422 | gHistBalanceFunctionHistogram->Scale(0.5); |
0879e280 | 423 | } |
424 | ||
0879e280 | 425 | return gHistBalanceFunctionHistogram; |
426 | } | |
a38fd7f3 | 427 | |
428 | //____________________________________________________________________// | |
621329de | 429 | TH2D *AliBalancePsi::GetBalanceFunctionDeltaEtaDeltaPhi(Double_t psiMin, |
6acdbcb2 | 430 | Double_t psiMax, |
431 | Double_t ptTriggerMin, | |
432 | Double_t ptTriggerMax, | |
433 | Double_t ptAssociatedMin, | |
434 | Double_t ptAssociatedMax) { | |
621329de | 435 | //Returns the BF histogram in Delta eta vs Delta phi, |
436 | //extracted from the 6 AliTHn objects | |
437 | //(private members) of the AliBalancePsi class. | |
438 | //iVariableSingle: 0(phi-Psi), 1(pt-trigger) | |
439 | //iVariablePair: 0(phi-Psi) 1(Delta eta), 2(Delta phi), 3(pt-trigger), 4(pt-associated | |
440 | TString histName = "gHistBalanceFunctionHistogram2D"; | |
441 | ||
442 | // Psi_2 | |
443 | fHistP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
444 | fHistN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
445 | fHistPN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
446 | fHistNP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
447 | fHistPP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
448 | fHistNN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
449 | ||
6acdbcb2 | 450 | // pt trigger |
451 | if((ptTriggerMin != -1.)&&(ptTriggerMax != -1.)) { | |
452 | fHistP->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
453 | fHistN->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
454 | fHistPN->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
455 | fHistNP->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
456 | fHistPP->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
457 | fHistNN->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
458 | } | |
459 | ||
460 | // pt associated | |
461 | if((ptAssociatedMin != -1.)&&(ptAssociatedMax != -1.)) { | |
462 | fHistPN->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax); | |
463 | fHistNP->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax); | |
464 | fHistPP->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax); | |
465 | fHistNN->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax); | |
466 | } | |
467 | ||
468 | //AliInfo(Form("P:%lf - N:%lf - PN:%lf - NP:%lf - PP:%lf - NN:%lf",fHistP->GetEntries(0),fHistN->GetEntries(0),fHistPN->GetEntries(0),fHistNP->GetEntries(0),fHistPP->GetEntries(0),fHistNN->GetEntries(0))); | |
621329de | 469 | |
470 | // Project into the wanted space (1st: analysis step, 2nd: axis) | |
471 | TH2D* hTemp1 = (TH2D*)fHistPN->Project(0,1,2); | |
472 | TH2D* hTemp2 = (TH2D*)fHistNP->Project(0,1,2); | |
473 | TH2D* hTemp3 = (TH2D*)fHistPP->Project(0,1,2); | |
474 | TH2D* hTemp4 = (TH2D*)fHistNN->Project(0,1,2); | |
475 | TH1D* hTemp5 = (TH1D*)fHistP->Project(0,1); | |
476 | TH1D* hTemp6 = (TH1D*)fHistN->Project(0,1); | |
477 | ||
478 | TH2D *gHistBalanceFunctionHistogram = 0x0; | |
479 | if((hTemp1)&&(hTemp2)&&(hTemp3)&&(hTemp4)&&(hTemp5)&&(hTemp6)) { | |
480 | gHistBalanceFunctionHistogram = (TH2D*)hTemp1->Clone(); | |
481 | gHistBalanceFunctionHistogram->Reset(); | |
482 | gHistBalanceFunctionHistogram->GetXaxis()->SetTitle("#Delta #eta"); | |
483 | gHistBalanceFunctionHistogram->GetYaxis()->SetTitle("#Delta #phi (deg.)"); | |
484 | gHistBalanceFunctionHistogram->GetZaxis()->SetTitle("B(#Delta #eta,#Delta #phi)"); | |
485 | ||
486 | hTemp1->Sumw2(); | |
487 | hTemp2->Sumw2(); | |
488 | hTemp3->Sumw2(); | |
489 | hTemp4->Sumw2(); | |
490 | hTemp1->Add(hTemp3,-1.); | |
491 | hTemp1->Scale(1./hTemp5->GetEntries()); | |
492 | hTemp2->Add(hTemp4,-1.); | |
493 | hTemp2->Scale(1./hTemp6->GetEntries()); | |
494 | gHistBalanceFunctionHistogram->Add(hTemp1,hTemp2,1.,1.); | |
495 | gHistBalanceFunctionHistogram->Scale(0.5); | |
496 | } | |
497 | ||
498 | return gHistBalanceFunctionHistogram; | |
499 | } | |
500 | ||
501 | //____________________________________________________________________// | |
502 | TH2D *AliBalancePsi::GetCorrelationFunctionPN(Double_t psiMin, | |
6acdbcb2 | 503 | Double_t psiMax, |
504 | Double_t ptTriggerMin, | |
505 | Double_t ptTriggerMax, | |
506 | Double_t ptAssociatedMin, | |
507 | Double_t ptAssociatedMax) { | |
a38fd7f3 | 508 | //Returns the 2D correlation function for (+-) pairs |
621329de | 509 | // Psi_2: axis 0 |
510 | fHistP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
511 | fHistPN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
621329de | 512 | |
6acdbcb2 | 513 | // pt trigger |
514 | if((ptTriggerMin != -1.)&&(ptTriggerMax != -1.)) { | |
515 | fHistP->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
516 | fHistPN->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
5ef8eaa7 | 517 | } |
621329de | 518 | |
6acdbcb2 | 519 | // pt associated |
520 | if((ptAssociatedMin != -1.)&&(ptAssociatedMax != -1.)) | |
521 | fHistPN->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax); | |
522 | ||
523 | //fHistP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(-0.5,2.5); | |
524 | //fHistPN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(-0.5,2.5); | |
525 | ||
526 | //TH2D *gHistTest = dynamic_cast<TH2D *>(fHistP->Project(0,0,1)); | |
527 | //TCanvas *c1 = new TCanvas("c1",""); | |
528 | //c1->cd(); | |
529 | //if(!gHistTest){ | |
530 | //AliError("Projection of fHistP = NULL"); | |
531 | //return gHistTest; | |
532 | //} | |
533 | //else{ | |
534 | //gHistTest->DrawCopy("colz"); | |
535 | //} | |
536 | ||
537 | //0:step, 1: Delta eta, 2: Delta phi | |
621329de | 538 | TH2D *gHist = dynamic_cast<TH2D *>(fHistPN->Project(0,1,2)); |
89c00c43 | 539 | if(!gHist){ |
540 | AliError("Projection of fHistPN = NULL"); | |
541 | return gHist; | |
542 | } | |
543 | ||
6acdbcb2 | 544 | //AliInfo(Form("Entries (test): %lf",(Double_t)(gHistTest->GetEntries()))); |
545 | //AliInfo(Form("Entries (1D): %lf",(Double_t)(fHistP->Project(0,1)->GetEntries()))); | |
546 | //AliInfo(Form("Entries (2D): %lf",(Double_t)(fHistPN->Project(0,1,2)->GetEntries()))); | |
621329de | 547 | |
6acdbcb2 | 548 | //TCanvas *c2 = new TCanvas("c2",""); |
549 | //c2->cd(); | |
550 | //fHistPN->Project(0,1,2)->DrawCopy("colz"); | |
621329de | 551 | |
552 | if((Double_t)(fHistP->Project(0,1)->GetEntries())!=0) | |
553 | gHist->Scale(1./(Double_t)(fHistP->Project(0,1)->GetEntries())); | |
a38fd7f3 | 554 | |
555 | return gHist; | |
556 | } | |
557 | ||
558 | //____________________________________________________________________// | |
621329de | 559 | TH2D *AliBalancePsi::GetCorrelationFunctionNP(Double_t psiMin, |
6acdbcb2 | 560 | Double_t psiMax, |
561 | Double_t ptTriggerMin, | |
562 | Double_t ptTriggerMax, | |
563 | Double_t ptAssociatedMin, | |
564 | Double_t ptAssociatedMax) { | |
a38fd7f3 | 565 | //Returns the 2D correlation function for (+-) pairs |
621329de | 566 | // Psi_2: axis 0 |
567 | fHistN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
568 | fHistNP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
a38fd7f3 | 569 | |
6acdbcb2 | 570 | // pt trigger |
571 | if((ptTriggerMin != -1.)&&(ptTriggerMax != -1.)) { | |
572 | fHistN->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
573 | fHistNP->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
574 | } | |
575 | ||
576 | // pt associated | |
577 | if((ptAssociatedMin != -1.)&&(ptAssociatedMax != -1.)) | |
578 | fHistNP->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax); | |
579 | ||
580 | //0:step, 1: Delta eta, 2: Delta phi | |
621329de | 581 | TH2D *gHist = dynamic_cast<TH2D *>(fHistNP->Project(0,1,2)); |
89c00c43 | 582 | if(!gHist){ |
583 | AliError("Projection of fHistPN = NULL"); | |
584 | return gHist; | |
585 | } | |
586 | ||
a38fd7f3 | 587 | //Printf("Entries (1D): %lf",(Double_t)(fHistN->Project(0,2)->GetEntries())); |
588 | //Printf("Entries (2D): %lf",(Double_t)(fHistNP->Project(0,2,3)->GetEntries())); | |
621329de | 589 | if((Double_t)(fHistN->Project(0,1)->GetEntries())!=0) |
590 | gHist->Scale(1./(Double_t)(fHistN->Project(0,1)->GetEntries())); | |
a38fd7f3 | 591 | |
592 | return gHist; | |
593 | } | |
594 | ||
595 | //____________________________________________________________________// | |
621329de | 596 | TH2D *AliBalancePsi::GetCorrelationFunctionPP(Double_t psiMin, |
6acdbcb2 | 597 | Double_t psiMax, |
598 | Double_t ptTriggerMin, | |
599 | Double_t ptTriggerMax, | |
600 | Double_t ptAssociatedMin, | |
601 | Double_t ptAssociatedMax) { | |
a38fd7f3 | 602 | //Returns the 2D correlation function for (+-) pairs |
621329de | 603 | // Psi_2: axis 0 |
604 | fHistP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
605 | fHistPP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
6acdbcb2 | 606 | |
607 | // pt trigger | |
608 | if((ptTriggerMin != -1.)&&(ptTriggerMax != -1.)) { | |
609 | fHistP->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
610 | fHistPP->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
611 | } | |
612 | ||
613 | // pt associated | |
614 | if((ptAssociatedMin != -1.)&&(ptAssociatedMax != -1.)) | |
615 | fHistPP->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax); | |
a38fd7f3 | 616 | |
6acdbcb2 | 617 | //0:step, 1: Delta eta, 2: Delta phi |
621329de | 618 | TH2D *gHist = dynamic_cast<TH2D *>(fHistPP->Project(0,1,2)); |
89c00c43 | 619 | if(!gHist){ |
620 | AliError("Projection of fHistPN = NULL"); | |
621 | return gHist; | |
622 | } | |
623 | ||
a38fd7f3 | 624 | //Printf("Entries (1D): %lf",(Double_t)(fHistP->Project(0,2)->GetEntries())); |
625 | //Printf("Entries (2D): %lf",(Double_t)(fHistPP->Project(0,2,3)->GetEntries())); | |
621329de | 626 | if((Double_t)(fHistP->Project(0,1)->GetEntries())!=0) |
627 | gHist->Scale(1./(Double_t)(fHistP->Project(0,1)->GetEntries())); | |
a38fd7f3 | 628 | |
629 | return gHist; | |
630 | } | |
631 | ||
632 | //____________________________________________________________________// | |
621329de | 633 | TH2D *AliBalancePsi::GetCorrelationFunctionNN(Double_t psiMin, |
6acdbcb2 | 634 | Double_t psiMax, |
635 | Double_t ptTriggerMin, | |
636 | Double_t ptTriggerMax, | |
637 | Double_t ptAssociatedMin, | |
638 | Double_t ptAssociatedMax) { | |
a38fd7f3 | 639 | //Returns the 2D correlation function for (+-) pairs |
621329de | 640 | // Psi_2: axis 0 |
641 | fHistN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
642 | fHistNN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
6acdbcb2 | 643 | |
644 | // pt trigger | |
645 | if((ptTriggerMin != -1.)&&(ptTriggerMax != -1.)) { | |
646 | fHistN->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
647 | fHistNN->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
648 | } | |
649 | ||
650 | // pt associated | |
651 | if((ptAssociatedMin != -1.)&&(ptAssociatedMax != -1.)) | |
652 | fHistNN->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax); | |
a38fd7f3 | 653 | |
6acdbcb2 | 654 | //0:step, 1: Delta eta, 2: Delta phi |
621329de | 655 | TH2D *gHist = dynamic_cast<TH2D *>(fHistNN->Project(0,1,2)); |
89c00c43 | 656 | if(!gHist){ |
657 | AliError("Projection of fHistPN = NULL"); | |
658 | return gHist; | |
659 | } | |
660 | ||
a38fd7f3 | 661 | //Printf("Entries (1D): %lf",(Double_t)(fHistN->Project(0,2)->GetEntries())); |
662 | //Printf("Entries (2D): %lf",(Double_t)(fHistNN->Project(0,2,3)->GetEntries())); | |
621329de | 663 | if((Double_t)(fHistN->Project(0,1)->GetEntries())!=0) |
664 | gHist->Scale(1./(Double_t)(fHistN->Project(0,1)->GetEntries())); | |
a38fd7f3 | 665 | |
666 | return gHist; | |
667 | } | |
621329de | 668 |