1 void combineHistograms3(
const char *dirName,
const char **inNames,
const char *outName,
int nCent) {
15 gROOT->LoadMacro(
"load2ptLibs.C");
17 gSystem->Load(
"StEStructPoolSupport.so");
46 const char* binName[]={
"all",
"awayside",
"nearside",
"soft",
"softAS",
"softNS",
"neck",
"neckAS",
"neckNS",
"hard",
"hardAS",
"hardNS",
"softHard",
"softHardAS",
"softHardNS"};
47 const char* chargeName[] = {
"_LS_",
"_US_",
"_CD_",
"_CI_"};
48 const char* chargeType[] = {
"_PP_",
"_PM_",
"_MP_",
"_MM_"};
49 char outFileName[1024];
50 sprintf(outFileName,
"%s/%s.root",dirName,outName);
51 TFile *out =
new TFile(outFileName,
"RECREATE");
53 char inFileName[1024];
56 int axialBins[] = {0, 3, 6, 9, 12};
57 for (
int ic=0;ic<nCent;ic++) {
58 printf(
"Centrality %2i: d2N/dEdP pHat_{A+} pHat_{A-} pHat_{B+} pHat_{B-}\n",ic);
59 for (
int ibin=0;ibin<5;ibin++) {
60 sprintf(inFileName,
"%s/%s%s.root",dirName,inNames[ic],binName[axialBins[ibin]]);
61 tf =
new TFile(inFileName);
64 ehelp->msilent =
true;
65 ehelp->mapplyDEtaFix =
false;
66 ehelp->mPairNormalization =
true;
67 ehelp->mIdenticalPair =
true;
71 ptsedpC = ehelp->buildPtCommon(
"SEtaDPhi",2,subtract);
72 ptdedpC = ehelp->buildPtCommon(
"DEtaDPhi",2,subtract);
73 ptetaetaC = ehelp->buildPtCommon(
"EtaEta",2,subtract);
74 ptetaetaSSC = ehelp->buildPtCommon(
"EtaEtaSS",2,subtract);
75 ptetaetaASC = ehelp->buildPtCommon(
"EtaEtaAS",2,subtract);
76 ptphiphiC = ehelp->buildPtCommon(
"PhiPhi",2,subtract);
78 ptsedp = ehelp->buildPtChargeTypes(
"SEtaDPhi",2,subtract);
79 ptdedp = ehelp->buildPtChargeTypes(
"DEtaDPhi",2,subtract);
80 ptetaeta = ehelp->buildPtChargeTypes(
"EtaEta",2,subtract);
81 ptetaetaSS = ehelp->buildPtChargeTypes(
"EtaEtaSS",2,subtract);
82 ptetaetaAS = ehelp->buildPtChargeTypes(
"EtaEtaAS",2,subtract);
83 ptphiphi = ehelp->buildPtChargeTypes(
"PhiPhi",2,subtract);
85 sedpC = ehelp->buildCommon(
"SEtaDPhi",2);
86 dedpC = ehelp->buildCommon(
"DEtaDPhi",2);
87 etaetaC = ehelp->buildCommon(
"EtaEta",2);
88 etaetaSSC = ehelp->buildCommon(
"EtaEtaSS",2);
89 etaetaASC = ehelp->buildCommon(
"EtaEtaAS",2);
90 phiphiC = ehelp->buildCommon(
"PhiPhi",2);
92 sedp = ehelp->buildChargeTypes(
"SEtaDPhi",2);
93 dedp = ehelp->buildChargeTypes(
"DEtaDPhi",2);
94 etaeta = ehelp->buildChargeTypes(
"EtaEta",2);
95 etaetaSS = ehelp->buildChargeTypes(
"EtaEtaSS",2);
96 etaetaAS = ehelp->buildChargeTypes(
"EtaEtaAS",2);
97 phiphi = ehelp->buildChargeTypes(
"PhiPhi",2);
100 for (
int icharge=0;icharge<4;icharge++) {
101 TString name(binName[axialBins[ibin]]);
102 name +=
"_NDEtaDPhi"; name += chargeName[icharge]; name += ic;
104 dedp[icharge]->SetName(name.Data());
105 dedp[icharge]->SetTitle(name.Data());
106 dedp[icharge]->Write();
108 TString name(binName[axialBins[ibin]]);
109 name +=
"_NSEtaDPhi"; name += chargeName[icharge]; name += ic;
111 sedp[icharge]->SetName(name.Data());
112 sedp[icharge]->SetTitle(name.Data());
113 sedp[icharge]->Write();
115 TString name(binName[axialBins[ibin]]);
116 name +=
"_PtDEtaDPhi"; name += chargeName[icharge]; name += ic;
118 ptdedp[icharge]->SetName(name.Data());
119 ptdedp[icharge]->SetTitle(name.Data());
120 ptdedp[icharge]->Write();
122 TString name(binName[axialBins[ibin]]);
123 name +=
"_PtSEtaDPhi"; name += chargeName[icharge]; name += ic;
125 ptsedp[icharge]->SetName(name.Data());
126 ptsedp[icharge]->SetTitle(name.Data());
127 ptsedp[icharge]->Write();
130 TString name(binName[axialBins[ibin]]);
131 name +=
"_NDEtaDPhi"; name += chargeType[icharge]; name += ic;
133 dedpC[icharge]->SetName(name.Data());
134 dedpC[icharge]->SetTitle(name.Data());
135 dedpC[icharge]->Write();
137 TString name(binName[axialBins[ibin]]);
138 name +=
"_NSEtaDPhi"; name += chargeType[icharge]; name += ic;
140 sedpC[icharge]->SetName(name.Data());
141 sedpC[icharge]->SetTitle(name.Data());
142 sedpC[icharge]->Write();
144 TString name(binName[axialBins[ibin]]);
145 name +=
"_PtDEtaDPhi"; name += chargeType[icharge]; name += ic;
147 ptdedpC[icharge]->SetName(name.Data());
148 ptdedpC[icharge]->SetTitle(name.Data());
149 ptdedpC[icharge]->Write();
151 TString name(binName[axialBins[ibin]]);
152 name +=
"_PtSEtaDPhi"; name += chargeType[icharge]; name += ic;
154 ptsedpC[icharge]->SetName(name.Data());
155 ptsedpC[icharge]->SetTitle(name.Data());
156 ptsedpC[icharge]->Write();
160 TString name(binName[axialBins[ibin]]);
161 name +=
"_NEtaEta"; name += chargeName[icharge]; name += ic;
163 etaeta[icharge]->SetName(name.Data());
164 etaeta[icharge]->SetTitle(name.Data());
165 etaeta[icharge]->Write();
167 TString name(binName[axialBins[ibin]]);
168 name +=
"_PtEtaEta"; name += chargeName[icharge]; name += ic;
170 ptetaeta[icharge]->SetName(name.Data());
171 ptetaeta[icharge]->SetTitle(name.Data());
172 ptetaeta[icharge]->Write();
174 TString name(binName[axialBins[ibin]]);
175 name +=
"_NEtaEtaSS"; name += chargeName[icharge]; name += ic;
177 etaetaSS[icharge]->SetName(name.Data());
178 etaetaSS[icharge]->SetTitle(name.Data());
179 etaetaSS[icharge]->Write();
181 TString name(binName[axialBins[ibin]]);
182 name +=
"_PtEtaEtaSS"; name += chargeName[icharge]; name += ic;
184 ptetaetaSS[icharge]->SetName(name.Data());
185 ptetaetaSS[icharge]->SetTitle(name.Data());
186 ptetaetaSS[icharge]->Write();
188 TString name(binName[axialBins[ibin]]);
189 name +=
"_NEtaEtaAS"; name += chargeName[icharge]; name += ic;
191 etaetaAS[icharge]->SetName(name.Data());
192 etaetaAS[icharge]->SetTitle(name.Data());
193 etaetaAS[icharge]->Write();
195 TString name(binName[axialBins[ibin]]);
196 name +=
"_PtEtaEtaAS"; name += chargeName[icharge]; name += ic;
198 ptetaetaAS[icharge]->SetName(name.Data());
199 ptetaetaAS[icharge]->SetTitle(name.Data());
200 ptetaetaAS[icharge]->Write();
203 TString name(binName[axialBins[ibin]]);
204 name +=
"_NEtaEta"; name += chargeType[icharge]; name += ic;
206 etaetaC[icharge]->SetName(name.Data());
207 etaetaC[icharge]->SetTitle(name.Data());
208 etaetaC[icharge]->Write();
210 TString name(binName[axialBins[ibin]]);
211 name +=
"_PtEtaEta"; name += chargeType[icharge]; name += ic;
213 ptetaetaC[icharge]->SetName(name.Data());
214 ptetaetaC[icharge]->SetTitle(name.Data());
215 ptetaetaC[icharge]->Write();
217 TString name(binName[axialBins[ibin]]);
218 name +=
"_NEtaEtaSS"; name += chargeType[icharge]; name += ic;
220 etaetaSSC[icharge]->SetName(name.Data());
221 etaetaSSC[icharge]->SetTitle(name.Data());
222 etaetaSSC[icharge]->Write();
224 TString name(binName[axialBins[ibin]]);
225 name +=
"_PtEtaEtaSS"; name += chargeType[icharge]; name += ic;
227 ptetaetaSSC[icharge]->SetName(name.Data());
228 ptetaetaSSC[icharge]->SetTitle(name.Data());
229 ptetaetaSSC[icharge]->Write();
231 TString name(binName[axialBins[ibin]]);
232 name +=
"_NEtaEtaAS"; name += chargeType[icharge]; name += ic;
234 etaetaASC[icharge]->SetName(name.Data());
235 etaetaASC[icharge]->SetTitle(name.Data());
236 etaetaASC[icharge]->Write();
238 TString name(binName[axialBins[ibin]]);
239 name +=
"_PtEtaEtaAS"; name += chargeType[icharge]; name += ic;
241 ptetaetaASC[icharge]->SetName(name.Data());
242 ptetaetaASC[icharge]->SetTitle(name.Data());
243 ptetaetaASC[icharge]->Write();
247 TString name(binName[axialBins[ibin]]);
248 name +=
"_NPhiPhi"; name += chargeName[icharge]; name += ic;
250 phiphi[icharge]->SetName(name.Data());
251 phiphi[icharge]->SetTitle(name.Data());
252 phiphi[icharge]->Write();
254 TString name(binName[axialBins[ibin]]);
255 name +=
"_PtPhiPhi"; name += chargeName[icharge]; name += ic;
257 ptphiphi[icharge]->SetName(name.Data());
258 ptphiphi[icharge]->SetTitle(name.Data());
259 ptphiphi[icharge]->Write();
262 TString name(binName[axialBins[ibin]]);
263 name +=
"_NPhiPhi"; name += chargeType[icharge]; name += ic;
265 phiphiC[icharge]->SetName(name.Data());
266 phiphiC[icharge]->SetTitle(name.Data());
267 phiphiC[icharge]->Write();
269 TString name(binName[axialBins[ibin]]);
270 name +=
"_PtPhiPhi"; name += chargeType[icharge]; name += ic;
272 ptphiphiC[icharge]->SetName(name.Data());
273 ptphiphiC[icharge]->SetTitle(name.Data());
274 ptphiphiC[icharge]->Write();
278 double scale = ehelp->getCIdNdEtadPhi();
279 double *ptHat = ehelp->getptHat();
280 printf(
" bin %8s %7.3f %7.3f %7.3f %7.3f %7.3f\n",binName[axialBins[ibin]],scale,ptHat[0],ptHat[1],ptHat[2],ptHat[3]);
292 gROOT->LoadMacro(
"minimizeNegative.C");
293 double *sFactor[2][3], *eSFactor[2][3];
294 for (
int it=0;it<2;it++) {
295 for (
int ibin=0;ibin<3;ibin++) {
296 sFactor[it][ibin] =
new double[nCent];
297 eSFactor[it][ibin] =
new double[nCent];
301 bool scaleYt =
false;
308 minData.mCorrType = 1;
309 minData.mLambda = 10;
312 int ytytBins[] = {0, 1, 2};
313 for (
int ic=0;ic<nCent;ic++) {
314 for (
int ibin=0;ibin<3;ibin++) {
315 sprintf(inFileName,
"%s/%s%s.root",dirName,inNames[ic],binName[ytytBins[ibin]]);
316 tf =
new TFile(inFileName);
319 ehelp->msilent =
true;
320 ehelp->mapplyDEtaFix =
false;
321 ehelp->mPairNormalization =
false;
322 ehelp->mIdenticalPair =
true;
323 ehelp->mYtYtNormalization =
true;
326 if (0 == ehelp->histogramExists(
"YtYt", 0)) {
332 minuit =
new TMinuit(1);
335 ehelp->mYtYtNormalization =
true;
338 cout <<
">>>>>Not fitting scale factors for centrality " << ic <<
" yt bin " << ibin <<
", Using YtYtNormalization = " << ehelp->mYtYtNormalization << endl;
339 ytyt = ehelp->buildChargeTypes(
"YtYt",5,sf);
340 ytytC = ehelp->buildCommon(
"YtYt",5,sf);
341 sytdyt = ehelp->buildChargeTypes(
"SYtDYt",5,sf);
342 sytdytC = ehelp->buildCommon(
"SYtDYt",5,sf);
345 minData.mSupport = ehelp;
346 minData.mChargeType = 0;
349 minuit->mnexcm(
"SET PRINT",argList,1,errFlag);
350 minuit->SetFCN(minimizeNegative);
351 minuit->mnparm( 0,
"rho_ref scale factor", start, step, bmin, bmax, errFlag );
352 minuit->SetErrorDef(1);
353 minuit->SetPrintLevel(-1);
355 minuit->mnexcm(
"SET STR",argList,1,errFlag);
357 cout <<
">>>>>Starting scale factor 0 fit for centrality " << ic <<
" yt bin " << ibin << endl;
358 minuit->mnexcm(
"MIGRAD",argList,1,errFlag);
360 minuit->GetParameter(0,cVal,eVal);
361 sFactor[0][ibin][ic] = cVal;
362 eSFactor[0][ibin][ic] = eVal;
364 minuit->mnexcm(
"MINOS",argList,1,errFlag);
365 minuit->GetParameter(0,cVal,eVal);
366 sFactor[0][ibin][ic] = cVal;
367 eSFactor[0][ibin][ic] = eVal;
369 cout <<
"++++Out of chesse error; Fit failed. Using scale factor = 1" << endl;
370 sFactor[0][ibin][ic] = 1;
371 eSFactor[0][ibin][ic] = 100;
379 minData.mChargeType = 1;
380 minuit =
new TMinuit(1);
382 minuit->mnexcm(
"SET PRINT",argList,1,errFlag);
383 minuit->SetFCN(minimizeNegative);
384 minuit->mnparm( 0,
"rho_ref scale factor", start, step, bmin, bmax, errFlag );
385 minuit->SetErrorDef(1);
386 minuit->SetPrintLevel(-1);
388 minuit->mnexcm(
"SET STR",argList,1,errFlag);
390 cout <<
">>>>>Starting scale factor 1 fit for centrality " << ic <<
" yt bin " << ibin << endl;
391 minuit->mnexcm(
"MIGRAD",argList,1,errFlag);
392 minuit->GetParameter(0,cVal,eVal);
393 sFactor[1][ibin][ic] = cVal;
394 eSFactor[1][ibin][ic] = eVal;
396 minuit->mnexcm(
"MINOS",argList,1,errFlag);
397 minuit->GetParameter(0,cVal,eVal);
398 sFactor[1][ibin][ic] = cVal;
399 eSFactor[1][ibin][ic] = eVal;
401 cout <<
"++++Out of chesse error; Fit failed. Using scale factor = 1" << endl;
402 sFactor[1][ibin][ic] = 1;
403 eSFactor[1][ibin][ic] = 100;
407 sf[0] = sFactor[0][ibin][ic];
408 sf[1] = sFactor[1][ibin][ic];
409 ytyt = ehelp->buildChargeTypes(
"YtYt",5,sf);
410 ytytC = ehelp->buildCommon(
"YtYt",5,sf);
411 sytdyt = ehelp->buildChargeTypes(
"SYtDYt",5,sf);
412 sytdytC = ehelp->buildCommon(
"SYtDYt",5,sf);
417 for (
int icharge=0;icharge<4;icharge++) {
419 TString name(binName[ytytBins[ibin]]);
420 name +=
"_YtYt"; name += chargeName[icharge]; name += ic;
421 ytyt[icharge]->SetName(name.Data());
422 ytyt[icharge]->SetTitle(name.Data());
423 ytyt[icharge]->Write();
426 TString name(binName[ytytBins[ibin]]);
427 name +=
"_YtYt"; name += chargeType[icharge]; name += ic;
428 ytytC[icharge]->SetName(name.Data());
429 ytytC[icharge]->SetTitle(name.Data());
430 ytytC[icharge]->Write();
434 TString name(binName[ytytBins[ibin]]);
435 name +=
"_SYtDYt"; name += chargeName[icharge]; name += ic;
436 sytdyt[icharge]->SetName(name.Data());
437 sytdyt[icharge]->SetTitle(name.Data());
438 sytdyt[icharge]->Write();
441 TString name(binName[ytytBins[ibin]]);
442 name +=
"_SYtDYt"; name += chargeType[icharge]; name += ic;
443 sytdytC[icharge]->SetName(name.Data());
444 sytdytC[icharge]->SetTitle(name.Data());
445 sytdytC[icharge]->Write();
453 cout <<
"<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" << endl;
454 cout <<
" Here are Yt scale factors for rho_{ref}" << endl;
455 printf(
" Centrality all LS SS LS AS LS all US SS US AS US \n");
456 for (
int ic=0;ic<nCent;ic++) {
457 printf(
"%6i %9.3f(%3.0f) %7.3f(%3.0f) %7.3f(%3.0f) %7.3f(%3.0f) %7.3f(%3.0f) %7.3f(%3.0f)\n",ic,
458 sFactor[0][0][ic],1000*eSFactor[0][0][ic],sFactor[0][1][ic],1000*eSFactor[0][1][ic],sFactor[0][2][ic],1000*eSFactor[0][2][ic],
459 sFactor[1][0][ic],1000*eSFactor[1][0][ic],sFactor[1][1][ic],1000*eSFactor[1][1][ic],sFactor[1][2][ic],1000*eSFactor[1][2][ic]);
461 for (
int it=0;it<2;it++) {
462 for (
int ibin=0;ibin<3;ibin++) {
463 delete sFactor[it][ibin];
464 delete eSFactor[it][ibin];