]>
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 ?! | |
67538f31 | 311 | for(Int_t j = 0; j < iMax; j++) { // or go to full here (everything prepared)? |
312 | if(j == i) continue; | |
6acdbcb2 | 313 | if (particlesMixed && jMax < i) // if the mixed track number is smaller than the main event one (could be done better if one loops over all tracks) |
314 | break; | |
9afe3098 | 315 | |
6acdbcb2 | 316 | AliVParticle* secondParticle = (AliVParticle*) particlesSecond->At(j); |
9afe3098 | 317 | |
6acdbcb2 | 318 | Short_t charge2 = (Short_t) secondParticle->Charge(); |
9afe3098 | 319 | |
6acdbcb2 | 320 | trackVariablesPair[0] = gPsiMinusPhiBin; |
321 | trackVariablesPair[1] = firstEta - secondEta[j]; // delta eta | |
322 | trackVariablesPair[2] = firstPhi - secondPhi[j]; // delta phi | |
323 | if (trackVariablesPair[2] > 180.) // delta phi between -180 and 180 | |
324 | trackVariablesPair[2] -= 360.; | |
325 | if (trackVariablesPair[2] < - 180.) | |
326 | trackVariablesPair[2] += 360.; | |
9afe3098 | 327 | |
6acdbcb2 | 328 | trackVariablesPair[3] = firstPt; // pt trigger |
329 | trackVariablesPair[4] = secondPt[j]; // pt | |
330 | // trackVariablesPair[5] = fCentrality; // centrality | |
9afe3098 | 331 | |
6acdbcb2 | 332 | if( charge > 0 && charge2 < 0) fHistPN->Fill(trackVariablesPair,0,1.); |
333 | else if( charge < 0 && charge2 > 0) fHistNP->Fill(trackVariablesPair,0,1.); | |
334 | else if( charge > 0 && charge2 > 0) fHistPP->Fill(trackVariablesPair,0,1.); | |
335 | else if( charge < 0 && charge2 < 0) fHistNN->Fill(trackVariablesPair,0,1.); | |
8795e993 | 336 | else { |
337 | //AliWarning(Form("Wrong charge combination: charge1 = %d and charge2 = %d",charge,charge2)); | |
338 | continue; | |
339 | } | |
6acdbcb2 | 340 | }//end of 2nd particle loop |
341 | }//end of 1st particle loop | |
0879e280 | 342 | } |
343 | ||
0879e280 | 344 | //____________________________________________________________________// |
9afe3098 | 345 | TH1D *AliBalancePsi::GetBalanceFunctionHistogram(Int_t iVariableSingle, |
346 | Int_t iVariablePair, | |
9afe3098 | 347 | Double_t psiMin, |
6acdbcb2 | 348 | Double_t psiMax, |
349 | Double_t ptTriggerMin, | |
350 | Double_t ptTriggerMax, | |
351 | Double_t ptAssociatedMin, | |
352 | Double_t ptAssociatedMax) { | |
9afe3098 | 353 | //Returns the BF histogram, extracted from the 6 AliTHn objects |
0879e280 | 354 | //(private members) of the AliBalancePsi class. |
621329de | 355 | //iVariableSingle: 0(phi-Psi), 1(pt-trigger) |
356 | //iVariablePair: 0(phi-Psi) 1(Delta eta), 2(Delta phi), 3(pt-trigger), 4(pt-associated | |
9afe3098 | 357 | // Psi_2 |
621329de | 358 | fHistP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); |
359 | fHistN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
360 | fHistPN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
361 | fHistNP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
362 | fHistPP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
363 | fHistNN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
9afe3098 | 364 | |
6acdbcb2 | 365 | // pt trigger |
366 | if((ptTriggerMin != -1.)&&(ptTriggerMax != -1.)) { | |
367 | fHistP->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
368 | fHistN->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
369 | fHistPN->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
370 | fHistNP->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
371 | fHistPP->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
372 | fHistNN->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
373 | } | |
374 | ||
375 | // pt associated | |
376 | if((ptAssociatedMin != -1.)&&(ptAssociatedMax != -1.)) { | |
377 | fHistPN->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax); | |
378 | fHistNP->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax); | |
379 | fHistPP->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax); | |
380 | fHistNN->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax); | |
381 | } | |
382 | ||
a38fd7f3 | 383 | //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)); |
384 | ||
9afe3098 | 385 | // Project into the wanted space (1st: analysis step, 2nd: axis) |
386 | TH1D* hTemp1 = (TH1D*)fHistPN->Project(0,iVariablePair); | |
387 | TH1D* hTemp2 = (TH1D*)fHistNP->Project(0,iVariablePair); | |
388 | TH1D* hTemp3 = (TH1D*)fHistPP->Project(0,iVariablePair); | |
389 | TH1D* hTemp4 = (TH1D*)fHistNN->Project(0,iVariablePair); | |
390 | TH1D* hTemp5 = (TH1D*)fHistP->Project(0,iVariableSingle); | |
391 | TH1D* hTemp6 = (TH1D*)fHistN->Project(0,iVariableSingle); | |
392 | ||
393 | TH1D *gHistBalanceFunctionHistogram = 0x0; | |
394 | if((hTemp1)&&(hTemp2)&&(hTemp3)&&(hTemp4)&&(hTemp5)&&(hTemp6)) { | |
395 | gHistBalanceFunctionHistogram = (TH1D*)hTemp1->Clone(); | |
396 | gHistBalanceFunctionHistogram->Reset(); | |
397 | ||
398 | switch(iVariablePair) { | |
621329de | 399 | case 1: |
9afe3098 | 400 | gHistBalanceFunctionHistogram->GetXaxis()->SetTitle("#Delta #eta"); |
401 | gHistBalanceFunctionHistogram->GetYaxis()->SetTitle("B(#Delta #eta)"); | |
402 | break; | |
621329de | 403 | case 2: |
9afe3098 | 404 | gHistBalanceFunctionHistogram->GetXaxis()->SetTitle("#Delta #phi (deg.)"); |
405 | gHistBalanceFunctionHistogram->GetYaxis()->SetTitle("B(#Delta #phi)"); | |
406 | break; | |
9afe3098 | 407 | default: |
408 | break; | |
409 | } | |
0879e280 | 410 | |
0879e280 | 411 | hTemp1->Sumw2(); |
412 | hTemp2->Sumw2(); | |
413 | hTemp3->Sumw2(); | |
414 | hTemp4->Sumw2(); | |
a38fd7f3 | 415 | hTemp1->Add(hTemp3,-1.); |
0879e280 | 416 | hTemp1->Scale(1./hTemp5->GetEntries()); |
a38fd7f3 | 417 | hTemp2->Add(hTemp4,-1.); |
0879e280 | 418 | hTemp2->Scale(1./hTemp6->GetEntries()); |
419 | gHistBalanceFunctionHistogram->Add(hTemp1,hTemp2,1.,1.); | |
9afe3098 | 420 | gHistBalanceFunctionHistogram->Scale(0.5); |
0879e280 | 421 | } |
422 | ||
0879e280 | 423 | return gHistBalanceFunctionHistogram; |
424 | } | |
a38fd7f3 | 425 | |
426 | //____________________________________________________________________// | |
621329de | 427 | TH2D *AliBalancePsi::GetBalanceFunctionDeltaEtaDeltaPhi(Double_t psiMin, |
6acdbcb2 | 428 | Double_t psiMax, |
429 | Double_t ptTriggerMin, | |
430 | Double_t ptTriggerMax, | |
431 | Double_t ptAssociatedMin, | |
432 | Double_t ptAssociatedMax) { | |
621329de | 433 | //Returns the BF histogram in Delta eta vs Delta phi, |
434 | //extracted from the 6 AliTHn objects | |
435 | //(private members) of the AliBalancePsi class. | |
436 | //iVariableSingle: 0(phi-Psi), 1(pt-trigger) | |
437 | //iVariablePair: 0(phi-Psi) 1(Delta eta), 2(Delta phi), 3(pt-trigger), 4(pt-associated | |
438 | TString histName = "gHistBalanceFunctionHistogram2D"; | |
439 | ||
440 | // Psi_2 | |
441 | fHistP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
442 | fHistN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
443 | fHistPN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
444 | fHistNP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
445 | fHistPP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
446 | fHistNN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
447 | ||
6acdbcb2 | 448 | // pt trigger |
449 | if((ptTriggerMin != -1.)&&(ptTriggerMax != -1.)) { | |
450 | fHistP->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
451 | fHistN->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
452 | fHistPN->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
453 | fHistNP->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
454 | fHistPP->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
455 | fHistNN->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
456 | } | |
457 | ||
458 | // pt associated | |
459 | if((ptAssociatedMin != -1.)&&(ptAssociatedMax != -1.)) { | |
460 | fHistPN->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax); | |
461 | fHistNP->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax); | |
462 | fHistPP->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax); | |
463 | fHistNN->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax); | |
464 | } | |
465 | ||
466 | //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 | 467 | |
468 | // Project into the wanted space (1st: analysis step, 2nd: axis) | |
469 | TH2D* hTemp1 = (TH2D*)fHistPN->Project(0,1,2); | |
470 | TH2D* hTemp2 = (TH2D*)fHistNP->Project(0,1,2); | |
471 | TH2D* hTemp3 = (TH2D*)fHistPP->Project(0,1,2); | |
472 | TH2D* hTemp4 = (TH2D*)fHistNN->Project(0,1,2); | |
473 | TH1D* hTemp5 = (TH1D*)fHistP->Project(0,1); | |
474 | TH1D* hTemp6 = (TH1D*)fHistN->Project(0,1); | |
475 | ||
476 | TH2D *gHistBalanceFunctionHistogram = 0x0; | |
477 | if((hTemp1)&&(hTemp2)&&(hTemp3)&&(hTemp4)&&(hTemp5)&&(hTemp6)) { | |
478 | gHistBalanceFunctionHistogram = (TH2D*)hTemp1->Clone(); | |
479 | gHistBalanceFunctionHistogram->Reset(); | |
480 | gHistBalanceFunctionHistogram->GetXaxis()->SetTitle("#Delta #eta"); | |
481 | gHistBalanceFunctionHistogram->GetYaxis()->SetTitle("#Delta #phi (deg.)"); | |
482 | gHistBalanceFunctionHistogram->GetZaxis()->SetTitle("B(#Delta #eta,#Delta #phi)"); | |
483 | ||
484 | hTemp1->Sumw2(); | |
485 | hTemp2->Sumw2(); | |
486 | hTemp3->Sumw2(); | |
487 | hTemp4->Sumw2(); | |
488 | hTemp1->Add(hTemp3,-1.); | |
489 | hTemp1->Scale(1./hTemp5->GetEntries()); | |
490 | hTemp2->Add(hTemp4,-1.); | |
491 | hTemp2->Scale(1./hTemp6->GetEntries()); | |
492 | gHistBalanceFunctionHistogram->Add(hTemp1,hTemp2,1.,1.); | |
493 | gHistBalanceFunctionHistogram->Scale(0.5); | |
494 | } | |
495 | ||
496 | return gHistBalanceFunctionHistogram; | |
497 | } | |
498 | ||
499 | //____________________________________________________________________// | |
500 | TH2D *AliBalancePsi::GetCorrelationFunctionPN(Double_t psiMin, | |
6acdbcb2 | 501 | Double_t psiMax, |
502 | Double_t ptTriggerMin, | |
503 | Double_t ptTriggerMax, | |
504 | Double_t ptAssociatedMin, | |
505 | Double_t ptAssociatedMax) { | |
a38fd7f3 | 506 | //Returns the 2D correlation function for (+-) pairs |
621329de | 507 | // Psi_2: axis 0 |
508 | fHistP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
509 | fHistPN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
621329de | 510 | |
6acdbcb2 | 511 | // pt trigger |
512 | if((ptTriggerMin != -1.)&&(ptTriggerMax != -1.)) { | |
513 | fHistP->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
514 | fHistPN->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
5ef8eaa7 | 515 | } |
621329de | 516 | |
6acdbcb2 | 517 | // pt associated |
518 | if((ptAssociatedMin != -1.)&&(ptAssociatedMax != -1.)) | |
519 | fHistPN->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax); | |
520 | ||
521 | //fHistP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(-0.5,2.5); | |
522 | //fHistPN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(-0.5,2.5); | |
523 | ||
524 | //TH2D *gHistTest = dynamic_cast<TH2D *>(fHistP->Project(0,0,1)); | |
525 | //TCanvas *c1 = new TCanvas("c1",""); | |
526 | //c1->cd(); | |
527 | //if(!gHistTest){ | |
528 | //AliError("Projection of fHistP = NULL"); | |
529 | //return gHistTest; | |
530 | //} | |
531 | //else{ | |
532 | //gHistTest->DrawCopy("colz"); | |
533 | //} | |
534 | ||
535 | //0:step, 1: Delta eta, 2: Delta phi | |
621329de | 536 | TH2D *gHist = dynamic_cast<TH2D *>(fHistPN->Project(0,1,2)); |
89c00c43 | 537 | if(!gHist){ |
538 | AliError("Projection of fHistPN = NULL"); | |
539 | return gHist; | |
540 | } | |
541 | ||
6acdbcb2 | 542 | //AliInfo(Form("Entries (test): %lf",(Double_t)(gHistTest->GetEntries()))); |
543 | //AliInfo(Form("Entries (1D): %lf",(Double_t)(fHistP->Project(0,1)->GetEntries()))); | |
544 | //AliInfo(Form("Entries (2D): %lf",(Double_t)(fHistPN->Project(0,1,2)->GetEntries()))); | |
621329de | 545 | |
6acdbcb2 | 546 | //TCanvas *c2 = new TCanvas("c2",""); |
547 | //c2->cd(); | |
548 | //fHistPN->Project(0,1,2)->DrawCopy("colz"); | |
621329de | 549 | |
550 | if((Double_t)(fHistP->Project(0,1)->GetEntries())!=0) | |
551 | gHist->Scale(1./(Double_t)(fHistP->Project(0,1)->GetEntries())); | |
a38fd7f3 | 552 | |
553 | return gHist; | |
554 | } | |
555 | ||
556 | //____________________________________________________________________// | |
621329de | 557 | TH2D *AliBalancePsi::GetCorrelationFunctionNP(Double_t psiMin, |
6acdbcb2 | 558 | Double_t psiMax, |
559 | Double_t ptTriggerMin, | |
560 | Double_t ptTriggerMax, | |
561 | Double_t ptAssociatedMin, | |
562 | Double_t ptAssociatedMax) { | |
a38fd7f3 | 563 | //Returns the 2D correlation function for (+-) pairs |
621329de | 564 | // Psi_2: axis 0 |
565 | fHistN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
566 | fHistNP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
a38fd7f3 | 567 | |
6acdbcb2 | 568 | // pt trigger |
569 | if((ptTriggerMin != -1.)&&(ptTriggerMax != -1.)) { | |
570 | fHistN->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
571 | fHistNP->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
572 | } | |
573 | ||
574 | // pt associated | |
575 | if((ptAssociatedMin != -1.)&&(ptAssociatedMax != -1.)) | |
576 | fHistNP->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax); | |
577 | ||
578 | //0:step, 1: Delta eta, 2: Delta phi | |
621329de | 579 | TH2D *gHist = dynamic_cast<TH2D *>(fHistNP->Project(0,1,2)); |
89c00c43 | 580 | if(!gHist){ |
581 | AliError("Projection of fHistPN = NULL"); | |
582 | return gHist; | |
583 | } | |
584 | ||
a38fd7f3 | 585 | //Printf("Entries (1D): %lf",(Double_t)(fHistN->Project(0,2)->GetEntries())); |
586 | //Printf("Entries (2D): %lf",(Double_t)(fHistNP->Project(0,2,3)->GetEntries())); | |
621329de | 587 | if((Double_t)(fHistN->Project(0,1)->GetEntries())!=0) |
588 | gHist->Scale(1./(Double_t)(fHistN->Project(0,1)->GetEntries())); | |
a38fd7f3 | 589 | |
590 | return gHist; | |
591 | } | |
592 | ||
593 | //____________________________________________________________________// | |
621329de | 594 | TH2D *AliBalancePsi::GetCorrelationFunctionPP(Double_t psiMin, |
6acdbcb2 | 595 | Double_t psiMax, |
596 | Double_t ptTriggerMin, | |
597 | Double_t ptTriggerMax, | |
598 | Double_t ptAssociatedMin, | |
599 | Double_t ptAssociatedMax) { | |
a38fd7f3 | 600 | //Returns the 2D correlation function for (+-) pairs |
621329de | 601 | // Psi_2: axis 0 |
602 | fHistP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
603 | fHistPP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
6acdbcb2 | 604 | |
605 | // pt trigger | |
606 | if((ptTriggerMin != -1.)&&(ptTriggerMax != -1.)) { | |
607 | fHistP->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
608 | fHistPP->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
609 | } | |
610 | ||
611 | // pt associated | |
612 | if((ptAssociatedMin != -1.)&&(ptAssociatedMax != -1.)) | |
613 | fHistPP->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax); | |
a38fd7f3 | 614 | |
6acdbcb2 | 615 | //0:step, 1: Delta eta, 2: Delta phi |
621329de | 616 | TH2D *gHist = dynamic_cast<TH2D *>(fHistPP->Project(0,1,2)); |
89c00c43 | 617 | if(!gHist){ |
618 | AliError("Projection of fHistPN = NULL"); | |
619 | return gHist; | |
620 | } | |
621 | ||
a38fd7f3 | 622 | //Printf("Entries (1D): %lf",(Double_t)(fHistP->Project(0,2)->GetEntries())); |
623 | //Printf("Entries (2D): %lf",(Double_t)(fHistPP->Project(0,2,3)->GetEntries())); | |
621329de | 624 | if((Double_t)(fHistP->Project(0,1)->GetEntries())!=0) |
625 | gHist->Scale(1./(Double_t)(fHistP->Project(0,1)->GetEntries())); | |
a38fd7f3 | 626 | |
627 | return gHist; | |
628 | } | |
629 | ||
630 | //____________________________________________________________________// | |
621329de | 631 | TH2D *AliBalancePsi::GetCorrelationFunctionNN(Double_t psiMin, |
6acdbcb2 | 632 | Double_t psiMax, |
633 | Double_t ptTriggerMin, | |
634 | Double_t ptTriggerMax, | |
635 | Double_t ptAssociatedMin, | |
636 | Double_t ptAssociatedMax) { | |
a38fd7f3 | 637 | //Returns the 2D correlation function for (+-) pairs |
621329de | 638 | // Psi_2: axis 0 |
639 | fHistN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
640 | fHistNN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax); | |
6acdbcb2 | 641 | |
642 | // pt trigger | |
643 | if((ptTriggerMin != -1.)&&(ptTriggerMax != -1.)) { | |
644 | fHistN->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
645 | fHistNN->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax); | |
646 | } | |
647 | ||
648 | // pt associated | |
649 | if((ptAssociatedMin != -1.)&&(ptAssociatedMax != -1.)) | |
650 | fHistNN->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax); | |
a38fd7f3 | 651 | |
6acdbcb2 | 652 | //0:step, 1: Delta eta, 2: Delta phi |
621329de | 653 | TH2D *gHist = dynamic_cast<TH2D *>(fHistNN->Project(0,1,2)); |
89c00c43 | 654 | if(!gHist){ |
655 | AliError("Projection of fHistPN = NULL"); | |
656 | return gHist; | |
657 | } | |
658 | ||
a38fd7f3 | 659 | //Printf("Entries (1D): %lf",(Double_t)(fHistN->Project(0,2)->GetEntries())); |
660 | //Printf("Entries (2D): %lf",(Double_t)(fHistNN->Project(0,2,3)->GetEntries())); | |
621329de | 661 | if((Double_t)(fHistN->Project(0,1)->GetEntries())!=0) |
662 | gHist->Scale(1./(Double_t)(fHistN->Project(0,1)->GetEntries())); | |
a38fd7f3 | 663 | |
664 | return gHist; | |
665 | } | |
621329de | 666 |