1 /**************************************************************************
2 * Author: Panos Christakoglou. *
3 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
14 /* $Id: AliBalancePsi.cxx 54125 2012-01-24 21:07:41Z miweber $ */
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 //-----------------------------------------------------------------
24 #include <Riostream.h>
30 #include <TLorentzVector.h>
31 #include <TObjArray.h>
32 #include <TGraphErrors.h>
35 #include "AliVParticle.h"
36 #include "AliMCParticle.h"
37 #include "AliESDtrack.h"
38 #include "AliAODTrack.h"
40 #include "AliAnalysisTaskTriggeredBF.h"
42 #include "AliBalancePsi.h"
44 ClassImp(AliBalancePsi)
46 //____________________________________________________________________//
47 AliBalancePsi::AliBalancePsi() :
50 fAnalysisLevel("ESD"),
63 fHistConversionbefore(0),
64 fHistConversionafter(0),
69 fConversionCut(kFALSE),
70 fEventClass("EventPlane"){
71 // Default constructor
74 //____________________________________________________________________//
75 AliBalancePsi::AliBalancePsi(const AliBalancePsi& balance):
76 TObject(balance), fShuffle(balance.fShuffle),
77 fAnalysisLevel(balance.fAnalysisLevel),
78 fAnalyzedEvents(balance.fAnalyzedEvents),
79 fCentralityId(balance.fCentralityId),
80 fCentStart(balance.fCentStart),
81 fCentStop(balance.fCentStop),
82 fHistP(balance.fHistP),
83 fHistN(balance.fHistN),
84 fHistPN(balance.fHistPN),
85 fHistNP(balance.fHistNP),
86 fHistPP(balance.fHistPP),
87 fHistNN(balance.fHistNN),
88 fHistHBTbefore(balance.fHistHBTbefore),
89 fHistHBTafter(balance.fHistHBTafter),
90 fHistConversionbefore(balance.fHistConversionbefore),
91 fHistConversionafter(balance.fHistConversionafter),
92 fHistPsiMinusPhi(balance.fHistPsiMinusPhi),
93 fPsiInterval(balance.fPsiInterval),
94 fDeltaEtaMax(balance.fDeltaEtaMax),
95 fHBTCut(balance.fHBTCut),
96 fConversionCut(balance.fConversionCut),
97 fEventClass("EventPlane"){
101 //____________________________________________________________________//
102 AliBalancePsi::~AliBalancePsi() {
111 delete fHistHBTbefore;
112 delete fHistHBTafter;
113 delete fHistConversionbefore;
114 delete fHistConversionafter;
115 delete fHistPsiMinusPhi;
119 //____________________________________________________________________//
120 void AliBalancePsi::InitHistograms() {
121 // single particle histograms
123 // global switch disabling the reference
124 // (to avoid "Replacing existing TH1" if several wagons are created in train)
125 Bool_t oldStatus = TH1::AddDirectoryStatus();
126 TH1::AddDirectory(kFALSE);
128 Int_t anaSteps = 1; // analysis steps
129 Int_t iBinSingle[kTrackVariablesSingle]; // binning for track variables
130 Double_t* dBinsSingle[kTrackVariablesSingle]; // bins for track variables
131 TString axisTitleSingle[kTrackVariablesSingle]; // axis titles for track variables
133 // two particle histograms
134 Int_t iBinPair[kTrackVariablesPair]; // binning for track variables
135 Double_t* dBinsPair[kTrackVariablesPair]; // bins for track variables
136 TString axisTitlePair[kTrackVariablesPair]; // axis titles for track variables
137 /**********************************************************
139 ======> Modification: Change Event Classification Scheme
141 ---> fEventClass == "EventPlane"
143 Default operation with Event Plane
145 ---> fEventClass == "Multiplicity"
147 Work with kTPCITStracklet multiplicity (from GetReferenceMultiplicity)
149 ---> fEventClass == "Centrality"
151 Work with Centrality Bins
153 ***********************************************************/
155 //--- Multiplicity Bins ------------------------------------
156 const Int_t kMultBins = 8;
157 //A first rough attempt at four bins
158 Double_t kMultBinLimits[kMultBins+1]={0,10,20,30,40,50,60,70,80};
159 //----------------------------------------------------------
161 //--- Centrality Bins --------------------------------------
162 const Int_t kNCentralityBins = 9;
163 Double_t centralityBins[kNCentralityBins+1] = {0.,5.,10.,20.,30.,40.,50.,60.,70.,80.};
164 //----------------------------------------------------------
166 //--- Event Plane Bins -------------------------------------
167 //Psi_2: -0.5->0.5 (in plane), 0.5->1.5 (intermediate), 1.5->2.5 (out of plane), 2.5->3.5 (rest)
168 const Int_t kNPsi2Bins = 4;
169 Double_t psi2Bins[kNPsi2Bins+1] = {-0.5,0.5,1.5,2.5,3.5};
170 //----------------------------------------------------------
172 //Depending on fEventClass Variable, do one thing or the other...
173 if(fEventClass == "Multiplicity"){
174 iBinSingle[0] = kMultBins;
175 dBinsSingle[0] = kMultBinLimits;
176 axisTitleSingle[0] = "kTPCITStracklet multiplicity";
177 iBinPair[0] = kMultBins;
178 dBinsPair[0] = kMultBinLimits;
179 axisTitlePair[0] = "kTPCITStracklet multiplicity";
181 if(fEventClass == "Centrality"){
182 iBinSingle[0] = kNCentralityBins;
183 dBinsSingle[0] = centralityBins;
184 axisTitleSingle[0] = "Centrality percentile [%]";
185 iBinPair[0] = kNCentralityBins;
186 dBinsPair[0] = centralityBins;
187 axisTitlePair[0] = "Centrality percentile [%]";
189 if(fEventClass == "EventPlane"){
190 iBinSingle[0] = kNPsi2Bins;
191 dBinsSingle[0] = psi2Bins;
192 axisTitleSingle[0] = "#varphi - #Psi_{2} (a.u.)";
193 iBinPair[0] = kNPsi2Bins;
194 dBinsPair[0] = psi2Bins;
195 axisTitlePair[0] = "#varphi - #Psi_{2} (a.u.)";
199 const Int_t kNDeltaEtaBins = 80;
200 Double_t deltaEtaBins[kNDeltaEtaBins+1];
201 for(Int_t i = 0; i < kNDeltaEtaBins+1; i++)
202 deltaEtaBins[i] = - fDeltaEtaMax + i * 2 * fDeltaEtaMax / (Double_t)kNDeltaEtaBins;
203 iBinPair[1] = kNDeltaEtaBins;
204 dBinsPair[1] = deltaEtaBins;
205 axisTitlePair[1] = "#Delta#eta";
208 const Int_t kNDeltaPhiBins = 72;
209 Double_t deltaPhiBins[kNDeltaPhiBins+1];
210 for(Int_t i = 0; i < kNDeltaPhiBins+1; i++){
211 //deltaPhiBins[i] = -180.0 + i * 5.;
212 deltaPhiBins[i] = -TMath::Pi()/2. + i * 5.*TMath::Pi()/180.;
214 iBinPair[2] = kNDeltaPhiBins;
215 dBinsPair[2] = deltaPhiBins;
216 axisTitlePair[2] = "#Delta#varphi (rad)";
218 // pt(trigger-associated)
219 const Int_t kNPtBins = 16;
220 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.};
221 //for(Int_t i = 0; i < kNPtBins+1; i++){
222 //ptBins[i] = 0.2 + i * 0.5;
224 iBinSingle[1] = kNPtBins;
225 dBinsSingle[1] = ptBins;
226 axisTitleSingle[1] = "p_{T,trig.} (GeV/c)";
228 iBinPair[3] = kNPtBins;
229 dBinsPair[3] = ptBins;
230 axisTitlePair[3] = "p_{T,trig.} (GeV/c)";
232 iBinPair[4] = kNPtBins;
233 dBinsPair[4] = ptBins;
234 axisTitlePair[4] = "p_{T,assoc.} (GeV/c)";
237 //+ triggered particles
239 if(fShuffle) histName.Append("_shuffle");
240 if(fCentralityId) histName += fCentralityId.Data();
241 fHistP = new AliTHn(histName.Data(),histName.Data(),anaSteps,kTrackVariablesSingle,iBinSingle);
242 for (Int_t j=0; j<kTrackVariablesSingle; j++) {
243 fHistP->SetBinLimits(j, dBinsSingle[j]);
244 fHistP->SetVarTitle(j, axisTitleSingle[j]);
247 //- triggered particles
249 if(fShuffle) histName.Append("_shuffle");
250 if(fCentralityId) histName += fCentralityId.Data();
251 fHistN = new AliTHn(histName.Data(),histName.Data(),anaSteps,kTrackVariablesSingle,iBinSingle);
252 for (Int_t j=0; j<kTrackVariablesSingle; j++) {
253 fHistN->SetBinLimits(j, dBinsSingle[j]);
254 fHistN->SetVarTitle(j, axisTitleSingle[j]);
258 histName = "fHistPN";
259 if(fShuffle) histName.Append("_shuffle");
260 if(fCentralityId) histName += fCentralityId.Data();
261 fHistPN = new AliTHn(histName.Data(),histName.Data(),anaSteps, kTrackVariablesPair, iBinPair);
262 for (Int_t j=0; j<kTrackVariablesPair; j++) {
263 fHistPN->SetBinLimits(j, dBinsPair[j]);
264 fHistPN->SetVarTitle(j, axisTitlePair[j]);
268 histName = "fHistNP";
269 if(fShuffle) histName.Append("_shuffle");
270 if(fCentralityId) histName += fCentralityId.Data();
271 fHistNP = new AliTHn(histName.Data(),histName.Data(),anaSteps, kTrackVariablesPair, iBinPair);
272 for (Int_t j=0; j<kTrackVariablesPair; j++) {
273 fHistNP->SetBinLimits(j, dBinsPair[j]);
274 fHistNP->SetVarTitle(j, axisTitlePair[j]);
278 histName = "fHistPP";
279 if(fShuffle) histName.Append("_shuffle");
280 if(fCentralityId) histName += fCentralityId.Data();
281 fHistPP = new AliTHn(histName.Data(),histName.Data(),anaSteps, kTrackVariablesPair, iBinPair);
282 for (Int_t j=0; j<kTrackVariablesPair; j++) {
283 fHistPP->SetBinLimits(j, dBinsPair[j]);
284 fHistPP->SetVarTitle(j, axisTitlePair[j]);
288 histName = "fHistNN";
289 if(fShuffle) histName.Append("_shuffle");
290 if(fCentralityId) histName += fCentralityId.Data();
291 fHistNN = new AliTHn(histName.Data(),histName.Data(),anaSteps, kTrackVariablesPair, iBinPair);
292 for (Int_t j=0; j<kTrackVariablesPair; j++) {
293 fHistNN->SetBinLimits(j, dBinsPair[j]);
294 fHistNN->SetVarTitle(j, axisTitlePair[j]);
296 AliInfo("Finished setting up the AliTHn");
299 fHistHBTbefore = new TH2D("fHistHBTbefore","before HBT cut",200,0,2,200,0,2.*TMath::Pi());
300 fHistHBTafter = new TH2D("fHistHBTafter","after HBT cut",200,0,2,200,0,2.*TMath::Pi());
301 fHistConversionbefore = new TH2D("fHistConversionbefore","before Conversion cut",200,0,2,200,0,2.*TMath::Pi());
302 fHistConversionafter = new TH2D("fHistConversionafter","after Conversion cut",200,0,2,200,0,2.*TMath::Pi());
303 fHistPsiMinusPhi = new TH2D("fHistPsiMinusPhi","",4,-0.5,3.5,100,0,2.*TMath::Pi());
305 TH1::AddDirectory(oldStatus);
309 //____________________________________________________________________//
310 void AliBalancePsi::CalculateBalance(Double_t gReactionPlane,
311 TObjArray *particles,
312 TObjArray *particlesMixed,
314 Double_t kMultorCent) {
315 // Calculates the balance function
318 // Initialize histograms if not done yet
320 AliWarning("Histograms not yet initialized! --> Will be done now");
321 AliWarning("This works only in local mode --> Add 'gBalance->InitHistograms()' in your configBalanceFunction");
325 Double_t trackVariablesSingle[kTrackVariablesSingle];
326 Double_t trackVariablesPair[kTrackVariablesPair];
329 AliWarning("particles TObjArray is NULL pointer --> return");
333 // define end of particle loops
334 Int_t iMax = particles->GetEntriesFast();
337 jMax = particlesMixed->GetEntriesFast();
339 // Eta() is extremely time consuming, therefore cache it for the inner loop here:
340 TObjArray* particlesSecond = (particlesMixed) ? particlesMixed : particles;
342 TArrayF secondEta(jMax);
343 TArrayF secondPhi(jMax);
344 TArrayF secondPt(jMax);
345 TArrayS secondCharge(jMax);
346 TArrayD secondCorrection(jMax);
348 for (Int_t i=0; i<jMax; i++){
349 secondEta[i] = ((AliVParticle*) particlesSecond->At(i))->Eta();
350 secondPhi[i] = ((AliVParticle*) particlesSecond->At(i))->Phi();
351 secondPt[i] = ((AliVParticle*) particlesSecond->At(i))->Pt();
352 secondCharge[i] = (Short_t)((AliVParticle*) particlesSecond->At(i))->Charge();
353 secondCorrection[i] = (Double_t)((AliBFBasicParticle*) particlesSecond->At(i))->Correction(); //==========================correction
357 for (Int_t i = 0; i < iMax; i++) {
358 //AliVParticle* firstParticle = (AliVParticle*) particles->At(i);
359 AliBFBasicParticle* firstParticle = (AliBFBasicParticle*) particles->At(i); //==========================correction
362 Float_t firstEta = firstParticle->Eta();
363 Float_t firstPhi = firstParticle->Phi();
364 Float_t firstPt = firstParticle->Pt();
365 Float_t firstCorrection = firstParticle->Correction();//==========================correction
367 // Event plane (determine psi bin)
368 Double_t gPsiMinusPhi = 0.;
369 Double_t gPsiMinusPhiBin = -10.;
370 gPsiMinusPhi = TMath::Abs(firstPhi - gReactionPlane);
372 if((gPsiMinusPhi <= 7.5*TMath::DegToRad())||
373 ((172.5*TMath::DegToRad() <= gPsiMinusPhi)&&(gPsiMinusPhi <= 187.5*TMath::DegToRad())))
374 gPsiMinusPhiBin = 0.0;
376 else if(((37.5*TMath::DegToRad() <= gPsiMinusPhi)&&(gPsiMinusPhi <= 52.5*TMath::DegToRad()))||
377 ((127.5*TMath::DegToRad() <= gPsiMinusPhi)&&(gPsiMinusPhi <= 142.5*TMath::DegToRad()))||
378 ((217.5*TMath::DegToRad() <= gPsiMinusPhi)&&(gPsiMinusPhi <= 232.5*TMath::DegToRad()))||
379 ((307.5*TMath::DegToRad() <= gPsiMinusPhi)&&(gPsiMinusPhi <= 322.5*TMath::DegToRad())))
380 gPsiMinusPhiBin = 1.0;
382 else if(((82.5*TMath::DegToRad() <= gPsiMinusPhi)&&(gPsiMinusPhi <= 97.5*TMath::DegToRad()))||
383 ((262.5*TMath::DegToRad() <= gPsiMinusPhi)&&(gPsiMinusPhi <= 277.5*TMath::DegToRad())))
384 gPsiMinusPhiBin = 2.0;
387 gPsiMinusPhiBin = 3.0;
389 fHistPsiMinusPhi->Fill(gPsiMinusPhiBin,gPsiMinusPhi);
391 Short_t charge1 = (Short_t) firstParticle->Charge();
393 trackVariablesSingle[0] = gPsiMinusPhiBin;
394 trackVariablesSingle[1] = firstPt;
395 if(fEventClass=="Multiplicity" || fEventClass == "Centrality" ) trackVariablesSingle[0] = kMultorCent;
397 //fill single particle histograms
398 if(charge1 > 0) fHistP->Fill(trackVariablesSingle,0,firstCorrection); //==========================correction
399 else if(charge1 < 0) fHistN->Fill(trackVariablesSingle,0,firstCorrection); //==========================correction
402 for(Int_t j = 0; j < jMax; j++) {
404 if(!particlesMixed && j == i) continue; // no auto correlations (only for non mixing)
406 Short_t charge2 = secondCharge[j];
408 trackVariablesPair[0] = trackVariablesSingle[0];
409 trackVariablesPair[1] = firstEta - secondEta[j]; // delta eta
410 trackVariablesPair[2] = firstPhi - secondPhi[j]; // delta phi
411 //if (trackVariablesPair[2] > 180.) // delta phi between -180 and 180
412 //trackVariablesPair[2] -= 360.;
413 //if (trackVariablesPair[2] < - 180.)
414 //trackVariablesPair[2] += 360.;
415 if (trackVariablesPair[2] > TMath::Pi()) // delta phi between -pi and pi
416 trackVariablesPair[2] -= 2.*TMath::Pi();
417 if (trackVariablesPair[2] < - TMath::Pi())
418 trackVariablesPair[2] += 2.*TMath::Pi();
419 if (trackVariablesPair[2] < - TMath::Pi()/2.)
420 trackVariablesPair[2] += 2.*TMath::Pi();
422 trackVariablesPair[3] = firstPt; // pt trigger
423 trackVariablesPair[4] = secondPt[j]; // pt
424 // trackVariablesPair[5] = fCentrality; // centrality
427 if(fHBTCut && charge1 * charge2 > 0){
428 //if( dphi < 3 || deta < 0.01 ){ // VERSION 1
431 Double_t deta = firstEta - secondEta[j];
432 Double_t dphi = firstPhi - secondPhi[j];
433 // VERSION 2 (Taken from DPhiCorrelations)
434 // the variables & cuthave been developed by the HBT group
435 // see e.g. https://indico.cern.ch/materialDisplay.py?contribId=36&sessionId=6&materialId=slides&confId=142700
436 fHistHBTbefore->Fill(deta,dphi);
439 if (TMath::Abs(deta) < 0.02 * 2.5 * 3) //twoTrackEfficiencyCutValue = 0.02 [default for dphicorrelations]
442 //Float_t phi1rad = firstPhi*TMath::DegToRad();
443 //Float_t phi2rad = secondPhi[j]*TMath::DegToRad();
444 Float_t phi1rad = firstPhi;
445 Float_t phi2rad = secondPhi[j];
447 // check first boundaries to see if is worth to loop and find the minimum
448 Float_t dphistar1 = GetDPhiStar(phi1rad, firstPt, charge1, phi2rad, secondPt[j], charge2, 0.8, bSign);
449 Float_t dphistar2 = GetDPhiStar(phi1rad, firstPt, charge1, phi2rad, secondPt[j], charge2, 2.5, bSign);
451 const Float_t kLimit = 0.02 * 3;
453 Float_t dphistarminabs = 1e5;
454 Float_t dphistarmin = 1e5;
456 if (TMath::Abs(dphistar1) < kLimit || TMath::Abs(dphistar2) < kLimit || dphistar1 * dphistar2 < 0 ) {
457 for (Double_t rad=0.8; rad<2.51; rad+=0.01) {
458 Float_t dphistar = GetDPhiStar(phi1rad, firstPt, charge1, phi2rad, secondPt[j], charge2, rad, bSign);
459 Float_t dphistarabs = TMath::Abs(dphistar);
461 if (dphistarabs < dphistarminabs) {
462 dphistarmin = dphistar;
463 dphistarminabs = dphistarabs;
467 if (dphistarminabs < 0.02 && TMath::Abs(deta) < 0.02) {
468 //AliInfo(Form("HBT: Removed track pair %d %d with [[%f %f]] %f %f %f | %f %f %d %f %f %d %f", i, j, deta, dphi, dphistarminabs, dphistar1, dphistar2, phi1rad, pt1, charge1, phi2rad, pt2, charge2, bSign));
473 fHistHBTafter->Fill(deta,dphi);
478 if (charge1 * charge2 < 0) {
479 Double_t deta = firstEta - secondEta[j];
480 Double_t dphi = firstPhi - secondPhi[j];
481 fHistConversionbefore->Fill(deta,dphi);
483 Float_t m0 = 0.510e-3;
484 Float_t tantheta1 = 1e10;
487 //Float_t phi1rad = firstPhi*TMath::DegToRad();
488 //Float_t phi2rad = secondPhi[j]*TMath::DegToRad();
489 Float_t phi1rad = firstPhi;
490 Float_t phi2rad = secondPhi[j];
492 if (firstEta < -1e-10 || firstEta > 1e-10)
493 tantheta1 = 2 * TMath::Exp(-firstEta) / ( 1 - TMath::Exp(-2*firstEta));
495 Float_t tantheta2 = 1e10;
496 if (secondEta[j] < -1e-10 || secondEta[j] > 1e-10)
497 tantheta2 = 2 * TMath::Exp(-secondEta[j]) / ( 1 - TMath::Exp(-2*secondEta[j]));
499 Float_t e1squ = m0 * m0 + firstPt * firstPt * (1.0 + 1.0 / tantheta1 / tantheta1);
500 Float_t e2squ = m0 * m0 + secondPt[j] * secondPt[j] * (1.0 + 1.0 / tantheta2 / tantheta2);
502 Float_t masssqu = 2 * m0 * m0 + 2 * ( TMath::Sqrt(e1squ * e2squ) - ( firstPt * secondPt[j] * ( TMath::Cos(phi1rad - phi2rad) + 1.0 / tantheta1 / tantheta2 ) ) );
504 if (masssqu < 0.04*0.04){
505 //AliInfo(Form("Conversion: Removed track pair %d %d with [[%f %f] %f %f] %d %d <- %f %f %f %f %f %f ", i, j, deta, dphi, masssqu, charge1, charge2,eta1,eta2,phi1,phi2,pt1,pt2));
508 fHistConversionafter->Fill(deta,dphi);
512 if( charge1 > 0 && charge2 < 0) fHistPN->Fill(trackVariablesPair,0,firstCorrection*secondCorrection[j]); //==========================correction
513 else if( charge1 < 0 && charge2 > 0) fHistNP->Fill(trackVariablesPair,0,firstCorrection*secondCorrection[j]);//==========================correction
514 else if( charge1 > 0 && charge2 > 0) fHistPP->Fill(trackVariablesPair,0,firstCorrection*secondCorrection[j]);//==========================correction
515 else if( charge1 < 0 && charge2 < 0) fHistNN->Fill(trackVariablesPair,0,firstCorrection*secondCorrection[j]);//==========================correction
517 //AliWarning(Form("Wrong charge combination: charge1 = %d and charge2 = %d",charge,charge2));
520 }//end of 2nd particle loop
521 }//end of 1st particle loop
524 //____________________________________________________________________//
525 TH1D *AliBalancePsi::GetBalanceFunctionHistogram(Int_t iVariableSingle,
529 Double_t ptTriggerMin,
530 Double_t ptTriggerMax,
531 Double_t ptAssociatedMin,
532 Double_t ptAssociatedMax) {
533 //Returns the BF histogram, extracted from the 6 AliTHn objects
534 //(private members) of the AliBalancePsi class.
535 //iVariableSingle: 0(phi-Psi), 1(pt-trigger)
536 //iVariablePair: 0(phi-Psi) 1(Delta eta), 2(Delta phi), 3(pt-trigger), 4(pt-associated
538 fHistP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
539 fHistN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
540 fHistPN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
541 fHistNP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
542 fHistPP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
543 fHistNN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
546 if((ptTriggerMin != -1.)&&(ptTriggerMax != -1.)) {
547 fHistP->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax);
548 fHistN->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax);
549 fHistPN->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
550 fHistNP->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
551 fHistPP->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
552 fHistNN->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
556 if((ptAssociatedMin != -1.)&&(ptAssociatedMax != -1.)) {
557 fHistPN->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
558 fHistNP->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
559 fHistPP->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
560 fHistNN->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
563 //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));
565 // Project into the wanted space (1st: analysis step, 2nd: axis)
566 TH1D* hTemp1 = (TH1D*)fHistPN->Project(0,iVariablePair);
567 TH1D* hTemp2 = (TH1D*)fHistNP->Project(0,iVariablePair);
568 TH1D* hTemp3 = (TH1D*)fHistPP->Project(0,iVariablePair);
569 TH1D* hTemp4 = (TH1D*)fHistNN->Project(0,iVariablePair);
570 TH1D* hTemp5 = (TH1D*)fHistP->Project(0,iVariableSingle);
571 TH1D* hTemp6 = (TH1D*)fHistN->Project(0,iVariableSingle);
573 TH1D *gHistBalanceFunctionHistogram = 0x0;
574 if((hTemp1)&&(hTemp2)&&(hTemp3)&&(hTemp4)&&(hTemp5)&&(hTemp6)) {
575 gHistBalanceFunctionHistogram = (TH1D*)hTemp1->Clone();
576 gHistBalanceFunctionHistogram->Reset();
578 switch(iVariablePair) {
580 gHistBalanceFunctionHistogram->GetXaxis()->SetTitle("#Delta#eta");
581 gHistBalanceFunctionHistogram->GetYaxis()->SetTitle("B(#Delta#eta)");
584 gHistBalanceFunctionHistogram->GetXaxis()->SetTitle("#Delta#varphi (rad)");
585 gHistBalanceFunctionHistogram->GetYaxis()->SetTitle("B(#Delta#varphi)");
595 hTemp1->Add(hTemp3,-1.);
596 hTemp1->Scale(1./hTemp5->GetEntries());
597 hTemp2->Add(hTemp4,-1.);
598 hTemp2->Scale(1./hTemp6->GetEntries());
599 gHistBalanceFunctionHistogram->Add(hTemp1,hTemp2,1.,1.);
600 gHistBalanceFunctionHistogram->Scale(0.5);
602 //normalize to bin width
603 gHistBalanceFunctionHistogram->Scale(1./((Double_t)gHistBalanceFunctionHistogram->GetXaxis()->GetBinWidth(1)*(Double_t)gHistBalanceFunctionHistogram->GetYaxis()->GetBinWidth(1)));
606 return gHistBalanceFunctionHistogram;
609 //____________________________________________________________________//
610 TH1D *AliBalancePsi::GetBalanceFunctionHistogram2pMethod(Int_t iVariableSingle,
614 Double_t ptTriggerMin,
615 Double_t ptTriggerMax,
616 Double_t ptAssociatedMin,
617 Double_t ptAssociatedMax,
618 AliBalancePsi *bfMix) {
619 //Returns the BF histogram, extracted from the 6 AliTHn objects
620 //after dividing each correlation function by the Event Mixing one
621 //(private members) of the AliBalancePsi class.
622 //iVariableSingle: 0(phi-Psi), 1(pt-trigger)
623 //iVariablePair: 0(phi-Psi) 1(Delta eta), 2(Delta phi), 3(pt-trigger), 4(pt-associated
625 fHistP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
626 fHistN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
627 fHistPN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
628 fHistNP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
629 fHistPP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
630 fHistNN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
633 if((ptTriggerMin != -1.)&&(ptTriggerMax != -1.)) {
634 fHistP->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax);
635 fHistN->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax);
636 fHistPN->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
637 fHistNP->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
638 fHistPP->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
639 fHistNN->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
643 if((ptAssociatedMin != -1.)&&(ptAssociatedMax != -1.)) {
644 fHistPN->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
645 fHistNP->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
646 fHistPP->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
647 fHistNN->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
650 // ============================================================================================
651 // the same for event mixing
652 AliTHn *fHistPMix = bfMix->GetHistNp();
653 AliTHn *fHistNMix = bfMix->GetHistNn();
654 AliTHn *fHistPNMix = bfMix->GetHistNpn();
655 AliTHn *fHistNPMix = bfMix->GetHistNnp();
656 AliTHn *fHistPPMix = bfMix->GetHistNpp();
657 AliTHn *fHistNNMix = bfMix->GetHistNnn();
660 fHistPMix->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
661 fHistNMix->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
662 fHistPNMix->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
663 fHistNPMix->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
664 fHistPPMix->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
665 fHistNNMix->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
668 if((ptTriggerMin != -1.)&&(ptTriggerMax != -1.)) {
669 fHistPMix->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax);
670 fHistNMix->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax);
671 fHistPNMix->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
672 fHistNPMix->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
673 fHistPPMix->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
674 fHistNNMix->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
678 if((ptAssociatedMin != -1.)&&(ptAssociatedMax != -1.)) {
679 fHistPNMix->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
680 fHistNPMix->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
681 fHistPPMix->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
682 fHistNNMix->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
684 // ============================================================================================
686 //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));
688 // Project into the wanted space (1st: analysis step, 2nd: axis)
689 TH1D* hTemp1 = (TH1D*)fHistPN->Project(0,iVariablePair);
690 TH1D* hTemp2 = (TH1D*)fHistNP->Project(0,iVariablePair);
691 TH1D* hTemp3 = (TH1D*)fHistPP->Project(0,iVariablePair);
692 TH1D* hTemp4 = (TH1D*)fHistNN->Project(0,iVariablePair);
693 TH1D* hTemp5 = (TH1D*)fHistP->Project(0,iVariableSingle);
694 TH1D* hTemp6 = (TH1D*)fHistN->Project(0,iVariableSingle);
696 // ============================================================================================
697 // the same for event mixing
698 TH2D* hTemp1Mix = (TH2D*)fHistPNMix->Project(0,iVariablePair);
699 TH2D* hTemp2Mix = (TH2D*)fHistNPMix->Project(0,iVariablePair);
700 TH2D* hTemp3Mix = (TH2D*)fHistPPMix->Project(0,iVariablePair);
701 TH2D* hTemp4Mix = (TH2D*)fHistNNMix->Project(0,iVariablePair);
702 TH1D* hTemp5Mix = (TH1D*)fHistPMix->Project(0,iVariableSingle);
703 TH1D* hTemp6Mix = (TH1D*)fHistNMix->Project(0,iVariableSingle);
704 // ============================================================================================
706 TH1D *gHistBalanceFunctionHistogram = 0x0;
707 if((hTemp1)&&(hTemp2)&&(hTemp3)&&(hTemp4)&&(hTemp5)&&(hTemp6)) {
708 gHistBalanceFunctionHistogram = (TH1D*)hTemp1->Clone();
709 gHistBalanceFunctionHistogram->Reset();
711 switch(iVariablePair) {
713 gHistBalanceFunctionHistogram->GetXaxis()->SetTitle("#Delta#eta");
714 gHistBalanceFunctionHistogram->GetYaxis()->SetTitle("B(#Delta#eta)");
717 gHistBalanceFunctionHistogram->GetXaxis()->SetTitle("#Delta#varphi (rad)");
718 gHistBalanceFunctionHistogram->GetYaxis()->SetTitle("B(#Delta#varphi)");
733 hTemp1->Scale(1./hTemp5->GetEntries());
734 hTemp3->Scale(1./hTemp5->GetEntries());
735 hTemp2->Scale(1./hTemp6->GetEntries());
736 hTemp4->Scale(1./hTemp6->GetEntries());
737 hTemp1Mix->Scale(1./hTemp5Mix->GetEntries());
738 hTemp3Mix->Scale(1./hTemp5Mix->GetEntries());
739 hTemp2Mix->Scale(1./hTemp6Mix->GetEntries());
740 hTemp4Mix->Scale(1./hTemp6Mix->GetEntries());
742 hTemp1->Divide(hTemp1Mix);
743 hTemp2->Divide(hTemp2Mix);
744 hTemp3->Divide(hTemp3Mix);
745 hTemp4->Divide(hTemp4Mix);
747 hTemp1->Add(hTemp3,-1.);
748 hTemp2->Add(hTemp4,-1.);
750 gHistBalanceFunctionHistogram->Add(hTemp1,hTemp2,1.,1.);
751 gHistBalanceFunctionHistogram->Scale(0.5);
753 //normalize to bin width
754 gHistBalanceFunctionHistogram->Scale(1./((Double_t)gHistBalanceFunctionHistogram->GetXaxis()->GetBinWidth(1)*(Double_t)gHistBalanceFunctionHistogram->GetYaxis()->GetBinWidth(1)));
757 return gHistBalanceFunctionHistogram;
760 //____________________________________________________________________//
761 TH2D *AliBalancePsi::GetBalanceFunctionDeltaEtaDeltaPhi(Double_t psiMin,
763 Double_t ptTriggerMin,
764 Double_t ptTriggerMax,
765 Double_t ptAssociatedMin,
766 Double_t ptAssociatedMax) {
767 //Returns the BF histogram in Delta eta vs Delta phi,
768 //extracted from the 6 AliTHn objects
769 //(private members) of the AliBalancePsi class.
770 //iVariableSingle: 0(phi-Psi), 1(pt-trigger)
771 //iVariablePair: 0(phi-Psi) 1(Delta eta), 2(Delta phi), 3(pt-trigger), 4(pt-associated
772 TString histName = "gHistBalanceFunctionHistogram2D";
775 fHistP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
776 fHistN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
777 fHistPN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
778 fHistNP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
779 fHistPP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
780 fHistNN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
783 if((ptTriggerMin != -1.)&&(ptTriggerMax != -1.)) {
784 fHistP->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax);
785 fHistN->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax);
786 fHistPN->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
787 fHistNP->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
788 fHistPP->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
789 fHistNN->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
793 if((ptAssociatedMin != -1.)&&(ptAssociatedMax != -1.)) {
794 fHistPN->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
795 fHistNP->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
796 fHistPP->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
797 fHistNN->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
800 //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)));
802 // Project into the wanted space (1st: analysis step, 2nd: axis)
803 TH2D* hTemp1 = (TH2D*)fHistPN->Project(0,1,2);
804 TH2D* hTemp2 = (TH2D*)fHistNP->Project(0,1,2);
805 TH2D* hTemp3 = (TH2D*)fHistPP->Project(0,1,2);
806 TH2D* hTemp4 = (TH2D*)fHistNN->Project(0,1,2);
807 TH1D* hTemp5 = (TH1D*)fHistP->Project(0,1);
808 TH1D* hTemp6 = (TH1D*)fHistN->Project(0,1);
810 TH2D *gHistBalanceFunctionHistogram = 0x0;
811 if((hTemp1)&&(hTemp2)&&(hTemp3)&&(hTemp4)&&(hTemp5)&&(hTemp6)) {
812 gHistBalanceFunctionHistogram = (TH2D*)hTemp1->Clone();
813 gHistBalanceFunctionHistogram->Reset();
814 gHistBalanceFunctionHistogram->GetXaxis()->SetTitle("#Delta#eta");
815 gHistBalanceFunctionHistogram->GetYaxis()->SetTitle("#Delta#varphi (rad)");
816 gHistBalanceFunctionHistogram->GetZaxis()->SetTitle("B(#Delta#eta,#Delta#varphi)");
822 hTemp1->Add(hTemp3,-1.);
823 hTemp1->Scale(1./hTemp5->GetEntries());
824 hTemp2->Add(hTemp4,-1.);
825 hTemp2->Scale(1./hTemp6->GetEntries());
826 gHistBalanceFunctionHistogram->Add(hTemp1,hTemp2,1.,1.);
827 gHistBalanceFunctionHistogram->Scale(0.5);
829 //normalize to bin width
830 gHistBalanceFunctionHistogram->Scale(1./((Double_t)gHistBalanceFunctionHistogram->GetXaxis()->GetBinWidth(1)*(Double_t)gHistBalanceFunctionHistogram->GetYaxis()->GetBinWidth(1)));
833 return gHistBalanceFunctionHistogram;
836 //____________________________________________________________________//
837 TH2D *AliBalancePsi::GetBalanceFunctionDeltaEtaDeltaPhi2pMethod(Double_t psiMin,
839 Double_t ptTriggerMin,
840 Double_t ptTriggerMax,
841 Double_t ptAssociatedMin,
842 Double_t ptAssociatedMax,
843 AliBalancePsi *bfMix) {
844 //Returns the BF histogram in Delta eta vs Delta phi,
845 //after dividing each correlation function by the Event Mixing one
846 //extracted from the 6 AliTHn objects
847 //(private members) of the AliBalancePsi class.
848 //iVariableSingle: 0(phi-Psi), 1(pt-trigger)
849 //iVariablePair: 0(phi-Psi) 1(Delta eta), 2(Delta phi), 3(pt-trigger), 4(pt-associated
850 TString histName = "gHistBalanceFunctionHistogram2D";
853 AliError("balance function object for event mixing not available");
858 fHistP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
859 fHistN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
860 fHistPN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
861 fHistNP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
862 fHistPP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
863 fHistNN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
866 if((ptTriggerMin != -1.)&&(ptTriggerMax != -1.)) {
867 fHistP->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax);
868 fHistN->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax);
869 fHistPN->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
870 fHistNP->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
871 fHistPP->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
872 fHistNN->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
876 if((ptAssociatedMin != -1.)&&(ptAssociatedMax != -1.)) {
877 fHistPN->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
878 fHistNP->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
879 fHistPP->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
880 fHistNN->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
884 // ============================================================================================
885 // the same for event mixing
886 AliTHn *fHistPMix = bfMix->GetHistNp();
887 AliTHn *fHistNMix = bfMix->GetHistNn();
888 AliTHn *fHistPNMix = bfMix->GetHistNpn();
889 AliTHn *fHistNPMix = bfMix->GetHistNnp();
890 AliTHn *fHistPPMix = bfMix->GetHistNpp();
891 AliTHn *fHistNNMix = bfMix->GetHistNnn();
894 fHistPMix->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
895 fHistNMix->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
896 fHistPNMix->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
897 fHistNPMix->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
898 fHistPPMix->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
899 fHistNNMix->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
902 if((ptTriggerMin != -1.)&&(ptTriggerMax != -1.)) {
903 fHistPMix->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax);
904 fHistNMix->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax);
905 fHistPNMix->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
906 fHistNPMix->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
907 fHistPPMix->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
908 fHistNNMix->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
912 if((ptAssociatedMin != -1.)&&(ptAssociatedMax != -1.)) {
913 fHistPNMix->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
914 fHistNPMix->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
915 fHistPPMix->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
916 fHistNNMix->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
918 // ============================================================================================
921 //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)));
923 // Project into the wanted space (1st: analysis step, 2nd: axis)
924 TH2D* hTemp1 = (TH2D*)fHistPN->Project(0,1,2);
925 TH2D* hTemp2 = (TH2D*)fHistNP->Project(0,1,2);
926 TH2D* hTemp3 = (TH2D*)fHistPP->Project(0,1,2);
927 TH2D* hTemp4 = (TH2D*)fHistNN->Project(0,1,2);
928 TH1D* hTemp5 = (TH1D*)fHistP->Project(0,1);
929 TH1D* hTemp6 = (TH1D*)fHistN->Project(0,1);
931 // ============================================================================================
932 // the same for event mixing
933 TH2D* hTemp1Mix = (TH2D*)fHistPNMix->Project(0,1,2);
934 TH2D* hTemp2Mix = (TH2D*)fHistNPMix->Project(0,1,2);
935 TH2D* hTemp3Mix = (TH2D*)fHistPPMix->Project(0,1,2);
936 TH2D* hTemp4Mix = (TH2D*)fHistNNMix->Project(0,1,2);
937 TH1D* hTemp5Mix = (TH1D*)fHistPMix->Project(0,1);
938 TH1D* hTemp6Mix = (TH1D*)fHistNMix->Project(0,1);
939 // ============================================================================================
941 TH2D *gHistBalanceFunctionHistogram = 0x0;
942 if((hTemp1)&&(hTemp2)&&(hTemp3)&&(hTemp4)&&(hTemp5)&&(hTemp6)) {
943 gHistBalanceFunctionHistogram = (TH2D*)hTemp1->Clone();
944 gHistBalanceFunctionHistogram->Reset();
945 gHistBalanceFunctionHistogram->GetXaxis()->SetTitle("#Delta#eta");
946 gHistBalanceFunctionHistogram->GetYaxis()->SetTitle("#Delta#varphi (rad)");
947 gHistBalanceFunctionHistogram->GetZaxis()->SetTitle("B(#Delta#eta,#Delta#varphi)");
958 hTemp1->Scale(1./hTemp5->GetEntries());
959 hTemp3->Scale(1./hTemp5->GetEntries());
960 hTemp2->Scale(1./hTemp6->GetEntries());
961 hTemp4->Scale(1./hTemp6->GetEntries());
962 hTemp1Mix->Scale(1./hTemp5Mix->GetEntries());
963 hTemp3Mix->Scale(1./hTemp5Mix->GetEntries());
964 hTemp2Mix->Scale(1./hTemp6Mix->GetEntries());
965 hTemp4Mix->Scale(1./hTemp6Mix->GetEntries());
967 hTemp1->Divide(hTemp1Mix);
968 hTemp2->Divide(hTemp2Mix);
969 hTemp3->Divide(hTemp3Mix);
970 hTemp4->Divide(hTemp4Mix);
972 hTemp1->Add(hTemp3,-1.);
973 hTemp2->Add(hTemp4,-1.);
975 gHistBalanceFunctionHistogram->Add(hTemp1,hTemp2,1.,1.);
976 gHistBalanceFunctionHistogram->Scale(0.5);
978 //normalize to bin width
979 gHistBalanceFunctionHistogram->Scale(1./((Double_t)gHistBalanceFunctionHistogram->GetXaxis()->GetBinWidth(1)*(Double_t)gHistBalanceFunctionHistogram->GetYaxis()->GetBinWidth(1)));
982 return gHistBalanceFunctionHistogram;
986 //____________________________________________________________________//
987 TH2D *AliBalancePsi::GetCorrelationFunctionPN(Double_t psiMin,
989 Double_t ptTriggerMin,
990 Double_t ptTriggerMax,
991 Double_t ptAssociatedMin,
992 Double_t ptAssociatedMax) {
993 //Returns the 2D correlation function for (+-) pairs
995 fHistP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
996 fHistPN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
999 if((ptTriggerMin != -1.)&&(ptTriggerMax != -1.)) {
1000 fHistP->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax);
1001 fHistPN->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
1005 if((ptAssociatedMin != -1.)&&(ptAssociatedMax != -1.))
1006 fHistPN->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
1008 //fHistP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(-0.5,2.5);
1009 //fHistPN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(-0.5,2.5);
1011 //TH2D *gHistTest = dynamic_cast<TH2D *>(fHistP->Project(0,0,1));
1012 //TCanvas *c1 = new TCanvas("c1","");
1015 //AliError("Projection of fHistP = NULL");
1019 //gHistTest->DrawCopy("colz");
1022 //0:step, 1: Delta eta, 2: Delta phi
1023 TH2D *gHist = dynamic_cast<TH2D *>(fHistPN->Project(0,1,2));
1025 AliError("Projection of fHistPN = NULL");
1029 //AliInfo(Form("Entries (test): %lf",(Double_t)(gHistTest->GetEntries())));
1030 //AliInfo(Form("Entries (1D): %lf",(Double_t)(fHistP->Project(0,1)->GetEntries())));
1031 //AliInfo(Form("Entries (2D): %lf",(Double_t)(fHistPN->Project(0,1,2)->GetEntries())));
1033 //TCanvas *c2 = new TCanvas("c2","");
1035 //fHistPN->Project(0,1,2)->DrawCopy("colz");
1037 if((Double_t)(fHistP->Project(0,1)->GetEntries())!=0)
1038 gHist->Scale(1./(Double_t)(fHistP->Project(0,1)->GetEntries()));
1040 //normalize to bin width
1041 gHist->Scale(1./((Double_t)gHist->GetXaxis()->GetBinWidth(1)*(Double_t)gHist->GetYaxis()->GetBinWidth(1)));
1046 //____________________________________________________________________//
1047 TH2D *AliBalancePsi::GetCorrelationFunctionNP(Double_t psiMin,
1049 Double_t ptTriggerMin,
1050 Double_t ptTriggerMax,
1051 Double_t ptAssociatedMin,
1052 Double_t ptAssociatedMax) {
1053 //Returns the 2D correlation function for (+-) pairs
1055 fHistN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
1056 fHistNP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
1059 if((ptTriggerMin != -1.)&&(ptTriggerMax != -1.)) {
1060 fHistN->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax);
1061 fHistNP->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
1065 if((ptAssociatedMin != -1.)&&(ptAssociatedMax != -1.))
1066 fHistNP->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
1068 //0:step, 1: Delta eta, 2: Delta phi
1069 TH2D *gHist = dynamic_cast<TH2D *>(fHistNP->Project(0,1,2));
1071 AliError("Projection of fHistPN = NULL");
1075 //Printf("Entries (1D): %lf",(Double_t)(fHistN->Project(0,2)->GetEntries()));
1076 //Printf("Entries (2D): %lf",(Double_t)(fHistNP->Project(0,2,3)->GetEntries()));
1077 if((Double_t)(fHistN->Project(0,1)->GetEntries())!=0)
1078 gHist->Scale(1./(Double_t)(fHistN->Project(0,1)->GetEntries()));
1080 //normalize to bin width
1081 gHist->Scale(1./((Double_t)gHist->GetXaxis()->GetBinWidth(1)*(Double_t)gHist->GetYaxis()->GetBinWidth(1)));
1086 //____________________________________________________________________//
1087 TH2D *AliBalancePsi::GetCorrelationFunctionPP(Double_t psiMin,
1089 Double_t ptTriggerMin,
1090 Double_t ptTriggerMax,
1091 Double_t ptAssociatedMin,
1092 Double_t ptAssociatedMax) {
1093 //Returns the 2D correlation function for (+-) pairs
1095 fHistP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
1096 fHistPP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
1099 if((ptTriggerMin != -1.)&&(ptTriggerMax != -1.)) {
1100 fHistP->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax);
1101 fHistPP->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
1105 if((ptAssociatedMin != -1.)&&(ptAssociatedMax != -1.))
1106 fHistPP->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
1108 //0:step, 1: Delta eta, 2: Delta phi
1109 TH2D *gHist = dynamic_cast<TH2D *>(fHistPP->Project(0,1,2));
1111 AliError("Projection of fHistPN = NULL");
1115 //Printf("Entries (1D): %lf",(Double_t)(fHistP->Project(0,2)->GetEntries()));
1116 //Printf("Entries (2D): %lf",(Double_t)(fHistPP->Project(0,2,3)->GetEntries()));
1117 if((Double_t)(fHistP->Project(0,1)->GetEntries())!=0)
1118 gHist->Scale(1./(Double_t)(fHistP->Project(0,1)->GetEntries()));
1120 //normalize to bin width
1121 gHist->Scale(1./((Double_t)gHist->GetXaxis()->GetBinWidth(1)*(Double_t)gHist->GetYaxis()->GetBinWidth(1)));
1126 //____________________________________________________________________//
1127 TH2D *AliBalancePsi::GetCorrelationFunctionNN(Double_t psiMin,
1129 Double_t ptTriggerMin,
1130 Double_t ptTriggerMax,
1131 Double_t ptAssociatedMin,
1132 Double_t ptAssociatedMax) {
1133 //Returns the 2D correlation function for (+-) pairs
1135 fHistN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
1136 fHistNN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
1139 if((ptTriggerMin != -1.)&&(ptTriggerMax != -1.)) {
1140 fHistN->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax);
1141 fHistNN->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
1145 if((ptAssociatedMin != -1.)&&(ptAssociatedMax != -1.))
1146 fHistNN->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
1148 //0:step, 1: Delta eta, 2: Delta phi
1149 TH2D *gHist = dynamic_cast<TH2D *>(fHistNN->Project(0,1,2));
1151 AliError("Projection of fHistPN = NULL");
1155 //Printf("Entries (1D): %lf",(Double_t)(fHistN->Project(0,2)->GetEntries()));
1156 //Printf("Entries (2D): %lf",(Double_t)(fHistNN->Project(0,2,3)->GetEntries()));
1157 if((Double_t)(fHistN->Project(0,1)->GetEntries())!=0)
1158 gHist->Scale(1./(Double_t)(fHistN->Project(0,1)->GetEntries()));
1160 //normalize to bin width
1161 gHist->Scale(1./((Double_t)gHist->GetXaxis()->GetBinWidth(1)*(Double_t)gHist->GetYaxis()->GetBinWidth(1)));
1166 //____________________________________________________________________//
1167 TH2D *AliBalancePsi::GetCorrelationFunctionChargeIndependent(Double_t psiMin,
1169 Double_t ptTriggerMin,
1170 Double_t ptTriggerMax,
1171 Double_t ptAssociatedMin,
1172 Double_t ptAssociatedMax) {
1173 //Returns the 2D correlation function for the sum of all charge combination pairs
1175 fHistN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
1176 fHistP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
1177 fHistNN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
1178 fHistPP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
1179 fHistNP->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
1180 fHistPN->GetGrid(0)->GetGrid()->GetAxis(0)->SetRangeUser(psiMin,psiMax);
1183 if((ptTriggerMin != -1.)&&(ptTriggerMax != -1.)) {
1184 fHistN->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax);
1185 fHistP->GetGrid(0)->GetGrid()->GetAxis(1)->SetRangeUser(ptTriggerMin,ptTriggerMax);
1186 fHistNN->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
1187 fHistPP->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
1188 fHistNP->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
1189 fHistPN->GetGrid(0)->GetGrid()->GetAxis(3)->SetRangeUser(ptTriggerMin,ptTriggerMax);
1193 if((ptAssociatedMin != -1.)&&(ptAssociatedMax != -1.))
1194 fHistNN->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
1195 fHistPP->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
1196 fHistNP->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
1197 fHistPN->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(ptAssociatedMin,ptAssociatedMax);
1199 //0:step, 1: Delta eta, 2: Delta phi
1200 TH2D *gHistNN = dynamic_cast<TH2D *>(fHistNN->Project(0,1,2));
1202 AliError("Projection of fHistNN = NULL");
1205 TH2D *gHistPP = dynamic_cast<TH2D *>(fHistPP->Project(0,1,2));
1207 AliError("Projection of fHistPP = NULL");
1210 TH2D *gHistNP = dynamic_cast<TH2D *>(fHistNP->Project(0,1,2));
1212 AliError("Projection of fHistNP = NULL");
1215 TH2D *gHistPN = dynamic_cast<TH2D *>(fHistPN->Project(0,1,2));
1217 AliError("Projection of fHistPN = NULL");
1221 // sum all 2 particle histograms
1222 gHistNN->Add(gHistPP);
1223 gHistNN->Add(gHistNP);
1224 gHistNN->Add(gHistPN);
1226 // divide by sum of + and - triggers
1227 if((Double_t)(fHistN->Project(0,1)->GetEntries())!=0 && (Double_t)(fHistP->Project(0,1)->GetEntries())!=0)
1228 gHistNN->Scale(1./(Double_t)(fHistN->Project(0,1)->GetEntries() + fHistN->Project(0,1)->GetEntries()));
1230 //normalize to bin width
1231 gHistNN->Scale(1./((Double_t)gHistNN->GetXaxis()->GetBinWidth(1)*(Double_t)gHistNN->GetYaxis()->GetBinWidth(1)));
1236 //____________________________________________________________________//
1237 Float_t AliBalancePsi::GetDPhiStar(Float_t phi1, Float_t pt1, Float_t charge1, Float_t phi2, Float_t pt2, Float_t charge2, Float_t radius, Float_t bSign) {
1239 // calculates dphistar
1241 Float_t dphistar = phi1 - phi2 - charge1 * bSign * TMath::ASin(0.075 * radius / pt1) + charge2 * bSign * TMath::ASin(0.075 * radius / pt2);
1243 static const Double_t kPi = TMath::Pi();
1246 // if (dphistar > 2 * kPi)
1247 // dphistar -= 2 * kPi;
1248 // if (dphistar < -2 * kPi)
1249 // dphistar += 2 * kPi;
1252 dphistar = kPi * 2 - dphistar;
1253 if (dphistar < -kPi)
1254 dphistar = -kPi * 2 - dphistar;
1255 if (dphistar > kPi) // might look funny but is needed
1256 dphistar = kPi * 2 - dphistar;