9 char *dataset =
"AuAu200GeV";
10 char *dataset =
"AuAu62GeV";
11 char *dataset =
"CuCu200GeV";
12 char *dataset =
"CuCu62GeV";
25 if (!strcmp(dataset,
"AuAu200GeV")) {
27 TFile *data1 =
new TFile(
"AuAu200GeV_11c_pair.root");
28 TFile *data2 =
new TFile(
"AuAu200GeV_11c_pair_noPileupCuts.root");
29 const char* centName[] = {
"90-100",
"80-90",
"70-80",
"60-70",
"50-60",
"40-50",
"30-40",
"20-30",
"10-20",
"5-10",
"0-5"};
30 double norm[] = {1.235, 1.177, 1.157, 1.167, 1.178, 1.193, 1.230, 1.292, 1.366, 1.379, 1.451};
33 double normN[] = {1.23, 1.177, 1.11, 1.13, 1.122, 1.142, 1.18, 1.258, 1.364, 1.5, 1.46};
34 double fPileup = 0.25;
37 }
else if (!strcmp(dataset,
"AuAu62GeV")) {
39 TFile *data1 =
new TFile(
"AuAu62GeV_11c_pair.root");
40 TFile *data2 =
new TFile(
"AuAu62GeV_11c_pair_noPileupCuts.root");
41 const char* centName[] = {
"90-100",
"80-90",
"70-80",
"60-70",
"50-60",
"40-50",
"30-40",
"20-30",
"10-20",
"5-10",
"0-5"};
42 double norm[] = {1.0298, 1.1747, 1.1758, 1.1937, 1.2174, 1.2416, 1.2702, 1.3082, 1.3668, 1.4016, 1.4426};
43 double fPileup = 0.25;
44 }
else if (!strcmp(dataset,
"CuCu200GeV")) {
46 TFile *data1 =
new TFile(
"CuCu200GeV_10c_pair.root");
47 TFile *data2 =
new TFile(
"CuCu200GeV_10c_pair_noPileupCuts.root");
48 const char* centName[] = {
"90-100",
"80-90",
"70-80",
"60-70",
"50-60",
"40-50",
"30-40",
"20-30",
"10-20",
"5-10",
"0-5"};
49 double fPileup = 0.25;
50 double norm[] = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0};
51 }
else if (!strcmp(dataset,
"CuCu62GeV")) {
53 TFile *data1 =
new TFile(
"CuCu62GeV_10c_pair.root");
54 TFile *data2 =
new TFile(
"CuCu62GeV_10c_pair_noPileupCuts.root");
55 const char* centName[] = {
"90-100",
"80-90",
"70-80",
"60-70",
"50-60",
"40-50",
"30-40",
"20-30",
"10-20",
"5-10",
"0-5"};
56 double fPileup = 0.25;
57 double norm[] = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0};
64 const char* binName[] = {
"all",
"soft",
"neck",
"hard",
"softHard"};
65 const char* chargeName[] = {
"LS",
"US",
"CD",
"CI"};
66 const char* chargeType[] = {
"_PP_",
"_PM_",
"_MP_",
"_MM_"};
69 TH2D *dedpNoCut[nCent];
70 TH2D *dedpNoPileup[nCent];
71 TH2D *dedpPileup[nCent];
76 for (
int ic=0;ic<nCent;ic++) {
78 TString name(binName[ibin]);
79 name +=
"_NDEtaDPhi_"; name += chargeName[icharge]; name +=
"_"; name += ic;
80 dedpCut[ic] = (TH2D *) gDirectory->Get(name.Data());
81 dedpCut[ic]->Scale(norm[ic]);
82 TString name(binName[ibin]);
83 name +=
"_PtDEtaDPhi_"; name += chargeName[icharge]; name +=
"_"; name += ic;
84 ptdedp[ic] = (TH2D *) gDirectory->Get(name.Data());
85 ptdedp[ic]->Scale(norm[ic]);
88 TString name(binName[ibin]);
89 name +=
"_NDEtaDPhi_"; name += chargeName[icharge]; name +=
"_"; name += ic;
90 dedpNoCut[ic] = (TH2D *) gDirectory->Get(name.Data());
91 dedpNoCut[ic]->Scale(norm[ic]);
93 dedpNoPileup[ic] = NULL;
94 dedpPileup[ic] = NULL;
102 for (
int ic=0;ic<nCent;ic++) {
103 if (dedpNoPileup[ic]) {
104 delete dedpNoPileup[ic];
105 dedpNoPileup[ic] = NULL;
107 if (dedpPileup[ic]) {
108 delete dedpPileup[ic];
109 dedpPileup[ic] = NULL;
111 dedpNoPileup[ic] = (TH2D *) dedpCut[ic]->Clone();
112 dedpPileup[ic] = (TH2D *) dedpCut[ic]->Clone();
113 dedpNoPileup[ic]->Reset();
114 dedpPileup[ic]->Reset();
116 dedpNoPileup[ic]->Add(dedpCut[ic],dedpNoCut[ic],1,-fPileup);
117 dedpPileup[ic]->Add(dedpNoCut[ic],dedpCut[ic],1,-1);
118 dedpNoPileup[ic]->Scale(1/(1-fPileup));
119 dedpPileup[ic]->Scale(1/(1-fPileup));
120 for (
int ix=1;ix<=dedpNoPileup[ic]->GetNbinsX();ix++) {
121 for (
int iy=1;iy<=dedpNoPileup[ic]->GetNbinsY();iy++) {
122 double err = dedpCut[ic]->GetBinError(ix,iy);
123 dedpNoPileup[ic]->SetBinError(ix,iy,err);
124 dedpPileup[ic]->SetBinError(ix,iy,err);
133 if (!strcmp(dataset,
"CuCu200GeV") || !strcmp(dataset,
"CuCu62GeV")) {
134 for (
int ic=0;ic<nCent;ic++) {
135 dedpNoPileup[ic]->SetBinError(13,7,1);
136 dedpPileup[ic]->SetBinError(13,7,1);
146 TAxis *x = dedpCut[3][0]->GetXaxis();
147 TAxis *y = dedpCut[3][0]->GetYaxis();
148 int nx = x->GetNbins();
149 double xmin = x->GetXmin();
150 double xmax = x->GetXmax();
151 int ny = y->GetNbins();
152 double ymin = y->GetXmin();
153 double ymax = y->GetXmax();
154 double pi = 3.1415926;
159 for (
int ic=0;ic<nCent;ic++) {
160 sprintf(buffer,
"fit_bin%i_charge%i_Cent%i",ibin,icharge,ic);
161 fitFunc[ic] =
new TF2(buffer,fitCos,xmin,xmax,ymin,ymax,nParams);
166 double matrix[nCent][nParams][nParams];
168 for (
int ic=0;ic<nCent;ic++) {
169 for (
int ip=0;ip<nParams;ip++) {
170 for (
int jp=0;jp<nParams;jp++) {
171 matrix[ic][ip][jp] = 0;
183 sprintf(lastFits,
"fitResults/cosEta_fitParams_%s_%ic.txt",dataset,nCent);
187 float lastParams[nCent][nParams], lastErrors[nCent][nParams];
188 readParams(lastFits,&lastParams[0][0],&lastErrors[0][0],nCent,nParams);
194 char *parName[] = {
"offset",
"cos(phi)",
"cos(2phi)",
"jetAmp",
"jetSigX",
"jetSigY",
"expAmp",
"expX",
"expY",
"cos(etaD)",
"cos(2etaD)",
"cos(3etaD)",
"cos(4etaD)"};
195 double parVal[] = {0.0, -0.03, 0.03, 0.15,0.6,0.6, 0.1,0.2,0.2, -0.1, 0.05, -0.02, 0.01};
196 for (
int ic=0;ic<nCent;ic++) {
197 for (
int ip=0;ip<nParams;ip++) {
198 fitFunc[ic]->SetParName(ip,parName[ip]);
200 fitFunc[ic]->SetParameter(ip,lastParams[ic][ip]);
202 fitFunc[ic]->SetParameter(ip,parVal[ip]);
208 for (
int ic=0;ic<nCent;ic++) {
209 fitFunc[ic]->SetParLimits( 0,-2.0,2.0);
210 fitFunc[ic]->SetParLimits( 1,-1.6,1.0);
211 fitFunc[ic]->SetParLimits( 2,-1.0,1.0);
212 fitFunc[ic]->SetParLimits( 3,0.0,2.0);
213 fitFunc[ic]->SetParLimits( 4,0.1,5.0);
214 fitFunc[ic]->SetParLimits( 5,0.1,5.0);
215 fitFunc[ic]->SetParLimits( 6,0.0,25.0);
216 fitFunc[ic]->SetParLimits( 7,1e-9,0.95);
217 fitFunc[ic]->SetParLimits( 8,1e-9,0.95);
218 fitFunc[ic]->SetParLimits( 9,-1.0,1.0);
219 fitFunc[ic]->SetParLimits(10,-1.0,1.0);
220 fitFunc[ic]->SetParLimits(11,-1.0,1.0);
221 fitFunc[ic]->SetParLimits(12,-1.0,1.0);
227 for (
int ic=0;ic<nCent;ic++) {
229 printf(
">>Starting fit to centrality %i, bin %i, charge %i\n",ic,ibin,icharge);
230 sprintf(buffer,
"fit_bin%i_charge%i_Cent%i",ibin,icharge,ic);
231 dedpNoPileup[ic]->Fit(buffer,
"O");
237 for (
int ic=0;ic<nCent;ic++) {
238 fitFunc[ic]->ReleaseParameter( 0);
239 fitFunc[ic]->ReleaseParameter( 1);
240 fitFunc[ic]->ReleaseParameter( 2);
241 fitFunc[ic]->ReleaseParameter( 3);
242 fitFunc[ic]->ReleaseParameter( 4);
243 fitFunc[ic]->ReleaseParameter( 5);
244 fitFunc[ic]->ReleaseParameter( 6);
245 fitFunc[ic]->ReleaseParameter( 7);
246 fitFunc[ic]->ReleaseParameter( 8);
247 fitFunc[ic]->ReleaseParameter( 9);
248 fitFunc[ic]->ReleaseParameter(10);
255 for (
int ic=0;ic<nCent;ic++) {
257 printf(
">>Starting fit to centrality %i, bin %i, charge %i\n",ic,ibin,icharge);
258 sprintf(buffer,
"fit_bin%i_charge%i_Cent%i",ibin,icharge,ic);
259 dedpNoPileup[ic]->Fit(buffer,
"EO");
260 gMinuit->mnemat(&matrix[ic][0][0],nParams);
267 double param[nCent][nParams];
268 double error[nCent][nParams];
271 for (
int ic=0;ic<nCent;ic++) {
272 fitFunc[ic]->GetParameters(param[ic]);
273 chi2[ic] = fitFunc[ic]->GetChisquare();
274 for (
int ip=0;ip<nParams;ip++) {
275 error[ic][ip] = fitFunc[ic]->GetParError(ip);
279 char *paramNames[] = {
" chi2 ",
" offset",
" cos(phi)",
" cos(2phi)",
" jetAmp",
" jetSigX",
" jetSigY",
" expAmp",
" expSigX",
" expSigY",
" cos(etaD)",
" cos(2etaD)",
" cos(3etaD)",
" cos(4etaD)"};
282 sprintf(newFits,
"fitResults/cosEta_fitParams_%s_%ic.txt",dataset,nCent);
283 FILE *fPar = fopen(newFits,
"w");
284 writeParams(fPar,ibin,icharge,paramNames,chi2,¶m[0][0],&error[0][0],nCent,nParams);
288 char *pNames[] = {
"offset",
"cosPhi",
"cos2Phi",
"MjAmp",
"MjEta",
"MjPhi",
"expAmp",
"expEta",
"expPhi",
"cos_etaD",
"cos_2etaD",
"cos_3etaD",
"cos_4etaD"};
291 sprintf(plotCode,
"fitResults/cos_plotCode_%s_%ic.C",dataset,nCent);
293 sprintf(tag,
"cos%s_%i_",dataset,nCent);
294 writePlotCode(plotCode,tag,pNames,chi2,¶m[0][0],&error[0][0],nCent,nParams);
299 char *cNames[] = {
" offset",
" cosPhi",
" cos2Phi",
" mjAmp",
" mjEta",
" mjPhi",
" eAmp",
" eEta",
" ePhi",
" cEta",
" c2Eta",
" c3Eta",
" c4Eta"};
300 .L writeCovariance.C++
301 char covariance[1024];
302 sprintf(covariance,
"fitResults/cos_covariance_%s_%ic.txt",dataset,nCent);
303 FILE *fPar = fopen(covariance,
"w");
304 writeCovariance(fPar,ibin,icharge,cNames,error[0],matrix[0][0],nCent,nParams);
313 TCanvas* c1=
new TCanvas(
"c1");
314 gStyle->SetPalette(1);
317 gStyle->SetOptStat(0);
318 c1->SetWindowSize(800,600);
324 TH2D *fitHist[nCent];
327 for (
int ic=0;ic<nCent;ic++) {
328 fitHist[ic] = (TH2D *) dedpNoPileup[ic]->Clone();
329 fitHist[ic]->Reset();
330 fitHist[ic]->Add(fitFunc[ic]);
337 for (
int ic=0;ic<nCent;ic++) {
341 fitHist[ic]->Draw(
"surf1,hist");
347 for (
int ic=0;ic<nCent;ic++) {
351 dedpNoPileup[ic]->Draw(
"surf1,hist");
357 TH2D *residual[nCent];
359 for (
int ic=0;ic<nCent;ic++) {
360 residual[ic] = (TH2D *) dedpNoPileup[ic]->Clone();
361 residual[ic]->Add(fitHist[ic],-1);
362 double max = dedpNoPileup[ic]->GetMaximum();
363 double min = dedpNoPileup[ic]->GetMinimum();
364 residual[ic]->SetMaximum(0.05*(max-min));
365 residual[ic]->SetMinimum(-0.05*(max-min));
370 for (
int ic=0;ic<nCent;ic++) {
374 residual[ic]->Draw(
"surf1,hist");
380 TH2D *chiSqMap[nCent];
383 for (
int ic=0;ic<nCent;ic++) {
389 for (
int ic=0;ic<nCent;ic++) {
394 chiSqMap[ic] = (TH2D *) dedpNoPileup[ic]->Clone();
395 chiSqMap[ic]->Add(fitFunc[ic],-1);
396 for (
int ix=1;ix<=chiSqMap[ic]->GetNbinsX();ix++) {
397 for (
int iy=1;iy<=chiSqMap[ic]->GetNbinsY();iy++) {
398 double den = dedpNoPileup[ic]->GetBinError(ix,iy);
400 double res = chiSqMap[ic]->GetBinContent(ix,iy)/den;
401 chiSqMap[ic]->SetBinContent(ix,iy,res);
409 for (
int ic=0;ic<nCent;ic++) {
414 chiSqMap[ic]->Draw(
"colz,hist");
422 for (
int ic=0;ic<nCent;ic++) {
423 hErr[ic] = (TH2D *) dedpNoPileup[ic]->Clone();
424 for (
int ix=1;ix<=hErr[ic]->GetNbinsX();ix++) {
425 for (
int iy=1;iy<=hErr[ic]->GetNbinsY();iy++) {
426 double e = dedpNoPileup[ic]->GetBinError(ix,iy);
427 hErr[ic]->SetBinContent(ix,iy,e);
434 for (
int ic=0;ic<nCent;ic++) {
438 hErr[ic]->Draw(
"surf1,hist");
448 for (
int ic=0;ic<nCent;ic++) {
449 sprintf(buffer,
"bin%i_CIDEtaDPhi_softHard.txt",ic);
450 FILE *fAmp = fopen(buffer,
"w");
451 sprintf(buffer,
"bin%i_CIDEtaDPhi_Errors_softHard.txt",ic);
452 FILE *fErr = fopen(buffer,
"w");
453 double eta, phi, a, e;
454 for (
int ix=1;ix<=dedpNoPileup[ic]->GetNbinsX();ix++) {
455 for (
int iy=1;iy<=dedpNoPileup[ic]->GetNbinsY();iy++) {
456 eta = dedpNoPileup[ic]->GetXaxis()->GetBinCenter(ix);
457 phi = dedpNoPileup[ic]->GetYaxis()->GetBinCenter(iy);
458 a = dedpNoPileup[ic]->GetBinContent(ix,iy);
459 e = dedpNoPileup[ic]->GetBinError(ix,iy);
460 fprintf(fAmp,
" %7.4f %7.4f %7.4f\n",eta,phi,a);
461 fprintf(fErr,
" %7.4f %7.4f %9.6f\n",eta,phi,e);
471 TF2 *fitComponent[nCent][9];
474 for (
int ic=0;ic<nCent;ic++) {
475 sprintf(buffer,
"fit_Cent%i_Component0",ic);
476 fitComponent[ic][0] =
new TF2(buffer,
"[0]",xmin,xmax,ymin,ymax);
477 fitComponent[ic][0]->SetNpx(nx);
478 fitComponent[ic][0]->SetNpy(ny);
479 sprintf(buffer,
"fit_Cent%i_Component1",ic);
480 fitComponent[ic][1] =
new TF2(buffer,
"[0]*cos(y)",xmin,xmax,ymin,ymax);
481 fitComponent[ic][1]->SetNpx(nx);
482 fitComponent[ic][1]->SetNpy(ny);
483 sprintf(buffer,
"fit_Cent%i_Component2",ic);
484 fitComponent[ic][2] =
new TF2(buffer,
"[0]*cos(2*y)",xmin,xmax,ymin,ymax);
485 fitComponent[ic][2]->SetNpx(nx);
486 fitComponent[ic][2]->SetNpy(ny);
487 sprintf(buffer,
"fit_Cent%i_Component3",ic);
488 fitComponent[ic][3] =
new TF2(buffer,
"[0]*exp(-0.5*((x/[1])^2+(y/[2])^2))+[0]*exp(-0.5*((x/[1])^2+((y-6.283)/[2])^2))",xmin,xmax,ymin,ymax);
489 fitComponent[ic][3]->SetNpx(nx);
490 fitComponent[ic][3]->SetNpy(ny);
491 sprintf(buffer,
"fit_Cent%i_Component4",ic);
492 fitComponent[ic][4] =
new TF2(buffer,
"[0]*exp(-sqrt((x/[1])^2+(y/[2])^2))",xmin,xmax,ymin,ymax);
493 fitComponent[ic][4]->SetNpx(nx);
494 fitComponent[ic][4]->SetNpy(ny);
495 sprintf(buffer,
"fit_Cent%i_Component5",ic);
496 fitComponent[ic][5] =
new TF2(buffer,
"[0]*cos(x)",xmin,xmax,ymin,ymax);
497 fitComponent[ic][5]->SetNpx(nx);
498 fitComponent[ic][5]->SetNpy(ny);
499 sprintf(buffer,
"fit_Cent%i_Component6",ic);
500 fitComponent[ic][6] =
new TF2(buffer,
"[0]*cos(2*x)",xmin,xmax,ymin,ymax);
501 fitComponent[ic][6]->SetNpx(nx);
502 fitComponent[ic][6]->SetNpy(ny);
503 sprintf(buffer,
"fit_Cent%i_Component7",ic);
504 fitComponent[ic][7] =
new TF2(buffer,
"[0]*cos(3*x)",xmin,xmax,ymin,ymax);
505 fitComponent[ic][7]->SetNpx(nx);
506 fitComponent[ic][7]->SetNpy(ny);
507 sprintf(buffer,
"fit_Cent%i_Component8",ic);
508 fitComponent[ic][8] =
new TF2(buffer,
"[0]*cos(4*x)",xmin,xmax,ymin,ymax);
509 fitComponent[ic][8]->SetNpx(nx);
510 fitComponent[ic][8]->SetNpy(ny);
515 for (
int ic=0;ic<nCent;ic++) {
516 fitComponent[ic][0]->SetParameter(0,param[ic][0]);
518 fitComponent[ic][1]->SetParameter(0,param[ic][1]);
520 fitComponent[ic][2]->SetParameter(0,param[ic][2]);
522 fitComponent[ic][3]->SetParameter(0,param[ic][3]);
523 fitComponent[ic][3]->SetParameter(1,param[ic][4]);
524 fitComponent[ic][3]->SetParameter(2,param[ic][5]);
526 fitComponent[ic][4]->SetParameter(0,param[ic][6]);
527 fitComponent[ic][4]->SetParameter(1,param[ic][7]);
528 fitComponent[ic][4]->SetParameter(2,param[ic][8]);
530 fitComponent[ic][5]->SetParameter(0,param[ic][9]);
531 fitComponent[ic][6]->SetParameter(0,param[ic][10]);
532 fitComponent[ic][7]->SetParameter(0,param[ic][11]);
533 fitComponent[ic][8]->SetParameter(0,param[ic][12]);
537 for (
int ic=0;ic<nCent;ic++) {
541 fitComponent[ic][4]->Draw(
"surf1,hist");
547 for (
int ic=0;ic<nCent;ic++) {
548 hSub[ic] = (TH2D *) dedpNoPileup[ic]->Clone();
550 hSub[ic]->Add(fitComponent[ic][5],1);
551 hSub[ic]->Add(fitComponent[ic][6],1);
552 hSub[ic]->Add(fitComponent[ic][7],1);
553 hSub[ic]->Add(fitComponent[ic][8],1);
557 for (
int ic=0;ic<nCent;ic++) {
558 hSub[ic]->Add(fitComponent[ic][3],-1);
562 for (
int ic=0;ic<nCent;ic++) {
566 hSub[ic]->Draw(
"surf1,hist");
572 gStyle->SetTitleBorderSize(0);
573 gPad->SetLeftMargin(0.16);
574 gROOT->SetStyle(
"Plain");
575 gStyle->SetOptStat(0);
577 hSub[6]->SetTitle(
"Same-side peak, 28-38% centrality")
578 TAxis *x = hSub[6]->GetXaxis();
579 x->SetTitleSize(0.07);
580 x->SetTitleOffset(1.0);
581 x->SetNdivisions(505);
582 x->SetLabelSize(0.05);
583 x->SetTitle(
"#eta_{#Delta}");
584 TAxis *y = hSub[6]->GetYaxis();
585 y->SetTitleSize(0.07);
586 y->SetTitleOffset(1.0);
587 y->SetNdivisions(505);
588 y->SetLabelSize(0.05);
589 y->SetTitle(
"#phi_{#Delta}");
590 TAxis *z = hSub[6]->GetZaxis();
591 z->SetTitleSize(0.07);
592 z->SetTitleOffset(1.0);
593 z->SetNdivisions(505);
594 z->SetLabelSize(0.05);
595 z->SetTitle(
"#Delta#rho/#sqrt{#rho_{ref}}");
597 hSub[4]->SetTitle(
"Same-side peak, 46-55% centrality")
598 TAxis *x = hSub[4]->GetXaxis();
599 x->SetTitleSize(0.07);
600 x->SetTitleOffset(1.0);
601 x->SetNdivisions(505);
602 x->SetLabelSize(0.05);
603 x->SetTitle(
"#eta_{#Delta}");
604 TAxis *y = hSub[4]->GetYaxis();
605 y->SetTitleSize(0.07);
606 y->SetTitleOffset(1.0);
607 y->SetNdivisions(505);
608 y->SetLabelSize(0.05);
609 y->SetTitle(
"#phi_{#Delta}");
610 TAxis *z = hSub[4]->GetZaxis();
611 z->SetTitleSize(0.07);
612 z->SetTitleOffset(1.0);
613 z->SetNdivisions(505);
614 z->SetLabelSize(0.05);
615 z->SetTitle(
"#Delta#rho/#sqrt{#rho_{ref}}");