1 const Int_t numberOfCentralityBins = 12;
2 //TString centralityArray[numberOfCentralityBins] = {"0-4","4-5","6-14","30-40","40-50","50-60","60-70","70-80","0-100","0-1","1-2","2-3"};
3 TString centralityArray[numberOfCentralityBins] = {"0-100","10-20","20-30","30-40","40-50","50-60","60-70","70-80","0-100","0-1","1-2","2-3"};
5 const Int_t gRebin = 1;
7 void drawCorrelationFunctionPsi(const char* filename = "AnalysisResultsPsi_train_06feb.root",
10 const char* gCentralityEstimator = 0x0,
11 Bool_t kShowShuffled = kFALSE,
12 Bool_t kShowMixed = kTRUE,
13 Double_t psiMin = -0.5,
14 Double_t psiMax = 3.5,
15 Double_t vertexZMin = -10.,
16 Double_t vertexZMax = 10.,
17 Double_t ptTriggerMin = -1.,
18 Double_t ptTriggerMax = -1.,
19 Double_t ptAssociatedMin = -1.,
20 Double_t ptAssociatedMax = -1.,
21 Bool_t normToTrig = kTRUE,
22 Bool_t kUseVzBinning = kTRUE,
25 TString eventClass = "EventPlane", //Can be "EventPlane", "Centrality", "Multiplicity"
27 TString listNameAdd = "")
29 //Macro that draws the correlation functions from the balance function
30 //analysis vs the reaction plane
31 //Author: Panos.Christakoglou@nikhef.nl
32 //gROOT->LoadMacro("~/SetPlotStyle.C");
34 gStyle->SetPalette(1,0);
36 //Load the PWG2ebye library
37 gSystem->Load("libCore.so");
38 gSystem->Load("libGeom.so");
39 gSystem->Load("libVMC.so");
40 gSystem->Load("libPhysics.so");
41 gSystem->Load("libTree.so");
42 gSystem->Load("libSTEERBase.so");
43 gSystem->Load("libESD.so");
44 gSystem->Load("libAOD.so");
46 gSystem->Load("libANALYSIS.so");
47 gSystem->Load("libANALYSISalice.so");
48 gSystem->Load("libEventMixing.so");
49 gSystem->Load("libCORRFW.so");
50 gSystem->Load("libPWGTools.so");
51 gSystem->Load("libPWGCFebye.so");
53 //Prepare the objects and return them
55 TList *list = GetListOfObjects(filename,gCentrality,gBit,gCentralityEstimator,0,bToy,listNameAdd);
56 TList *listShuffled = NULL;
57 if(kShowShuffled) listShuffled = GetListOfObjects(filename,gCentrality,gBit,gCentralityEstimator,1,bToy,listNameAdd);
58 TList *listMixed = NULL;
59 if(kShowMixed) listMixed = GetListOfObjects(filename,gCentrality,gBit,gCentralityEstimator,2,bToy,listNameAdd);
61 // else get the QA histograms (for convolution)
64 TFile *f = TFile::Open(filename,"UPDATE");
65 if((!f)||(!f->IsOpen())) {
66 Printf("The file %s is not found.",filename);
70 TDirectoryFile *dir = dynamic_cast<TDirectoryFile *>(f->Get("PWGCFEbyE.outputBalanceFunctionPsiAnalysis"));
72 Printf("The TDirectoryFile is not found.",filename);
75 TString listQAName = "listQAPsi_";
77 listQAName += centralityArray[gCentrality-1];
79 listQAName += "_Bit"; listQAName += gBit; }
80 if(gCentralityEstimator) {
81 listQAName += "_"; listQAName += gCentralityEstimator;}
83 listQA = (TList*)dir->Get(Form("%s",listQAName.Data()));
85 Printf("TList QA not found!!!");
90 Printf("The TList object was not created");
94 draw(list,listShuffled,listMixed,listQA,
95 gCentralityEstimator,gCentrality,psiMin,psiMax,vertexZMin,vertexZMax,
96 ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax,normToTrig,kUseVzBinning,rebinEta,rebinPhi,eventClass);
99 //______________________________________________________//
100 TList *GetListOfObjects(const char* filename,
103 const char *gCentralityEstimator,
105 Bool_t bToy = kFALSE,
106 TString listNameAdd = "") {
107 //Get the TList objects (QA, bf, bf shuffled)
111 TFile *f = TFile::Open(filename,"UPDATE");
112 if((!f)||(!f->IsOpen())) {
113 Printf("The file %s is not found. Aborting...",filename);
118 TDirectoryFile *dir = dynamic_cast<TDirectoryFile *>(f->Get("PWGCFEbyE.outputBalanceFunctionPsiAnalysis"));
120 Printf("The TDirectoryFile is not found. Aborting...",filename);
127 //cout<<"no shuffling - no mixing"<<endl;
128 listBFName = "listBFPsi";
130 else if(kData == 1) {
131 //cout<<"shuffling - no mixing"<<endl;
132 listBFName = "listBFPsiShuffled";
134 else if(kData == 2) {
135 //cout<<"no shuffling - mixing"<<endl;
136 listBFName = "listBFPsiMixed";
139 // different list names in case of toy model
142 listBFName += centralityArray[gCentrality-1];
144 listBFName += "_Bit"; listBFName += gBit; }
145 if(gCentralityEstimator) {
146 listBFName += "_"; listBFName += gCentralityEstimator;}
149 listBFName.ReplaceAll("Psi","");
151 listBFName += listNameAdd;
153 // histograms were already retrieved (in first iteration)
154 if(dir->Get(Form("%s_histograms",listBFName.Data()))){
155 listBF = dynamic_cast<TList *>(dir->Get(Form("%s_histograms",listBFName.Data())));
158 // histograms were not yet retrieved (this is the first iteration)
161 listBF = dynamic_cast<TList *>(dir->Get(listBFName.Data()));
162 if(!listBF) dir->ls();
163 cout<<"======================================================="<<endl;
164 cout<<"List name (control): "<<listBFName.Data()<<endl;
165 cout<<"List name: "<<listBF->GetName()<<endl;
171 histoName = "fHistP";
173 histoName = "fHistP_shuffle";
175 histoName = "fHistP";
176 if(gCentralityEstimator)
177 histoName += gCentralityEstimator;
178 AliTHn *fHistP = dynamic_cast<AliTHn *>(listBF->FindObject(histoName.Data()));
180 Printf("fHistP %s not found!!!",histoName.Data());
183 fHistP->FillParent(); fHistP->DeleteContainers();
186 histoName = "fHistN";
188 histoName = "fHistN_shuffle";
190 histoName = "fHistN";
191 if(gCentralityEstimator)
192 histoName += gCentralityEstimator;
193 AliTHn *fHistN = dynamic_cast<AliTHn *>(listBF->FindObject(histoName.Data()));
195 Printf("fHistN %s not found!!!",histoName.Data());
198 fHistN->FillParent(); fHistN->DeleteContainers();
201 histoName = "fHistPN";
203 histoName = "fHistPN_shuffle";
205 histoName = "fHistPN";
206 if(gCentralityEstimator)
207 histoName += gCentralityEstimator;
208 AliTHn *fHistPN = dynamic_cast<AliTHn *>(listBF->FindObject(histoName.Data()));
210 Printf("fHistPN %s not found!!!",histoName.Data());
213 fHistPN->FillParent(); fHistPN->DeleteContainers();
216 histoName = "fHistNP";
218 histoName = "fHistNP_shuffle";
220 histoName = "fHistNP";
221 if(gCentralityEstimator)
222 histoName += gCentralityEstimator;
223 AliTHn *fHistNP = dynamic_cast<AliTHn *>(listBF->FindObject(histoName.Data()));
225 Printf("fHistNP %s not found!!!",histoName.Data());
228 fHistNP->FillParent(); fHistNP->DeleteContainers();
231 histoName = "fHistPP";
233 histoName = "fHistPP_shuffle";
235 histoName = "fHistPP";
236 if(gCentralityEstimator)
237 histoName += gCentralityEstimator;
238 AliTHn *fHistPP = dynamic_cast<AliTHn *>(listBF->FindObject(histoName.Data()));
240 Printf("fHistPP %s not found!!!",histoName.Data());
243 fHistPP->FillParent(); fHistPP->DeleteContainers();
246 histoName = "fHistNN";
248 histoName = "fHistNN_shuffle";
250 histoName = "fHistNN";
251 if(gCentralityEstimator)
252 histoName += gCentralityEstimator;
253 AliTHn *fHistNN = dynamic_cast<AliTHn *>(listBF->FindObject(histoName.Data()));
255 Printf("fHistNN %s not found!!!",histoName.Data());
258 fHistNN->FillParent(); fHistNN->DeleteContainers();
261 listBF->Write(Form("%s_histograms",listBFName.Data()), TObject::kSingleKey);
270 //______________________________________________________//
271 void draw(TList *list, TList *listBFShuffled, TList *listBFMixed,
273 const char *gCentralityEstimator,
274 Int_t gCentrality, Double_t psiMin, Double_t psiMax,
275 Double_t vertexZMin,Double_t vertexZMax,
276 Double_t ptTriggerMin, Double_t ptTriggerMax,
277 Double_t ptAssociatedMin, Double_t ptAssociatedMax,
279 Bool_t kUseVzBinning,
280 Int_t rebinEta, Int_t rebinPhi,TString eventClass) {
281 //Draws the correlation functions for every centrality bin
282 //(+-), (-+), (++), (--)
290 TString gHistPname = "fHistP";
291 if(gCentralityEstimator) gHistPname += gCentralityEstimator;
292 TString gHistNname = "fHistN";
293 if(gCentralityEstimator) gHistNname += gCentralityEstimator;
294 TString gHistPNname = "fHistPN";
295 if(gCentralityEstimator) gHistPNname += gCentralityEstimator;
296 TString gHistNPname = "fHistNP";
297 if(gCentralityEstimator) gHistNPname += gCentralityEstimator;
298 TString gHistPPname = "fHistPP";
299 if(gCentralityEstimator) gHistPPname += gCentralityEstimator;
300 TString gHistNNname = "fHistNN";
301 if(gCentralityEstimator) gHistNNname += gCentralityEstimator;
303 hP = (AliTHn*) list->FindObject(gHistPname.Data());
304 hN = (AliTHn*) list->FindObject(gHistNname.Data());
305 hPN = (AliTHn*) list->FindObject(gHistPNname.Data());
306 hNP = (AliTHn*) list->FindObject(gHistNPname.Data());
307 hPP = (AliTHn*) list->FindObject(gHistPPname.Data());
308 hNN = (AliTHn*) list->FindObject(gHistNNname.Data());
312 //Create the AliBalancePsi object and fill it with the AliTHn objects
313 AliBalancePsi *b = new AliBalancePsi();
314 b->SetEventClass(eventClass);
321 if(kUseVzBinning) b->SetVertexZBinning(kTRUE);
323 //balance function shuffling
324 AliTHn *hPShuffled = NULL;
325 AliTHn *hNShuffled = NULL;
326 AliTHn *hPNShuffled = NULL;
327 AliTHn *hNPShuffled = NULL;
328 AliTHn *hPPShuffled = NULL;
329 AliTHn *hNNShuffled = NULL;
331 //listBFShuffled->ls();
333 gHistPname = "fHistP_shuffle";
334 if(gCentralityEstimator) gHistPname += gCentralityEstimator;
335 gHistNname = "fHistN_shuffle";
336 if(gCentralityEstimator) gHistNname += gCentralityEstimator;
337 gHistPNname = "fHistPN_shuffle";
338 if(gCentralityEstimator) gHistPNname += gCentralityEstimator;
339 gHistNPname = "fHistNP_shuffle";
340 if(gCentralityEstimator) gHistNPname += gCentralityEstimator;
341 gHistPPname = "fHistPP_shuffle";
342 if(gCentralityEstimator) gHistPPname += gCentralityEstimator;
343 gHistNNname = "fHistNN_shuffle";
344 if(gCentralityEstimator) gHistNNname += gCentralityEstimator;
346 hPShuffled = (AliTHn*) listBFShuffled->FindObject(gHistPname.Data());
347 hPShuffled->SetName("gHistPShuffled");
348 hNShuffled = (AliTHn*) listBFShuffled->FindObject(gHistNname.Data());
349 hNShuffled->SetName("gHistNShuffled");
350 hPNShuffled = (AliTHn*) listBFShuffled->FindObject(gHistPNname.Data());
351 hPNShuffled->SetName("gHistPNShuffled");
352 hNPShuffled = (AliTHn*) listBFShuffled->FindObject(gHistNPname.Data());
353 hNPShuffled->SetName("gHistNPShuffled");
354 hPPShuffled = (AliTHn*) listBFShuffled->FindObject(gHistPPname.Data());
355 hPPShuffled->SetName("gHistPPShuffled");
356 hNNShuffled = (AliTHn*) listBFShuffled->FindObject(gHistNNname.Data());
357 hNNShuffled->SetName("gHistNNShuffled");
359 AliBalancePsi *bShuffled = new AliBalancePsi();
360 bShuffled->SetEventClass(eventClass);
361 bShuffled->SetHistNp(hPShuffled);
362 bShuffled->SetHistNn(hNShuffled);
363 bShuffled->SetHistNpn(hPNShuffled);
364 bShuffled->SetHistNnp(hNPShuffled);
365 bShuffled->SetHistNpp(hPPShuffled);
366 bShuffled->SetHistNnn(hNNShuffled);
367 if(kUseVzBinning) bShuffled->SetVertexZBinning(kTRUE);
370 //balance function mixing
371 AliTHn *hPMixed = NULL;
372 AliTHn *hNMixed = NULL;
373 AliTHn *hPNMixed = NULL;
374 AliTHn *hNPMixed = NULL;
375 AliTHn *hPPMixed = NULL;
376 AliTHn *hNNMixed = NULL;
381 gHistPname = "fHistP";
382 if(gCentralityEstimator) gHistPname += gCentralityEstimator;
383 gHistNname = "fHistN";
384 if(gCentralityEstimator) gHistNname += gCentralityEstimator;
385 gHistPNname = "fHistPN";
386 if(gCentralityEstimator) gHistPNname += gCentralityEstimator;
387 gHistNPname = "fHistNP";
388 if(gCentralityEstimator) gHistNPname += gCentralityEstimator;
389 gHistPPname = "fHistPP";
390 if(gCentralityEstimator) gHistPPname += gCentralityEstimator;
391 gHistNNname = "fHistNN";
392 if(gCentralityEstimator) gHistNNname += gCentralityEstimator;
393 hPMixed = (AliTHn*) listBFMixed->FindObject(gHistPname.Data());
394 hPMixed->SetName("gHistPMixed");
395 hNMixed = (AliTHn*) listBFMixed->FindObject(gHistNname.Data());
396 hNMixed->SetName("gHistNMixed");
397 hPNMixed = (AliTHn*) listBFMixed->FindObject(gHistPNname.Data());
398 hPNMixed->SetName("gHistPNMixed");
399 hNPMixed = (AliTHn*) listBFMixed->FindObject(gHistNPname.Data());
400 hNPMixed->SetName("gHistNPMixed");
401 hPPMixed = (AliTHn*) listBFMixed->FindObject(gHistPPname.Data());
402 hPPMixed->SetName("gHistPPMixed");
403 hNNMixed = (AliTHn*) listBFMixed->FindObject(gHistNNname.Data());
404 hNNMixed->SetName("gHistNNMixed");
406 AliBalancePsi *bMixed = new AliBalancePsi();
407 bMixed->SetEventClass(eventClass);
408 bMixed->SetHistNp(hPMixed);
409 bMixed->SetHistNn(hNMixed);
410 bMixed->SetHistNpn(hPNMixed);
411 bMixed->SetHistNnp(hNPMixed);
412 bMixed->SetHistNpp(hPPMixed);
413 bMixed->SetHistNnn(hNNMixed);
414 if(kUseVzBinning) bMixed->SetVertexZBinning(kTRUE);
427 TString histoTitle, pngName;
429 // if no mixing then divide by convoluted histograms
430 if(!listBFMixed && listQA){
432 if(!listQA->FindObject("fHistEtaPhiPos") || !listQA->FindObject("fHistEtaPhiNeg")){
434 Printf("fHistEtaPhiPos or fHistEtaPhiNeg not found! --> no convolution");
440 TH2D* fHistPos = (TH2D*)((TH3D*)listQA->FindObject("fHistEtaPhiPos"))->Project3D("xy");
441 fHistPos->GetYaxis()->SetRangeUser(-0.79,0.79);
443 TH2D* fHistNeg = (TH2D*)((TH3D*)listQA->FindObject("fHistEtaPhiNeg"))->Project3D("xy");
444 fHistNeg->GetYaxis()->SetRangeUser(-0.79,0.79);
446 gHistPN[2] = convolute2D(fHistPos, fHistNeg, "hConvPN");
447 gHistPN[2]->Scale(1./gHistPN[2]->GetBinContent(gHistPN[2]->FindBin(0,0)));
449 gHistNP[2] = convolute2D(fHistNeg, fHistPos, "hConvNP");
450 gHistNP[2]->Scale(1./gHistNP[2]->GetBinContent(gHistNP[2]->FindBin(0,0)));
452 gHistNN[2] = convolute2D(fHistNeg, fHistNeg, "hConvNN");
453 gHistNN[2]->Scale(1./gHistNN[2]->GetBinContent(gHistNN[2]->FindBin(0,0)));
455 gHistPP[2] = convolute2D(fHistPos, fHistPos, "hConvPP");
456 gHistPP[2]->Scale(1./gHistPP[2]->GetBinContent(gHistPP[2]->FindBin(0,0)));
461 if(eventClass == "Centrality"){
462 histoTitle = "(+-) | Centrality: ";
463 histoTitle += psiMin;
465 histoTitle += psiMax;
467 histoTitle += " (0^{o} < #varphi^{t} - #Psi_{2} < 180^{o})";
469 else if(eventClass == "Multiplicity"){
470 histoTitle = "(+-) | Multiplicity: ";
471 histoTitle += psiMin;
473 histoTitle += psiMax;
474 histoTitle += " tracks";
475 histoTitle += " (0^{o} < #varphi^{t} - #Psi_{2} < 180^{o})";
477 else{ // "EventPlane" (default)
478 histoTitle = "(+-) | Centrality: ";
479 histoTitle += centralityArray[gCentrality-1];
481 if((psiMin == -0.5)&&(psiMax == 0.5))
482 histoTitle += " (-7.5^{o} < #varphi^{t} - #Psi_{2} < 7.5^{o})";
483 else if((psiMin == 0.5)&&(psiMax == 1.5))
484 histoTitle += " (37.5^{o} < #varphi^{t} - #Psi_{2} < 52.5^{o})";
485 else if((psiMin == 1.5)&&(psiMax == 2.5))
486 histoTitle += " (82.5^{o} < #varphi^{t} - #Psi_{2} < 97.5^{o})";
488 histoTitle += " (0^{o} < #varphi^{t} - #Psi_{2} < 180^{o})";
490 gHistPN[0] = b->GetCorrelationFunctionPN(psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);
491 if(rebinEta > 1 || rebinPhi > 1){
492 gHistPN[0]->Rebin2D(rebinEta,rebinPhi);
493 gHistPN[0]->Scale(1./(Double_t)(rebinEta*rebinPhi));
495 gHistPN[0]->GetYaxis()->SetTitleOffset(1.5);
496 gHistPN[0]->GetYaxis()->SetTitle("#Delta #varphi (rad)");
497 gHistPN[0]->SetTitle(histoTitle.Data());
498 cPN[0] = new TCanvas("cPN0","",0,0,600,500);
499 cPN[0]->SetFillColor(10); cPN[0]->SetHighLightColor(10);
500 gHistPN[0]->DrawCopy("surf1fb");
501 gPad->SetTheta(30); // default is 30
502 //gPad->SetPhi(130); // default is 30
503 gPad->SetPhi(-60); // default is 30
505 pngName = "DeltaPhiDeltaEta.Centrality";
506 pngName += centralityArray[gCentrality-1];
507 pngName += ".Psi"; pngName += psiMin; pngName += "To"; pngName += psiMax;
508 pngName += ".PositiveNegative.png";
509 //cPN[0]->SaveAs(pngName.Data());
513 histoTitle.ReplaceAll("(+-)","(+-) shuffled");
515 gHistPN[1] = bShuffled->GetCorrelationFunctionPN(psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);
516 if(rebinEta > 1 || rebinPhi > 1){
517 gHistPN[1]->Rebin2D(rebinEta,rebinPhi);
518 gHistPN[1]->Scale(1./(Double_t)(rebinEta*rebinPhi));
520 gHistPN[1]->GetYaxis()->SetTitleOffset(1.5);
521 gHistPN[1]->GetYaxis()->SetTitle("#Delta #varphi (rad)");
522 gHistPN[1]->SetTitle(histoTitle.Data());
523 cPN[1] = new TCanvas("cPN1","",0,100,600,500);
524 cPN[1]->SetFillColor(10);
525 cPN[1]->SetHighLightColor(10);
526 gHistPN[1]->DrawCopy("surf1fb");
527 gPad->SetTheta(30); // default is 30
528 //gPad->SetPhi(130); // default is 30
529 gPad->SetPhi(-60); // default is 30
531 pngName = "DeltaPhiDeltaEtaShuffled.Centrality";
532 pngName += centralityArray[gCentrality-1];
533 pngName += ".Psi"; pngName += psiMin; pngName += "To"; pngName += psiMax;
534 pngName += ".PositiveNegative.png";
535 //cPN[1]->SaveAs(pngName.Data());
540 if(histoTitle.Contains("shuffled")) histoTitle.ReplaceAll("(+-) shuffled","(+-) mixed");
541 else histoTitle.ReplaceAll("(+-)","(+-) mixed");
543 // if normalization to trigger then do not divide Event mixing by number of trigger particles
544 gHistPN[2] = bMixed->GetCorrelationFunctionPN(psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);
545 if(rebinEta > 1 || rebinPhi > 1){
546 gHistPN[2]->Rebin2D(rebinEta,rebinPhi);
547 gHistPN[2]->Scale(1./(Double_t)(rebinEta*rebinPhi));
550 // normalization to 1 at (0,0) --> Jan Fietes method
552 Double_t mixedNorm = gHistPN[2]->Integral(gHistPN[2]->GetXaxis()->FindBin(0-10e-5),gHistPN[2]->GetXaxis()->FindBin(0+10e-5),1,gHistPN[2]->GetNbinsX());
553 mixedNorm /= gHistPN[2]->GetNbinsY()*(gHistPN[2]->GetXaxis()->FindBin(0.01) - gHistPN[2]->GetXaxis()->FindBin(-0.01) + 1);
554 gHistPN[2]->Scale(1./mixedNorm);
557 gHistPN[2]->GetYaxis()->SetTitleOffset(1.5);
558 gHistPN[2]->GetYaxis()->SetTitle("#Delta #varphi (rad)");
559 gHistPN[2]->SetTitle(histoTitle.Data());
560 cPN[2] = new TCanvas("cPN2","",0,200,600,500);
561 cPN[2]->SetFillColor(10);
562 cPN[2]->SetHighLightColor(10);
563 gHistPN[2]->DrawCopy("surf1fb");
564 gPad->SetTheta(30); // default is 30
565 //gPad->SetPhi(130); // default is 30
566 gPad->SetPhi(-60); // default is 30
568 pngName = "DeltaPhiDeltaEtaMixed.Centrality";
569 pngName += centralityArray[gCentrality-1];
570 pngName += ".Psi"; pngName += psiMin; pngName += "To"; pngName += psiMax;
571 pngName += ".PositiveNegative.png";
572 //cPN[2]->SaveAs(pngName.Data());
574 //Correlation function (+-)
575 gHistPN[3] = b->GetCorrelationFunction("PN",psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax,bMixed);
576 gHistPN[3]->GetXaxis()->SetRangeUser(-1.5,1.5);
578 gHistPN[3]->GetZaxis()->SetTitle("#frac{1}{N_{trig}}#frac{d^{2}N_{assoc}}{d#Delta#eta#Delta#varphi} (rad^{-1})");
580 gHistPN[3]->GetZaxis()->SetTitle("C_{+-}(#Delta#eta,#Delta#varphi)");
581 //gHistPN[3]->SetTitle("C_{+-}(#Delta#eta,#Delta#varphi)");
582 cPN[3] = new TCanvas("cPN3","",0,300,600,500);
583 cPN[3]->SetFillColor(10);
584 cPN[3]->SetHighLightColor(10);
585 gHistPN[3]->DrawCopy("surf1fb");
586 gPad->SetTheta(30); // default is 30
587 //gPad->SetPhi(130); // default is 30
588 gPad->SetPhi(-60); // default is 30
590 pngName = "CorrelationFunction.Centrality";
591 pngName += centralityArray[gCentrality-1];
592 pngName += ".Psi"; pngName += psiMin; pngName += "To"; pngName += psiMax;
593 pngName += ".PositiveNegative.png";
594 //cPN[3]->SaveAs(pngName.Data());
596 // if no mixing then divide by convoluted histograms
599 if(histoTitle.Contains("shuffled")) histoTitle.ReplaceAll("(+-) shuffled","(+-) convoluted");
600 else histoTitle.ReplaceAll("(+-)","(+-) convoluted");
602 if(rebinEta > 1 || rebinPhi > 1){
603 gHistPN[2]->Rebin2D(rebinEta,rebinPhi);
604 gHistPN[0]->Scale(1./(Double_t)(rebinEta*rebinPhi));
607 // normalization to 1 at (0,0) --> Jan Fietes method
609 Double_t mixedNorm = gHistPN[2]->Integral(gHistPN[2]->GetXaxis()->FindBin(0-10e-5),gHistPN[2]->GetXaxis()->FindBin(0+10e-5),1,gHistPN[2]->GetNbinsX());
610 mixedNorm /= gHistPN[2]->GetNbinsY()*(gHistPN[2]->GetXaxis()->FindBin(0.01) - gHistPN[2]->GetXaxis()->FindBin(-0.01) + 1);
611 gHistPN[2]->Scale(1./mixedNorm);
614 gHistPN[2]->GetYaxis()->SetTitleOffset(1.5);
615 gHistPN[2]->GetYaxis()->SetTitle("#Delta #varphi (rad)");
616 gHistPN[2]->SetTitle(histoTitle.Data());
617 cPN[2] = new TCanvas("cPN2","",0,200,600,500);
618 cPN[2]->SetFillColor(10);
619 cPN[2]->SetHighLightColor(10);
620 gHistPN[2]->DrawCopy("surf1fb");
621 gPad->SetTheta(30); // default is 30
622 //gPad->SetPhi(130); // default is 30
623 gPad->SetPhi(-60); // default is 30
625 pngName = "DeltaPhiDeltaEtaMixed.Centrality";
626 pngName += centralityArray[gCentrality-1];
627 pngName += ".Psi"; pngName += psiMin; pngName += "To"; pngName += psiMax;
628 pngName += ".PositiveNegative.png";
629 //cPN[2]->SaveAs(pngName.Data());
631 //Correlation function (+-)
632 gHistPN[3] = dynamic_cast<TH2D *>(gHistPN[0]->Clone());
633 gHistPN[3]->Divide(gHistPN[2]);
634 gHistPN[3]->GetXaxis()->SetRangeUser(-1.5,1.5);
636 gHistPN[3]->GetZaxis()->SetTitle("#frac{1}{N_{trig}}#frac{d^{2}N_{assoc}}{d#Delta#eta#Delta#varphi} (rad^{-1})");
638 gHistPN[3]->GetZaxis()->SetTitle("C_{+-}(#Delta#eta,#Delta#varphi)");
639 //gHistPN[3]->SetTitle("C_{+-}(#Delta#eta,#Delta#varphi)");
640 cPN[3] = new TCanvas("cPN3","",0,300,600,500);
641 cPN[3]->SetFillColor(10);
642 cPN[3]->SetHighLightColor(10);
643 gHistPN[3]->DrawCopy("surf1fb");
644 gPad->SetTheta(30); // default is 30
645 //gPad->SetPhi(130); // default is 30
646 gPad->SetPhi(-60); // default is 30
648 pngName = "CorrelationFunction.Centrality";
649 pngName += centralityArray[gCentrality-1];
650 pngName += ".Psi"; pngName += psiMin; pngName += "To"; pngName += psiMax;
651 pngName += ".PositiveNegative.png";
652 //cPN[3]->SaveAs(pngName.Data());
656 if(eventClass == "Centrality"){
657 histoTitle = "(-+) | Centrality: ";
658 histoTitle += psiMin;
660 histoTitle += psiMax;
662 histoTitle += " (0^{o} < #varphi^{t} - #Psi_{2} < 180^{o})";
664 else if(eventClass == "Multiplicity"){
665 histoTitle = "(-+) | Multiplicity: ";
666 histoTitle += psiMin;
668 histoTitle += psiMax;
669 histoTitle += " tracks";
670 histoTitle += " (0^{o} < #varphi^{t} - #Psi_{2} < 180^{o})";
672 else{ // "EventPlane" (default)
673 histoTitle = "(-+) | Centrality: ";
674 histoTitle += centralityArray[gCentrality-1];
676 if((psiMin == -0.5)&&(psiMax == 0.5))
677 histoTitle += " (-7.5^{o} < #varphi^{t} - #Psi_{2} < 7.5^{o})";
678 else if((psiMin == 0.5)&&(psiMax == 1.5))
679 histoTitle += " (37.5^{o} < #varphi^{t} - #Psi_{2} < 52.5^{o})";
680 else if((psiMin == 1.5)&&(psiMax == 2.5))
681 histoTitle += " (82.5^{o} < #varphi^{t} - #Psi_{2} < 97.5^{o})";
683 histoTitle += " (0^{o} < #varphi^{t} - #Psi_{2} < 180^{o})";
686 gHistNP[0] = b->GetCorrelationFunctionNP(psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);
687 if(rebinEta > 1 || rebinPhi > 1){
688 gHistNP[0]->Rebin2D(rebinEta,rebinPhi);
689 gHistNP[0]->Scale(1./(Double_t)(rebinEta*rebinPhi));
691 gHistNP[0]->GetYaxis()->SetTitleOffset(1.5);
692 gHistNP[0]->GetYaxis()->SetTitle("#Delta #varphi (rad)");
693 gHistNP[0]->SetTitle(histoTitle.Data());
694 cNP[0] = new TCanvas("cNP0","",100,0,600,500);
695 cNP[0]->SetFillColor(10);
696 cNP[0]->SetHighLightColor(10);
697 gHistNP[0]->DrawCopy("surf1fb");
698 gPad->SetTheta(30); // default is 30
699 //gPad->SetPhi(130); // default is 30
700 gPad->SetPhi(-60); // default is 30
702 pngName = "DeltaPhiDeltaEta.Centrality";
703 pngName += centralityArray[gCentrality-1];
704 pngName += ".Psi"; pngName += psiMin; pngName += "To"; pngName += psiMax;
705 pngName += ".NegativePositive.png";
706 //cNP[0]->SaveAs(pngName.Data());
710 histoTitle.ReplaceAll("(-+)","(-+) shuffled");
712 gHistNP[1] = bShuffled->GetCorrelationFunctionNP(psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);
713 if(rebinEta > 1 || rebinPhi > 1){
714 gHistNP[1]->Rebin2D(rebinEta,rebinPhi);
715 gHistNP[1]->Scale(1./(Double_t)(rebinEta*rebinPhi));
717 gHistNP[1]->GetYaxis()->SetTitleOffset(1.5);
718 gHistNP[1]->GetYaxis()->SetTitle("#Delta #varphi (rad)");
719 gHistNP[1]->SetTitle(histoTitle.Data());
720 cNP[1] = new TCanvas("cNP1","",100,100,600,500);
721 cNP[1]->SetFillColor(10);
722 cNP[1]->SetHighLightColor(10);
723 gHistNP[1]->DrawCopy("surf1fb");
724 gPad->SetTheta(30); // default is 30
725 //gPad->SetPhi(130); // default is 30
726 gPad->SetPhi(-60); // default is 30
728 pngName = "DeltaPhiDeltaEtaShuffled.Centrality";
729 pngName += centralityArray[gCentrality-1];
730 pngName += ".Psi"; pngName += psiMin; pngName += "To"; pngName += psiMax;
731 pngName += ".NegativePositive.png";
732 //cNP[1]->SaveAs(pngName.Data());
737 if(histoTitle.Contains("shuffled")) histoTitle.ReplaceAll("(-+) shuffled","(-+) mixed");
738 else histoTitle.ReplaceAll("(-+)","(-+) mixed");
740 // if normalization to trigger then do not divide Event mixing by number of trigger particles
741 gHistNP[2] = bMixed->GetCorrelationFunctionNP(psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);
742 if(rebinEta > 1 || rebinPhi > 1){
743 gHistNP[2]->Rebin2D(rebinEta,rebinPhi);
744 gHistNP[2]->Scale(1./(Double_t)(rebinEta*rebinPhi));
746 // normalization to 1 at (0,0) --> Jan Fietes method
748 Double_t mixedNorm = gHistNP[2]->Integral(gHistNP[2]->GetXaxis()->FindBin(0-10e-5),gHistNP[2]->GetXaxis()->FindBin(0+10e-5),1,gHistNP[2]->GetNbinsX());
749 mixedNorm /= gHistNP[2]->GetNbinsY()*(gHistNP[2]->GetXaxis()->FindBin(0.01) - gHistNP[2]->GetXaxis()->FindBin(-0.01) + 1);
750 gHistNP[2]->Scale(1./mixedNorm);
753 gHistNP[2]->GetYaxis()->SetTitleOffset(1.5);
754 gHistNP[2]->GetYaxis()->SetTitle("#Delta #varphi (rad)");
755 gHistNP[2]->SetTitle(histoTitle.Data());
756 cNP[2] = new TCanvas("cNP2","",100,200,600,500);
757 cNP[2]->SetFillColor(10);
758 cNP[2]->SetHighLightColor(10);
759 gHistNP[2]->DrawCopy("surf1fb");
760 gPad->SetTheta(30); // default is 30
761 //gPad->SetPhi(130); // default is 30
762 gPad->SetPhi(-60); // default is 30
764 pngName = "DeltaPhiDeltaEtaMixed.Centrality";
765 pngName += centralityArray[gCentrality-1];
766 pngName += ".Psi"; pngName += psiMin; pngName += "To"; pngName += psiMax;
767 pngName += ".NegativePositive.png";
768 //cNP[2]->SaveAs(pngName.Data());
770 //Correlation function (-+)
771 gHistNP[3] = b->GetCorrelationFunction("NP",psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax,bMixed);
772 gHistNP[3]->GetXaxis()->SetRangeUser(-1.5,1.5);
774 gHistNP[3]->GetZaxis()->SetTitle("#frac{1}{N_{trig}}#frac{d^{2}N_{assoc}}{d#Delta#eta#Delta#varphi} (rad^{-1})");
776 gHistNP[3]->GetZaxis()->SetTitle("C_{-+}(#Delta#eta,#Delta#varphi)");
777 //gHistNP[3]->SetTitle("C_{+-}(#Delta#eta,#Delta#varphi)");
778 cNP[3] = new TCanvas("cNP3","",100,300,600,500);
779 cNP[3]->SetFillColor(10);
780 cNP[3]->SetHighLightColor(10);
781 gHistNP[3]->DrawCopy("surf1fb");
782 gPad->SetTheta(30); // default is 30
783 //gPad->SetPhi(130); // default is 30
784 gPad->SetPhi(-60); // default is 30
786 pngName = "CorrelationFunction.Centrality";
787 pngName += centralityArray[gCentrality-1];
788 pngName += ".Psi"; pngName += psiMin; pngName += "To"; pngName += psiMax;
789 pngName += ".NegativePositive.png";
790 //cNP[3]->SaveAs(pngName.Data());
792 // if no mixing then divide by convoluted histograms
795 if(histoTitle.Contains("shuffled")) histoTitle.ReplaceAll("(-+) shuffled","(-+) convoluted");
796 else histoTitle.ReplaceAll("(-+)","(-+) convoluted");
798 if(rebinEta > 1 || rebinPhi > 1){
799 gHistNP[2]->Rebin2D(rebinEta,rebinPhi);
800 gHistNP[2]->Scale(1./(Double_t)(rebinEta*rebinPhi));
803 // normalization to 1 at (0,0) --> Jan Fietes method
805 Double_t mixedNorm = gHistNP[2]->Integral(gHistNP[2]->GetXaxis()->FindBin(0-10e-5),gHistNP[2]->GetXaxis()->FindBin(0+10e-5),1,gHistNP[2]->GetNbinsX());
806 mixedNorm /= gHistNP[2]->GetNbinsY()*(gHistNP[2]->GetXaxis()->FindBin(0.01) - gHistNP[2]->GetXaxis()->FindBin(-0.01) + 1);
807 gHistNP[2]->Scale(1./mixedNorm);
810 gHistNP[2]->GetYaxis()->SetTitleOffset(1.5);
811 gHistNP[2]->GetYaxis()->SetTitle("#Delta #varphi (rad)");
812 gHistNP[2]->SetTitle(histoTitle.Data());
813 cNP[2] = new TCanvas("cNP2","",100,200,600,500);
814 cNP[2]->SetFillColor(10);
815 cNP[2]->SetHighLightColor(10);
816 gHistNP[2]->DrawCopy("surf1fb");
817 gPad->SetTheta(30); // default is 30
818 //gPad->SetPhi(130); // default is 30
819 gPad->SetPhi(-60); // default is 30
821 pngName = "DeltaPhiDeltaEtaMixed.Centrality";
822 pngName += centralityArray[gCentrality-1];
823 pngName += ".Psi"; pngName += psiMin; pngName += "To"; pngName += psiMax;
824 pngName += ".NegativePositive.png";
825 //cNP[2]->SaveAs(pngName.Data());
827 //Correlation function (-+)
828 gHistNP[3] = dynamic_cast<TH2D *>(gHistNP[0]->Clone());
829 gHistNP[3]->Divide(gHistNP[2]);
830 gHistNP[3]->GetXaxis()->SetRangeUser(-1.5,1.5);
832 gHistNP[3]->GetZaxis()->SetTitle("#frac{1}{N_{trig}}#frac{d^{2}N_{assoc}}{d#Delta#eta#Delta#varphi} (rad^{-1})");
834 gHistNP[3]->GetZaxis()->SetTitle("C_{-+}(#Delta#eta,#Delta#varphi)");
835 //gHistNP[3]->SetTitle("C_{-+}(#Delta#eta,#Delta#varphi)");
836 cNP[3] = new TCanvas("cNP3","",100,300,600,500);
837 cNP[3]->SetFillColor(10);
838 cNP[3]->SetHighLightColor(10);
839 gHistNP[3]->DrawCopy("surf1fb");
840 gPad->SetTheta(30); // default is 30
841 //gPad->SetPhi(130); // default is 30
842 gPad->SetPhi(-60); // default is 30
844 pngName = "CorrelationFunction.Centrality";
845 pngName += centralityArray[gCentrality-1];
846 pngName += ".Psi"; pngName += psiMin; pngName += "To"; pngName += psiMax;
847 pngName += ".NegativePositive.png";
848 //cNP[3]->SaveAs(pngName.Data());
853 if(eventClass == "Centrality"){
854 histoTitle = "(++) | Centrality: ";
855 histoTitle += psiMin;
857 histoTitle += psiMax;
859 histoTitle += " (0^{o} < #varphi^{t} - #Psi_{2} < 180^{o})";
861 else if(eventClass == "Multiplicity"){
862 histoTitle = "(++) | Multiplicity: ";
863 histoTitle += psiMin;
865 histoTitle += psiMax;
866 histoTitle += " tracks";
867 histoTitle += " (0^{o} < #varphi^{t} - #Psi_{2} < 180^{o})";
869 else{ // "EventPlane" (default)
870 histoTitle = "(++) | Centrality: ";
871 histoTitle += centralityArray[gCentrality-1];
873 if((psiMin == -0.5)&&(psiMax == 0.5))
874 histoTitle += " (-7.5^{o} < #varphi^{t} - #Psi_{2} < 7.5^{o})";
875 else if((psiMin == 0.5)&&(psiMax == 1.5))
876 histoTitle += " (37.5^{o} < #varphi^{t} - #Psi_{2} < 52.5^{o})";
877 else if((psiMin == 1.5)&&(psiMax == 2.5))
878 histoTitle += " (82.5^{o} < #varphi^{t} - #Psi_{2} < 97.5^{o})";
880 histoTitle += " (0^{o} < #varphi^{t} - #Psi_{2} < 180^{o})";
883 gHistPP[0] = b->GetCorrelationFunctionPP(psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);
884 if(rebinEta > 1 || rebinPhi > 1){
885 gHistPP[0]->Rebin2D(rebinEta,rebinPhi);
886 gHistPP[0]->Scale(1./(Double_t)(rebinEta*rebinPhi));
888 gHistPP[0]->GetYaxis()->SetTitleOffset(1.5);
889 gHistPP[0]->GetYaxis()->SetTitle("#Delta #varphi (rad)");
890 gHistPP[0]->SetTitle(histoTitle.Data());
891 cPP[0] = new TCanvas("cPP0","",200,0,600,500);
892 cPP[0]->SetFillColor(10);
893 cPP[0]->SetHighLightColor(10);
894 gHistPP[0]->DrawCopy("surf1fb");
895 gPad->SetTheta(30); // default is 30
896 //gPad->SetPhi(130); // default is 30
897 gPad->SetPhi(-60); // default is 30
899 pngName = "DeltaPhiDeltaEta.Centrality";
900 pngName += centralityArray[gCentrality-1];
901 pngName += ".Psi"; pngName += psiMin; pngName += "To"; pngName += psiMax;
902 pngName += ".PositivePositive.png";
903 //cPP[0]->SaveAs(pngName.Data());
907 histoTitle.ReplaceAll("(++)","(++) shuffled");
909 gHistPP[1] = bShuffled->GetCorrelationFunctionPP(psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);
910 if(rebinEta > 1 || rebinPhi > 1){
911 gHistPP[1]->Rebin2D(rebinEta,rebinPhi);
912 gHistPP[1]->Scale(1./(Double_t)(rebinEta*rebinPhi));
914 gHistPP[1]->GetYaxis()->SetTitleOffset(1.5);
915 gHistPP[1]->GetYaxis()->SetTitle("#Delta #varphi (rad)");
916 gHistPP[1]->SetTitle(histoTitle.Data());
917 cPP[1] = new TCanvas("cPP1","",200,100,600,500);
918 cPP[1]->SetFillColor(10);
919 cPP[1]->SetHighLightColor(10);
920 gHistPP[1]->DrawCopy("surf1fb");
921 gPad->SetTheta(30); // default is 30
922 //gPad->SetPhi(130); // default is 30
923 gPad->SetPhi(-60); // default is 30
925 pngName = "DeltaPhiDeltaEtaShuffled.Centrality";
926 pngName += centralityArray[gCentrality-1];
927 pngName += ".Psi"; pngName += psiMin; pngName += "To"; pngName += psiMax;
928 pngName += ".PositivePositive.png";
929 //cPP[1]->SaveAs(pngName.Data());
934 if(histoTitle.Contains("shuffled")) histoTitle.ReplaceAll("(++) shuffled","(++) mixed");
935 else histoTitle.ReplaceAll("(++)","(++) mixed");
937 // if normalization to trigger then do not divide Event mixing by number of trigger particles
938 gHistPP[2] = bMixed->GetCorrelationFunctionPP(psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);
939 if(rebinEta > 1 || rebinPhi > 1){
940 gHistPP[2]->Rebin2D(rebinEta,rebinPhi);
941 gHistPP[2]->Scale(1./(Double_t)(rebinEta*rebinPhi));
943 // normalization to 1 at (0,0) --> Jan Fietes method
945 Double_t mixedNorm = gHistPP[2]->Integral(gHistPP[2]->GetXaxis()->FindBin(0-10e-5),gHistPP[2]->GetXaxis()->FindBin(0+10e-5),1,gHistPP[2]->GetNbinsX());
946 mixedNorm /= gHistPP[2]->GetNbinsY()*(gHistPP[2]->GetXaxis()->FindBin(0.01) - gHistPP[2]->GetXaxis()->FindBin(-0.01) + 1);
947 gHistPP[2]->Scale(1./mixedNorm);
950 gHistPP[2]->GetYaxis()->SetTitleOffset(1.5);
951 gHistPP[2]->GetYaxis()->SetTitle("#Delta #varphi (rad)");
952 gHistPP[2]->SetTitle(histoTitle.Data());
953 cPP[2] = new TCanvas("cPP2","",200,200,600,500);
954 cPP[2]->SetFillColor(10);
955 cPP[2]->SetHighLightColor(10);
956 gHistPP[2]->DrawCopy("surf1fb");
957 gPad->SetTheta(30); // default is 30
958 //gPad->SetPhi(130); // default is 30
959 gPad->SetPhi(-60); // default is 30
961 pngName = "DeltaPhiDeltaEtaMixed.Centrality";
962 pngName += centralityArray[gCentrality-1];
963 pngName += ".Psi"; pngName += psiMin; pngName += "To"; pngName += psiMax;
964 pngName += ".PositivePositive.png";
965 //cPP[2]->SaveAs(pngName.Data());
967 //Correlation function (++)
968 gHistPP[3] = b->GetCorrelationFunction("PP",psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax,bMixed);
969 gHistPP[3]->GetXaxis()->SetRangeUser(-1.5,1.5);
971 gHistPP[3]->GetZaxis()->SetTitle("#frac{1}{N_{trig}}#frac{d^{2}N_{assoc}}{d#Delta#eta#Delta#varphi} (rad^{-1})");
973 gHistPP[3]->GetZaxis()->SetTitle("C_{++}(#Delta#eta,#Delta#varphi)");
974 // gHistPP[3]->SetTitle("C_{++}(#Delta#eta,#Delta#varphi)");
975 cPP[3] = new TCanvas("cPP3","",200,300,600,500);
976 cPP[3]->SetFillColor(10);
977 cPP[3]->SetHighLightColor(10);
978 gHistPP[3]->DrawCopy("surf1fb");
979 gPad->SetTheta(30); // default is 30
980 //gPad->SetPhi(130); // default is 30
981 gPad->SetPhi(-60); // default is 30
983 pngName = "CorrelationFunction.Centrality";
984 pngName += centralityArray[gCentrality-1];
985 pngName += ".Psi"; pngName += psiMin; pngName += "To"; pngName += psiMax;
986 pngName += ".PositivePositive.png";
987 //cPP[3]->SaveAs(pngName.Data());
989 // if no mixing then divide by convoluted histograms
992 if(histoTitle.Contains("shuffled")) histoTitle.ReplaceAll("(++) shuffled","(++) convoluted");
993 else histoTitle.ReplaceAll("(++)","(++) convoluted");
995 if(rebinEta > 1 || rebinPhi > 1){
996 gHistPP[2]->Rebin2D(rebinEta,rebinPhi);
997 gHistPP[2]->Scale(1./(Double_t)(rebinEta*rebinPhi));
999 // normalization to 1 at (0,0) --> Jan Fietes method
1001 Double_t mixedNorm = gHistPP[2]->Integral(gHistPP[2]->GetXaxis()->FindBin(0-10e-5),gHistPP[2]->GetXaxis()->FindBin(0+10e-5),1,gHistPP[2]->GetNbinsX());
1002 mixedNorm /= gHistPP[2]->GetNbinsY()*(gHistPP[2]->GetXaxis()->FindBin(0.01) - gHistPP[2]->GetXaxis()->FindBin(-0.01) + 1);
1003 gHistPP[2]->Scale(1./mixedNorm);
1006 gHistPP[2]->GetYaxis()->SetTitleOffset(1.5);
1007 gHistPP[2]->GetYaxis()->SetTitle("#Delta #varphi (rad)");
1008 gHistPP[2]->SetTitle(histoTitle.Data());
1009 cPP[2] = new TCanvas("cPP2","",200,200,600,500);
1010 cPP[2]->SetFillColor(10);
1011 cPP[2]->SetHighLightColor(10);
1012 gHistPP[2]->DrawCopy("surf1fb");
1013 gPad->SetTheta(30); // default is 30
1014 //gPad->SetPhi(130); // default is 30
1015 gPad->SetPhi(-60); // default is 30
1017 pngName = "DeltaPhiDeltaEtaMixed.Centrality";
1018 pngName += centralityArray[gCentrality-1];
1019 pngName += ".Psi"; pngName += psiMin; pngName += "To"; pngName += psiMax;
1020 pngName += ".PositivePositive.png";
1021 //cPP[2]->SaveAs(pngName.Data());
1023 //Correlation function (++)
1024 gHistPP[3] = dynamic_cast<TH2D *>(gHistPP[0]->Clone());
1025 gHistPP[3]->Divide(gHistPP[2]);
1026 gHistPP[3]->GetXaxis()->SetRangeUser(-1.5,1.5);
1028 gHistPP[3]->GetZaxis()->SetTitle("#frac{1}{N_{trig}}#frac{d^{2}N_{assoc}}{d#Delta#eta#Delta#varphi} (rad^{-1})");
1030 gHistPP[3]->GetZaxis()->SetTitle("C_{++}(#Delta#eta,#Delta#varphi)");
1031 //gHistPP[3]->SetTitle("C_{++}(#Delta#eta,#Delta#varphi)");
1032 cPP[3] = new TCanvas("cPP3","",200,300,600,500);
1033 cPP[3]->SetFillColor(10);
1034 cPP[3]->SetHighLightColor(10);
1035 gHistPP[3]->DrawCopy("surf1fb");
1036 gPad->SetTheta(30); // default is 30
1037 //gPad->SetPhi(130); // default is 30
1038 gPad->SetPhi(-60); // default is 30
1040 pngName = "CorrelationFunction.Centrality";
1041 pngName += centralityArray[gCentrality-1];
1042 pngName += ".Psi"; pngName += psiMin; pngName += "To"; pngName += psiMax;
1043 pngName += ".PositivePositive.png";
1044 //cPP[3]->SaveAs(pngName.Data());
1048 if(eventClass == "Centrality"){
1049 histoTitle = "(--) | Centrality: ";
1050 histoTitle += psiMin;
1051 histoTitle += " - ";
1052 histoTitle += psiMax;
1053 histoTitle += " % ";
1054 histoTitle += " (0^{o} < #varphi^{t} - #Psi_{2} < 180^{o})";
1056 else if(eventClass == "Multiplicity"){
1057 histoTitle = "(--) | Multiplicity: ";
1058 histoTitle += psiMin;
1059 histoTitle += " - ";
1060 histoTitle += psiMax;
1061 histoTitle += " tracks";
1062 histoTitle += " (0^{o} < #varphi^{t} - #Psi_{2} < 180^{o})";
1064 else{ // "EventPlane" (default)
1065 histoTitle = "(--) | Centrality: ";
1066 histoTitle += centralityArray[gCentrality-1];
1068 if((psiMin == -0.5)&&(psiMax == 0.5))
1069 histoTitle += " (-7.5^{o} < #varphi^{t} - #Psi_{2} < 7.5^{o})";
1070 else if((psiMin == 0.5)&&(psiMax == 1.5))
1071 histoTitle += " (37.5^{o} < #varphi^{t} - #Psi_{2} < 52.5^{o})";
1072 else if((psiMin == 1.5)&&(psiMax == 2.5))
1073 histoTitle += " (82.5^{o} < #varphi^{t} - #Psi_{2} < 97.5^{o})";
1075 histoTitle += " (0^{o} < #varphi^{t} - #Psi_{2} < 180^{o})";
1078 gHistNN[0] = b->GetCorrelationFunctionNN(psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);
1079 if(rebinEta > 1 || rebinPhi > 1){
1080 gHistNN[0]->Rebin2D(rebinEta,rebinPhi);
1081 gHistNN[0]->Scale(1./(Double_t)(rebinEta*rebinPhi));
1083 gHistNN[0]->GetYaxis()->SetTitleOffset(1.5);
1084 gHistNN[0]->GetYaxis()->SetTitle("#Delta #varphi (rad)");
1085 gHistNN[0]->SetTitle(histoTitle.Data());
1086 cNN[0] = new TCanvas("cNN0","",300,0,600,500);
1087 cNN[0]->SetFillColor(10);
1088 cNN[0]->SetHighLightColor(10);
1089 gHistNN[0]->DrawCopy("surf1fb");
1090 gPad->SetTheta(30); // default is 30
1091 gPad->SetPhi(-60); // default is 30
1092 //gPad->SetPhi(-60); // default is 30
1094 pngName = "DeltaPhiDeltaEta.Centrality";
1095 pngName += centralityArray[gCentrality-1];
1096 pngName += ".Psi"; pngName += psiMin; pngName += "To"; pngName += psiMax;
1097 pngName += ".NegativeNegative.png";
1098 //cNN[0]->SaveAs(pngName.Data());
1100 if(listBFShuffled) {
1102 histoTitle.ReplaceAll("(--)","(--) shuffled");
1104 gHistNN[1] = bShuffled->GetCorrelationFunctionNN(psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);
1105 if(rebinEta > 1 || rebinPhi > 1){
1106 gHistNN[1]->Rebin2D(rebinEta,rebinPhi);
1107 gHistNN[1]->Scale(1./(Double_t)(rebinEta*rebinPhi));
1109 gHistNN[1]->GetYaxis()->SetTitleOffset(1.5);
1110 gHistNN[1]->GetYaxis()->SetTitle("#Delta #varphi (rad)");
1111 gHistNN[1]->SetTitle(histoTitle.Data());
1112 cNN[1] = new TCanvas("cNN1","",300,100,600,500);
1113 cNN[1]->SetFillColor(10);
1114 cNN[1]->SetHighLightColor(10);
1115 gHistNN[1]->DrawCopy("surf1fb");
1116 gPad->SetTheta(30); // default is 30
1117 //gPad->SetPhi(130); // default is 30
1118 gPad->SetPhi(-60); // default is 30
1120 pngName = "DeltaPhiDeltaEtaShuffled.Centrality";
1121 pngName += centralityArray[gCentrality-1];
1122 pngName += ".Psi"; pngName += psiMin; pngName += "To"; pngName += psiMax;
1123 pngName += ".NegativeNegative.png";
1124 //cNN[1]->SaveAs(pngName.Data());
1129 if(histoTitle.Contains("shuffled")) histoTitle.ReplaceAll("(--) shuffled","(--) mixed");
1130 else histoTitle.ReplaceAll("(--)","(--) mixed");
1132 // if normalization to trigger then do not divide Event mixing by number of trigger particles
1133 gHistNN[2] = bMixed->GetCorrelationFunctionNN(psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax);
1134 if(rebinEta > 1 || rebinPhi > 1){
1135 gHistNN[2]->Rebin2D(rebinEta,rebinPhi);
1136 gHistNN[2]->Scale(1./(Double_t)(rebinEta*rebinPhi));
1138 // normalization to 1 at (0,0) --> Jan Fietes method
1140 Double_t mixedNorm = gHistNN[2]->Integral(gHistNN[2]->GetXaxis()->FindBin(0-10e-5),gHistNN[2]->GetXaxis()->FindBin(0+10e-5),1,gHistNN[2]->GetNbinsX());
1141 mixedNorm /= gHistNN[2]->GetNbinsY()*(gHistNN[2]->GetXaxis()->FindBin(0.01) - gHistNN[2]->GetXaxis()->FindBin(-0.01) + 1);
1142 gHistNN[2]->Scale(1./mixedNorm);
1145 gHistNN[2]->GetYaxis()->SetTitleOffset(1.5);
1146 gHistNN[2]->GetYaxis()->SetTitle("#Delta #varphi (rad)");
1147 gHistNN[2]->SetTitle(histoTitle.Data());
1148 cNN[2] = new TCanvas("cNN2","",300,200,600,500);
1149 cNN[2]->SetFillColor(10);
1150 cNN[2]->SetHighLightColor(10);
1151 gHistNN[2]->DrawCopy("surf1fb");
1152 gPad->SetTheta(30); // default is 30
1153 //gPad->SetPhi(130); // default is 30
1154 gPad->SetPhi(-60); // default is 30
1156 pngName = "DeltaPhiDeltaEtaMixed.Centrality";
1157 pngName += centralityArray[gCentrality-1];
1158 pngName += ".Psi"; pngName += psiMin; pngName += "To"; pngName += psiMax;
1159 pngName += ".NegativeNegative.png";
1160 //cNN[2]->SaveAs(pngName.Data());
1162 //Correlation function (--)
1163 gHistNN[3] = b->GetCorrelationFunction("NN",psiMin,psiMax,vertexZMin,vertexZMax,ptTriggerMin,ptTriggerMax,ptAssociatedMin,ptAssociatedMax,bMixed);
1164 gHistNN[3]->GetXaxis()->SetRangeUser(-1.5,1.5);
1166 gHistNN[3]->GetZaxis()->SetTitle("#frac{1}{N_{trig}}#frac{d^{2}N_{assoc}}{d#Delta#eta#Delta#varphi} (rad^{-1})");
1168 gHistNN[3]->GetZaxis()->SetTitle("C_{--}(#Delta#eta,#Delta#varphi)");
1169 // gHistNN[3]->SetTitle("C_{--}(#Delta#eta,#Delta#varphi)");
1170 cNN[3] = new TCanvas("cNN3","",300,300,600,500);
1171 cNN[3]->SetFillColor(10);
1172 cNN[3]->SetHighLightColor(10);
1173 gHistNN[3]->DrawCopy("surf1fb");
1174 gPad->SetTheta(30); // default is 30
1175 //gPad->SetPhi(130); // default is 30
1176 gPad->SetPhi(-60); // default is 30
1178 pngName = "CorrelationFunction.Centrality";
1179 pngName += centralityArray[gCentrality-1];
1180 pngName += ".Psi"; pngName += psiMin; pngName += "To"; pngName += psiMax;
1181 pngName += ".NegativeNegative.png";
1182 //cNN[3]->SaveAs(pngName.Data());
1184 // if no mixing then divide by convoluted histograms
1187 if(histoTitle.Contains("shuffled")) histoTitle.ReplaceAll("(--) shuffled","(--) convoluted");
1188 else histoTitle.ReplaceAll("(--)","(--) convoluted");
1190 if(rebinEta > 1 || rebinPhi > 1){
1191 gHistNN[2]->Rebin2D(rebinEta,rebinPhi);
1192 gHistNN[2]->Scale(1./(Double_t)(rebinEta*rebinPhi));
1194 // normalization to 1 at (0,0) --> Jan Fietes method
1196 Double_t mixedNorm = gHistNN[2]->Integral(gHistNN[2]->GetXaxis()->FindBin(0-10e-5),gHistNN[2]->GetXaxis()->FindBin(0+10e-5),1,gHistNN[2]->GetNbinsX());
1197 mixedNorm /= gHistNN[2]->GetNbinsY()*(gHistNN[2]->GetXaxis()->FindBin(0.01) - gHistNN[2]->GetXaxis()->FindBin(-0.01) + 1);
1198 gHistNN[2]->Scale(1./mixedNorm);
1201 gHistNN[2]->GetYaxis()->SetTitleOffset(1.5);
1202 gHistNN[2]->GetYaxis()->SetTitle("#Delta #varphi (rad)");
1203 gHistNN[2]->SetTitle(histoTitle.Data());
1204 cNN[2] = new TCanvas("cNN2","",300,200,600,500);
1205 cNN[2]->SetFillColor(10);
1206 cNN[2]->SetHighLightColor(10);
1207 gHistNN[2]->DrawCopy("surf1fb");
1208 gPad->SetTheta(30); // default is 30
1209 //gPad->SetPhi(130); // default is 30
1210 gPad->SetPhi(-60); // default is 30
1212 pngName = "DeltaPhiDeltaEtaMixed.Centrality";
1213 pngName += centralityArray[gCentrality-1];
1214 pngName += ".Psi"; pngName += psiMin; pngName += "To"; pngName += psiMax;
1215 pngName += ".NegativeNegative.png";
1216 //cNN[2]->SaveAs(pngName.Data());
1218 //Correlation function (--)
1219 gHistNN[3] = dynamic_cast<TH2D *>(gHistNN[0]->Clone());
1220 gHistNN[3]->Divide(gHistNN[2]);
1221 gHistNN[3]->GetXaxis()->SetRangeUser(-1.5,1.5);
1223 gHistNN[3]->GetZaxis()->SetTitle("#frac{1}{N_{trig}}#frac{d^{2}N_{assoc}}{d#Delta#eta#Delta#varphi} (rad^{-1})");
1225 gHistNN[3]->GetZaxis()->SetTitle("C_{--}(#Delta#eta,#Delta#varphi)");
1226 //gHistNN[3]->SetTitle("C_{--}(#Delta#eta,#Delta#varphi)");
1227 cNN[3] = new TCanvas("cNN3","",300,300,600,500);
1228 cNN[3]->SetFillColor(10);
1229 cNN[3]->SetHighLightColor(10);
1230 gHistNN[3]->DrawCopy("surf1fb");
1231 gPad->SetTheta(30); // default is 30
1232 //gPad->SetPhi(130); // default is 30
1233 gPad->SetPhi(-60); // default is 30
1235 pngName = "CorrelationFunction.Centrality";
1236 pngName += centralityArray[gCentrality-1];
1237 pngName += ".Psi"; pngName += psiMin; pngName += "To"; pngName += psiMax;
1238 pngName += ".NegativeNegative.png";
1239 //cNN[3]->SaveAs(pngName.Data());
1242 //Write to output file
1243 TString newFileName = "correlationFunction.";
1244 if(eventClass == "Centrality"){
1245 newFileName += Form("Centrality%.1fTo%.1f",psiMin,psiMax);
1246 newFileName += ".PsiAll.PttFrom";
1248 else if(eventClass == "Multiplicity"){
1249 newFileName += Form("Multiplicity%.0fTo%.0f",psiMin,psiMax);
1250 newFileName += ".PsiAll.PttFrom";
1252 else{ // "EventPlane" (default)
1253 newFileName += "Centrality";
1254 newFileName += gCentrality; newFileName += ".Psi";
1255 if((psiMin == -0.5)&&(psiMax == 0.5)) newFileName += "InPlane.Ptt";
1256 else if((psiMin == 0.5)&&(psiMax == 1.5)) newFileName += "Intermediate.Ptt";
1257 else if((psiMin == 1.5)&&(psiMax == 2.5)) newFileName += "OutOfPlane.Ptt";
1258 else if((psiMin == 2.5)&&(psiMax == 3.5)) newFileName += "Rest.PttFrom";
1259 else newFileName += "All.PttFrom";
1261 newFileName += Form("%.1f",ptTriggerMin); newFileName += "To";
1262 newFileName += Form("%.1f",ptTriggerMax); newFileName += "PtaFrom";
1263 newFileName += Form("%.1f",ptAssociatedMin); newFileName += "To";
1264 newFileName += Form("%.1f",ptAssociatedMax);
1267 newFileName += Form("%.1f",psiMin);
1269 newFileName += Form("%.1f",psiMax);
1270 newFileName += ".root";
1272 TFile *newFile = TFile::Open(newFileName.Data(),"recreate");
1273 gHistPN[0]->SetName("gHistPNRaw"); gHistPN[0]->Write();
1274 gHistNP[0]->SetName("gHistNPRaw"); gHistNP[0]->Write();
1275 gHistPP[0]->SetName("gHistPPRaw"); gHistPP[0]->Write();
1276 gHistNN[0]->SetName("gHistNNRaw"); gHistNN[0]->Write();
1277 if(listBFShuffled) {
1278 gHistPN[1]->SetName("gHistPNShuffled"); gHistPN[1]->Write();
1279 gHistNP[1]->SetName("gHistNPShuffled"); gHistNP[1]->Write();
1280 gHistPP[1]->SetName("gHistPPShuffled"); gHistPP[1]->Write();
1281 gHistNN[1]->SetName("gHistNNShuffled"); gHistNN[1]->Write();
1283 if(listBFMixed || (!listBFMixed&&listQA)) {
1284 gHistPN[2]->SetName("gHistPNMixed"); gHistPN[2]->Write();
1285 gHistNP[2]->SetName("gHistNPMixed"); gHistNP[2]->Write();
1286 gHistPP[2]->SetName("gHistPPMixed"); gHistPP[2]->Write();
1287 gHistNN[2]->SetName("gHistNNMixed"); gHistNN[2]->Write();
1289 gHistPN[3]->SetName("gHistPNCorrelationFunctions"); gHistPN[3]->Write();
1290 gHistNP[3]->SetName("gHistNPCorrelationFunctions"); gHistNP[3]->Write();
1291 gHistPP[3]->SetName("gHistPPCorrelationFunctions"); gHistPP[3]->Write();
1292 gHistNN[3]->SetName("gHistNNCorrelationFunctions"); gHistNN[3]->Write();
1297 for(Int_t i = 0; i < 4; i++){
1299 if(!listBFShuffled && i == 1) continue;
1300 if(!listBFMixed && (i == 2 || i == 3)) continue;
1302 if(gHistPP[i]) delete gHistPP[i];
1303 if(gHistPN[i]) delete gHistPN[i];
1304 if(gHistNP[i]) delete gHistNP[i];
1305 if(gHistNN[i]) delete gHistNN[i];
1307 if(cPN[i]) delete cPN[i];
1308 if(cNP[i]) delete cNP[i];
1309 if(cPP[i]) delete cPP[i];
1310 if(cNN[i]) delete cNN[i];
1336 //____________________________________________________________//
1337 void drawCorrelationFunctions(const char* lhcPeriod = "LHC10h",
1338 const char* gCentralityEstimator = "V0M",
1340 const char* gEventPlaneEstimator = "VZERO",
1341 Int_t gCentrality = 1,
1342 Double_t psiMin = -0.5, Double_t psiMax = 3.5,
1343 Double_t vertexZMin = -10.,
1344 Double_t vertexZMax = 10.,
1345 Double_t ptTriggerMin = -1.,
1346 Double_t ptTriggerMax = -1.,
1347 Double_t ptAssociatedMin = -1.,
1348 Double_t ptAssociatedMax = -1.,
1349 Bool_t kFit = kFALSE) {
1350 //Macro that draws the charge dependent correlation functions
1351 //for each centrality bin for the different pT of trigger and
1352 //associated particles
1353 //Author: Panos.Christakoglou@nikhef.nl
1354 TGaxis::SetMaxDigits(3);
1356 //Get the input file
1357 /* TString filename = lhcPeriod;
1358 filename += "/Centrality"; filename += gCentralityEstimator;
1359 filename += "_Bit"; filename += gBit;
1360 filename += "_"; filename += gEventPlaneEstimator;
1361 filename +="/PttFrom";
1362 filename += Form("%.1f",ptTriggerMin); filename += "To";
1363 filename += Form("%.1f",ptTriggerMax); filename += "PtaFrom";
1364 filename += Form("%.1f",ptAssociatedMin); filename += "To";
1365 filename += Form("%.1f",ptAssociatedMax); */
1367 TString filename = "correlationFunction.Centrality";
1368 filename += gCentrality; filename += ".Psi";
1369 if((psiMin == -0.5)&&(psiMax == 0.5)) filename += "InPlane.Ptt";
1370 else if((psiMin == 0.5)&&(psiMax == 1.5)) filename += "Intermediate.Ptt";
1371 else if((psiMin == 1.5)&&(psiMax == 2.5)) filename += "OutOfPlane.Ptt";
1372 else if((psiMin == 2.5)&&(psiMax == 3.5)) filename += "Rest.Ptt";
1373 else filename += "All.PttFrom";
1374 filename += Form("%.1f",ptTriggerMin); filename += "To";
1375 filename += Form("%.1f",ptTriggerMax); filename += "PtaFrom";
1376 filename += Form("%.1f",ptAssociatedMin); filename += "To";
1377 filename += Form("%.1f",ptAssociatedMax);
1380 filename += Form("%.1f",psiMin);
1382 filename += Form("%.1f",psiMax);
1383 filename += ".root";
1386 TFile *f = TFile::Open(filename.Data());
1387 if((!f)||(!f->IsOpen())) {
1388 Printf("The file %s is not found. Aborting...",filename);
1394 TString centralityLatex = "Centrality: ";
1395 centralityLatex += centralityArray[gCentrality-1];
1396 centralityLatex += "%";
1399 if((psiMin == -0.5)&&(psiMax == 0.5))
1400 psiLatex = " -7.5^{o} < #varphi^{t} - #Psi_{2} < 7.5^{o}";
1401 else if((psiMin == 0.5)&&(psiMax == 1.5))
1402 psiLatex = " 37.5^{o} < #varphi^{t} - #Psi_{2} < 52.5^{o}";
1403 else if((psiMin == 1.5)&&(psiMax == 2.5))
1404 psiLatex = " 82.5^{o} < #varphi^{t} - #Psi_{2} < 97.5^{o}";
1406 psiLatex = " 0^{o} < #varphi^{t} - #Psi_{2} < 180^{o}";
1408 TString pttLatex = Form("%.1f",ptTriggerMin);
1409 pttLatex += " < p_{T,trig} < "; pttLatex += Form("%.1f",ptTriggerMax);
1410 pttLatex += " GeV/c";
1412 TString ptaLatex = Form("%.1f",ptAssociatedMin);
1413 ptaLatex += " < p_{T,assoc} < "; ptaLatex += Form("%.1f",ptAssociatedMax);
1414 ptaLatex += " GeV/c";
1416 TLatex *latexInfo1 = new TLatex();
1417 latexInfo1->SetNDC();
1418 latexInfo1->SetTextSize(0.045);
1419 latexInfo1->SetTextColor(1);
1423 //============================================================//
1424 //Get the +- correlation function
1425 TH2D *gHistPN = dynamic_cast<TH2D *>(f->Get("gHistPNCorrelationFunctions"));
1426 gHistPN->SetStats(kFALSE);
1427 gHistPN->SetTitle("C_{+-}(#Delta#eta,#Delta#varphi)");
1428 gHistPN->GetXaxis()->SetRangeUser(-1.4,1.4);
1429 gHistPN->GetXaxis()->CenterTitle();
1430 gHistPN->GetXaxis()->SetTitleOffset(1.2);
1431 gHistPN->GetYaxis()->CenterTitle();
1432 gHistPN->GetYaxis()->SetTitleOffset(1.2);
1433 gHistPN->GetZaxis()->SetTitleOffset(1.5);
1434 TCanvas *cPN = new TCanvas("cPN","",0,0,600,500);
1435 cPN->SetFillColor(10); cPN->SetHighLightColor(10);
1436 cPN->SetLeftMargin(0.15);
1437 gHistPN->DrawCopy("surf1fb");
1439 gPad->SetTheta(30); // default is 30
1440 gPad->SetPhi(-60); // default is 30
1443 latexInfo1->DrawLatex(0.6,0.95,centralityLatex.Data());
1444 latexInfo1->DrawLatex(0.6,0.89,psiLatex.Data());
1445 latexInfo1->DrawLatex(0.6,0.83,pttLatex.Data());
1446 latexInfo1->DrawLatex(0.6,0.77,ptaLatex.Data());
1448 pngName = "CorrelationFunction.Centrality";
1449 pngName += centralityArray[gCentrality-1];
1451 if((psiMin == -0.5)&&(psiMax == 0.5)) pngName += "InPlane.Ptt";
1452 else if((psiMin == 0.5)&&(psiMax == 1.5)) pngName += "Intermediate.Ptt";
1453 else if((psiMin == 1.5)&&(psiMax == 2.5)) pngName += "OutOfPlane.Ptt";
1454 else if((psiMin == 2.5)&&(psiMax == 3.5)) pngName += "Rest.Ptt";
1455 else pngName += "All.PttFrom";
1456 pngName += Form("%.1f",ptTriggerMin); pngName += "To";
1457 pngName += Form("%.1f",ptTriggerMax); pngName += "PtaFrom";
1458 pngName += Form("%.1f",ptAssociatedMin); pngName += "To";
1459 pngName += Form("%.1f",ptAssociatedMax);
1460 pngName += ".PositiveNegative.png";
1461 cPN->SaveAs(pngName.Data());
1463 fitCorrelationFunctions(gCentrality, psiMin, psiMax,vertexZMin, vertexZMax,
1464 ptTriggerMin,ptTriggerMax,
1465 ptAssociatedMin, ptAssociatedMax,gHistPN);
1467 //============================================================//
1468 //Get the -+ correlation function
1469 TH2D *gHistNP = dynamic_cast<TH2D *>(f->Get("gHistNPCorrelationFunctions"));
1470 gHistNP->SetStats(kFALSE);
1471 gHistNP->SetTitle("C_{-+}(#Delta#eta,#Delta#varphi)");
1472 gHistNP->GetXaxis()->SetRangeUser(-1.4,1);
1473 gHistNP->GetXaxis()->CenterTitle();
1474 gHistNP->GetXaxis()->SetTitleOffset(1.2);
1475 gHistNP->GetYaxis()->CenterTitle();
1476 gHistNP->GetYaxis()->SetTitleOffset(1.2);
1477 gHistNP->GetZaxis()->SetTitleOffset(1.5);
1478 TCanvas *cNP = new TCanvas("cNP","",50,50,600,500);
1479 cNP->SetFillColor(10); cNP->SetHighLightColor(10);
1480 cNP->SetLeftMargin(0.15);
1481 gHistNP->DrawCopy("surf1fb");
1483 gPad->SetTheta(30); // default is 30
1484 gPad->SetPhi(-60); // default is 30
1487 latexInfo1->DrawLatex(0.6,0.95,centralityLatex.Data());
1488 latexInfo1->DrawLatex(0.6,0.89,psiLatex.Data());
1489 latexInfo1->DrawLatex(0.6,0.83,pttLatex.Data());
1490 latexInfo1->DrawLatex(0.6,0.77,ptaLatex.Data());
1492 pngName = "CorrelationFunction.Centrality";
1493 pngName += centralityArray[gCentrality-1];
1495 if((psiMin == -0.5)&&(psiMax == 0.5)) pngName += "InPlane.Ptt";
1496 else if((psiMin == 0.5)&&(psiMax == 1.5)) pngName += "Intermediate.Ptt";
1497 else if((psiMin == 1.5)&&(psiMax == 2.5)) pngName += "OutOfPlane.Ptt";
1498 else if((psiMin == 2.5)&&(psiMax == 3.5)) pngName += "Rest.Ptt";
1499 else pngName += "All.PttFrom";
1500 pngName += Form("%.1f",ptTriggerMin); pngName += "To";
1501 pngName += Form("%.1f",ptTriggerMax); pngName += "PtaFrom";
1502 pngName += Form("%.1f",ptAssociatedMin); pngName += "To";
1503 pngName += Form("%.1f",ptAssociatedMax);
1504 pngName += ".NegativePositive.png";
1505 cNP->SaveAs(pngName.Data());
1508 fitCorrelationFunctions(gCentrality, psiMin, psiMax,vertexZMin, vertexZMax,
1509 ptTriggerMin,ptTriggerMax,
1510 ptAssociatedMin, ptAssociatedMax,gHistNP);
1512 //============================================================//
1513 //Get the ++ correlation function
1514 TH2D *gHistPP = dynamic_cast<TH2D *>(f->Get("gHistPPCorrelationFunctions"));
1515 gHistPP->SetStats(kFALSE);
1516 gHistPP->SetTitle("C_{++}(#Delta#eta,#Delta#varphi)");
1517 gHistPP->GetXaxis()->SetRangeUser(-1.4,1.4);
1518 gHistPP->GetXaxis()->CenterTitle();
1519 gHistPP->GetXaxis()->SetTitleOffset(1.2);
1520 gHistPP->GetYaxis()->CenterTitle();
1521 gHistPP->GetYaxis()->SetTitleOffset(1.2);
1522 gHistPP->GetZaxis()->SetTitleOffset(1.5);
1523 TCanvas *cPP = new TCanvas("cPP","",100,100,600,500);
1524 cPP->SetFillColor(10); cPP->SetHighLightColor(10);
1525 cPP->SetLeftMargin(0.15);
1526 gHistPP->DrawCopy("surf1fb");
1528 gPad->SetTheta(30); // default is 30
1529 gPad->SetPhi(-60); // default is 30
1532 latexInfo1->DrawLatex(0.6,0.95,centralityLatex.Data());
1533 latexInfo1->DrawLatex(0.6,0.89,psiLatex.Data());
1534 latexInfo1->DrawLatex(0.6,0.83,pttLatex.Data());
1535 latexInfo1->DrawLatex(0.6,0.77,ptaLatex.Data());
1537 pngName = "CorrelationFunction.Centrality";
1538 pngName += centralityArray[gCentrality-1];
1540 if((psiMin == -0.5)&&(psiMax == 0.5)) pngName += "InPlane.Ptt";
1541 else if((psiMin == 0.5)&&(psiMax == 1.5)) pngName += "Intermediate.Ptt";
1542 else if((psiMin == 1.5)&&(psiMax == 2.5)) pngName += "OutOfPlane.Ptt";
1543 else if((psiMin == 2.5)&&(psiMax == 3.5)) pngName += "Rest.Ptt";
1544 else pngName += "All.PttFrom";
1545 pngName += Form("%.1f",ptTriggerMin); pngName += "To";
1546 pngName += Form("%.1f",ptTriggerMax); pngName += "PtaFrom";
1547 pngName += Form("%.1f",ptAssociatedMin); pngName += "To";
1548 pngName += Form("%.1f",ptAssociatedMax);
1549 pngName += ".PositivePositive.png";
1550 cPP->SaveAs(pngName.Data());
1553 fitCorrelationFunctions(gCentrality, psiMin, psiMax,vertexZMin, vertexZMax,
1554 ptTriggerMin,ptTriggerMax,
1555 ptAssociatedMin, ptAssociatedMax,gHistPP);
1557 //============================================================//
1558 //Get the -- correlation function
1559 TH2D *gHistNN = dynamic_cast<TH2D *>(f->Get("gHistNNCorrelationFunctions"));
1560 gHistNN->SetStats(kFALSE);
1561 gHistNN->SetTitle("C_{--}(#Delta#eta,#Delta#varphi)");
1562 gHistNN->GetXaxis()->SetRangeUser(-1.4,1.4);
1563 gHistNN->GetXaxis()->CenterTitle();
1564 gHistNN->GetXaxis()->SetTitleOffset(1.2);
1565 gHistNN->GetYaxis()->CenterTitle();
1566 gHistNN->GetYaxis()->SetTitleOffset(1.2);
1567 gHistNN->GetZaxis()->SetTitleOffset(1.5);
1568 TCanvas *cNN = new TCanvas("cNN","",150,150,600,500);
1569 cNN->SetFillColor(10); cNN->SetHighLightColor(10);
1570 cNN->SetLeftMargin(0.15);
1571 gHistNN->DrawCopy("surf1fb");
1573 gPad->SetTheta(30); // default is 30
1574 gPad->SetPhi(-60); // default is 30
1577 latexInfo1->DrawLatex(0.6,0.95,centralityLatex.Data());
1578 latexInfo1->DrawLatex(0.6,0.89,psiLatex.Data());
1579 latexInfo1->DrawLatex(0.6,0.83,pttLatex.Data());
1580 latexInfo1->DrawLatex(0.6,0.77,ptaLatex.Data());
1582 pngName = "CorrelationFunction.Centrality";
1583 pngName += centralityArray[gCentrality-1];
1585 if((psiMin == -0.5)&&(psiMax == 0.5)) pngName += "InPlane.Ptt";
1586 else if((psiMin == 0.5)&&(psiMax == 1.5)) pngName += "Intermediate.Ptt";
1587 else if((psiMin == 1.5)&&(psiMax == 2.5)) pngName += "OutOfPlane.Ptt";
1588 else if((psiMin == 2.5)&&(psiMax == 3.5)) pngName += "Rest.Ptt";
1589 else pngName += "All.PttFrom";
1590 pngName += Form("%.1f",ptTriggerMin); pngName += "To";
1591 pngName += Form("%.1f",ptTriggerMax); pngName += "PtaFrom";
1592 pngName += Form("%.1f",ptAssociatedMin); pngName += "To";
1593 pngName += Form("%.1f",ptAssociatedMax);
1594 pngName += ".NegativeNegative.png";
1595 cNN->SaveAs(pngName.Data());
1598 fitCorrelationFunctions(gCentrality, psiMin, psiMax,vertexZMin, vertexZMax,
1599 ptTriggerMin,ptTriggerMax,
1600 ptAssociatedMin, ptAssociatedMax,gHistNN);
1603 //____________________________________________________________//
1604 void drawProjections(Bool_t kProjectInEta = kFALSE,
1607 Int_t gCentrality = 1,
1608 Double_t psiMin = -0.5,
1609 Double_t psiMax = 3.5,
1610 Double_t ptTriggerMin = -1.,
1611 Double_t ptTriggerMax = -1.,
1612 Double_t ptAssociatedMin = -1.,
1613 Double_t ptAssociatedMax = -1.,
1614 Bool_t kUseZYAM = kFALSE,
1615 TString eventClass = "Centrality") {
1616 //Macro that draws the charge dependent correlation functions PROJECTIONS
1617 //for each centrality bin for the different pT of trigger and
1618 //associated particles
1619 TGaxis::SetMaxDigits(3);
1621 //Get the input file
1622 /*TString filename = lhcPeriod;
1623 filename += "/Centrality"; filename += gCentralityEstimator;
1624 filename += "_Bit"; filename += gBit;
1625 filename += "_"; filename += gEventPlaneEstimator;
1626 filename +="/PttFrom";
1627 filename += Form("%.1f",ptTriggerMin); filename += "To";
1628 filename += Form("%.1f",ptTriggerMax); filename += "PtaFrom";
1629 filename += Form("%.1f",ptAssociatedMin); filename += "To";
1630 filename += Form("%.1f",ptAssociatedMax); */
1632 TString filename = "correlationFunction.";
1633 if(eventClass == "Centrality"){
1634 filename += Form("Centrality%.1fTo%.1f",psiMin,psiMax);
1635 filename += ".PsiAll.PttFrom";
1637 else if(eventClass == "Multiplicity"){
1638 filename += Form("Multiplicity%.0fTo%.0f",psiMin,psiMax);
1639 filename += ".PsiAll.PttFrom";
1641 else{ // "EventPlane" (default)
1642 filename += "Centrality";
1643 filename += gCentrality; filename += ".Psi";
1644 if((psiMin == -0.5)&&(psiMax == 0.5)) filename += "InPlane.Ptt";
1645 else if((psiMin == 0.5)&&(psiMax == 1.5)) filename += "Intermediate.Ptt";
1646 else if((psiMin == 1.5)&&(psiMax == 2.5)) filename += "OutOfPlane.Ptt";
1647 else if((psiMin == 2.5)&&(psiMax == 3.5)) filename += "Rest.PttFrom";
1648 else filename += "All.PttFrom";
1650 filename += Form("%.1f",ptTriggerMin); filename += "To";
1651 filename += Form("%.1f",ptTriggerMax); filename += "PtaFrom";
1652 filename += Form("%.1f",ptAssociatedMin); filename += "To";
1653 filename += Form("%.1f",ptAssociatedMax);
1654 //if(k2pMethod) filename += "_2pMethod";
1657 filename += Form("%.1f",psiMin);
1659 filename += Form("%.1f",psiMax);
1661 filename += ".root";
1664 TFile *f = TFile::Open(filename.Data());
1665 if((!f)||(!f->IsOpen())) {
1666 Printf("The file %s is not found. Aborting...",filename);
1672 TString centralityLatex = "Centrality: ";
1673 if(eventClass == "Centrality")
1674 centralityLatex += Form("%.0f - %.0f",psiMin,psiMax);
1676 centralityLatex += centralityArray[gCentrality-1];
1677 centralityLatex += " %";
1680 if((psiMin == -0.5)&&(psiMax == 0.5))
1681 psiLatex = " -7.5^{o} < #varphi^{t} - #Psi_{2} < 7.5^{o}";
1682 else if((psiMin == 0.5)&&(psiMax == 1.5))
1683 psiLatex = " 37.5^{o} < #varphi^{t} - #Psi_{2} < 52.5^{o}";
1684 else if((psiMin == 1.5)&&(psiMax == 2.5))
1685 psiLatex = " 82.5^{o} < #varphi^{t} - #Psi_{2} < 97.5^{o}";
1687 psiLatex = " 0^{o} < #varphi^{t} - #Psi_{2} < 180^{o}";
1689 TString pttLatex = Form("%.1f",ptTriggerMin);
1690 pttLatex += " < p_{T,trig} < "; pttLatex += Form("%.1f",ptTriggerMax);
1691 pttLatex += " GeV/c";
1693 TString ptaLatex = Form("%.1f",ptAssociatedMin);
1694 ptaLatex += " < p_{T,assoc} < "; ptaLatex += Form("%.1f",ptAssociatedMax);
1695 ptaLatex += " GeV/c";
1697 TLatex *latexInfo1 = new TLatex();
1698 latexInfo1->SetNDC();
1699 latexInfo1->SetTextSize(0.045);
1700 latexInfo1->SetTextColor(1);
1704 //============================================================//
1705 //Get the +- correlation function
1706 TH2D *gHistPN = dynamic_cast<TH2D *>(f->Get("gHistPNCorrelationFunctions"));
1707 gHistPN->SetStats(kFALSE);
1708 gHistPN->SetTitle("C_{+-}(#Delta#eta,#Delta#varphi)");
1709 gHistPN->GetXaxis()->SetRangeUser(-1.4,1.4);
1710 gHistPN->GetXaxis()->CenterTitle();
1711 gHistPN->GetXaxis()->SetTitleOffset(1.2);
1712 gHistPN->GetYaxis()->CenterTitle();
1713 gHistPN->GetYaxis()->SetTitleOffset(1.2);
1714 gHistPN->GetZaxis()->SetTitleOffset(1.5);
1715 TCanvas *cPN = new TCanvas("cPN","",0,0,600,500);
1716 cPN->SetFillColor(10);
1717 cPN->SetHighLightColor(10);
1718 cPN->SetLeftMargin(0.15);
1720 //================//
1721 TH1D* gHistPNprojection = 0x0;
1723 Double_t gError = 0.0;
1725 //projection in delta eta
1727 gHistPNprojection = new TH1D("gHistPNprojection","",gHistPN->GetNbinsX(),gHistPN->GetXaxis()->GetXmin(),gHistPN->GetXaxis()->GetXmax());
1728 for(Int_t iBinX = 1; iBinX <= gHistPN->GetNbinsX(); iBinX++) {
1729 sum = 0.; gError = 0.0; nCounter = 0;
1730 for(Int_t iBinY = binMin; iBinY <= binMax; iBinY++) {
1731 sum += gHistPN->GetBinContent(iBinX,iBinY);
1732 if(gHistPN->GetBinContent(iBinX,iBinY) != 0.) nCounter += 1;
1733 Double_t exy = gHistPN->GetCellError(iBinX,iBinY);
1738 gError = TMath::Sqrt(gError)/nCounter;
1740 gHistPNprojection->SetBinContent(iBinX,sum);
1741 gHistPNprojection->SetBinError(iBinX,gError);
1743 gHistPNprojection->GetXaxis()->SetRangeUser(-1.4,1.4);
1745 gHistPNprojection->GetYaxis()->SetTitle("#frac{1}{N_{trig}}#frac{dN_{assoc}}{#Delta#eta} - b_{ZYAM}");
1747 gHistPNprojection->GetYaxis()->SetTitle("C_{+-}(#Delta#eta)");
1748 gHistPNprojection->GetXaxis()->SetTitle("#Delta#eta");
1749 }//projection in delta eta
1750 //projection in delta phi
1752 gHistPNprojection = new TH1D("gHistPNprojection","",gHistPN->GetNbinsY(),gHistPN->GetYaxis()->GetXmin(),gHistPN->GetYaxis()->GetXmax());
1753 for(Int_t iBinY = 1; iBinY <= gHistPN->GetNbinsY(); iBinY++) {
1754 sum = 0.; gError = 0.0; nCounter = 0;
1755 for(Int_t iBinX = binMin; iBinX <= binMax; iBinX++) {
1756 //for(Int_t iBinX = 1; iBinX <= gHistPN->GetNbinsX(); iBinX++) {
1757 sum += gHistPN->GetBinContent(iBinX,iBinY);
1758 if(gHistPN->GetBinContent(iBinX,iBinY) != 0.) nCounter += 1;
1759 Double_t exy = gHistPN->GetCellError(iBinX,iBinY);
1764 gError = TMath::Sqrt(gError)/nCounter;
1766 gHistPNprojection->SetBinContent(iBinY,sum);
1767 gHistPNprojection->SetBinError(iBinY,gError);
1770 gHistPNprojection->GetYaxis()->SetTitle("#frac{1}{N_{trig}}#frac{dN_{assoc}}{#Delta#varphi} - b_{ZYAM} (rad^{-1})");
1772 gHistPNprojection->GetYaxis()->SetTitle("C_{+-}(#Delta#varphi)");
1773 gHistPNprojection->GetXaxis()->SetTitle("#Delta#varphi (rad)");
1778 Double_t reference = gHistPNprojection->GetBinContent(gHistPNprojection->GetMinimumBin());
1779 for(Int_t iBinX = 1; iBinX <= gHistPNprojection->GetNbinsX(); iBinX++)
1780 gHistPNprojection->SetBinContent(iBinX,gHistPNprojection->GetBinContent(iBinX) - reference);
1783 gHistPNprojection->GetYaxis()->SetTitleOffset(1.5);
1784 gHistPNprojection->SetMarkerStyle(20);
1785 gHistPNprojection->SetStats(kFALSE);
1786 gHistPNprojection->DrawCopy("E");
1787 //=================//
1789 gPad->SetTheta(30); // default is 30
1790 gPad->SetPhi(-60); // default is 30
1793 latexInfo1->DrawLatex(0.6,0.95,centralityLatex.Data());
1794 latexInfo1->DrawLatex(0.6,0.89,psiLatex.Data());
1795 latexInfo1->DrawLatex(0.6,0.83,pttLatex.Data());
1796 latexInfo1->DrawLatex(0.6,0.77,ptaLatex.Data());
1799 if(kProjectInEta) pngName.ReplaceAll(".root","_DeltaEtaProjection");
1800 else pngName.ReplaceAll(".root","_DeltaPhiProjection");
1801 pngName += ".PositiveNegative.png";
1802 cPN->SaveAs(pngName.Data());
1804 //============================================================//
1805 //Get the -+ correlation function
1806 TH2D *gHistNP = dynamic_cast<TH2D *>(f->Get("gHistNPCorrelationFunctions"));
1807 gHistNP->SetStats(kFALSE);
1808 gHistNP->SetTitle("C_{-+}(#Delta#eta,#Delta#varphi)");
1809 gHistNP->GetXaxis()->SetRangeUser(-1.4,1.4);
1810 gHistNP->GetXaxis()->CenterTitle();
1811 gHistNP->GetXaxis()->SetTitleOffset(1.2);
1812 gHistNP->GetYaxis()->CenterTitle();
1813 gHistNP->GetYaxis()->SetTitleOffset(1.2);
1814 gHistNP->GetZaxis()->SetTitleOffset(1.5);
1815 TCanvas *cNP = new TCanvas("cNP","",50,50,600,500);
1816 cNP->SetFillColor(10); cNP->SetHighLightColor(10);
1817 cNP->SetLeftMargin(0.15);
1819 //================//
1820 TH1D* gHistNPprojection = 0x0;
1822 Double_t gError = 0.0;
1825 gHistNPprojection = new TH1D("gHistNPprojection","",gHistNP->GetNbinsX(),gHistNP->GetXaxis()->GetXmin(),gHistNP->GetXaxis()->GetXmax());
1826 for(Int_t iBinX = 1; iBinX <= gHistNP->GetNbinsX(); iBinX++) {
1827 sum = 0.; gError = 0.0; nCounter = 0;
1828 for(Int_t iBinY = binMin; iBinY <= binMax; iBinY++) {
1829 //for(Int_t iBinY = 1; iBinY <= gHistNP->GetNbinsY(); iBinY++) {
1830 sum += gHistNP->GetBinContent(iBinX,iBinY);
1831 if(gHistNP->GetBinContent(iBinX,iBinY) != 0.) nCounter += 1;
1832 Double_t exy = gHistNP->GetCellError(iBinX,iBinY);
1837 gError = TMath::Sqrt(gError)/nCounter;
1839 gHistNPprojection->SetBinContent(iBinX,sum);
1840 gHistNPprojection->SetBinError(iBinX,gError);
1842 gHistNPprojection->GetXaxis()->SetRangeUser(-1.4,1.4);
1844 gHistNPprojection->GetYaxis()->SetTitle("#frac{1}{N_{trig}}#frac{dN_{assoc}}{#Delta#eta} - b_{ZYAM}");
1846 gHistNPprojection->GetYaxis()->SetTitle("C_{-+}(#Delta#eta)");
1847 gHistNPprojection->GetXaxis()->SetTitle("#Delta#eta");
1850 gHistNPprojection = new TH1D("gHistNPprojection","",gHistNP->GetNbinsY(),gHistNP->GetYaxis()->GetXmin(),gHistNP->GetYaxis()->GetXmax());
1851 for(Int_t iBinY = 1; iBinY <= gHistNP->GetNbinsY(); iBinY++) {
1852 sum = 0.; gError = 0.0; nCounter = 0;
1853 for(Int_t iBinX = binMin; iBinX <= binMax; iBinX++) {
1854 //for(Int_t iBinX = 1; iBinX <= gHistNP->GetNbinsX(); iBinX++) {
1855 sum += gHistNP->GetBinContent(iBinX,iBinY);
1856 if(gHistNP->GetBinContent(iBinX,iBinY) != 0.) nCounter += 1;
1857 Double_t exy = gHistNP->GetCellError(iBinX,iBinY);
1862 gError = TMath::Sqrt(gError)/nCounter;
1864 gHistNPprojection->SetBinContent(iBinY,sum);
1865 gHistNPprojection->SetBinError(iBinY,gError);
1868 gHistNPprojection->GetYaxis()->SetTitle("#frac{1}{N_{trig}}#frac{dN_{assoc}}{#Delta#varphi} - b_{ZYAM} (rad^{-1})");
1870 gHistNPprojection->GetYaxis()->SetTitle("C_{-+}(#Delta#varphi)");
1871 gHistNPprojection->GetXaxis()->SetTitle("#Delta#varphi (rad)");
1875 Double_t reference = gHistNPprojection->GetBinContent(gHistNPprojection->GetMinimumBin());
1876 for(Int_t iBinX = 1; iBinX <= gHistNPprojection->GetNbinsX(); iBinX++)
1877 gHistNPprojection->SetBinContent(iBinX,gHistNPprojection->GetBinContent(iBinX) - reference);
1880 gHistNPprojection->GetYaxis()->SetTitleOffset(1.5);
1881 gHistNPprojection->SetMarkerStyle(20);
1882 gHistNPprojection->SetStats(kFALSE);
1883 gHistNPprojection->DrawCopy("E");
1884 //================//
1886 gPad->SetTheta(30); // default is 30
1887 gPad->SetPhi(-60); // default is 30
1890 latexInfo1->DrawLatex(0.6,0.95,centralityLatex.Data());
1891 latexInfo1->DrawLatex(0.6,0.89,psiLatex.Data());
1892 latexInfo1->DrawLatex(0.6,0.83,pttLatex.Data());
1893 latexInfo1->DrawLatex(0.6,0.77,ptaLatex.Data());
1896 if(kProjectInEta) pngName.ReplaceAll(".root","_DeltaEtaProjection");
1897 else pngName.ReplaceAll(".root","_DeltaPhiProjection");
1898 pngName += ".NegativePositive.png";
1899 cNP->SaveAs(pngName.Data());
1901 //============================================================//
1902 //Get the ++ correlation function
1903 TH2D *gHistPP = dynamic_cast<TH2D *>(f->Get("gHistPPCorrelationFunctions"));
1904 gHistPP->SetStats(kFALSE);
1905 gHistPP->SetTitle("C_{++}(#Delta#eta,#Delta#varphi)");
1906 gHistPP->GetXaxis()->SetRangeUser(-1.4,1.4);
1907 gHistPP->GetXaxis()->CenterTitle();
1908 gHistPP->GetXaxis()->SetTitleOffset(1.2);
1909 gHistPP->GetYaxis()->CenterTitle();
1910 gHistPP->GetYaxis()->SetTitleOffset(1.2);
1911 gHistPP->GetZaxis()->SetTitleOffset(1.5);
1912 TCanvas *cPP = new TCanvas("cPP","",100,100,600,500);
1913 cPP->SetFillColor(10); cPP->SetHighLightColor(10);
1914 cPP->SetLeftMargin(0.15);
1916 //=================//
1917 TH1D* gHistPPprojection = 0x0;
1919 Double_t gError = 0.0;
1922 gHistPPprojection = new TH1D("gHistPPprojection","",gHistPP->GetNbinsX(),gHistPP->GetXaxis()->GetXmin(),gHistPP->GetXaxis()->GetXmax());
1923 for(Int_t iBinX = 1; iBinX <= gHistPP->GetNbinsX(); iBinX++) {
1924 sum = 0.; gError = 0.0; nCounter = 0;
1925 for(Int_t iBinY = binMin; iBinY <= binMax; iBinY++) {
1926 //for(Int_t iBinY = 1; iBinY <= gHistPP->GetNbinsY(); iBinY++) {
1927 sum += gHistPP->GetBinContent(iBinX,iBinY);
1928 if(gHistPP->GetBinContent(iBinX,iBinY) != 0.) nCounter += 1;
1929 Double_t exy = gHistPP->GetCellError(iBinX,iBinY);
1934 gError = TMath::Sqrt(gError)/nCounter;
1936 gHistPPprojection->SetBinContent(iBinX,sum);
1937 gHistPPprojection->SetBinError(iBinX,gError);
1939 gHistPPprojection->GetXaxis()->SetRangeUser(-1.4,1.4);
1941 gHistPPprojection->GetYaxis()->SetTitle("#frac{1}{N_{trig}}#frac{dN_{assoc}}{#Delta#eta} - b_{ZYAM}");
1943 gHistPPprojection->GetYaxis()->SetTitle("C_{++}(#Delta#eta)");
1944 gHistPPprojection->GetXaxis()->SetTitle("#Delta#eta");
1947 gHistPPprojection = new TH1D("gHistPPprojection","",gHistPP->GetNbinsY(),gHistPP->GetYaxis()->GetXmin(),gHistPP->GetYaxis()->GetXmax());
1948 for(Int_t iBinY = 1; iBinY <= gHistPP->GetNbinsY(); iBinY++) {
1949 sum = 0.; gError = 0.0; nCounter = 0;
1950 for(Int_t iBinX = binMin; iBinX <= binMax; iBinX++) {
1951 //for(Int_t iBinX = 1; iBinX <= gHistPP->GetNbinsX(); iBinX++) {
1952 sum += gHistPP->GetBinContent(iBinX,iBinY);
1953 if(gHistPP->GetBinContent(iBinX,iBinY) != 0.) nCounter += 1;
1954 Double_t exy = gHistPP->GetCellError(iBinX,iBinY);
1959 gError = TMath::Sqrt(gError)/nCounter;
1961 gHistPPprojection->SetBinContent(iBinY,sum);
1962 gHistPPprojection->SetBinError(iBinY,gError);
1965 gHistPPprojection->GetYaxis()->SetTitle("#frac{1}{N_{trig}}#frac{dN_{assoc}}{#Delta#varphi} - b_{ZYAM} (rad^{-1})");
1967 gHistPPprojection->GetYaxis()->SetTitle("C_{++}(#Delta#varphi)");
1968 gHistPPprojection->GetXaxis()->SetTitle("#Delta#varphi (rad)");
1972 Double_t reference = gHistPPprojection->GetBinContent(gHistPPprojection->GetMinimumBin());
1973 for(Int_t iBinX = 1; iBinX <= gHistPPprojection->GetNbinsX(); iBinX++)
1974 gHistPPprojection->SetBinContent(iBinX,gHistPPprojection->GetBinContent(iBinX) - reference);
1977 gHistPPprojection->GetYaxis()->SetTitleOffset(1.5);
1978 gHistPPprojection->SetMarkerStyle(20);
1979 gHistPPprojection->SetStats(kFALSE);
1980 gHistPPprojection->DrawCopy("E");
1981 //================//
1983 gPad->SetTheta(30); // default is 30
1984 gPad->SetPhi(-60); // default is 30
1987 latexInfo1->DrawLatex(0.6,0.95,centralityLatex.Data());
1988 latexInfo1->DrawLatex(0.6,0.89,psiLatex.Data());
1989 latexInfo1->DrawLatex(0.6,0.83,pttLatex.Data());
1990 latexInfo1->DrawLatex(0.6,0.77,ptaLatex.Data());
1993 if(kProjectInEta) pngName.ReplaceAll(".root","_DeltaEtaProjection");
1994 else pngName.ReplaceAll(".root","_DeltaPhiProjection");
1995 pngName += ".PositivePositive.png";
1996 cPP->SaveAs(pngName.Data());
1998 //============================================================//
1999 //Get the -- correlation function
2000 TH2D *gHistNN = dynamic_cast<TH2D *>(f->Get("gHistNNCorrelationFunctions"));
2001 gHistNN->SetStats(kFALSE);
2002 gHistNN->SetTitle("C_{--}(#Delta#eta,#Delta#varphi)");
2003 gHistNN->GetXaxis()->SetRangeUser(-1.4,1.4);
2004 gHistNN->GetXaxis()->CenterTitle();
2005 gHistNN->GetXaxis()->SetTitleOffset(1.2);
2006 gHistNN->GetYaxis()->CenterTitle();
2007 gHistNN->GetYaxis()->SetTitleOffset(1.2);
2008 gHistNN->GetZaxis()->SetTitleOffset(1.5);
2009 TCanvas *cNN = new TCanvas("cNN","",150,150,600,500);
2010 cNN->SetFillColor(10); cNN->SetHighLightColor(10);
2011 cNN->SetLeftMargin(0.15);
2013 //=================//
2014 TH1D* gHistNNprojection = 0x0;
2016 Double_t gError = 0.0;
2019 gHistNNprojection = new TH1D("gHistNNprojection","",gHistNN->GetNbinsX(),gHistNN->GetXaxis()->GetXmin(),gHistNN->GetXaxis()->GetXmax());
2020 for(Int_t iBinX = 1; iBinX <= gHistNN->GetNbinsX(); iBinX++) {
2021 sum = 0.; gError = 0.0; nCounter = 0;
2022 for(Int_t iBinY = binMin; iBinY <= binMax; iBinY++) {
2023 //for(Int_t iBinY = 1; iBinY <= gHistNN->GetNbinsY(); iBinY++) {
2024 sum += gHistNN->GetBinContent(iBinX,iBinY);
2025 if(gHistNN->GetBinContent(iBinX,iBinY) != 0.) nCounter += 1;
2026 Double_t exy = gHistNN->GetCellError(iBinX,iBinY);
2031 gError = TMath::Sqrt(gError)/nCounter;
2033 gHistNNprojection->SetBinContent(iBinX,sum);
2034 gHistNNprojection->SetBinError(iBinX,gError);
2036 gHistNNprojection->GetXaxis()->SetRangeUser(-1.4,1.4);
2038 gHistNNprojection->GetYaxis()->SetTitle("#frac{1}{N_{trig}}#frac{dN_{assoc}}{#Delta#eta} - b_{ZYAM}");
2040 gHistNNprojection->GetYaxis()->SetTitle("C_{--}(#Delta#eta)");
2041 gHistNNprojection->GetXaxis()->SetTitle("#Delta#eta");
2044 gHistNNprojection = new TH1D("gHistNNprojection","",gHistNN->GetNbinsY(),gHistNN->GetYaxis()->GetXmin(),gHistNN->GetYaxis()->GetXmax());
2045 for(Int_t iBinY = 1; iBinY <= gHistNN->GetNbinsY(); iBinY++) {
2046 sum = 0.; gError = 0.0; nCounter = 0;
2047 for(Int_t iBinX = binMin; iBinX <= binMax; iBinX++) {
2048 //for(Int_t iBinX = 1; iBinX <= gHistNN->GetNbinsX(); iBinX++) {
2049 sum += gHistNN->GetBinContent(iBinX,iBinY);
2050 if(gHistNN->GetBinContent(iBinX,iBinY) != 0.) nCounter += 1;
2051 Double_t exy = gHistNN->GetCellError(iBinX,iBinY);
2056 gError = TMath::Sqrt(gError)/nCounter;
2058 gHistNNprojection->SetBinContent(iBinY,sum);
2059 gHistNNprojection->SetBinError(iBinY,gError);
2062 gHistNNprojection->GetYaxis()->SetTitle("#frac{1}{N_{trig}}#frac{dN_{assoc}}{#Delta#varphi} - b_{ZYAM} (rad^{-1})");
2064 gHistNNprojection->GetYaxis()->SetTitle("C_{--}(#Delta#varphi)");
2065 gHistNNprojection->GetXaxis()->SetTitle("#Delta#varphi (rad)");
2069 Double_t reference = gHistNNprojection->GetBinContent(gHistNNprojection->GetMinimumBin());
2070 for(Int_t iBinX = 1; iBinX <= gHistNNprojection->GetNbinsX(); iBinX++)
2071 gHistNNprojection->SetBinContent(iBinX,gHistNNprojection->GetBinContent(iBinX) - reference);
2074 gHistNNprojection->GetYaxis()->SetTitleOffset(1.5);
2075 gHistNNprojection->SetMarkerStyle(20);
2076 gHistNNprojection->SetStats(kFALSE);
2077 gHistNNprojection->DrawCopy("E");
2078 //=================//
2080 gPad->SetTheta(30); // default is 30
2081 gPad->SetPhi(-60); // default is 30
2084 latexInfo1->DrawLatex(0.6,0.95,centralityLatex.Data());
2085 latexInfo1->DrawLatex(0.6,0.89,psiLatex.Data());
2086 latexInfo1->DrawLatex(0.6,0.83,pttLatex.Data());
2087 latexInfo1->DrawLatex(0.6,0.77,ptaLatex.Data());
2090 if(kProjectInEta) pngName.ReplaceAll(".root","_DeltaEtaProjection");
2091 else pngName.ReplaceAll(".root","_DeltaPhiProjection");
2092 pngName += ".NegativeNegative.png";
2093 cNN->SaveAs(pngName.Data());
2095 TString outFileName = filename;
2096 if(kProjectInEta) outFileName.ReplaceAll(".root","_DeltaEtaProjection.root");
2097 else outFileName.ReplaceAll(".root","_DeltaPhiProjection.root");
2098 TFile *fProjection = TFile::Open(outFileName.Data(),"recreate");
2099 gHistNPprojection->Write();
2100 gHistPNprojection->Write();
2101 gHistNNprojection->Write();
2102 gHistPPprojection->Write();
2103 fProjection->Close();
2106 //____________________________________________________________//
2107 void fitCorrelationFunctions(Int_t gCentrality = 1,
2108 Double_t psiMin = -0.5, Double_t psiMax = 3.5,
2109 Double_t vertexZMin = -10.,Double_t vertexZMax = 10.,
2110 Double_t ptTriggerMin = -1.,
2111 Double_t ptTriggerMax = -1.,
2112 Double_t ptAssociatedMin = -1.,
2113 Double_t ptAssociatedMax = -1.,
2116 cout<<"FITTING FUNCTION"<<endl;
2118 //near side peak: [1]*TMath::Exp(-TMath::Power((0.5*TMath::Power((x/[2]),2)+0.5*TMath::Power((y/[3]),2)),[4]))
2119 //away side ridge: [5]*TMath::Exp(-TMath::Power((0.5*TMath::Power(((y-TMath::Pi())/[6]),2)),[7]))
2120 //longitudinal ridge: [8]*TMath::Exp(-TMath::Power((0.5*TMath::Power((x/[9]),2)),[10]))
2121 //wing structures: [11]*TMath::Power(x,2)
2122 //flow contribution (v1 up to v4): 2.*([12]*TMath::Cos(y) + [13]*TMath::Cos(2.*y) + [14]*TMath::Cos(3.*y) + [15]*TMath::Cos(4.*y))
2123 TF2 *gFitFunction = new TF2("gFitFunction","[0]+[1]*TMath::Exp(-TMath::Power((0.5*TMath::Power((x/[2]),2)+0.5*TMath::Power((y/[3]),2)),[4]))+[5]*TMath::Exp(-TMath::Power((0.5*TMath::Power(((y-TMath::Pi())/[6]),2)),[7]))+[8]*TMath::Exp(-TMath::Power((0.5*TMath::Power(((x+[17])/[9]),2)),[10]))+[8]*TMath::Exp(-TMath::Power((0.5*TMath::Power(((x-[17])/[9]),2)),[10]))+[11]*TMath::Power(x,2)+2.*[12]*([13]*TMath::Cos(y) + [14]*TMath::Cos(2.*y) + [15]*TMath::Cos(3.*y) + [16]*TMath::Cos(4.*y))",-2.0,2.0,-TMath::Pi()/2.,3.*TMath::Pi()/2.);
2124 gFitFunction->SetName("gFitFunction");
2128 gFitFunction->SetParName(0,"N1");
2130 gFitFunction->SetParName(1,"N_{near side}");gFitFunction->FixParameter(1,0.0);
2131 gFitFunction->SetParName(2,"Sigma_{near side}(delta eta)"); gFitFunction->FixParameter(2,0.0);
2132 gFitFunction->SetParName(3,"Sigma_{near side}(delta phi)"); gFitFunction->FixParameter(3,0.0);
2133 gFitFunction->SetParName(4,"Exponent_{near side}"); gFitFunction->FixParameter(4,1.0);
2135 gFitFunction->SetParName(5,"N_{away side}"); gFitFunction->FixParameter(5,0.0);
2136 gFitFunction->SetParName(6,"Sigma_{away side}(delta phi)"); gFitFunction->FixParameter(6,0.0);
2137 gFitFunction->SetParName(7,"Exponent_{away side}"); gFitFunction->FixParameter(7,1.0);
2138 //longitudinal ridge
2139 gFitFunction->SetParName(8,"N_{long. ridge}"); gFitFunction->SetParameter(8,0.05);//
2140 gFitFunction->FixParameter(8,0.0);
2141 gFitFunction->SetParName(9,"Sigma_{long. ridge}(delta eta)"); gFitFunction->FixParameter(9,0.0);
2142 gFitFunction->SetParName(10,"Exponent_{long. ridge}"); gFitFunction->FixParameter(10,1.0);
2144 gFitFunction->SetParName(11,"N_{wing}"); gFitFunction->FixParameter(11,0.0);
2146 gFitFunction->SetParName(12,"N_{flow}"); gFitFunction->SetParameter(12,0.2);gFitFunction->SetParLimits(12,0.0,10);
2147 gFitFunction->SetParName(13,"V1"); gFitFunction->SetParameter(13,0.005);gFitFunction->SetParLimits(13,0.0,10);
2148 gFitFunction->SetParName(14,"V2"); gFitFunction->SetParameter(14,0.1);gFitFunction->SetParLimits(14,0.0,10);
2149 gFitFunction->SetParName(15,"V3"); gFitFunction->SetParameter(15,0.05);gFitFunction->SetParLimits(15,0.0,10);
2150 gFitFunction->SetParName(16,"V4"); gFitFunction->SetParameter(16,0.005);gFitFunction->SetParLimits(16,0.0,10);
2151 gFitFunction->SetParName(17,"Offset"); gFitFunction->FixParameter(17,0.0);
2160 //Fitting the correlation function (first the edges to extract flow)
2161 gHist->Fit("gFitFunction","nm","",1.0,1.6);
2163 fNV += gFitFunction->GetParameter(12);
2164 fV1 += gFitFunction->GetParameter(13);
2165 fV2 += gFitFunction->GetParameter(14);
2166 fV3 += gFitFunction->GetParameter(15);
2167 fV4 += gFitFunction->GetParameter(16);
2169 gHist->Fit("gFitFunction","nm","",-1.6,-1.0);
2171 fNV += gFitFunction->GetParameter(12);
2172 fV1 += gFitFunction->GetParameter(13);
2173 fV2 += gFitFunction->GetParameter(14);
2174 fV3 += gFitFunction->GetParameter(15);
2175 fV4 += gFitFunction->GetParameter(16);
2177 // Now fit the whole with fixed flow
2178 gFitFunction->FixParameter(12,fNV/2.);
2179 gFitFunction->FixParameter(13,fV1/2.);
2180 gFitFunction->FixParameter(14,fV2/2.);
2181 gFitFunction->FixParameter(15,fV3/2.);
2182 gFitFunction->FixParameter(16,fV4/2.);
2184 gFitFunction->ReleaseParameter(0);gFitFunction->SetParameter(0,1.0);
2185 gFitFunction->ReleaseParameter(1);gFitFunction->SetParameter(1,0.3);
2186 gFitFunction->ReleaseParameter(2);gFitFunction->SetParameter(2,0.3);gFitFunction->SetParLimits(2,0.05,0.7);
2187 gFitFunction->ReleaseParameter(3);gFitFunction->SetParameter(3,0.3);gFitFunction->SetParLimits(3,0.05,1.7);
2188 //gFitFunction->ReleaseParameter(4);gFitFunction->SetParameter(4,1.0);gFitFunction->SetParLimits(4,0.0,2.0);
2189 gFitFunction->ReleaseParameter(5);gFitFunction->SetParameter(5,1.0);//gFitFunction->SetParLimits(5,0.0,10);
2190 gFitFunction->ReleaseParameter(6);gFitFunction->SetParameter(6,0.5);//gFitFunction->SetParLimits(6,0.0,10);
2191 //gFitFunction->ReleaseParameter(7);gFitFunction->SetParameter(7,1.0);gFitFunction->SetParLimits(7,0.0,2.0);
2192 //gFitFunction->ReleaseParameter(8);gFitFunction->SetParameter(8,0.05);
2193 //gFitFunction->ReleaseParameter(9);gFitFunction->SetParameter(9,0.6);gFitFunction->SetParLimits(9,0.1,10.0);
2194 //gFitFunction->ReleaseParameter(10);gFitFunction->SetParameter(10,1.0);gFitFunction->SetParLimits(10,0.0,2.0);
2195 gFitFunction->ReleaseParameter(17);gFitFunction->SetParameter(17,0.7);gFitFunction->SetParLimits(17,0.0,0.9);
2197 gHist->Fit("gFitFunction","nm");
2200 //Cloning the histogram
2201 TString histoName = gHist->GetName(); histoName += "Fit";
2202 TH2D *gHistFit = new TH2D(histoName.Data(),";#Delta#eta;#Delta#varphi (rad);C(#Delta#eta,#Delta#varphi)",gHist->GetNbinsX(),gHist->GetXaxis()->GetXmin(),gHist->GetXaxis()->GetXmax(),gHist->GetNbinsY(),gHist->GetYaxis()->GetXmin(),gHist->GetYaxis()->GetXmax());
2203 TH2D *gHistResidual = dynamic_cast<TH2D *>(gHist->Clone());
2204 gHistResidual->SetName("gHistResidual");
2205 gHistResidual->Sumw2();
2207 for(Int_t iBinDeltaEta = 1; iBinDeltaEta <= gHist->GetNbinsX(); iBinDeltaEta++) {
2208 for(Int_t iBinDeltaPhi = 1; iBinDeltaPhi <= gHist->GetNbinsY(); iBinDeltaPhi++) {
2209 gHistFit->SetBinContent(iBinDeltaEta,iBinDeltaPhi,gFitFunction->Eval(gHist->GetXaxis()->GetBinCenter(iBinDeltaEta),gHist->GetYaxis()->GetBinCenter(iBinDeltaPhi)));
2212 gHistResidual->Add(gHistFit,-1);
2214 //Write to output file
2215 TString newFileName = "correlationFunctionFit";
2216 if(histoName.Contains("PN")) newFileName += "PN";
2217 else if(histoName.Contains("NP")) newFileName += "NP";
2218 else if(histoName.Contains("PP")) newFileName += "PP";
2219 else if(histoName.Contains("NN")) newFileName += "NN";
2220 newFileName += ".Centrality";
2221 newFileName += gCentrality; newFileName += ".Psi";
2222 if((psiMin == -0.5)&&(psiMax == 0.5)) newFileName += "InPlane.Ptt";
2223 else if((psiMin == 0.5)&&(psiMax == 1.5)) newFileName += "Intermediate.Ptt";
2224 else if((psiMin == 1.5)&&(psiMax == 2.5)) newFileName += "OutOfPlane.Ptt";
2225 else if((psiMin == 2.5)&&(psiMax == 3.5)) newFileName += "Rest.PttFrom";
2226 else newFileName += "All.PttFrom";
2227 newFileName += Form("%.1f",ptTriggerMin); newFileName += "To";
2228 newFileName += Form("%.1f",ptTriggerMax); newFileName += "PtaFrom";
2229 newFileName += Form("%.1f",ptAssociatedMin); newFileName += "To";
2230 newFileName += Form("%.1f",ptAssociatedMax);
2233 newFileName += Form("%.1f",psiMin);
2235 newFileName += Form("%.1f",psiMax);
2237 newFileName += ".root";
2238 TFile *newFile = TFile::Open(newFileName.Data(),"recreate");
2241 gHistResidual->Write();
2242 gFitFunction->Write();
2248 //____________________________________________________________//
2249 TH2D *convolute2D(TH2D* h1, TH2D* h2, TString hname) {
2251 // this function does the convolution of 2 eta or phi "efficiencies" in a deta or dphi "efficiency"
2252 // and returns a new histogram which is normalized to the number of bin combinations
2254 // histogram definition
2256 hConv = new TH2D(hname.Data(),hname.Data(), h1->GetNbinsY(),-2,2,h1->GetNbinsX(),-TMath::Pi()/2.,3*TMath::Pi()/2.);
2270 for(Int_t i = 0; i < h1->GetNbinsX(); i ++){
2271 cout<<"CONVOLUTING BIN = "<<i<<" of "<<h1->GetNbinsX()<<endl;
2272 for(Int_t j = 0; j < h1->GetNbinsY(); j ++){
2273 for(Int_t k = 0; k < h2->GetNbinsX(); k ++){
2274 for(Int_t l = 0; l < h2->GetNbinsY(); l ++){
2276 x1 = (Double_t)h1->GetXaxis()->GetBinCenter(i+1);
2277 y1 = (Double_t)h1->GetYaxis()->GetBinCenter(j+1);
2278 x2 = (Double_t)h2->GetXaxis()->GetBinCenter(k+1);
2279 y2 = (Double_t)h2->GetYaxis()->GetBinCenter(l+1);
2281 z1 = (Double_t)h1->GetBinContent(i+1,j+1);
2282 z2 = (Double_t)h2->GetBinContent(k+1,l+1);
2284 // need the gymnastics to keep the same binning
2285 dx = x1 - x2 - (h1->GetXaxis()->GetBinWidth(1)/2.);
2286 if(gRandom->Gaus() > 0) dy = y1 - y2 + (h1->GetYaxis()->GetBinWidth(1)/2.);
2287 else dy = y1 - y2 - (h1->GetYaxis()->GetBinWidth(1)/2.);
2289 if(dx>3./2.*TMath::Pi()) dx = dx - 2.*TMath::Pi();
2290 if(dx<-1./2.*TMath::Pi()) dx = 2*TMath::Pi() + dx;
2294 hConv->Fill(dy,dx,dz);