]>
Commit | Line | Data |
---|---|---|
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> | |
25 | #include <TCanvas.h> | |
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" | |
39 | #include "AliTHn.h" | |
40 | ||
41 | #include "AliBalancePsi.h" | |
42 | ||
43 | ClassImp(AliBalancePsi) | |
44 | ||
45 | //____________________________________________________________________// | |
46 | AliBalancePsi::AliBalancePsi() : | |
47 | TObject(), | |
48 | fShuffle(kFALSE), | |
49 | fAnalysisLevel("ESD"), | |
50 | fAnalyzedEvents(0) , | |
51 | fCentralityId(0) , | |
52 | fCentStart(0.), | |
53 | fCentStop(0.), | |
54 | fHistP(0), | |
55 | fHistN(0), | |
56 | fHistPN(0), | |
57 | fHistNP(0), | |
58 | fHistPP(0), | |
59 | fHistNN(0), | |
60 | fPsiInterval(15.) { | |
61 | // Default constructor | |
62 | } | |
63 | ||
64 | //____________________________________________________________________// | |
65 | AliBalancePsi::AliBalancePsi(const AliBalancePsi& balance): | |
66 | TObject(balance), fShuffle(balance.fShuffle), | |
67 | fAnalysisLevel(balance.fAnalysisLevel), | |
68 | fAnalyzedEvents(balance.fAnalyzedEvents), | |
69 | fCentralityId(balance.fCentralityId), | |
70 | fCentStart(balance.fCentStart), | |
71 | fCentStop(balance.fCentStop), | |
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) { | |
79 | //copy constructor | |
80 | } | |
81 | ||
82 | //____________________________________________________________________// | |
83 | AliBalancePsi::~AliBalancePsi() { | |
84 | // Destructor | |
85 | delete fHistP; | |
86 | delete fHistN; | |
87 | delete fHistPN; | |
88 | delete fHistNP; | |
89 | delete fHistPP; | |
90 | delete fHistNN; | |
91 | } | |
92 | ||
93 | //____________________________________________________________________// | |
94 | void AliBalancePsi::InitHistograms() { | |
95 | // single particle histograms | |
96 | Int_t anaSteps = 1; // analysis steps | |
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 | |
100 | ||
101 | // two particle histograms | |
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 | |
105 | ||
106 | //centrality | |
107 | /*const Int_t kNCentralityBins = 9; | |
108 | Double_t centralityBins[kNCentralityBins+1] = {0.,5.,10.,20.,30.,40.,50.,60.,70.,80.}; | |
109 | iBinSingle[0] = kNCentralityBins; | |
110 | dBinsSingle[0] = centralityBins; | |
111 | axisTitleSingle[0] = "Centrality percentile [%]"; | |
112 | iBinPair[0] = kNCentralityBins; | |
113 | dBinsPair[0] = centralityBins; | |
114 | axisTitlePair[0] = "Centrality percentile [%]"; */ | |
115 | ||
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}; | |
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.)"; | |
125 | ||
126 | // delta eta | |
127 | const Int_t kNDeltaEtaBins = 80; | |
128 | Double_t deltaEtaBins[kNDeltaEtaBins+1]; | |
129 | for(Int_t i = 0; i < kNDeltaEtaBins+1; i++) | |
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 | |
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 | } | |
141 | iBinPair[2] = kNDeltaPhiBins; | |
142 | dBinsPair[2] = deltaPhiBins; | |
143 | axisTitlePair[2] = "#Delta #phi (#circ)"; | |
144 | ||
145 | // pt(trigger-associated) | |
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 | //} | |
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)"; | |
158 | ||
159 | iBinPair[4] = kNPtBins; | |
160 | dBinsPair[4] = ptBins; | |
161 | axisTitlePair[4] = "p_{t}^{assoc.} (GeV/c)"; | |
162 | ||
163 | TString histName; | |
164 | //+ triggered particles | |
165 | histName = "fHistP"; | |
166 | if(fShuffle) histName.Append("_shuffle"); | |
167 | if(fCentralityId) histName += fCentralityId.Data(); | |
168 | fHistP = new AliTHn(histName.Data(),histName.Data(),anaSteps,kTrackVariablesSingle,iBinSingle); | |
169 | for (Int_t j=0; j<kTrackVariablesSingle; j++) { | |
170 | fHistP->SetBinLimits(j, dBinsSingle[j]); | |
171 | fHistP->SetVarTitle(j, axisTitleSingle[j]); | |
172 | } | |
173 | ||
174 | //- triggered particles | |
175 | histName = "fHistN"; | |
176 | if(fShuffle) histName.Append("_shuffle"); | |
177 | if(fCentralityId) histName += fCentralityId.Data(); | |
178 | fHistN = new AliTHn(histName.Data(),histName.Data(),anaSteps,kTrackVariablesSingle,iBinSingle); | |
179 | for (Int_t j=0; j<kTrackVariablesSingle; j++) { | |
180 | fHistN->SetBinLimits(j, dBinsSingle[j]); | |
181 | fHistN->SetVarTitle(j, axisTitleSingle[j]); | |
182 | } | |
183 | ||
184 | //+- pairs | |
185 | histName = "fHistPN"; | |
186 | if(fShuffle) histName.Append("_shuffle"); | |
187 | if(fCentralityId) histName += fCentralityId.Data(); | |
188 | fHistPN = new AliTHn(histName.Data(),histName.Data(),anaSteps, kTrackVariablesPair, iBinPair); | |
189 | for (Int_t j=0; j<kTrackVariablesPair; j++) { | |
190 | fHistPN->SetBinLimits(j, dBinsPair[j]); | |
191 | fHistPN->SetVarTitle(j, axisTitlePair[j]); | |
192 | } | |
193 | ||
194 | //-+ pairs | |
195 | histName = "fHistNP"; | |
196 | if(fShuffle) histName.Append("_shuffle"); | |
197 | if(fCentralityId) histName += fCentralityId.Data(); | |
198 | fHistNP = new AliTHn(histName.Data(),histName.Data(),anaSteps, kTrackVariablesPair, iBinPair); | |
199 | for (Int_t j=0; j<kTrackVariablesPair; j++) { | |
200 | fHistNP->SetBinLimits(j, dBinsPair[j]); | |
201 | fHistNP->SetVarTitle(j, axisTitlePair[j]); | |
202 | } | |
203 | ||
204 | //++ pairs | |
205 | histName = "fHistPP"; | |
206 | if(fShuffle) histName.Append("_shuffle"); | |
207 | if(fCentralityId) histName += fCentralityId.Data(); | |
208 | fHistPP = new AliTHn(histName.Data(),histName.Data(),anaSteps, kTrackVariablesPair, iBinPair); | |
209 | for (Int_t j=0; j<kTrackVariablesPair; j++) { | |
210 | fHistPP->SetBinLimits(j, dBinsPair[j]); | |
211 | fHistPP->SetVarTitle(j, axisTitlePair[j]); | |
212 | } | |
213 | ||
214 | //-- pairs | |
215 | histName = "fHistNN"; | |
216 | if(fShuffle) histName.Append("_shuffle"); | |
217 | if(fCentralityId) histName += fCentralityId.Data(); | |
218 | fHistNN = new AliTHn(histName.Data(),histName.Data(),anaSteps, kTrackVariablesPair, iBinPair); | |
219 | for (Int_t j=0; j<kTrackVariablesPair; j++) { | |
220 | fHistNN->SetBinLimits(j, dBinsPair[j]); | |
221 | fHistNN->SetVarTitle(j, axisTitlePair[j]); | |
222 | } | |
223 | AliInfo("Finished setting up the AliTHn"); | |
224 | } | |
225 | ||
226 | //____________________________________________________________________// | |
227 | void AliBalancePsi::CalculateBalance(Double_t gReactionPlane, | |
228 | TObjArray *particles, | |
229 | TObjArray *particlesMixed ) { | |
230 | // Calculates the balance function | |
231 | fAnalyzedEvents++; | |
232 | ||
233 | // Initialize histograms if not done yet | |
234 | if(!fHistPN){ | |
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 | ||
240 | Double_t trackVariablesSingle[kTrackVariablesSingle]; | |
241 | Double_t trackVariablesPair[kTrackVariablesPair]; | |
242 | ||
243 | if (!particles){ | |
244 | AliWarning("particles TObjArray is NULL pointer --> return"); | |
245 | return; | |
246 | } | |
247 | ||
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 | |
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 ?! | |
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 | |
314 | break; | |
315 | ||
316 | if(j == i) continue; // no auto correlations | |
317 | ||
318 | AliVParticle* secondParticle = (AliVParticle*) particlesSecond->At(j); | |
319 | ||
320 | Short_t charge2 = (Short_t) secondParticle->Charge(); | |
321 | ||
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.; | |
329 | ||
330 | trackVariablesPair[3] = firstPt; // pt trigger | |
331 | trackVariablesPair[4] = secondPt[j]; // pt | |
332 | // trackVariablesPair[5] = fCentrality; // centrality | |
333 | ||
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.); | |
338 | else { | |
339 | //AliWarning(Form("Wrong charge combination: charge1 = %d and charge2 = %d",charge,charge2)); | |
340 | continue; | |
341 | } | |
342 | }//end of 2nd particle loop | |
343 | }//end of 1st particle loop | |
344 | } | |
345 | ||
346 | //____________________________________________________________________// | |
347 | TH1D *AliBalancePsi::GetBalanceFunctionHistogram(Int_t iVariableSingle, | |
348 | Int_t iVariablePair, | |
349 | Double_t psiMin, | |
350 | Double_t psiMax, | |
351 | Double_t ptTriggerMin, | |
352 | Double_t ptTriggerMax, | |
353 | Double_t ptAssociatedMin, | |
354 | Double_t ptAssociatedMax) { | |
355 | //Returns the BF histogram, extracted from the 6 AliTHn objects | |
356 | //(private members) of the AliBalancePsi class. | |
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 | |
359 | // Psi_2 | |
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); | |
366 | ||
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 | ||
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 | ||
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) { | |
401 | case 1: | |
402 | gHistBalanceFunctionHistogram->GetXaxis()->SetTitle("#Delta #eta"); | |
403 | gHistBalanceFunctionHistogram->GetYaxis()->SetTitle("B(#Delta #eta)"); | |
404 | break; | |
405 | case 2: | |
406 | gHistBalanceFunctionHistogram->GetXaxis()->SetTitle("#Delta #phi (deg.)"); | |
407 | gHistBalanceFunctionHistogram->GetYaxis()->SetTitle("B(#Delta #phi)"); | |
408 | break; | |
409 | default: | |
410 | break; | |
411 | } | |
412 | ||
413 | hTemp1->Sumw2(); | |
414 | hTemp2->Sumw2(); | |
415 | hTemp3->Sumw2(); | |
416 | hTemp4->Sumw2(); | |
417 | hTemp1->Add(hTemp3,-1.); | |
418 | hTemp1->Scale(1./hTemp5->GetEntries()); | |
419 | hTemp2->Add(hTemp4,-1.); | |
420 | hTemp2->Scale(1./hTemp6->GetEntries()); | |
421 | gHistBalanceFunctionHistogram->Add(hTemp1,hTemp2,1.,1.); | |
422 | gHistBalanceFunctionHistogram->Scale(0.5); | |
423 | } | |
424 | ||
425 | return gHistBalanceFunctionHistogram; | |
426 | } | |
427 | ||
428 | //____________________________________________________________________// | |
429 | TH2D *AliBalancePsi::GetBalanceFunctionDeltaEtaDeltaPhi(Double_t psiMin, | |
430 | Double_t psiMax, | |
431 | Double_t ptTriggerMin, | |
432 | Double_t ptTriggerMax, | |
433 | Double_t ptAssociatedMin, | |
434 | Double_t ptAssociatedMax) { | |
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 | ||
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))); | |
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, | |
503 | Double_t psiMax, | |
504 | Double_t ptTriggerMin, | |
505 | Double_t ptTriggerMax, | |
506 | Double_t ptAssociatedMin, | |
507 | Double_t ptAssociatedMax) { | |
508 | //Returns the 2D correlation function for (+-) pairs | |
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); | |
512 | ||
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); | |
517 | } | |
518 | ||
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 | |
538 | TH2D *gHist = dynamic_cast<TH2D *>(fHistPN->Project(0,1,2)); | |
539 | if(!gHist){ | |
540 | AliError("Projection of fHistPN = NULL"); | |
541 | return gHist; | |
542 | } | |
543 | ||
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()))); | |
547 | ||
548 | //TCanvas *c2 = new TCanvas("c2",""); | |
549 | //c2->cd(); | |
550 | //fHistPN->Project(0,1,2)->DrawCopy("colz"); | |
551 | ||
552 | if((Double_t)(fHistP->Project(0,1)->GetEntries())!=0) | |
553 | gHist->Scale(1./(Double_t)(fHistP->Project(0,1)->GetEntries())); | |
554 | ||
555 | return gHist; | |
556 | } | |
557 | ||
558 | //____________________________________________________________________// | |
559 | TH2D *AliBalancePsi::GetCorrelationFunctionNP(Double_t psiMin, | |
560 | Double_t psiMax, | |
561 | Double_t ptTriggerMin, | |
562 | Double_t ptTriggerMax, | |
563 | Double_t ptAssociatedMin, | |
564 | Double_t ptAssociatedMax) { | |
565 | //Returns the 2D correlation function for (+-) pairs | |
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); | |
569 | ||
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 | |
581 | TH2D *gHist = dynamic_cast<TH2D *>(fHistNP->Project(0,1,2)); | |
582 | if(!gHist){ | |
583 | AliError("Projection of fHistPN = NULL"); | |
584 | return gHist; | |
585 | } | |
586 | ||
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())); | |
589 | if((Double_t)(fHistN->Project(0,1)->GetEntries())!=0) | |
590 | gHist->Scale(1./(Double_t)(fHistN->Project(0,1)->GetEntries())); | |
591 | ||
592 | return gHist; | |
593 | } | |
594 | ||
595 | //____________________________________________________________________// | |
596 | TH2D *AliBalancePsi::GetCorrelationFunctionPP(Double_t psiMin, | |
597 | Double_t psiMax, | |
598 | Double_t ptTriggerMin, | |
599 | Double_t ptTriggerMax, | |
600 | Double_t ptAssociatedMin, | |
601 | Double_t ptAssociatedMax) { | |
602 | //Returns the 2D correlation function for (+-) pairs | |
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); | |
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); | |
616 | ||
617 | //0:step, 1: Delta eta, 2: Delta phi | |
618 | TH2D *gHist = dynamic_cast<TH2D *>(fHistPP->Project(0,1,2)); | |
619 | if(!gHist){ | |
620 | AliError("Projection of fHistPN = NULL"); | |
621 | return gHist; | |
622 | } | |
623 | ||
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())); | |
626 | if((Double_t)(fHistP->Project(0,1)->GetEntries())!=0) | |
627 | gHist->Scale(1./(Double_t)(fHistP->Project(0,1)->GetEntries())); | |
628 | ||
629 | return gHist; | |
630 | } | |
631 | ||
632 | //____________________________________________________________________// | |
633 | TH2D *AliBalancePsi::GetCorrelationFunctionNN(Double_t psiMin, | |
634 | Double_t psiMax, | |
635 | Double_t ptTriggerMin, | |
636 | Double_t ptTriggerMax, | |
637 | Double_t ptAssociatedMin, | |
638 | Double_t ptAssociatedMax) { | |
639 | //Returns the 2D correlation function for (+-) pairs | |
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); | |
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); | |
653 | ||
654 | //0:step, 1: Delta eta, 2: Delta phi | |
655 | TH2D *gHist = dynamic_cast<TH2D *>(fHistNN->Project(0,1,2)); | |
656 | if(!gHist){ | |
657 | AliError("Projection of fHistPN = NULL"); | |
658 | return gHist; | |
659 | } | |
660 | ||
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())); | |
663 | if((Double_t)(fHistN->Project(0,1)->GetEntries())!=0) | |
664 | gHist->Scale(1./(Double_t)(fHistN->Project(0,1)->GetEntries())); | |
665 | ||
666 | return gHist; | |
667 | } | |
668 |