1 void combineHistograms0(
const char *dirName,
const char **inNames,
const char *outName,
int nCent) {
15 gROOT->LoadMacro(
"load2ptLibs.C");
17 gSystem->Load(
"StEStructPoolSupport.so");
34 const char* binName[]={
"Symm"};
35 const char* chargeName[] = {
"_LS_",
"_US_",
"_CD_",
"_CI_"};
36 const char* chargeType[] = {
"_PP_",
"_PM_",
"_MP_",
"_MM_"};
37 char outFileName[1024];
38 sprintf(outFileName,
"%s/%s.root",dirName,outName);
39 TFile *out =
new TFile(outFileName,
"RECREATE");
41 char inFileName[1024];
43 for (
int ic=0;ic<nCent;ic++) {
44 printf(
"Scale factors for centrality %2i, ++ +- -+ -- CI \n",ic);
45 for (
int ibin=0;ibin<1;ibin++) {
46 sprintf(inFileName,
"%s/%s%s.root",dirName,inNames[ic],binName[ibin]);
47 tf =
new TFile(inFileName);
50 ehelp->msilent =
true;
51 ehelp->mapplyDEtaFix =
false;
52 ehelp->mPairNormalization =
true;
54 ehelp->mIdenticalPair =
true;
57 ptdedpC = ehelp->buildPtCommon(
"DEtaDPhi",2,subtract);
58 ptetaetaC = ehelp->buildPtCommon(
"EtaEta",2,subtract);
59 ptphiphiC = ehelp->buildPtCommon(
"PhiPhi",2,subtract);
61 ptdedp = ehelp->buildPtChargeTypes(
"DEtaDPhi",2,subtract);
62 ptetaeta = ehelp->buildPtChargeTypes(
"EtaEta",2,subtract);
63 ptphiphi = ehelp->buildPtChargeTypes(
"PhiPhi",2,subtract);
65 dedpC = ehelp->buildCommon(
"DEtaDPhi",2);
66 etaetaC = ehelp->buildCommon(
"EtaEta",2);
67 phiphiC = ehelp->buildCommon(
"PhiPhi",2);
69 dedp = ehelp->buildChargeTypes(
"DEtaDPhi",2);
70 etaeta = ehelp->buildChargeTypes(
"EtaEta",2);
71 phiphi = ehelp->buildChargeTypes(
"PhiPhi",2);
74 for (
int icharge=0;icharge<4;icharge++) {
75 TString name(
"NDEtaDPhi"); name += chargeName[icharge]; name += ic;
77 dedp[icharge]->SetName(name.Data());
78 dedp[icharge]->SetTitle(name.Data());
79 dedp[icharge]->Write();
81 TString name(
"PtDEtaDPhi"); name += chargeName[icharge]; name += ic;
83 ptdedp[icharge]->SetName(name.Data());
84 ptdedp[icharge]->SetTitle(name.Data());
85 ptdedp[icharge]->Write();
88 TString name(
"NDEtaDPhi"); name += chargeType[icharge]; name += ic;
90 dedpC[icharge]->SetName(name.Data());
91 dedpC[icharge]->SetTitle(name.Data());
92 dedpC[icharge]->Write();
94 TString name(
"PtDEtaDPhi"); name += chargeType[icharge]; name += ic;
96 ptdedpC[icharge]->SetName(name.Data());
97 ptdedpC[icharge]->SetTitle(name.Data());
98 ptdedpC[icharge]->Write();
102 TString name(
"NEtaEta"); name += chargeName[icharge]; name += ic;
104 etaeta[icharge]->SetName(name.Data());
105 etaeta[icharge]->SetTitle(name.Data());
106 etaeta[icharge]->Write();
108 TString name(
"PtEtaEta"); name += chargeName[icharge]; name += ic;
110 ptetaeta[icharge]->SetName(name.Data());
111 ptetaeta[icharge]->SetTitle(name.Data());
112 ptetaeta[icharge]->Write();
115 TString name(
"NEtaEta"); name += chargeType[icharge]; name += ic;
117 etaetaC[icharge]->SetName(name.Data());
118 etaetaC[icharge]->SetTitle(name.Data());
119 etaetaC[icharge]->Write();
121 TString name(
"PtEtaEta"); name += chargeType[icharge]; name += ic;
123 ptetaetaC[icharge]->SetName(name.Data());
124 ptetaetaC[icharge]->SetTitle(name.Data());
125 ptetaetaC[icharge]->Write();
129 TString name(
"NPhiPhi"); name += chargeName[icharge]; name += ic;
131 phiphi[icharge]->SetName(name.Data());
132 phiphi[icharge]->SetTitle(name.Data());
133 phiphi[icharge]->Write();
135 TString name(
"PtPhiPhi"); name += chargeName[icharge]; name += ic;
137 ptphiphi[icharge]->SetName(name.Data());
138 ptphiphi[icharge]->SetTitle(name.Data());
139 ptphiphi[icharge]->Write();
142 TString name(
"NPhiPhi"); name += chargeType[icharge]; name += ic;
144 phiphiC[icharge]->SetName(name.Data());
145 phiphiC[icharge]->SetTitle(name.Data());
146 phiphiC[icharge]->Write();
148 TString name(
"PtPhiPhi"); name += chargeType[icharge]; name += ic;
150 ptphiphiC[icharge]->SetName(name.Data());
151 ptphiphiC[icharge]->SetTitle(name.Data());
152 ptphiphiC[icharge]->Write();
156 double *scale = ehelp->getScaleFactors();
157 printf(
" %7.2f %7.2f %7.2f %7.2f %7.2f\n",scale[0],scale[1],scale[2],scale[3],scale[4]);
168 gROOT->LoadMacro(
"minimizeNegative.C");
169 double *sFactor[2][1], *eSFactor[2][1];
170 for (
int it=0;it<2;it++) {
171 for (
int ibin=0;ibin<1;ibin++) {
172 sFactor[it][ibin] =
new double[nCent];
173 eSFactor[it][ibin] =
new double[nCent];
183 minData.mCorrType = 1;
184 minData.mLambda = 10;
187 int ytytBins[] = {0};
188 for (
int ic=0;ic<nCent;ic++) {
189 for (
int ibin=0;ibin<1;ibin++) {
190 sprintf(inFileName,
"%s/%s%s.root",dirName,inNames[ic],binName[ytytBins[ibin]]);
191 tf =
new TFile(inFileName);
194 ehelp->msilent =
true;
195 ehelp->mapplyDEtaFix =
false;
196 ehelp->mPairNormalization =
true;
197 ehelp->mIdenticalPair =
true;
201 if (0 == ehelp->histogramExists(
"YtYt", 0)) {
207 minData.mSupport = ehelp;
208 minData.mChargeType = 0;
210 minuit =
new TMinuit(1);
211 minuit->SetFCN(minimizeNegative);
212 minuit->mnparm( 0,
"rho_ref scale factor", start, step, bmin, bmax, errFlag );
213 minuit->SetErrorDef(1);
214 minuit->SetPrintLevel(-1);
216 minuit->mnexcm(
"SET STR",argList,1,errFlag);
218 cout <<
">>>>>Starting scale factor 0 fit for centrality " << ic <<
" yt bin " << ibin << endl;
219 minuit->mnexcm(
"MIGRAD",argList,1,errFlag);
220 minuit->GetParameter(0,sFactor[0][ibin][ic],eSFactor[0][ibin][ic]);
222 cout <<
"++++Out of chesse error; Fit failed. Using scale factor = 1" << endl;
223 sFactor[0][ibin][ic] = 1;
224 eSFactor[0][ibin][ic] = 100;
231 minData.mChargeType = 1;
232 minuit =
new TMinuit(1);
233 minuit->SetFCN(minimizeNegative);
235 minuit->mnparm( 0,
"rho_ref scale factor", start, step, bmin, bmax, errFlag );
236 minuit->SetErrorDef(1);
237 minuit->SetPrintLevel(-1);
239 minuit->mnexcm(
"SET STR",argList,1,errFlag);
241 cout <<
">>>>>Starting scale factor 1 fit for centrality " << ic <<
" yt bin " << ibin << endl;
242 minuit->mnexcm(
"MIGRAD",argList,1,errFlag);
243 minuit->GetParameter(0,sFactor[1][ibin][ic],eSFactor[1][ibin][ic]);
245 cout <<
"++++Out of chesse error; Fit failed. Using scale factor = 1" << endl;
246 sFactor[1][ibin][ic] = 1;
247 eSFactor[1][ibin][ic] = 100;
251 sf[0] = sFactor[0][ibin][ic];
252 sf[1] = sFactor[1][ibin][ic];
253 ytyt = ehelp->buildChargeTypes(
"YtYt",5,sf);
254 ytytC = ehelp->buildCommon(
"YtYt",5,sf);
255 sytdyt = ehelp->buildChargeTypes(
"SYtDYt",5,sf);
256 sytdytC = ehelp->buildCommon(
"SYtDYt",5,sf);
259 for (
int icharge=0;icharge<4;icharge++) {
260 TString name(
"YtYt"); name += chargeName[icharge]; name += ic;
261 ytyt[icharge]->SetName(name.Data());
262 ytyt[icharge]->SetTitle(name.Data());
263 ytyt[icharge]->Write();
264 TString name(
"YtYt"); name += chargeType[icharge]; name += ic;
265 ytytC[icharge]->SetName(name.Data());
266 ytytC[icharge]->SetTitle(name.Data());
267 ytytC[icharge]->Write();
269 TString name(
"SYtDYt"); name += chargeName[icharge]; name += ic;
270 sytdyt[icharge]->SetName(name.Data());
271 sytdyt[icharge]->SetTitle(name.Data());
272 sytdyt[icharge]->Write();
273 TString name(
"SYtDYt"); name += chargeType[icharge]; name += ic;
274 sytdytC[icharge]->SetName(name.Data());
275 sytdytC[icharge]->SetTitle(name.Data());
276 sytdytC[icharge]->Write();
282 cout <<
"<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" << endl;
283 cout <<
" Here are Yt scale factors for rho_{ref}" << endl;
284 printf(
" Centrality all LS all US \n");
285 for (
int ic=0;ic<nCent;ic++) {
286 printf(
"%6i %9.3f(%3.0f) %7.3f(%3.0f)\n",ic,
287 sFactor[0][0][ic],1000*eSFactor[0][0][ic],sFactor[1][0][ic],1000*eSFactor[1][0][ic]);
291 for (
int it=0;it<2;it++) {
292 for (
int ibin=0;ibin<1;ibin++) {
293 delete sFactor[it][ibin];
294 delete eSFactor[it][ibin];