1 Float_t gpTMin_T1 = 6.0;
2 Float_t gpTMax_T1 = 14.0;
3 Float_t gpTMin_T2 = 4.0;
4 Float_t gpTMax_T2 = 10.0;
5 Float_t gpTMin_assoc = 1.0;
6 Float_t gpTMax_assoc = 4.0;
8 Float_t gZVtxRange = -1;
10 Float_t gBasisSize = 350;
11 Float_t g_phi_bin = 0.32;//0.32;//bins of 0.174532 //maximum is pi/4, because max(delta phi) + 2 alpha < pi/2 (because at Delta phi = pi/2 the number of background triggers are measured)
12 Float_t g_eta_bin = 0.39;//bins of 0.2
13 //char* path = "PWGCF_TwoPlusOne/histosTwoPlusOne";//before 1091
14 //char* path = "PWGCF_TwoPlusOne/addedEvents_";
15 char* path = "PWGCF_TwoPlusOne/histosTwoPlusOne_lowPt";//1095
17 //static const int pt_assoc_bins_number = 8;
18 //Double_t pt_assoc_bins[pt_assoc_bins_number] = {0.5, 1.0, 2.0, 3.0, 4.0, 6.0, 8.0, 10.0};
19 //Double_t pt_assoc_bin_center[pt_assoc_bins_number-1] = {0.75, 1.5, 2.5, 3.5, 5.0, 7.0, 9.0};
20 //Double_t pt_assoc_bin_error[pt_assoc_bins_number-1] = {0.25, 0.5, 0.5, 0.5, 1.0, 1.0, 1.0};
22 static const int pt_assoc_bins_number = 6;
23 Double_t pt_assoc_bins[pt_assoc_bins_number] = {0.5, 1.0, 2.0, 3.0, 4.0, 6.0};
24 Double_t pt_assoc_bin_center[pt_assoc_bins_number-1] = {0.75, 1.5, 2.5, 3.5, 5.0};
25 Double_t pt_assoc_bin_error[pt_assoc_bins_number-1] = {0.25, 0.5, 0.5, 0.5, 1.0};
27 //static const int pt_assoc_bins_number = 12;
28 //Double_t pt_assoc_bins[pt_assoc_bins_number] = {0.5, 0.75, 1.0, 1.25, 1.50, 2.0, 2.5, 3.0, 3.5, 4.0, 5.0, 6.0};
29 //Double_t pt_assoc_bin_center[pt_assoc_bins_number-1] = {0.625, 0.875, 1.125, 1.375, 1.75, 2.25, 2.75, 3.25, 3.75, 4.5, 5.5};
30 //Double_t pt_assoc_bin_error[pt_assoc_bins_number-1] = {0.125, 0.125, 0.125, 0.125, 0.25, 0.25, 0.25, 0.25, 0.25, 0.5, 0.5};
34 gSystem->Load("libANALYSIS");
35 gSystem->Load("libANALYSISalice");
36 gSystem->Load("libCORRFW");
37 gSystem->Load("libPWGTools");
38 gSystem->Load("libPWGCFCorrelationsBase");
42 void* getList(const char* fileName, const char* folder)
44 file = TFile::Open(fileName);
48 list = (TList*) gFile->Get(folder);
49 //list = (TList*) gFile->Get("PWGCF_TwoPlusOne/histosTwoPlusOne");
57 const char* lastFileName = 0;
58 const char* lastFileName2 = 0;
60 void* cacheEvent2 = 0;
63 void* GetTwoPlusOne(const char* fileName)
66 if (lastFileName && strcmp(lastFileName, fileName) == 0){
67 Printf("GetTwoPlusOne --> Using cache for %s", fileName);
70 if (lastFileName2 && strcmp(lastFileName2, fileName) == 0){
71 Printf("GetTwoPlusOne --> Using cache for %s", fileName);
75 lastFileName2 = fileName;
77 lastFileName = fileName;
79 //list = (TList*) getList(fileName, "PWGCF_TwoPlusOne/histosTwoPlusOne");
80 list = (TList*) getList(fileName, path);
82 AliTwoPlusOneContainer* container = (AliTwoPlusOneContainer*) list->FindObject("AliTwoPlusOneContainer");
84 if (container->GetData()->GetTrackHist(0)->GetGrid(6)->GetGrid()->GetNbins() == 0)
86 Printf("We have %d axes", ((AliTHn*) container->GetData()->GetTrackHist(0)->GetNVar()));
88 ((AliTHn*) container->GetData()->GetTrackHist(0))->FillParent();
89 ((AliTHn*) container->GetData()->GetTrackHist(0))->DeleteContainers();
92 if(lastFileName2 && strcmp(lastFileName2, fileName) == 0){
93 cacheEvent2 = container;
97 cacheEvent = container;
102 void* GetPhiCorrelations(const char* fileName)
104 list = (TList*) getList(fileName, "PWG4_PhiCorrelations/histosPhiCorrelations");
107 AliUEHistograms* container = list->FindObject("AliUEHistogramsSame");
109 if (container->GetUEHist(2)->GetTrackHist(0)->GetGrid(6)->GetGrid()->GetNbins() == 0)
111 Printf("We have %d axes", ((AliTHn*) container->GetUEHist(2)->GetTrackHist(0)->GetNVar()));
113 ((AliTHn*) container->GetUEHist(2)->GetTrackHist(0))->FillParent();
114 ((AliTHn*) container->GetUEHist(2)->GetTrackHist(0))->DeleteContainers();
120 void* showEvents(const char* fileName, int twoPlusOne = 1)
123 //list = (TList*) getList(fileName, "PWGCF_TwoPlusOne/histosTwoPlusOne");
124 list = (TList*) getList(fileName, path);
126 list = (TList*) getList(fileName, "PWG4_PhiCorrelations/histosPhiCorrelations");
128 TH1F* event_stat = (TH1F*) list->FindObject("eventStat");
129 TCanvas* can = new TCanvas();
130 event_stat->DrawCopy();
133 //returns maximum of the flow
134 //flow from 1.0 > |eta| > 1.6 is subtracted from the rest of the histogram
135 //the flow in the TH2 is subtracted
136 void subtractFlow(TH2* etaPhi){
137 int firstbin = etaPhi->GetYaxis()->FindBin(1.01);
138 int lastbin = etaPhi->GetYaxis()->FindBin(1.39);
140 TH1D* etaPhi_proj = etaPhi->ProjectionX("_px", firstbin, lastbin);
141 int usedBins = lastbin - firstbin + 1;
143 firstbin = etaPhi->GetYaxis()->FindBin(-1.39);
144 lastbin = etaPhi->GetYaxis()->FindBin(-1.01);
145 TH1D* signal2 = etaPhi->ProjectionX("_px2", firstbin, lastbin);
146 usedBins += lastbin - firstbin + 1;
147 etaPhi_proj->Add(signal2, 1.0);
149 etaPhi_proj->Scale(1.0/usedBins);
151 etaPhi->GetYaxis()->SetRangeUser(-1.0, 1.0);
153 for(int i=0;i<=etaPhi->GetNbinsX();i++){
154 double subtract = etaPhi_proj->GetBinContent(i);
156 for(int j=0;j<etaPhi->GetNbinsY();j++){
157 double content = etaPhi->GetBinContent(i,j)-subtract;
158 etaPhi->SetBinContent(i,j,content);
163 //use fit method to subtract the baseline if the subtractFlow method doesn't work because of poor statistics
164 Double_t subtractBaseline(TH1D* h1_phi){
166 TF1* fit = new TF1("fit", "[0]", -TMath::Pi()/2+0.01, TMath::Pi()/2-0.01);
168 h1_phi->Fit("fit", "N", "", -TMath::Pi()/2+0.01, -1.0);
169 Double_t par0 = fit->GetParameter(0);
171 h1_phi->Fit("fit", "N", "", 1.0, TMath::Pi()/2-0.01);
172 Double_t par1 = fit->GetParameter(0);
174 //this is done so that the fit is not drawn
175 //h1_phi->Fit("fit", "0", "", 1.0, TMath::Pi()/2-0.01);
177 Double_t subtract = (par0+par1)/2;//h1_phi->GetMinimum();
180 for(int i=0; i<h1_phi->GetNbinsX(); i++)
181 h1_phi->SetBinContent(i, h1_phi->GetBinContent(i) - subtract);
187 void showAllTriggerPt(const char* fileName, Int_t multBinBegin = 5, Int_t multBinEnd = 7, Int_t side = 0){
189 const Int_t pt1_bins_length = 3;
190 //Int_t pt1_bins[pt1_bins_length+1] = {6.0, 8.0, 10.0, 12.0, 14.0};
191 Int_t pt1_bins[pt1_bins_length+1] = {6.0, 8.0, 10.0, 12.0};
192 const Int_t pt2_bins_length = 2;
193 Int_t pt2_bins[pt2_bins_length] = {4.0, 6.0};
195 for(Int_t i=0; i<pt1_bins_length; i++){
196 Double_t pt1Minimum = pt1_bins[i];
197 Double_t pt1Maximum = pt1_bins[i+1];
198 for(Int_t j=0; j<pt2_bins_length; j++){
199 Double_t pt2Minimum = pt2_bins[j];
200 getAnalysis(fileName, pt1Minimum, pt1Maximum, pt2Minimum, gpTMin_assoc, gpTMax_assoc, gVertex, multBinBegin, multBinEnd, side, i, j, 1, 0);
205 void showAllTrigger1Pt(const char* fileName, Int_t multBinBegin = 5, Int_t multBinEnd = 7, Int_t pt2Minimum = 4.0, Double_t ptAssocMin = 0.5, Double_t ptAssocMax = 8.0){
207 const Int_t pt1_bins_length = 3;
208 Int_t pt1_bins[pt1_bins_length+1] = {6.0, 8.0, 10.0, 12.0};
210 for(Int_t i=0; i<pt1_bins_length; i++){
211 TH1D* near = getAnalysis(fileName, pt1_bins[i], pt1_bins[i+1], pt2Minimum, ptAssocMin, ptAssocMax, gVertex, multBinBegin, multBinEnd, 0, i, 0, 1, 0);
213 TH1D* away = getAnalysis(fileName, pt1_bins[i], pt1_bins[i+1], pt2Minimum, ptAssocMin, ptAssocMax, gVertex, multBinBegin, multBinEnd, 1, i, 1, 1, 0);
215 near->Divide(near, away);
216 TCanvas* c1 = new TCanvas(Form("can %i %i", i, 0), Form("can %i %i", i, 0), i*gBasisSize+50, 0, gBasisSize, gBasisSize);
223 void showAllAssocPt(const char* fileName, Int_t multBinBegin = 0, Int_t multBinEnd = 16, Int_t pt1Minimum = 4.0, Int_t pt1Maximum = 14.0, Int_t pt2Minimum = 2.0){
225 //const Int_t ptAssoc_bins_length = 5;
226 //Int_t ptAssoc_bins[ptAssoc_bins_length+1] = {1.0, 2.0, 3.0, 4.0, 6.0, 8.0};
227 const Int_t ptAssoc_bins_length = 3;
228 Int_t ptAssoc_bins[ptAssoc_bins_length+1] = {1.0, 3.0, 6.0, 8.0};
230 for(Int_t i=0; i<ptAssoc_bins_length; i++){
233 TH1D* near = getAnalysis(fileName, pt1Minimum, pt1Maximum, pt2Minimum, ptAssoc_bins[i], ptAssoc_bins[i+1], gVertex, multBinBegin, multBinEnd, 0, i, 0, draw, 0)->Clone();
235 TH1D* away = getAnalysis(fileName, pt1Minimum, pt1Maximum, pt2Minimum, ptAssoc_bins[i], ptAssoc_bins[i+1], gVertex, multBinBegin, multBinEnd, 1, i, 1, draw, 0)->Clone();
238 near->Divide(near, away);
240 TCanvas* c1 = new TCanvas(Form("can %i %i", i, 0), Form("can %i %i", i, 0), i*gBasisSize+50, 0, gBasisSize, gBasisSize);
242 //TCanvas* c2 = new TCanvas(Form("can2 %i %i", i, 0), Form("can2 %i %i", i, 0), i*gBasisSize+50, gBasisSize+50, gBasisSize, gBasisSize);
248 void showAllMult(const char* fileName, Int_t pt1Minimum = 4.0, Int_t pt1Maximum = 14.0, Int_t pt2Minimum = 2.0, Double_t ptAssocMin = 0.5, Double_t ptAssocMax = 8.0){
250 //in multiplicity this are the bins
251 //standard binning: 0, 1, 2, 3, 4, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100.1
252 const Int_t mult_bins_length = 5;
253 //Int_t mult_bins[mult_bins_length+1] = {1, 5, 6, 8, 11, 15};
254 Int_t mult_bins[mult_bins_length+1] = {1, 1, 5, 7, 9, 10};
256 for(Int_t i=0; i<mult_bins_length; i++){
257 TH1D* near = getAnalysis(fileName, pt1Minimum, pt1Maximum, pt2Minimum, ptAssocMin, ptAssocMax, gVertex, mult_bins[i], mult_bins[i+1], 0, i, 0, 1, 0);
259 TH1D* away = getAnalysis(fileName, pt1Minimum, pt1Maximum, pt2Minimum, ptAssocMin, ptAssocMax, gVertex, mult_bins[i], mult_bins[i+1], 1, i, 1, 1, 0);
261 near->Divide(near, away);
263 TCanvas* c1 = new TCanvas(Form("can %i %i", i, 0), Form("can %i %i", i, 0), i*gBasisSize+50, 0, gBasisSize, gBasisSize);
270 void showMultCompare(const char* filename, Int_t pt1Minimum = 4.0, Int_t pt1Maximum = 14.0, Int_t pt2Minimum = 2.0, Double_t ptAssocMin = 0.5, Double_t ptAssocMax = 8.0, Int_t side = 0, Int_t subtractMixedComb = 1, Int_t subtractFlow = 1){
272 TLegend *leg = new TLegend(0.65,0.7,0.85,0.9);
273 leg->SetFillColor(10);
274 leg->SetFillStyle(0);
275 leg->SetBorderSize(0);
276 leg->SetTextFont(gStyle->GetTextFont());
277 leg->SetTextSize(gStyle->GetTextSize()*1.0);
279 TH1D* central = getAnalysis(filename, pt1Minimum, pt1Maximum, pt2Minimum, ptAssocMin, ptAssocMax, 6.9, 1, 5, side, 1, 1, 0, subtractMixedComb, subtractFlow);
281 TCanvas* multCompare = new TCanvas("multCompare", "multCompare", gBasisSize+100, gBasisSize+50, 2*gBasisSize, 2*gBasisSize);
282 central->SetLineColor(kBlue);
283 leg->AddEntry(central->Clone(),"central","l");
284 subtractBaseline(central);
287 TH1D* semiCentral = getAnalysis(filename, pt1Minimum, pt1Maximum, pt2Minimum, ptAssocMin, ptAssocMax, 6.9, 9, 10, side, 1, 1, 0, subtractMixedComb, subtractFlow);
289 semiCentral->SetLineColor(kRed);
290 subtractBaseline(semiCentral);
291 semiCentral->DrawCopy("same");
292 leg->AddEntry(semiCentral->Clone(),"semiCentral","l");
294 TH1D* peripheral = getAnalysis(filename, pt1Minimum, pt1Maximum, pt2Minimum, ptAssocMin, ptAssocMax, 6.9, 11, 14, side, 1, 1, 0, subtractMixedComb);
296 peripheral->SetLineColor(kGreen);
297 leg->AddEntry(peripheral,"peripheral","l");
298 peripheral->DrawCopy("same");
303 //show same and mixed event of one vertex and multiplicity bin
304 //getRawAnalysis(filename, pt1Minimum, pt1Maximum, pt2Minimum, ptAssocMin, ptAssocMax, 3, 3);
307 void showAnalysis(const char* fileName, double pt1Min = 4.0, double pt1Max = 14.0, double pt2Min = 2.0, Double_t ptAssocMin = 0.5, Double_t ptAssocMax = 8.0, Int_t multBinBegin = 1, Int_t multBinEnd = 5, Int_t subtractMixedComb = 0, Int_t subtractFlow = 0){
309 TLegend* leg = getLegend();
312 TH1* near = (TH1*)getAnalysis(fileName, pt1Min, pt1Max, pt2Min, ptAssocMin, ptAssocMax, 6.9, multBinBegin, multBinEnd, 0, 1, 1, showPlots, subtractMixedComb, subtractFlow)->Clone();
314 subtractFlow(h2_etaPhi);
315 h2_etaPhi->GetYaxis()->SetRangeUser(-1.6, 1.6);//corresponds to the really used eta range
317 int firstbin = h2_etaPhi->GetYaxis()->FindBin(-0.59);
318 int lastbin = h2_etaPhi->GetYaxis()->FindBin(0.59);
320 TH1D* h1_phi = projectToTH1D(h2_etaPhi, "fully corrected", firstbin, lastbin, 1.0);//last number is triggers
322 leg->AddEntry(near->Clone(), "near side", "l");
324 TH1* away = getAnalysis(fileName, pt1Min, pt1Max, pt2Min, ptAssocMin, ptAssocMax, 6.9, multBinBegin, multBinEnd, 1, 2, 1, showPlots, subtractMixedComb, subtractFlow);
325 leg->AddEntry(away, "away side", "l");
329 TCanvas* c1 = new TCanvas("can", "can", gBasisSize+50, gBasisSize+50, gBasisSize, gBasisSize);
332 away->SetLineColor(kRed);
333 away->DrawCopy("same");
337 void peakDifference_mult(const char* fileName, double pt1Min = 4.0, double pt1Max = 14.0, double pt2Min = 2.0, Int_t subtractMixedComb = 1, Int_t subtractFlow = 1){
339 Int_t side = 0;//no effect because here both sides for one multiplicity are shown
341 peakDifference(fileName, pt1Min, pt1Max, pt2Min, 1, 5, side, 0, mode, subtractMixedComb, subtractFlow);
342 peakDifference(fileName, pt1Min, pt1Max, pt2Min, 9, 10, side, 1, mode, subtractMixedComb, subtractFlow);
346 void peakDifference_side(const char* fileName, double pt1Min = 4.0, double pt1Max = 14.0, double pt2Min = 2.0, Int_t subtractMixedComb = 1, Int_t subtractFlow = 1){
348 Int_t mult = 0;//no effect because here both multiplicities for one side are shown
350 peakDifference(fileName, pt1Min, pt1Max, pt2Min, mult, mult, 0, 0, mode, subtractMixedComb, subtractFlow);
351 peakDifference(fileName, pt1Min, pt1Max, pt2Min, mult, mult, 1, 1, mode, subtractMixedComb, subtractFlow);
355 //mode 0 near and away side (two different multiplicities in the two rows)
356 //mode 1 central and semi central (near side in top and away side in bottom row)
357 void peakDifference(const char* fileName, double pt1Min = 4.0, double pt1Max = 14.0, double pt2Min = 2.0, Int_t multBinBegin = 1, Int_t multBinEnd = 5, Int_t side = 0, Int_t yPos = 0, Int_t mode = 0, Int_t subtractMixedComb = 1, Int_t subtractFlow = 1, Int_t draw = 0){
359 Double_t near_content[pt_assoc_bins_number-1];
360 Double_t away_content[pt_assoc_bins_number-1];
361 Double_t onePlusOne_content[pt_assoc_bins_number-1];
362 Double_t near_error[pt_assoc_bins_number-1];
363 Double_t away_error[pt_assoc_bins_number-1];
364 Double_t onePlusOne_error[pt_assoc_bins_number-1];
366 for(int i=0; i<pt_assoc_bins_number-1; i++){
373 near = (TH1*)getAnalysis(fileName, pt1Min, pt1Max, pt2Min, pt_assoc_bins[i], pt_assoc_bins[i+1], 6.9, multBinBegin, multBinEnd, 0, 1, 1, 0, subtractMixedComb, subtractFlow)->Clone();
374 away = (TH1*)getAnalysis(fileName, pt1Min, pt1Max, pt2Min, pt_assoc_bins[i], pt_assoc_bins[i+1], 6.9, multBinBegin, multBinEnd, 1, 2, 1, 0, subtractMixedComb, subtractFlow)->Clone();
375 onePlusOne = (TH1*)getAnalysis(fileName, pt1Min, pt1Max, pt2Min, pt_assoc_bins[i], pt_assoc_bins[i+1], 6.9, multBinBegin, multBinEnd, 6, 2, 1, 0, subtractMixedComb, subtractFlow);
376 //onePlusOne = (TH1*)getAnalysis(fileName, pt2Min, pt1Min, pt2Min, pt_assoc_bins[i], pt_assoc_bins[i+1], 6.9, multBinBegin, multBinEnd, 6, 2, 1, 0, subtractMixedComb, subtractFlow);
378 can = new TCanvas(Form(" %i, mult %i-%i ", i, multBinBegin, multBinEnd), Form(" %i, mult %i-%i ", i, multBinBegin, multBinEnd), i*gBasisSize+100, yPos*(gBasisSize+50), gBasisSize, gBasisSize);
381 near = (TH1*)getAnalysis(fileName, pt1Min, pt1Max, pt2Min, pt_assoc_bins[i], pt_assoc_bins[i+1], 6.9, 1, 5, side, 1, 1, 0, subtractMixedComb, subtractFlow)->Clone();
382 away = (TH1*)getAnalysis(fileName, pt1Min, pt1Max, pt2Min, pt_assoc_bins[i], pt_assoc_bins[i+1], 6.9, 9, 10, side, 2, 1, 0, subtractMixedComb, subtractFlow);
384 can = new TCanvas(Form(" %i, side %i ", i, side), Form(" %i, side %i ", i, side), i*gBasisSize+50, yPos*(gBasisSize+50), gBasisSize, gBasisSize);
386 Printf("mode does not exist!");
389 away->SetLineColor(kRed);
391 onePlusOne->SetLineColor(kGreen);
393 Int_t bin_start = near->FindBin(-1*g_phi_bin);
394 Int_t bin_end = near->FindBin(g_phi_bin);
396 near_content[i] = near->IntegralAndError(bin_start, bin_end, near_error[i]);
397 away_content[i] = away->IntegralAndError(bin_start, bin_end, away_error[i]);
399 onePlusOne_content[i] = onePlusOne->IntegralAndError(bin_start, bin_end, onePlusOne_error[i]);
401 ((TH1*)(near->Clone()))->DrawCopy();
402 ((TH1*)(away->Clone()))->DrawCopy("same");
404 ((TH1*)(onePlusOne->Clone()))->DrawCopy("same");
407 TLegend* leg = getLegend();
409 leg->AddEntry(near,"near side","l");
410 leg->AddEntry(away,"away side","l");
411 leg->AddEntry(onePlusOne, "1plus1", "l");
413 leg->AddEntry(near,"central","l");
414 leg->AddEntry(away,"semi central","l");
422 double sum_1plus1 = 0;
425 double err_1plus1 = 0;
427 for(int i=0; i<pt_assoc_bins_number-1; i++){
428 Double_t diff = near_content[i] - away_content[i];
429 Double_t err = TMath::Sqrt(TMath::Power(near_error[i], 2) + TMath::Power(away_error[i], 2));
432 Printf("near side (%.1f - %.1f): %f +/- %f, away side %f +/- %f, difference: %f +/- %f ", pt_assoc_bins[i], pt_assoc_bins[i+1], near_content[i], near_error[i], away_content[i], away_error[i], diff, err);
433 sum_near += near_content[i]*(pt_assoc_bins[i] + pt_assoc_bins[i+1])/2;
434 sum_away += away_content[i]*(pt_assoc_bins[i] + pt_assoc_bins[i+1])/2;
435 sum_1plus1 += onePlusOne_content[i]*(pt_assoc_bins[i] + pt_assoc_bins[i+1])/2;
436 err_near += near_error[i]*(pt_assoc_bins[i] + pt_assoc_bins[i+1])/2;
437 err_away += away_error[i]*(pt_assoc_bins[i] + pt_assoc_bins[i+1])/2;
438 err_1plus1 += onePlusOne_error[i]*(pt_assoc_bins[i] + pt_assoc_bins[i+1])/2;
440 Printf("central (%.1f - %.1f): %f +/- %f, semi central %f +/- %f, difference: %f +/- %f ", pt_assoc_bins[i], pt_assoc_bins[i+1], near_content[i], near_error[i], away_content[i], away_error[i], diff, err);
444 Printf("Near side pT: %f +/- %f", sum_near, err_near);
445 Printf("Away side pT: %f +/- %f", sum_away, err_away);
446 Printf("1plus1 pT: %f +/- %f", sum_1plus1, err_1plus1);
449 //scale content with the bin width
450 for(int i=0; i<pt_assoc_bins_number-1; i++){
451 near_content[i] /= 2*pt_assoc_bin_error[i];
452 near_error[i] /= 2*pt_assoc_bin_error[i];
453 away_content[i] /= 2*pt_assoc_bin_error[i];
454 away_error[i] /= 2*pt_assoc_bin_error[i];
456 onePlusOne_content[i] /= 2*pt_assoc_bin_error[i];
457 onePlusOne_error[i] /= 2*pt_assoc_bin_error[i];
461 //divide content by 1+1 content
462 for(int i=0; i<pt_assoc_bins_number-1; i++){
463 near_content[i] /= onePlusOne_content[i];
464 near_error[i] /= onePlusOne_content[i];
465 away_content[i] /= onePlusOne_content[i];
466 away_error[i] /= onePlusOne_content[i];
469 TGraphErrors* graph_near = new TGraphErrors(pt_assoc_bins_number, pt_assoc_bin_center, near_content, pt_assoc_bin_error, near_error);
470 TGraphErrors* graph_away = new TGraphErrors(pt_assoc_bins_number, pt_assoc_bin_center, away_content, pt_assoc_bin_error, away_error);
471 TGraphErrors* graph_onePlusone = new TGraphErrors(pt_assoc_bins_number, pt_assoc_bin_center, onePlusOne_content, pt_assoc_bin_error, onePlusOne_error);
473 TCanvas* can_graph = new TCanvas(Form("result %i", yPos), Form("result %i", yPos), pt_assoc_bins_number*gBasisSize+50, yPos*(gBasisSize+50), gBasisSize, gBasisSize);
475 graph_near->GetXaxis()->SetTitle("p_{T,assoc} (GeV/c)");
476 graph_near->GetYaxis()->SetTitle("1/N dN/dpT");
477 graph_near->SetMarkerSize(2);
478 graph_near->SetLineWidth(2);
479 graph_near->SetMarkerColor(kBlue);
480 graph_near->SetLineColor(kBlue);
481 graph_near->SetMarkerStyle(20);
482 graph_away->GetXaxis()->SetTitle("p_{T,assoc} (GeV/c)");
483 graph_away->GetYaxis()->SetTitle("1/N dN/dpT");
484 graph_away->SetMarkerSize(2);
485 graph_away->SetLineWidth(2);
486 graph_away->SetMarkerColor(kRed);
487 graph_away->SetLineColor(kRed);
488 graph_away->SetMarkerStyle(22);
489 graph_near->Draw("AP");
490 graph_away->Draw("P");
492 if(false && mode==0){
493 graph_onePlusone->GetXaxis()->SetTitle("p_{T,assoc} (GeV/c)");
494 graph_onePlusone->GetYaxis()->SetTitle("1/N dN/dpT");
495 graph_onePlusone->SetMarkerSize(2);
496 graph_onePlusone->SetLineWidth(2);
497 graph_onePlusone->SetMarkerColor(kGreen);
498 graph_onePlusone->SetLineColor(kGreen);
499 graph_onePlusone->SetMarkerStyle(22);
500 graph_onePlusone->Draw("P");
504 TLegend* leg2 = getLegend();
506 leg2->AddEntry(graph_near,"near side","l");
507 leg2->AddEntry(graph_away,"away side","l");
508 leg2->AddEntry(graph_onePlusone,"1plus1","l");
510 leg2->AddEntry(graph_near,"central","l");
511 leg2->AddEntry(graph_away,"semi central","l");
523 void create_peakDifference_pictures(const char* fileName){
525 gROOT->SetBatch(kTRUE);
527 Printf("peakDifference_draw(fileName, 6, 8, 4, 1, 1, 1");
528 peakDifference_draw(fileName, 6, 8, 4, 1, 1, 1);
530 Printf("peakDifference_draw(fileName, 6, 8, 6, 1, 1, 1");
531 peakDifference_draw(fileName, 6, 8, 6, 1, 1, 1);
532 Printf("peakDifference_draw(fileName, 8, 10, 4, 1, 1, 1");
533 peakDifference_draw(fileName, 8, 10, 4, 1, 1, 1);
534 Printf("peakDifference_draw(fileName, 8, 10, 6, 1, 1, 1");
535 peakDifference_draw(fileName, 8, 10, 6, 1, 1, 1);
536 Printf("peakDifference_draw(fileName, 10, 12, 4, 1, 1, 1");
537 peakDifference_draw(fileName, 10, 12, 4, 1, 1, 1);
538 Printf("peakDifference_draw(fileName, 10, 12, 6, 1, 1, 1");
539 peakDifference_draw(fileName, 10, 12, 6, 1, 1, 1);
542 TCanvas* can = new TCanvas("can_filename", "can_filename");
543 TH1F* mixedDist = getMixedDist(fileName);
544 mixedDist->SetTitle(fileName);
545 mixedDist->Draw("colz");
546 can->SaveAs("pt_spectra/filename.eps");
553 void peakDifference_draw(const char* fileName, double pt1Min = 4.0, double pt1Max = 14.0, double pt2Min = 2.0, Int_t yPos = 0, Int_t subtractMixedComb = 1, Int_t subtractFlow = 1){
555 TGraphErrors* graph_central_near = (TGraphErrors*)(peakDifference_graph(fileName, pt1Min, pt1Max, pt2Min, 1, 5, 0, yPos, subtractMixedComb, subtractFlow)->Clone());
556 TGraphErrors* graph_central_away = (TGraphErrors*)(peakDifference_graph(fileName, pt1Min, pt1Max, pt2Min, 1, 5, 1, yPos, subtractMixedComb, subtractFlow)->Clone());
558 TGraphErrors* graph_semi_near = (TGraphErrors*)(peakDifference_graph(fileName, pt1Min, pt1Max, pt2Min, 9, 10, 0, yPos, subtractMixedComb, subtractFlow)->Clone());
559 TGraphErrors* graph_semi_away = (TGraphErrors*)(peakDifference_graph(fileName, pt1Min, pt1Max, pt2Min, 9, 10, 1, yPos, subtractMixedComb, subtractFlow)->Clone());
561 TCanvas* can_graph = new TCanvas(Form("result %i", yPos), Form("result %i", yPos), gBasisSize+50, yPos*(gBasisSize+50), gBasisSize, gBasisSize);
565 Double_t maximum = TMath::MaxElement(elements, graph_central_near->GetY());
566 Printf("maximum of central near is %f ", maximum);
567 Double_t max = TMath::MaxElement(elements, graph_central_away->GetY());
568 Printf("maximum of central away is %f ", max);
569 if(max>maximum) maximum = max;
570 max = TMath::MaxElement(elements, graph_semi_near->GetY());
571 Printf("maximum of semi near is %f ", max);
572 if(max>maximum) maximum = max;
573 max = TMath::MaxElement(elements, graph_semi_away->GetY());
574 Printf("maximum of semi away is %f ", max);
575 if(max>maximum) maximum = max;
576 graph_central_near->SetMaximum(maximum*1.25);
578 Double_t minimum = TMath::MinElement(elements, graph_central_near->GetY());
579 //if(minimum==0) minimum = maximum;
580 Printf("minimum of central near is %f ", minimum);
581 Double_t min = TMath::MinElement(elements, graph_central_away->GetY());
582 Printf("minimum of central away is %f ", min);
583 if(min>0 && min<minimum) minimum = min;
584 min = TMath::MinElement(elements, graph_semi_near->GetY());
585 Printf("minimum of semi near is %f ", min);
586 if(min>0 && min<minimum) minimum = min;
587 min = TMath::MinElement(elements, graph_semi_away->GetY());
588 Printf("minimum of semi away is %f ", min);
589 if(min>0 && min<minimum) minimum = min;
590 graph_central_near->SetMinimum(minimum/1.30);
593 graph_central_near->SetTitle(Form("p_{T,assoc} spectrum for %.1f < p_{T,1} < %.1f and %.1f < p_{T,2} < p_{T,1}", pt1Min, pt1Max, pt2Min));
594 graph_central_near->Draw("AP");
596 graph_central_away->SetMarkerColor(kRed);
597 graph_central_away->SetLineColor(kRed);
598 graph_central_away->Draw("P");
600 graph_semi_near->SetMarkerColor(kCyan);
601 graph_semi_near->SetLineColor(kCyan);
602 graph_semi_near->Draw("P");
604 graph_semi_away->SetMarkerColor(kOrange);
605 graph_semi_away->SetLineColor(kOrange);
606 graph_semi_away->Draw("P");
610 TLegend* leg = getLegend(0.40,0.75,0.85,0.9);
611 leg->AddEntry(graph_central_near,"central near","l");
612 leg->AddEntry(graph_central_away,"central away side","l");
613 leg->AddEntry(graph_semi_near,"semi central near","l");
614 leg->AddEntry(graph_semi_away,"semi central away","l");
617 can_graph->SaveAs(Form("pt_spectra/pt_spectrum_%.0f_%.0f_%.0f.eps", pt1Min, pt1Max, pt2Min));
619 save_graph_ratio(graph_central_near, graph_central_away, graph_semi_near, graph_semi_away, elements, Form("central and semi near over away p_{T,assoc} spectrum for %.1f < p_{T,1} < %.1f and %.1f < p_{T,2} < p_{T,1}", pt1Min, pt1Max, pt2Min), Form("pt_spectra/centralANDsemi_near_away_ratio_%.0f_%.0f_%.0f.eps", pt1Min, pt1Max, pt2Min), "central", "semi central");
621 save_graph_ratio(graph_central_near, graph_semi_near, graph_central_away, graph_semi_away, elements, Form("near and semi central over semi p_{T,assoc} spectrum for %.1f < p_{T,1} < %.1f and %.1f < p_{T,2} < p_{T,1}", pt1Min, pt1Max, pt2Min), Form("pt_spectra/nearANDaway_central_semi_ratio_%.0f_%.0f_%.0f.eps", pt1Min, pt1Max, pt2Min), "near", "away");
623 save_graph_difference(graph_central_near, graph_central_away, graph_semi_near, graph_semi_away, elements, Form("central and semi near minus away p_{T,assoc} spectrum for %.1f < p_{T,1} < %.1f and %.1f < p_{T,2} < p_{T,1}", pt1Min, pt1Max, pt2Min), Form("pt_spectra/centralANDsemi_near_away_diff_%.0f_%.0f_%.0f.eps", pt1Min, pt1Max, pt2Min));
628 void save_graph_ratio(TGraphErrors* first, TGraphErrors* second, TGraphErrors* third, TGraphErrors* forth, const Int_t bins, char* title, char* name, char* legend1, char* legend2){
630 Double_t start_x = 0.45;
634 TLegend *leg = getLegend(start_x,0.75,0.85,0.9);
636 TGraphErrors* graph = (TGraphErrors*)(save_graph_compute(first, second, bins, title, 0, NULL, NULL)->Clone());
637 if(third!=NULL && forth!=NULL){
638 TGraphErrors* graph2 = (TGraphErrors*)(save_graph_compute(third, forth, bins, title, 0, NULL, NULL)->Clone());
640 leg->AddEntry(graph, legend1, "p");
641 leg->AddEntry(graph2, legend2, "p");
643 save_graph(graph, graph2, name, 0, leg);
645 save_graph(graph, NULL, name, 0, leg);
651 void save_graph_difference(TGraphErrors* first, TGraphErrors* second, TGraphErrors* third, TGraphErrors* forth, const Int_t bins, char* title, char* name){
654 Double_t diff1_err = 0;
656 Double_t diff2_err = 0;
658 TGraphErrors* graph = (TGraphErrors*)(save_graph_compute(first, second, bins, title, 1, &diff1, &diff1_err)->Clone());
659 TGraphErrors* graph2 = (TGraphErrors*)(save_graph_compute(third, forth, bins, title, 1, &diff2, &diff2_err)->Clone());
661 TLegend *leg = getLegend(0.45,0.15,0.85,0.3);
662 leg->AddEntry(graph, "central", "p");
663 leg->AddEntry(graph2, "semi central", "p");
664 leg->AddEntry(graph, Form("\\Delta E = %.1f \\pm %.1f", diff1, diff1_err),"");
665 leg->AddEntry(graph2, Form("\\Delta E = %.1f \\pm %.1f", diff2, diff2_err),"");
667 save_graph(graph, graph2, name, 1, leg);
672 //mode: 0 ratio of the graphs
673 //mode: 1 difference of the graphs
674 //returns difference of the graphs
675 void save_graph(TGraphErrors* first, TGraphErrors* second, char* name, int mode, TLegend *leg){
676 TCanvas* can_graph_ratio = new TCanvas("can_saveGraph", "can_saveGraph", gBasisSize+50, gBasisSize+50, gBasisSize, gBasisSize);
678 first->SetMinimum(0.4);
679 first->SetMaximum(1.6);
681 first->SetMarkerSize(1);
682 first->SetLineWidth(3);
683 first->SetMarkerColor(kBlue);
684 first->SetLineColor(kBlue);
685 first->SetMarkerStyle(20);
689 second->SetMarkerSize(1);
690 second->SetLineWidth(3);
691 second->SetMarkerColor(kRed);
692 second->SetLineColor(kRed);
693 second->SetMarkerStyle(20);
699 can_graph_ratio->SaveAs(name);
702 TGraphErrors* save_graph_compute(TGraphErrors* first, TGraphErrors* second, const Int_t bins, char* title, int mode, Double_t* diff, Double_t* diff_err){
703 Double_t content_x[bins];
704 Double_t content_y[bins];
705 Double_t x_error[bins];
706 Double_t y_error[bins];
707 for(int i=0; i<bins; i++){
713 Double_t error_first;
714 Double_t error_second;
715 first->GetPoint(i, content_x[i], content_y[i]);
716 x_error[i] = first->GetErrorX(i);
717 error_first = first->GetErrorY(i);
718 Double_t content_second;
719 second->GetPoint(i, content_x[i], content_second);
720 error_second = second->GetErrorY(i);
721 if(content_second>0 && error_second>0){
723 content_y[i] /= content_second;
724 y_error[i] = TMath::Sqrt(TMath::Power(error_first/content_second, 2) + TMath::Power(error_second/content_second*content_y[i], 2));
726 content_y[i] -= content_second;
727 y_error[i] = TMath::Sqrt(TMath::Power(error_first, 2) + TMath::Power(error_second, 2));
729 Printf("calls save graph with no correct mode");
732 }else{Printf("content or content error is smaller or equal to 0");}
734 //if this is mode 1 (difference of the graphs) this calculates the difference of the plots
736 //Double_t diff_err = 0;
738 for(int i=0; i<bins; i++){
739 *diff += content_y[i] * content_x[i];
740 *diff_err += TMath::Power(y_error[i]*content_x[i], 2);
742 *diff_err = TMath::Sqrt(*diff_err);
745 TGraphErrors* graph = new TGraphErrors(bins, content_x, content_y, x_error, y_error);
746 graph->SetTitle(title);
747 graph->GetXaxis()->SetTitle("p_{T,assoc} (GeV/c)");
753 TGraphErrors* peakDifference_graph(const char* fileName, double pt1Min = 4.0, double pt1Max = 14.0, double pt2Min = 2.0, Int_t multBinBegin = 1, Int_t multBinEnd = 5, Int_t side = 0, Int_t yPos = 0, Int_t subtractMixedComb = 1, Int_t subtractFlow = 1, Int_t draw = 0){
754 Double_t content[pt_assoc_bins_number-1];
755 Double_t error[pt_assoc_bins_number-1];
757 for(int i=0; i<pt_assoc_bins_number-1; i++){
758 TH1* near = (TH1*)getAnalysis(fileName, pt1Min, pt1Max, pt2Min, pt_assoc_bins[i], pt_assoc_bins[i+1], 6.9, multBinBegin, multBinEnd, side, 1, 1, 0, subtractMixedComb, subtractFlow)->Clone();
760 Int_t bin_start = near->FindBin(-1*g_phi_bin);
761 Int_t bin_end = near->FindBin(g_phi_bin);
763 content[i] = near->IntegralAndError(bin_start, bin_end, error[i]);
766 //scale content with the bin width
767 for(int i=0; i<pt_assoc_bins_number-1; i++){
768 content[i] /= 2*pt_assoc_bin_error[i];
769 error[i] /= 2*pt_assoc_bin_error[i];
772 TGraphErrors* graph = new TGraphErrors(pt_assoc_bins_number-1, pt_assoc_bin_center, content, pt_assoc_bin_error, error);
774 graph->GetXaxis()->SetTitle("p_{T,assoc} (GeV/c)");
775 graph->GetYaxis()->SetTitle("1/N dN/dpT");
776 graph->SetMarkerSize(1);
777 graph->SetLineWidth(3);
778 graph->SetMarkerColor(kBlue);
779 graph->SetLineColor(kBlue);
780 graph->SetMarkerStyle(20);
801 void showAll1plus1(const char* fileName, double pt1Min = 4.0, double pt1Max = 14.0, double pt2Min = 2.0, Int_t subtractMixedComb = 1, Int_t subtractFlow = 1){
803 show1plus1("AnalysisResults_1045.root", pt1Min, pt1Max, 1, 5, 0, subtractFlow);
805 show1plus1("AnalysisResults_1045.root", pt1Min, pt1Max, 9, 10, 1, subtractFlow);
808 void show1plus1(const char* fileName, double pt1Min = 4.0, double pt1Max = 14.0, Int_t multBinBegin = 1, Int_t multBinEnd = 5, Int_t yPos = 0, Int_t subtractFlow = 1){
810 //for 1+1 there is no mixed comb
811 Int_t subtractMixedComb = 0;
813 const int pt1_bins = 2;//(pt1Max-pt1Min)/2;
814 static const int pt1_bins_max = 20;
816 if(pt1_bins>pt1_bins_max){
817 printf("error not enough pt1_bins");
821 Double_t content[pt1_bins_max][pt_assoc_bins_number-1];
822 Double_t error[pt1_bins_max][pt_assoc_bins_number-1];
824 for(int i=0; i<pt_assoc_bins_number-1; i++){
825 TCanvas* can = new TCanvas(Form("1plus1 %i, pT %i", yPos, i), Form("1plus1 %i, pT %i", yPos, i), i*gBasisSize+50, yPos*(gBasisSize+50), gBasisSize, gBasisSize);
827 TLegend *leg = getLegend();
829 for(int j=0; j<pt1_bins; j++){
830 double pt1Minimum = pt1Min+j*2.0;
831 TH1D* onePlusOne = (TH1*)getAnalysis(fileName, pt1Minimum, pt1Minimum + 2.0, 0, pt_assoc_bins[i], pt_assoc_bins[i+1], 6.9, multBinBegin, multBinEnd, 6, 2, 1, 0, subtractMixedComb, subtractFlow);
833 Int_t bin_start = onePlusOne->FindBin(-1*g_phi_bin);
834 Int_t bin_end = onePlusOne->FindBin(g_phi_bin);
836 content[j][i] = onePlusOne->IntegralAndError(bin_start, bin_end, error[j][i]);
839 onePlusOne->SetLineColor(kRed);
841 onePlusOne->SetLineColor(kGreen);
843 onePlusOne->SetLineColor(kMagenta);
846 ((TH1*)(onePlusOne->Clone()))->DrawCopy();
848 ((TH1*)(onePlusOne->Clone()))->DrawCopy("same");
851 leg->AddEntry((TH1*)(onePlusOne->Clone()), Form("pT %.0f", pt1Minimum) ,"l");
858 TCanvas* can_graph = new TCanvas(Form("result %i", yPos), Form("result %i", yPos), pt_assoc_bins_number*gBasisSize+50, yPos*(gBasisSize+50), gBasisSize, gBasisSize);
860 TLegend *leg = getLegend();
862 for(int j=0; j<pt1_bins; j++){
863 TGraphErrors* graph = new TGraphErrors(pt_assoc_bins_number, pt_assoc_bin_center, content[j], pt_assoc_bin_error, error[j]);
865 graph->GetXaxis()->SetTitle("p_{T,assoc} (GeV/c)");
866 graph->GetYaxis()->SetTitle("1/N dN/dpT");
867 graph->SetMarkerSize(2);
868 graph->SetLineWidth(2);
869 graph->SetMarkerStyle(20);
872 //graph->SetMarkerColor(kCyan);
873 //graph->SetLineColor(kCyan);
874 graph->SetMarkerColor(kBlue);
875 graph->SetLineColor(kBlue);
876 (TGraphErrors*)(graph->Clone())->Draw("AP");
877 //(TGraphErrors*)(graph->Clone())->Draw("P");
879 //graph->SetMarkerColor(kOrange);
880 //graph->SetLineColor(kOrange);
881 graph->SetMarkerColor(kRed);
882 graph->SetLineColor(kRed);
883 (TGraphErrors*)(graph->Clone())->Draw("P");
885 //graph->SetMarkerColor(kMagenta);
886 //graph->SetLineColor(kMagenta);
887 graph->SetMarkerColor(kGreen);
888 graph->SetLineColor(kGreen);
889 (TGraphErrors*)(graph->Clone())->Draw("P");
892 double pt1Minimum = pt1Min+j*2.0;
893 leg->AddEntry((TGraphErrors*)(graph->Clone()),Form("pT %.0f", pt1Minimum),"l");
902 //does the reading out of the results
903 //divides the same event by the mixed events
904 //subtracts the mixed combinatorics
905 TH1D* getAnalysis(const char* fileName, double pt1Min = 4.0, double pt1Max = 14.0, Double_t pt2Min = 2.0, Double_t ptAssocMin = 0.5, Double_t ptAssocMax = 8.0, Double_t setVertex = 7, Int_t multBinBegin = 1, Int_t multBinEnd = 5, Int_t step = 0, Int_t posX = 1, Int_t posY = 1, Int_t showPlots = 0, Int_t subtractMixedComb = 0, Int_t subtractFlow =0, Int_t* trigger = NULL)
908 //to guarantee to pick only the bins from the choosen pt on
915 AliTwoPlusOneContainer* h = (AliTwoPlusOneContainer*) GetTwoPlusOne(fileName);
917 AliUEHist::CFStep step_same = step;//(AliUEHist::CFStep) AliTwoPlusOneContainer::kSameNS;
918 AliUEHist::CFStep step_mixed = (step%2)+2;//(AliUEHist::CFStep) AliTwoPlusOneContainer::kMixedNS;
919 if(step>=7) step_mixed = ((step+1)%2)+2;
920 AliUEHist::CFStep step_mixedComb = (step%2)+4;//(AliUEHist::CStep) AliTwoPlusOneContainer::kMixedCombNS;
921 AliUEHist::CFStep step_backgroundSame = (step%2)+7;//(AliUEHist::CStep) AliTwoPlusOneContainer::kBackgroundSameNS;
923 AliUEHist::CFStep step_1plus1 = (AliUEHist::CFStep) AliTwoPlusOneContainer::k1plus1;
924 AliUEHist::CFStep step_1plus1_mixed = (AliUEHist::CFStep) AliTwoPlusOneContainer::kMixed1plus1;
926 h->GetData()->SetPtRange(ptAssocMin, ptAssocMax);
927 h->GetData()->SetPt2Min(pt2Min);
928 h->GetData()->SetZVtxRange(-1*setVertex, setVertex);
930 //GetSumOfRatios2(mixed, step, region, ptLeadMin, ptLeadMax, multBinBegin, multBinEnd, normalizePerTrigger, stepForMixed)
932 TH2D* h2_etaPhi_mixedComb;
933 TH2D* h2_etaPhi_backgroundSame;
936 //TH2D* h2_etaPhi_mixedComb2;
938 TH1D* h1_phi_cloneProject;
940 if(step>=2||!subtractMixedComb){
941 Int_t trigger_etaPhi;
943 h2_etaPhi = (TH2D*) h->GetData()->GetSumOfRatios2(h->GetData(), step_same, 0, pt1Min, pt1Max, multBinBegin, multBinEnd, kTRUE, step_mixed, &trigger_etaPhi);
945 h2_etaPhi = (TH2D*) h->GetData()->GetSumOfRatios2(h->GetData(), step_1plus1, 0, pt1Min, pt1Max, multBinBegin, multBinEnd, kTRUE, step_1plus1_mixed, &trigger_etaPhi);
948 *trigger = (Int_t)trigger_etaPhi;
949 }else if(step<2 && subtractMixedComb){
951 Int_t trigger_mixed_comb;
952 Int_t trigger_background_same;
954 //h2_etaPhi = (TH2D*) h->GetData()->GetSumOfRatios2(h->GetData(), step_same, 0, pt1Min, pt1Max, multBinBegin, multBinEnd, kFALSE, step_mixed, &trigger_same);
955 h2_etaPhi = (TH2D*) h->GetData()->GetSumOfRatios2(h->GetData(), step_same, 0, pt1Min, pt1Max, multBinBegin, multBinEnd, kFALSE, step_1plus1_mixed, &trigger_same);
956 TH2D* h2_etaPhi_clone = h2_etaPhi->Clone();
958 subtractFlow(h2_etaPhi_clone);
959 h2_etaPhi_clone->Scale(1.0/trigger_same);
961 //don't need to use getMixedComb_scaled_backgroundSame, see compareScaledMixedComb which shows that both methods are identical but here getSumOfRatios is used which makes it easier (and safer against errors)
962 //the 1+1 analysis can only be used if the full analysis was done within the same pt bins
966 h2_etaPhi_mixedComb = (TH2D*) h->GetData()->GetSumOfRatios2(h->GetData(), step_1plus1, 0, pt1Min, pt1Max, multBinBegin, multBinEnd, kFALSE, step_1plus1_mixed, &trigger_mixed_comb);
968 h2_etaPhi_mixedComb = (TH2D*) h->GetData()->GetSumOfRatios2(h->GetData(), step_1plus1, 0, pt2Min, pt1Min, multBinBegin, multBinEnd, kFALSE, step_1plus1_mixed, &trigger_mixed_comb);
969 else //this is never used, it's the old method of getting the background
970 h2_etaPhi_mixedComb = (TH2D*) h->GetData()->GetSumOfRatios2(h->GetData(), step_mixedComb, 0, pt1Min, pt1Max, multBinBegin, multBinEnd, kFALSE, step_mixed, &trigger_mixed_comb);
972 h2_etaPhi_backgroundSame = (TH2D*) h->GetData()->GetSumOfRatios2(h->GetData(), step_backgroundSame, 0, pt1Min, pt1Max, multBinBegin, multBinEnd, kFALSE, step_mixed, &trigger_background_same);
974 //trigger_background_same *= 2;//error in the plots for runs 968 and 973
975 double trigger_ratio = (double)trigger_background_same;
976 if(trigger_mixed_comb>0)
977 trigger_ratio /= trigger_mixed_comb;
978 Printf("trigger mixed comb: %i, trigger background same %i, ratio %f", trigger_mixed_comb, trigger_background_same, trigger_ratio);
979 h2_etaPhi_mixedComb->Scale(trigger_ratio);
980 trigger_mixed_comb = trigger_background_same;
981 Printf("trigger same: %i, trigger mixed comb %i ", trigger_same, trigger_mixed_comb);
983 int firstbin = h2_etaPhi->GetYaxis()->FindBin(-1*g_eta_bin);
984 int lastbin = h2_etaPhi->GetYaxis()->FindBin(g_eta_bin);
987 TCanvas* can_1 = new TCanvas("sameEvent near side", "sameEvent near side", 100, 50, gBasisSize, gBasisSize);
988 h2_etaPhi->DrawCopy("surf1");
990 //TH1D* h1_phi_1 = projectToTH1D(h2_etaPhi, "same near", firstbin, lastbin, trigger_same);
991 TH1D* h1_phi_1 = projectToTH1D(h2_etaPhi, "same near", firstbin, lastbin, 1.0);
992 h1_phi_1->SetLineColor(kRed);
993 //h1_phi_1->DrawCopy();
995 TLegend *leg = getLegend();
996 leg->AddEntry(h1_phi_1,"same event","l");
998 TCanvas* can_2 = new TCanvas("sameEvent mixed comb", "sameEvent mixed comb", gBasisSize+100, 50, gBasisSize, gBasisSize);
999 h2_etaPhi_mixedComb->DrawCopy("surf1");
1000 //TH1D* h1_phi_2 = projectToTH1D(h2_etaPhi_mixedComb, "mixedComb near", firstbin, lastbin, trigger_mixed_comb);
1001 TH1D* h1_phi_2 = projectToTH1D(h2_etaPhi_mixedComb, "mixedComb near", firstbin, lastbin, 1.0);
1002 Printf(Form("trigger mixed_comb", trigger_mixed_comb));
1003 //h1_phi_2->DrawCopy();
1004 leg->AddEntry(h1_phi_2->Clone(),"mixed comb","l");
1005 //leg->Draw("same");
1007 TCanvas* can_2 = new TCanvas("sameEvent flow subtracted", "sameEvent flow subtracted", 100, 2*(gBasisSize+50), gBasisSize, gBasisSize);
1008 //TH2D* h2_etaPhi_clone = h2_etaPhi->Clone(); // is already cloned earlier
1009 //subtractFlow(h2_etaPhi_clone);
1011 h1_phi_cloneProject = projectToTH1D(h2_etaPhi_clone, "same flow subtracted", firstbin, lastbin, trigger_same);
1012 h1_phi_cloneProject->DrawCopy();
1014 TCanvas* can_3 = new TCanvas("mixed comb subtracted", "mixed comb subtracted", 2*gBasisSize+100, 2*(gBasisSize+50), gBasisSize, gBasisSize);
1015 h2_etaPhi->Add(h2_etaPhi_mixedComb, -1);
1016 //h2_etaPhi2->Add(h2_etaPhi_mixedComb2, -1);
1018 if(trigger_same-trigger_mixed_comb>0)
1019 h2_etaPhi->Scale(1.0/(trigger_same-trigger_mixed_comb));
1020 //h2_etaPhi2->Scale(1.0/(trigger_same2-trigger_mixed_comb2));
1022 //h2_etaPhi->DrawCopy("surf1");
1023 h1_phi_3 = projectToTH1D(h2_etaPhi, "same minus mixedComb", firstbin, lastbin, 1.0);
1024 //h1_phi_3_b = projectToTH1D(h2_etaPhi2, "same minus mixedComb away", firstbin, lastbin, 1.0);
1025 h1_phi_3->SetLineColor(kRed);
1026 h1_phi_3->DrawCopy();
1027 //h1_phi_3_b->DrawCopy("same");
1029 TLegend* leg2 = getLegend();
1030 leg2->AddEntry(h1_phi_3, "near side", "l");
1031 //leg2->AddEntry(h1_phi_3_b, "away side", "l");
1035 h2_etaPhi->Add(h2_etaPhi_mixedComb, -1);
1037 if(trigger_same-trigger_mixed_comb>0)
1038 h2_etaPhi->Scale(1.0/(trigger_same-trigger_mixed_comb));
1039 //using backgroundSame as correction, can only be used if the used phi and eta bins of the associated particles are very close to the trigger particles
1041 h2_etaPhi->Add(h2_etaPhi_backgroundSame, -1);
1042 h2_etaPhi->Scale(1.0/(trigger_same-trigger_background_same));
1046 subtractFlow(h2_etaPhi_mixedComb);
1047 if(trigger_mixed_comb>0)
1048 h2_etaPhi_mixedComb->Scale(1.0/trigger_mixed_comb);
1052 *trigger = (Int_t)trigger_same-trigger_mixed_comb;
1055 Printf("cannot subtract mixed combinatorics from step %i ", step);
1060 subtractFlow(h2_etaPhi);
1061 h2_etaPhi->GetYaxis()->SetRangeUser(-1.6, 1.6);//corresponds to the really used eta range
1063 int firstbin = h2_etaPhi->GetYaxis()->FindBin(-1*g_eta_bin);
1064 int lastbin = h2_etaPhi->GetYaxis()->FindBin(g_eta_bin);
1066 TH1D* h1_phi = projectToTH1D(h2_etaPhi, "fully corrected", firstbin, lastbin, 1.0);
1067 //TH1D* h1_phi = projectToTH1D(h2_etaPhi_mixedComb, "fully corrected", firstbin, lastbin, 1.0);//shows background distributions
1070 TLegend *leg = getLegend();
1072 TCanvas* can_4 = new TCanvas(Form("fully corrected, %i, %i ", posX, posY), Form("fully corrected, %i, %i ", posX, posY), posX*gBasisSize+100, 50, gBasisSize, gBasisSize);
1073 h2_etaPhi->GetYaxis()->SetRangeUser(-1.4, 1.4);
1074 h2_etaPhi->DrawCopy("surf1");
1075 //h2_etaPhi_mixedComb->DrawCopy("surf1");
1076 //h1_phi->DrawCopy();
1077 //h1_phi_cloneProject->SetLineColor(kRed);
1078 //h1_phi_cloneProject->DrawCopy("same");
1080 leg->AddEntry(h1_phi,"with mixed comb","l");
1081 leg->AddEntry(h1_phi_cloneProject,"without mixed comb","l");
1083 //leg->Draw("same");
1087 TCanvas* can_5 = new TCanvas(Form("compare projection, %i, %i ", posX, posY), Form("compare projection, %i, %i ", posX, posY), posX*gBasisSize+100, posY*gBasisSize+50, gBasisSize, gBasisSize);
1088 TLegend *leg2 = getLegend();
1091 leg2->AddEntry(h1_phi,"chosen correction","l");
1092 TH1D* h1_phi_raw = projectToTH1D(h2_etaPhi_clone, "raw same event", firstbin, lastbin, 1.0);
1093 h1_phi_raw->SetLineColor(kRed);
1094 h1_phi_raw->DrawCopy("same");
1095 leg2->AddEntry(h1_phi_raw,"raw same event","l");
1096 TH1D* h1_phi_mixedComb = projectToTH1D(h2_etaPhi_mixedComb, "mixed comb", firstbin, lastbin, 1.0);
1097 h1_phi_mixedComb->SetLineColor(kGreen);
1098 h1_phi_mixedComb->DrawCopy("same");
1099 leg2->AddEntry(h1_phi_mixedComb,"mixed comb","l");
1107 TH1D* projectToTH1D(TH2D* etaPhi, char* name, int firstbin, int lastbin, int trigger){
1108 // Printf(Form("name %s", name));
1110 TH1D* h1_phi_1 = etaPhi->ProjectionX(Form("px_%s", name), firstbin, lastbin);
1111 h1_phi_1->SetLineWidth(3);
1112 h1_phi_1->SetStats(kFALSE);
1113 h1_phi_1->Scale(1.0/trigger);
1114 h1_phi_1->Scale(1.0/(double)(lastbin-firstbin+1));
1115 h1_phi_1->Scale(etaPhi->GetYaxis()->GetBinWidth(firstbin));//scale with eta bin width
1116 h1_phi_1->GetXaxis()->SetRangeUser(-TMath::Pi()/2+0.01, TMath::Pi()/2-0.01);
1117 //h1_phi_1->GetXaxis()->SetRangeUser(-TMath::Pi()/2+0.01, 3*TMath::Pi()/2-0.01);
1118 h1_phi_1->SetYTitle("1/N \\ dN/(d \\Delta \\varphi)");
1120 symmetrize(h1_phi_1);
1121 subtractBaseline(h1_phi_1);
1126 TLegend* getLegend(double x_start = 0.65, double y_start = 0.7, double x_end = 0.85, double y_end = 0.9){
1127 TLegend *leg = new TLegend(x_start, y_start, x_end, y_end);
1128 leg->SetFillColor(10);
1129 leg->SetFillStyle(0);
1130 leg->SetBorderSize(0);
1131 leg->SetTextFont(gStyle->GetTextFont());
1132 leg->SetTextSize(gStyle->GetTextSize()*1.0);
1136 void compareAllBackground(const char* fileName, double pt1Min = 4.0, double pt1Max = 14.0, Double_t pt2Min = 2.0, Int_t subtractMixedComb = 0, Int_t subtractFlow = 0){
1138 //static const int pt_assoc_bins_number = 8;
1139 //Double_t pt_assoc_bins[pt_assoc_bins_number] = {0.5, 1.0, 2.0, 3.0, 4.0, 6.0, 8.0, 10.0};
1141 for(int i=0; i<pt_assoc_bins_number-1; i++){
1142 compareBackground(fileName, pt1Min, pt1Max, pt2Min, pt_assoc_bins[i], pt_assoc_bins[i+1], 1, 5, i, 0, subtractMixedComb, subtractFlow);
1143 compareBackground(fileName, pt1Min, pt1Max, pt2Min, pt_assoc_bins[i], pt_assoc_bins[i+1], 9, 10, i, 1, subtractMixedComb, subtractFlow);
1149 //compares the background of the mixed comb analysis with the 1+1 background
1150 //statistics for background same is the worst because in each event at 2 places is searched for T2
1151 //for mixed comb a lot of events are searched for the second trigger particle
1152 //for 1+1 no second trigger particle needs to be found at all so the statistics is the highest
1153 void compareBackground(const char* fileName, double pt1Min = 4.0, double pt1Max = 14.0, Double_t pt2Min = 2.0, Double_t ptAssocMin = 0.5, Double_t ptAssocMax = 8.0, Int_t multBinBegin = 1, Int_t multBinEnd = 5, Int_t posX = 1, Int_t posY = 1, Int_t subtractMixedComb = 0, Int_t subtractFlow = 0){
1155 Int_t trigger_mixed_comb=0;
1156 Int_t trigger_1plus1=0;
1157 Int_t trigger_background_same=0;
1159 TH1D* mixedComb = (TH1*)getAnalysis(fileName, pt1Min, pt1Max, pt2Min, ptAssocMin, ptAssocMax, 6.9, multBinBegin, multBinEnd, 4, 1, 1, 0, subtractMixedComb, subtractFlow, &trigger_mixed_comb)->Clone();
1161 TH1D* backgroundSame = (TH1*)getAnalysis(fileName, pt1Min, pt1Max, pt2Min, ptAssocMin, ptAssocMax, 6.9, multBinBegin, multBinEnd, 7, 1, 1, 0, subtractMixedComb, subtractFlow, &trigger_background_same)->Clone();
1164 TH1D* onePlusOne = (TH1*)getAnalysis(fileName, pt1Min, pt1Max, pt2Min, ptAssocMin, ptAssocMax, 6.9, multBinBegin, multBinEnd, 6, 1, 1, 0, subtractMixedComb, subtractFlow, &trigger_1plus1)->Clone();
1166 //TH1D* onePlusOne = (TH1*)getAnalysis(fileName, pt2Min, pt1Min, pt2Min, ptAssocMin, ptAssocMax, 6.9, multBinBegin, multBinEnd, 6, 1, 1, 0, subtractMixedComb, subtractFlow, &trigger_1plus1)->Clone();
1168 onePlusOne->SetLineColor(kRed);
1169 backgroundSame->SetLineColor(kGreen);
1171 Printf("found trigger: mixed comb %i, 1plus1 %i, background_same %i", trigger_mixed_comb, trigger_1plus1, trigger_background_same);
1172 //do not need to scale these distributions because both are already divided by the number of triggers
1174 TCanvas* can = new TCanvas(Form("compare background, %i, %i ", posX, posY), Form("compare background, %i, %i ", posX, posY), posX*gBasisSize+100, posY*gBasisSize+50, gBasisSize, gBasisSize);
1176 ((TH1*)(backgroundSame->Clone()))->DrawCopy();
1177 ((TH1*)(mixedComb->Clone()))->DrawCopy("same");
1178 ((TH1*)(onePlusOne->Clone()))->DrawCopy("same");
1180 TLegend *leg = getLegend();
1181 leg->AddEntry(mixedComb, "mixed combinatorics","l");
1182 leg->AddEntry(onePlusOne, "1plus1 background","l");
1183 leg->AddEntry(backgroundSame, "background same","l");
1187 void compareAllMixedComb(const char* fileName, double pt1Min = 4.0, double pt1Max = 14.0, Double_t pt2Min = 2.0, Int_t subtractMixedComb = 0, Int_t subtractFlow = 0){
1189 //static const int pt_assoc_bins_number = 8;
1190 //Double_t pt_assoc_bins[pt_assoc_bins_number] = {0.5, 1.0, 2.0, 3.0, 4.0, 6.0, 8.0, 10.0};
1192 for(int i=0; i<pt_assoc_bins_number-1; i++){
1193 compareMixedComb_sides(fileName, pt1Min, pt1Max, pt2Min, pt_assoc_bins[i], pt_assoc_bins[i+1], 1, 5, i, 0, subtractMixedComb, subtractFlow);
1194 compareMixedComb_sides(fileName, pt1Min, pt1Max, pt2Min, pt_assoc_bins[i], pt_assoc_bins[i+1], 9, 10, i, 1, subtractMixedComb, subtractFlow);
1200 void compareMixedComb_sides(const char* fileName, double pt1Min = 4.0, double pt1Max = 14.0, Double_t pt2Min = 2.0, Double_t ptAssocMin = 0.5, Double_t ptAssocMax = 8.0, Int_t multBinBegin = 1, Int_t multBinEnd = 5, Int_t posX = 1, Int_t posY = 1, Int_t subtractMixedComb = 0, Int_t subtractFlow = 0){
1202 Int_t trigger_mixed_comb=0;
1204 TH1D* mixedComb_near = (TH1*)getAnalysis(fileName, pt1Min, pt1Max, pt2Min, ptAssocMin, ptAssocMax, 6.9, multBinBegin, multBinEnd, 4, 1, 1, 0, subtractMixedComb, subtractFlow, &trigger_mixed_comb)->Clone();
1206 TH1D* mixedComb_away = (TH1*)getAnalysis(fileName, pt1Min, pt1Max, pt2Min, ptAssocMin, ptAssocMax, 6.9, multBinBegin, multBinEnd, 5, 1, 1, 0, subtractMixedComb, subtractFlow, &trigger_mixed_comb)->Clone();
1208 TCanvas* can = new TCanvas(Form("compare mixedComb, %i, %i ", posX, posY), Form("compare mixedComb, %i, %i ", posX, posY), posX*gBasisSize+100, posY*gBasisSize+50, gBasisSize, gBasisSize);
1210 mixedComb_away->SetLineColor(kRed);
1212 ((TH1*)(mixedComb_near->Clone()))->DrawCopy();
1213 ((TH1*)(mixedComb_away->Clone()))->DrawCopy("same");
1215 TLegend *leg = getLegend();
1216 leg->AddEntry(mixedComb_near, "near side","l");
1217 leg->AddEntry(mixedComb_away, "away side","l");
1218 //leg->Draw("same");
1224 //calculates the mixed comb by scaling it up to the amount of trigger in same background
1225 //this method can probably not be used because the statistics is too smal
1226 //within one vertex and multiplicity bin there are 12 to 30 trigger combinations -> the error on the correction factor is too high.
1227 TH2D* getMixedComb_scaled_backgroundSame(const char* fileName, double pt1Min = 4.0, double pt1Max = 14.0, double pt2Min = 4.0, double ptAssocMin = 2.0, double ptAssocMax = 4.0, Int_t multBinBegin = 1, Int_t multBinEnd = 5, Double_t setVertex = 7, Int_t step = 4, Int_t* trigger = NULL){
1231 printf("#############################");
1232 printf(Form("step %i", step));
1233 printf("#############################");
1234 AliTwoPlusOneContainer* h = (AliTwoPlusOneContainer*) GetTwoPlusOne(fileName);
1235 h->GetData()->SetPtRange(ptAssocMin, ptAssocMax);
1236 h->GetData()->SetPt2Min(pt2Min);
1238 TH2D* return_mixed_comb = 0;
1240 if(step!=4 && step!=5){
1241 Printf("#############################");
1242 Printf("ERROR wrong step in getMixedComb_scaled_backgroundSame");
1243 Printf("#############################");
1244 return return_mixed_comb;
1247 THnBase* trackMixedCombAll = 0;
1248 TH2* eventMixedCombAll = 0;
1249 h->GetData()->GetHistsZVtxMult((AliUEHist::CFStep)step, AliUEHist::kToward, pt1Min, pt1Max, &trackMixedCombAll, &eventMixedCombAll);
1251 THnBase* trackBackgroundSameAll = 0;
1252 TH2* eventBackgroundSameAll = 0;
1253 h->GetData()->GetHistsZVtxMult((AliUEHist::CFStep)(step+3), AliUEHist::kToward, pt1Min, pt1Max, &trackBackgroundSameAll, &eventBackgroundSameAll);
1255 TAxis* vertexAxis = trackMixedCombAll->GetAxis(2);
1256 Int_t vertexBinBegin = vertexAxis->FindBin(-1*setVertex);
1257 Int_t vertexBinEnd = vertexAxis->FindBin(setVertex);
1259 Printf(Form("vertex bin begin %i, end %i ", vertexBinBegin, vertexBinEnd));
1261 for(Int_t multBin=multBinBegin; multBin<=multBinEnd; multBin++){
1262 for(Int_t vertexBin=vertexBinBegin; vertexBin<=vertexBinEnd; vertexBin++){
1263 Printf(" multBin %i, vertexBin %i ", multBin, vertexBin);
1265 trackMixedCombAll->GetAxis(3)->SetRange(multBin, multBin);
1266 trackMixedCombAll->GetAxis(2)->SetRange(vertexBin, vertexBin);
1268 trackBackgroundSameAll->GetAxis(3)->SetRange(multBin, multBin);
1269 trackBackgroundSameAll->GetAxis(2)->SetRange(vertexBin, vertexBin);
1271 TH2D* tracks_mixedComb = trackMixedCombAll->Projection(1, 0, "E");
1272 Int_t trigger_mixed_comb = eventMixedCombAll->Integral(vertexBin, vertexBin, multBin, multBin);
1274 TH2D* tracks_background_same = trackBackgroundSameAll->Projection(1, 0, "E");
1275 Int_t trigger_background_same = eventBackgroundSameAll->Integral(vertexBin, vertexBin, multBin, multBin);
1277 //this has to be done because of a bug in the AliRoot code
1278 //because of an absolute cast in the dphi computation only half of this background is considered
1279 //wrong runs are 968 and 973
1280 //trigger_background_same *= 2;
1282 Double_t trigger_ratio = 0;
1283 if(trigger_background_same>0)
1284 trigger_ratio = (Double_t)trigger_background_same/trigger_mixed_comb;
1285 Printf("(getMixedComb_scaled_backgroundSame) Triggers: mixed comb %i, background same %i, trigger ratio %f ", trigger_mixed_comb, trigger_background_same, trigger_ratio);
1287 double b1 = tracks_mixedComb->GetBinContent(tracks_mixedComb->FindBin(0.001,0.001));
1288 double b2 = tracks_mixedComb->GetBinContent(tracks_mixedComb->FindBin(0.001,-0.001));
1289 double b3 = tracks_mixedComb->GetBinContent(tracks_mixedComb->FindBin(-0.001,0.001));
1290 double b4 = tracks_mixedComb->GetBinContent(tracks_mixedComb->FindBin(-0.001,-0.001));
1292 double b1_bsame = tracks_background_same->GetBinContent(tracks_background_same->FindBin(0.001,0.001));
1293 double b2_bsame = tracks_background_same->GetBinContent(tracks_background_same->FindBin(0.001,-0.001));
1294 double b3_bsame = tracks_background_same->GetBinContent(tracks_background_same->FindBin(-0.001,0.001));
1295 double b4_bsame = tracks_background_same->GetBinContent(tracks_background_same->FindBin(-0.001,-0.001));
1297 Double_t content_ratio = 0;
1298 if(b1 + b2 + b3 + b4 > 0)
1299 content_ratio = (b1_bsame + b2_bsame + b3_bsame + b4_bsame)/(b1 + b2 + b3 + b4);
1300 Printf(" trigger_ratio %f, content_ratio %f", trigger_ratio, content_ratio);
1302 //Printf("Maximum: mixed comb %f, background same %f, normalization ratio %f ", content_mixed_comb, content_background_same, content_ratio);
1304 tracks_mixedComb->Scale(trigger_ratio);
1305 //tracks_mixedComb->Scale(content_ratio);
1307 //correct event with mixed event
1308 TH2D* mixedEvent = getMixedEvent(fileName, pt1Min, pt1Max, pt2Min, ptAssocMin, ptAssocMax, multBin, multBin, vertexBin, vertexBin, (AliUEHist::CFStep)(step-2), 0);
1309 //TH2D* mixedEvent = getMixedEvent(fileName, pt1Min, pt1Max, pt2Min, ptAssocMin, ptAssocMax, multBin, multBin, vertexBinBegin, vertexBinEnd, (AliUEHist::CFStep)(step-2), 1);
1310 tracks_mixedComb->Divide(mixedEvent);
1312 //TCanvas* can_1 = new TCanvas("mixed comb", "mixed comb", 100, 50, gBasisSize, gBasisSize);
1313 //tracks_mixedComb->DrawCopy("surf1");
1314 //TCanvas* can_2 = new TCanvas("mixed", "mixed", gBasisSize+100, 50, gBasisSize, gBasisSize);
1315 //mixedEvent->DrawCopy("surf1");
1317 if(!return_mixed_comb)
1318 return_mixed_comb = (TH2D*) tracks_mixedComb->Clone("total tracks");
1320 return_mixed_comb->Add(tracks_mixedComb);
1323 *trigger += trigger_background_same ;
1327 // normalizate to dphi widht
1328 Float_t normalization = return_mixed_comb->GetXaxis()->GetBinWidth(1);
1329 return_mixed_comb->Scale(1.0 / normalization);
1331 return return_mixed_comb;
1335 //shows alpha dependent significance of the signal, signal/background for different centralities
1336 void get1plus1(const char* fileName, Double_t pt1Min, Double_t pt1Max, Double_t ptAssocMin, Double_t ptAssocMax){
1338 TFile::Open(fileName);
1340 //to guarantee to pick only the bins from the choosen pt on
1346 Int_t alpha_bins = 5;//number of alpha bins maximal used around the two bins close to pi, maximum usable would be 5 because than already the full away side is searched for a trigger 2
1347 Int_t showAlpha = 1;
1348 Double_t alpha_bin_width = 0.174532;
1351 Int_t multBinBegin = 9;
1352 Int_t multBinEnd = 10;
1354 AliTwoPlusOneContainer* h = (AliTwoPlusOneContainer*) GetTwoPlusOne(fileName);
1356 AliUEHist::CFStep step_1plus1 = (AliUEHist::CFStep) AliTwoPlusOneContainer::k1plus1;
1357 AliUEHist::CFStep step_mixed = (AliUEHist::CFStep) AliTwoPlusOneContainer::kMixedNS;
1359 TH1D* alpha_plot_significance = new TH1D("alpha_plot", "", alpha_bins, 0, alpha_bins*alpha_bin_width);
1360 alpha_plot_significance->SetXTitle("\\alpha");
1361 alpha_plot_significance->SetYTitle("significance");
1363 TH1D* alpha_plot_sigBack = new TH1D("alpha_plot", "", alpha_bins, 0, alpha_bins*alpha_bin_width);
1364 alpha_plot_sigBack->SetXTitle("\\alpha");
1365 alpha_plot_sigBack->SetYTitle("signal/background");
1367 for(Int_t cent = 0; cent<4; cent++){
1368 char* cent_string = "";
1372 cent_string = "0-5%";
1376 cent_string = "5-10%";
1380 cent_string = "10-30%";
1384 cent_string = "30-50%";
1387 for(Int_t alpha = 0; alpha <alpha_bins; alpha++){
1388 if(alpha==showAlpha) draw = 1; else draw = 0;
1390 h->GetData()->SetPtRange(ptAssocMin, ptAssocMax);
1391 TH2* h2_etaPhi = h->GetData()->GetSumOfRatios2(h->GetData(), step_1plus1, 0, pt1Min, pt1Max, multBinBegin, multBinEnd, kFALSE, step_mixed);
1393 showResult(h2_etaPhi, cent, 0, alpha, arr1, draw);
1394 alpha_plot_significance->SetBinContent(alpha+1, arr1[0]);
1395 alpha_plot_significance->SetBinError(alpha+1, arr1[2]);
1396 alpha_plot_sigBack->SetBinContent(alpha+1, arr1[1]);
1397 alpha_plot_sigBack->SetBinError(alpha+1, arr1[3]);
1400 TCanvas* c1 = new TCanvas(Form("alpha_plot_significance %s ", cent_string), Form("alpha_plot_significance %s ", cent_string), cent*gBasisSize+50, 1*gBasisSize+50, gBasisSize, gBasisSize);
1401 alpha_plot_significance->DrawCopy("E");
1403 TCanvas* c2 = new TCanvas(Form("alpha_plot_signalBackground %s ", cent_string), Form("alpha_plot_signalBackground %s ", cent_string), cent*gBasisSize+50, 2*gBasisSize+50, gBasisSize, gBasisSize);
1404 alpha_plot_sigBack->DrawCopy("E");
1411 //method used just in get1plus1 to calculate the significance and the signal/background
1412 void showResult(TH2* h2_etaPhi, Int_t posX, Int_t posY, Int_t alpha_bins, Double_t* arr, Int_t draw){
1414 int firstbin = h2_etaPhi->GetYaxis()->FindBin(-1*g_eta_bin);
1415 int lastbin = h2_etaPhi->GetYaxis()->FindBin(g_eta_bin);
1417 Printf("firstbin %i, lastbin %i, \n", firstbin, lastbin);
1419 TH1D* h1_phi = h2_etaPhi->ProjectionX(Form("px_%i_%i", posX, posY), firstbin, lastbin);
1421 double alpha = 0.15;// use 0.15 to get only the next two bins which are a bit smaller than 0.2//0.2;
1422 //Pi is exactely the bin edge
1423 int bin_1 = 27 - alpha_bins;//h1_phi->FindBin(TMath::Pi()-alpha+0.01);
1424 int bin_2 = 28 + alpha_bins;//h1_phi->FindBin(TMath::Pi()+alpha-0.01);
1426 Int_t bin_start = h1_phi->FindBin(TMath::Pi()/3+0.01);
1427 Int_t bin_end = h1_phi->FindBin(2*TMath::Pi()/3-0.01);
1431 for(int i=bin_start; i<=bin_end; i++){
1432 par0 += h1_phi->GetBinContent(i);
1433 err0 += h1_phi->GetBinError(i);
1435 par0 /= bin_end - bin_start + 1;
1436 err0 /= bin_end - bin_start + 1;
1441 for(int bin = bin_1; bin<=bin_2; bin++){
1442 sum += h1_phi->GetBinContent(bin);
1443 sum_err += h1_phi->GetBinError(bin);
1445 sum_err /= (bin_2-bin_1+1);
1446 double background = (bin_2 - bin_1 + 1)*par0;
1447 double background_err = (bin_2 - bin_1 + 1)*err0;
1448 double signal2 = sum - background;
1449 double signal2_err = TMath::Sqrt(sum_err*sum_err+background_err*background_err);
1451 Double_t significance = signal2/h1_phi->GetBinError((bin_1+bin_2)/2);
1452 Double_t significance_err = signal2_err/(TMath::Sqrt(sum));
1453 //Double_t significance = signal2/(TMath::Sqrt(sum));
1454 //Double_t significance_err = TMath::Sqrt(TMath::Power(signal2_err/(TMath::Sqrt(sum)), 2) + TMath::Power(signal2/(TMath::Sqrt(sum*sum*sum)*sum_err), 2));
1456 Double_t significance_rel = signal2/background;//signal over background
1457 Double_t significance_rel_err = TMath::Sqrt(TMath::Power(signal2_err/background,2)+TMath::Power(signal2/(background*background)*background_err,2));//signal over background
1459 Printf("X %i, Y %i, significance: %f, signal over background %f ", posX, posY, significance, significance_rel);
1461 h1_phi->SetYTitle("1/N_{trig} \\ dN_{assoc}/d \\varphi");
1462 h1_phi->SetTitle("");
1463 h1_phi->SetStats(kFALSE);
1464 //h1_phi->Scale(1/(lastbin - firstbin + 1));
1466 TCanvas* c1 = new TCanvas(Form("can %i %i", posX, posY), Form("can %i %i", posX, posY), posX*gBasisSize+50, posY*gBasisSize+50, gBasisSize, gBasisSize);
1467 //h1_phi->DrawCopy();
1468 h2_etaPhi->DrawCopy("surf1");
1471 arr[0] = significance;
1472 arr[1] = significance_rel;
1473 arr[2] = significance_err;
1474 arr[3] = significance_rel_err;
1478 //this method is not further maintained after the copy into this file
1479 //it was used to compare the different kind of background distributions
1480 //this method compares the expected amount of background trigger combinations for 3 methods:
1481 //1. get background from the arithmetical average between delta phi = pi/3 and 2pi/3
1482 //2. mixed combinatorics (they are lacking some combinations because the buffers have to be filled first)
1483 //3. background same, search at delta phi = pi/2 for trigger particles the same way as it is done in mixed comb
1484 void printBackground2plus1(const char* fileName, double pt1Min = 4.0, double pt1Max = 14.0, Double_t pt2Min = 2.0, Double_t ptAssocMin = 2.0, Double_t ptAssocMax = 4.0, Double_t setVertex = 7, Int_t multBinBegin = 1, Int_t multBinEnd = 5, Int_t step = 0){
1487 TFile::Open(fileName);
1489 //to guarantee to pick only the bins from the choosen pt on
1496 Double_t alpha_radius = 0.393;// =pi/8 //0.2;//use radius which was used by the mixed comb and background same method in the loaded file
1498 AliTwoPlusOneContainer* h = (AliTwoPlusOneContainer*) GetTwoPlusOne(fileName);
1499 AliUEHist::CFStep step_1plus1 = (AliUEHist::CFStep) AliTwoPlusOneContainer::k1plus1;
1500 AliUEHist::CFStep step_mixed = (AliUEHist::CFStep) AliTwoPlusOneContainer::kMixedAS;
1501 AliUEHist::CFStep step_mixedComb = (AliUEHist::CFStep) AliTwoPlusOneContainer::kMixedCombAS;
1502 AliUEHist::CFStep step_backgroundSame = (AliUEHist::CFStep) AliTwoPlusOneContainer::kBackgroundSameAS;
1504 //get error from the 1+1 correlation
1506 THnBase* trackSameAll = 0;
1507 TH2* eventSameAll = 0;
1508 //h->GetData()->SetPtRange(pt2Min, pt1Max);
1509 h->GetData()->SetPtRange(ptAssocMin, ptAssocMax);
1510 //h->GetData()->SetPtRange(6, 10);
1511 h->GetData()->SetPt2Min(pt2Min);
1512 h->GetData()->SetZVtxRange(-1*setVertex, setVertex);
1514 h->GetData()->GetHistsZVtxMult(step_1plus1, AliUEHist::kToward, pt1Min, pt1Max, &trackSameAll, &eventSameAll);
1515 trackSameAll->GetAxis(3)->SetRange(multBinBegin, multBinEnd);
1517 TAxis* vertexAxis = trackSameAll->GetAxis(2);
1518 Int_t vertexBinBegin = vertexAxis->FindBin(-1*setVertex);
1519 Int_t vertexBinEnd = vertexAxis->FindBin(setVertex);
1521 trackSameAll->GetAxis(2)->SetRange(vertexBinBegin, vertexBinEnd);
1523 TH2* tracksSame = trackSameAll->Projection(1, 0, "E");
1524 TH1D* h1_phi = tracksSame->ProjectionX();
1525 h1_phi->Scale(1/h1_phi->GetXaxis()->GetBinWidth(1));
1529 TH2* h2_etaPhi = h->GetData()->GetSumOfRatios2(h->GetData(), step_1plus1, 0, pt1Min, pt1Max, multBinBegin, multBinEnd, kFALSE, step_mixed);
1531 int firstbin = -1;//h2_etaPhi->GetYaxis()->FindBin(-0.99);
1532 int lastbin = -1;//h2_etaPhi->GetYaxis()->FindBin(0.99);
1533 TH1D* h1_phi = h2_etaPhi->ProjectionX("px", firstbin, lastbin);
1536 //undo phi normalization
1537 //h1_phi->Scale(h1_phi->GetXaxis()->GetBinWidth(1));
1539 TF1* fit = new TF1("fit", "[0]", 1.01, 1.99);
1540 h1_phi->Fit("fit", "N", "", 1.01, 1.99);
1541 Double_t par0 = fit->GetParameter(0);
1542 Double_t err0 = fit->GetParError(0);
1544 Int_t bin_start = h1_phi->FindBin(TMath::Pi()/3+0.01);
1545 Int_t bin_end = h1_phi->FindBin(2*TMath::Pi()/3-0.01);
1546 //Int_t bin_start = h1_phi->FindBin(1.37);
1547 //Int_t bin_end = h1_phi->FindBin(1.57);
1551 for(int i=bin_start; i<=bin_end; i++){
1552 sum += h1_phi->GetBinContent(i);
1553 err += h1_phi->GetBinError(i);
1555 Printf("bin start %i, bin end %i, sum %f ", bin_start, bin_end, sum);
1556 sum /= (bin_end - bin_start + 1);
1557 err /= (bin_end - bin_start + 1);
1558 Printf(" sum %f ", sum);
1560 Printf("sum %f, bin width %f ", sum, h1_phi->GetBinWidth(bin_start));
1562 double background = 2*alpha_radius*sum;//the plot is already normalized for the bin_width by getting it from getSumOfRatios2
1563 double background_err = 2*alpha_radius*err;
1565 //TCanvas* can = new TCanvas();
1566 //h1_phi->DrawCopy();
1568 //get error from mixed combinatorics
1569 Int_t trigger_mixed_comb;
1574 //TH2* h2_etaPhi_mixedComb = (TH2D*) h->GetData()->GetSumOfRatios2(h->GetData(), step_mixedComb, 0, pt1Min, pt1Max, multBinBegin, multBinEnd, kFALSE, step_mixed, &trigger_mixed_comb);
1575 h2_etaPhi_mixedComb = getMixedComb_scaled_backgroundSame(fileName, pt1Min, pt1Max, pt2Min, ptAssocMin, ptAssocMax, multBinBegin, multBinEnd, setVertex, step_mixedComb, &trigger_mixed_comb);
1577 int firstbin_eta = h2_etaPhi_mixedComb->GetYaxis()->FindBin(-0.39);
1578 int lastbin_eta = h2_etaPhi_mixedComb->GetYaxis()->FindBin(0.39);
1579 TH1* h1_phi_mixedComb = h2_etaPhi_mixedComb->ProjectionX("mixedComb_px", firstbin_eta, lastbin_eta);
1581 //get error from mixed combinatorics
1582 Int_t trigger_backgroundSame;
1584 TH2* h2_etaPhi_backgroundSame = (TH2D*) h->GetData()->GetSumOfRatios2(h->GetData(), step_backgroundSame, 0, pt1Min, pt1Max, multBinBegin, multBinEnd, kFALSE, step_mixed, &trigger_backgroundSame);
1585 TH1* h1_phi_backgroundSame = h2_etaPhi_backgroundSame->ProjectionX("backgroundSame_px", firstbin_eta, lastbin_eta);
1588 TCanvas* can = new TCanvas("can", "can", gBasisSize+50, gBasisSize+50, 2*gBasisSize, 2*gBasisSize);
1589 h1_phi_mixedComb->SetLineWidth(3);
1590 h1_phi_mixedComb->SetStats(kFALSE);
1591 h1_phi_mixedComb->DrawCopy();
1592 h1_phi_backgroundSame->SetLineWidth(3);
1593 h1_phi_backgroundSame->SetLineColor(kRed);
1594 h1_phi_backgroundSame->DrawCopy("same");
1596 TLegend *leg = getLegend();
1597 leg->AddEntry(h1_phi_mixedComb, "mixed combinatorics","l");
1598 leg->AddEntry(h1_phi_backgroundSame, "background same","l");
1601 Printf("expect from 1+1 %f +/- %f", background, background_err);
1602 Printf("expect from trigger_mixed_comb %i ", trigger_mixed_comb);
1603 Printf("expect from trigger_backgroundSame %i ", trigger_backgroundSame);
1616 void symmetrize(TH1D* tracks)
1618 int bins = tracks->FindBin(TMath::Pi()/2-0.01);
1619 for(int i=0; i<=bins/2; i++){
1620 double tmp = (tracks->GetBinContent(i)+tracks->GetBinContent(bins-i+1))/2;
1621 tracks->SetBinContent(i, tmp);
1622 tracks->SetBinContent(bins-i+1, tmp);
1633 TH2D* getMixedEvent(const char* fileName, double pt1Min = 4.0, double pt1Max = 14.0, double pt2Min = 2.0, Double_t ptAssocMin = 0.5, Double_t ptAssocMax = 8.0, Int_t multBinBegin = 1, Int_t multBinEnd = 5, Int_t vertexBinBegin = 1, Int_t vertexBinEnd = 5, Int_t step = 1, Int_t symmetrize = 0)
1636 TH2D* tracksMixed = getCorrelationStep(fileName, pt1Min, pt1Max, pt2Min, ptAssocMin, ptAssocMax, multBinBegin, multBinEnd, vertexBinBegin, vertexBinEnd, step);
1638 double b1 = tracksMixed->GetBinContent(tracksMixed->FindBin(0.001,0.001));
1639 double b2 = tracksMixed->GetBinContent(tracksMixed->FindBin(0.001,-0.001));
1640 double b3 = tracksMixed->GetBinContent(tracksMixed->FindBin(-0.001,0.001));
1641 double b4 = tracksMixed->GetBinContent(tracksMixed->FindBin(-0.001,-0.001));
1642 double divide = (b1 + b2 + b3 + b4)/4;//=value at zero
1643 double error = TMath::Power(b1/divide-1, 2)+TMath::Power(b2/divide-1, 2)+TMath::Power(b3/divide-1, 2)+TMath::Power(b4/divide-1, 2);//not further used
1644 Printf(Form(" filename: %s, four bins: %f, %f, %f, %f, divide: %f", fileName, b1/divide, b2/divide, b3/divide, b4/divide, divide));
1648 for(i=0; i<=tracksMixed->GetNbinsX(); i++){
1649 int y_bins = tracksMixed->GetNbinsY();
1650 for(j=0; j<=y_bins/2; j++){
1651 double tmp = (tracksMixed->GetBinContent(i, j)+tracksMixed->GetBinContent(i, y_bins-j+1))/2;
1652 tracksMixed->SetBinContent(i, j, tmp);
1653 tracksMixed->SetBinContent(i, y_bins-j+1, tmp);
1657 //finite bin correction
1658 //ftrackEtaCut = 0.9;
1659 Double_t finiteBinCorrection = -1.0 / (2*0.9) * tracksMixed->GetYaxis()->GetBinWidth(1) / 2 + 1;
1660 Printf("Finite bin correction: %f", finiteBinCorrection);
1661 divide /= finiteBinCorrection;
1662 error /= finiteBinCorrection;//not further used
1664 tracksMixed->Scale(1.0/divide);
1666 TH1D* proj = tracksMixed->ProjectionY("_norm");
1667 Int_t bins_X = tracksMixed->GetNbinsX();
1669 double norm1 = proj->GetBinContent(proj->FindBin(-0.001));
1670 double norm2 = proj->GetBinContent(proj->FindBin(0.001));
1671 double norm = (norm1+norm2)/2.0;
1673 //tracksMixed->Scale(1.0/(bins_X*norm));
1674 Printf("norm1 %f, norm2 %f, norm %f", norm1/norm, norm2/norm, norm);
1676 TCanvas* c2 = new TCanvas("mixedEvent", "mixedEvent", gBasisSize+50, 2*gBasisSize+50, gBasisSize, gBasisSize);
1677 tracksMixed->DrawCopy("surf1");
1685 //old method with an double cache
1686 //used to compare results but very difficult to read
1687 const char* lastFileName_corStep = 0;
1688 double lastPt1Min = 0;
1689 double lastPt1Max = 0;
1690 double lastPt2Min = 0;
1691 double lastPtAssocMin = 0;
1692 double lastPtAssocMax = 0;
1694 void* cacheHistsZVTxMult = 0;
1695 void* cacheEvtZVTxMult = 0;
1697 const char* lastFileName2_corStep = 0;
1698 double lastPt1Min2 = 0;
1699 double lastPt1Max2 = 0;
1700 double lastPt2Min2 = 0;
1701 double lastPtAssocMin2 = 0;
1702 double lastPtAssocMax2 = 0;
1704 void* cacheHistsZVTxMult2 = 0;
1705 void* cacheEvtZVTxMult2 = 0;
1709 TH2D* getCorrelationStep(const char* fileName, double pt1Min = 4.0, double pt1Max = 14.0, double pt2Min = 2.0, Double_t ptAssocMin = 0.5, Double_t ptAssocMax = 8.0, Int_t multBinBegin = 1, Int_t multBinEnd = 5, Int_t vertexBinBegin = 1, Int_t vertexBinEnd = 5, Int_t step = 1, Int_t* trigger = NULL){
1711 //to guarantee to pick only the bins from the choosen pt on
1719 THnBase* trackMixedAll = 0;
1720 TH2* eventMixedAll = 0;
1722 //look if the THnBase is already in the cache
1723 if(lastFileName_corStep && strcmp(lastFileName_corStep, fileName) == 0 && lastPt1Min==pt1Min && lastPt1Max==pt1Max && lastPt2Min==pt2Min && lastPtAssocMin==ptAssocMin && lastPtAssocMax==ptAssocMax && laststep==step){
1724 Printf("use cache 1");
1726 trackMixedAll = cacheHistsZVTxMult;
1727 eventMixedAll = cacheEvtZVTxMult;
1729 }else if(lastFileName2_corStep && strcmp(lastFileName2_corStep, fileName) == 0 && lastPt1Min2==pt1Min && lastPt1Max2==pt1Max && lastPt2Min2==pt2Min && lastPtAssocMin2==ptAssocMin && lastPtAssocMax2==ptAssocMax && laststep2==step){
1730 Printf("use cache 2");
1732 trackMixedAll = cacheHistsZVTxMult2;
1733 eventMixedAll = cacheEvtZVTxMult2;
1735 //if it is in no cache continue getting it (by always recomputing it a memory leak is introduced)
1739 AliTwoPlusOneContainer* twoPlusOne = (AliTwoPlusOneContainer*) GetTwoPlusOne(fileName);
1741 twoPlusOne->GetData()->SetPtRange(ptAssocMin, ptAssocMax);
1742 twoPlusOne->GetData()->SetPt2Min(pt2Min);
1744 twoPlusOne->GetData()->GetHistsZVtxMult((AliUEHist::CFStep)step, AliUEHist::kToward, pt1Min, pt1Max, &trackMixedAll, &eventMixedAll);
1747 cacheHistsZVTxMult = trackMixedAll;
1748 cacheEvtZVTxMult = eventMixedAll;
1750 lastFileName_corStep = fileName;
1751 lastPt1Min = pt1Min;
1752 lastPt1Max = pt1Max;
1753 lastPt2Min = pt2Min;
1754 lastPtAssocMin = ptAssocMin;
1755 lastPtAssocMax = ptAssocMax;
1761 cacheHistsZVTxMult2 = trackMixedAll;
1762 cacheEvtZVTxMult2 = eventMixedAll;
1764 lastFileName2_corStep = fileName;
1765 lastPt1Min2 = pt1Min;
1766 lastPt1Max2 = pt1Max;
1767 lastPt2Min2 = pt2Min;
1768 lastPtAssocMin2 = ptAssocMin;
1769 lastPtAssocMax2 = ptAssocMax;
1776 trackMixedAll->GetAxis(3)->SetRange(multBinBegin, multBinEnd);
1777 trackMixedAll->GetAxis(2)->SetRange(vertexBinBegin, vertexBinEnd);
1779 TH2D* tracksMixed = trackMixedAll->Projection(1, 0, "E");
1782 *trigger = eventMixedAll->Integral(vertexBinBegin, vertexBinEnd, multBinBegin, multBinEnd);
1788 void showMixedDist(const char* fileName){
1791 TH1F* mixedDist = getMixedDist(fileName);
1792 TCanvas* can = new TCanvas();
1793 mixedDist->DrawCopy("colz");
1796 TH1F* getMixedDist(const char* fileName){
1799 //list = (TList*) getList(fileName, "PWGCF_TwoPlusOne/histosTwoPlusOne");
1800 //list = (TList*) getList(fileName, "PWGCF_TwoPlusOne/addedEvents_");
1801 list = (TList*) getList(fileName, path);
1803 TH1F* mixedDist = (TH1F*) list->FindObject("mixedDist");
1809 void compareScaledMixedComb(const char* fileName, double pt1Min = 4.0, double pt1Max = 14.0, Double_t pt2Min = 2.0, Double_t ptAssocMin = 0.5, Double_t ptAssocMax = 8.0, Double_t setVertex = 7, Int_t multBinBegin = 1, Int_t multBinEnd = 5, Int_t step = 0){
1813 //to guarantee to pick only the bins from the choosen pt on
1820 AliTwoPlusOneContainer* h = (AliTwoPlusOneContainer*) GetTwoPlusOne(fileName);
1822 AliUEHist::CFStep step_same = step;//(AliUEHist::CFStep) AliTwoPlusOneContainer::kSameNS;
1823 AliUEHist::CFStep step_mixed = step+2;//(AliUEHist::CFStep) AliTwoPlusOneContainer::kMixedNS;
1824 AliUEHist::CFStep step_mixedComb = step+4;//(AliUEHist::CStep) AliTwoPlusOneContainer::kMixedCombNS;
1825 AliUEHist::CFStep step_backgroundSame = step+7;//(AliUEHist::CStep) AliTwoPlusOneContainer::kBackgroundSameNS;
1827 h->GetData()->SetPtRange(ptAssocMin, ptAssocMax);
1828 h->GetData()->SetPt2Min(pt2Min);
1829 h->GetData()->SetZVtxRange(-1*setVertex, setVertex);
1831 //GetSumOfRatios2(mixed, step, region, ptLeadMin, ptLeadMax, multBinBegin, multBinEnd, normalizePerTrigger, stepForMixed)
1833 TH2D* h2_etaPhi_mixedComb;
1834 TH2D* h2_etaPhi_backgroundSame;
1838 Int_t trigger_mixed_comb;
1839 Int_t trigger_mixed_comb_method;
1840 Int_t trigger_background_same;
1843 h2_etaPhi_mixedComb_sumOfRatios = (TH2D*) h->GetData()->GetSumOfRatios2(h->GetData(), step_mixedComb, 0, pt1Min, pt1Max, multBinBegin, multBinEnd, kFALSE, step_mixed, &trigger_mixed_comb);
1844 h2_etaPhi_backgroundSame_sumOfRatios = (TH2D*) h->GetData()->GetSumOfRatios2(h->GetData(), step_backgroundSame, 0, pt1Min, pt1Max, multBinBegin, multBinEnd, kFALSE, step_mixed, &trigger_background_same);
1845 //trigger_background_same *= 2;//error in the plots for run 968 and 973
1846 double trigger_ratio = (double)trigger_background_same/trigger_mixed_comb;
1847 Printf("trigger mixed comb: %i, trigger background same %i, ratio %f", trigger_mixed_comb, trigger_background_same, trigger_ratio);
1848 h2_etaPhi_mixedComb_sumOfRatios->Scale(trigger_ratio);
1849 trigger_mixed_comb = trigger_background_same;
1851 h2_etaPhi_mixedComb_method = getMixedComb_scaled_backgroundSame(fileName, pt1Min, pt1Max, pt2Min, ptAssocMin, ptAssocMax, multBinBegin, multBinEnd, setVertex, step_mixedComb, &trigger_mixed_comb_method);
1854 TCanvas* can = new TCanvas("can", "can", gBasisSize+50, gBasisSize+50, gBasisSize, gBasisSize);
1855 h2_etaPhi_mixedComb_sumOfRatios->DrawCopy("surf1");
1857 TCanvas* can2 = new TCanvas("can2", "can2", gBasisSize+50, 2*(gBasisSize+50), gBasisSize, gBasisSize);
1858 h2_etaPhi_mixedComb_method->DrawCopy("surf1");
1860 TCanvas* can3 = new TCanvas("can3", "can3", gBasisSize+50, 3*(gBasisSize+50), gBasisSize, gBasisSize);
1861 h2_etaPhi_mixedComb_sumOfRatios->Add(h2_etaPhi_mixedComb_method, -1);
1862 h2_etaPhi_mixedComb_sumOfRatios->Divide(h2_etaPhi_mixedComb_method);
1863 h2_etaPhi_mixedComb_sumOfRatios->GetYaxis()->SetRangeUser(-1.5, 1.5);
1864 h2_etaPhi_mixedComb_sumOfRatios->DrawCopy("surf1");
1866 Printf("mixed comb sumofratios %i, method %i", trigger_mixed_comb, h2_etaPhi_mixedComb_sumOfRatios);
1872 void Plot_oneAxis(const char* fileName, int project)
1876 TFile::Open(fileName);
1878 AliTwoPlusOneContainer* h = (AliTwoPlusOneContainer*) GetTwoPlusOne(fileName);
1880 TCanvas* c1 = new TCanvas("can1", "can1", 1200, 800);
1883 AliCFGridSparse* near_plot = h->GetData()->GetTrackHist(0)->GetGrid((AliUEHist::CFStep) AliTwoPlusOneContainer::k1plus1);
1884 //near_plot->SetRangeUser(2, gpTMin_T1, gpTMax_T1);
1885 //near_plot->SetRangeUser(6, gpTMin_T2, gpTMax_T2);
1886 //near_plot->SetRangeUser(1, gpTMin_assoc, gpTMax_assoc);
1887 TH1D* tracks_near = near_plot->Project(project);
1890 tracks_near->DrawCopy();
1892 AliCFGridSparse* away_plot = h->GetData()->GetTrackHist(0)->GetGrid((AliUEHist::CFStep) AliTwoPlusOneContainer::kSameNS);
1893 TH1D* tracks_away = away_plot->Project(project);
1896 tracks_away->DrawCopy();
1899 void test(const char* fileName, double pt1Min, double pt1Max, double pt2Min, double ptAssocMin, double ptAssocMax)
1902 Int_t multBinBegin = 1;
1903 Int_t multBinEnd = 5;
1904 Int_t trigger_mixed_comb;
1906 TFile::Open(fileName);
1908 AliTwoPlusOneContainer* h = (AliTwoPlusOneContainer*) GetTwoPlusOne(fileName);
1910 h->GetData()->SetPtRange(ptAssocMin, ptAssocMax);
1911 h->GetData()->SetPt2Min(pt2Min);
1912 h->GetData()->SetZVtxRange(-1*6.9, 6.9);
1914 AliUEHist::CFStep step_same = (AliUEHist::CFStep) AliTwoPlusOneContainer::kSameNS;
1915 AliUEHist::CFStep step_mixed = (AliUEHist::CFStep) AliTwoPlusOneContainer::kMixedNS;
1917 AliUEHist::CFStep step_1plus1 = (AliUEHist::CFStep) AliTwoPlusOneContainer::k1plus1;
1919 //GetSumOfRatios2(mixed, step, region, ptLeadMin, ptLeadMax, multBinBegin, multBinEnd, normalizePerTrigger, stepForMixed)
1921 TH2D* h2_etaPhi_mixedComb;
1923 h2_etaPhi_mixedComb = (TH2D*) h->GetData()->GetSumOfRatios2(h->GetData(), step_1plus1, 0, pt1Min, pt1Max, multBinBegin, multBinEnd, kFALSE, step_mixed, &trigger_mixed_comb);
1925 TCanvas* c1 = new TCanvas("can1", "can1", 1200, 800);
1926 h2_etaPhi_mixedComb->DrawCopy("surf1");
1929 void showAsymmetry(const char* fileName, Int_t mixed){
1932 TFile::Open(fileName);
1933 AliTwoPlusOneContainer* h = (AliTwoPlusOneContainer*) GetTwoPlusOne(fileName);
1935 TH1F* asymm_same = h->GetAsymmetry();
1936 TH1F* asymm_mixed = h->GetAsymmetryMixed();
1938 TCanvas* c1 = new TCanvas("can1", "can1", 1200, 800);
1940 asymm_same->DrawCopy();
1942 asymm_mixed->DrawCopy();
1944 asymm_same->DrawCopy();
1945 asymm_mixed->SetLineColor(kRed);
1946 asymm_mixed->Scale(1.0/80);
1947 asymm_mixed->DrawCopy("same");
1951 void showTriggerPt(const char* fileName){
1954 TFile::Open(fileName);
1955 AliTwoPlusOneContainer* h = (AliTwoPlusOneContainer*) GetTwoPlusOne(fileName);
1957 TCanvas* c1 = new TCanvas("can1", "can1", 1200, 800);
1958 h->GetTriggerPt()->DrawCopy("colz");