14 #include "StEStructHAdd.h"
16 #include "StEStructPool/Correlations/StEStructBinning.h"
17 #include "StEStructPool/Correlations/StEStructCutBin.h"
43 void
StEStructHAdd::addCuts(const
char* outfile, TFile* inFile,
44 int* nlist,
int ntot,
int parentDist[][2],
int* nParentDist,
int symmXX) {
46 const char* base[]={
"Sib",
"Mix"};
47 const char* tpe[]={
"pp",
"pm",
"mp",
"mm"};
48 const char* knd[]={
"YtYt",
"NYtYt",
"PtPt",
49 "PhiPhi",
"NPhiPhi",
"PrPhiPhi",
"PaPhiPhi",
"PbPhiPhi",
50 "EtaEta",
"PrEtaEta",
"PaEtaEta",
"PbEtaEta",
51 "EtaEtaSS",
"PrEtaEtaSS",
"PaEtaEtaSS",
"PbEtaEtaSS",
52 "EtaEtaAS",
"PrEtaEtaAS",
"PaEtaEtaAS",
"PbEtaEtaAS",
53 "DEtaDPhiArr",
"NDEtaDPhiArr",
"PrDEtaDPhiArr",
"PaDEtaDPhiArr",
"PbDEtaDPhiArr",
55 "SEtaDPhiArr",
"NSEtaDPhiArr",
"PrSEtaDPhiArr",
"PaSEtaDPhiArr",
"PbSEtaDPhiArr",
57 int isXXHist[]={1, 1, 1,
66 const char* symEtaPhi[]={
"DEtaDPhi",
"NDEtaDPhi",
"PrDEtaDPhi",
"PaDEtaDPhi",
"PbDEtaDPhi"};
67 const char* symPhi[]={
"SEtaDPhi",
"NSEtaDPhi",
"PrSEtaDPhi",
"PaSEtaDPhi",
"PbSEtaDPhi"};
68 const char* Title[]={
"Sibling",
"Mixed"};
69 const char* Species[]={
"A",
"B"};
70 const char* Type[]={
" : +.+",
" : +.-",
" : -.+",
" : -.-"};
73 inFile->GetObject(
"EtaPhiRange",hEtaPhi);
77 TAxis *x = hEtaPhi->GetXaxis();
78 etaMin = x->GetXmin();
79 etaMax = x->GetXmax();
81 b->setEtaRange(etaMin,etaMax);
85 TFile* outFile =
new TFile(outfile,
"RECREATE");
91 for (
int i=0;i<2;i++) {
92 for (
int j=0;j<4;j++) {
93 for (
int k=0;k<34;k++) {
103 TString htype(base[i]); htype+=tpe[j]; htype+=knd[k];
104 for (
int n=0;n<ntot;n++) {
105 TString fullName(htype.Data()); fullName+=
"_cutBin_"; fullName+=nlist[n]; fullName+=
"_zBuf_"; fullName+=zBin;
106 TString hName(htype.Data()); hName+=
"_zBuf_"; hName+=zBin;
107 inFile->GetObject(fullName.Data(),tmp);
113 outhist=(TH2D *)tmp->Clone();
114 if (symmXX && isXXHist[k]) {
116 if (cb->notSymmetrizedXX(nlist[n],j)) {
117 symmetrizeXX(outhist);
120 outhist->SetName(hName.Data());
121 outhist->SetTitle(tmp->GetTitle());
123 cpy = (TH2D *)tmp->Clone();
124 if (symmXX && isXXHist[k]) {
126 if (cb->notSymmetrizedXX(nlist[n],j)) {
134 for (
int isym=0;isym<5;isym++) {
135 if (!strncmp(symEtaPhi[isym],knd[k],8)) {
137 b->setNDEtaBins(outhist->GetNbinsX());
138 b->setNDPhiBins(outhist->GetNbinsY());
139 TString hname(base[i]); hname+=tpe[j]; hname+=symEtaPhi[isym];
140 TString zName(hname); zName+=
"_zBuf_"; zName+=zBin;
141 TString htitle(Title[i]); htitle+=Type[j]; htitle+=symEtaPhi[isym];
142 TString zTitle(htitle); zTitle+=
"_zBuf_"; zTitle+=zBin;
143 tmp =
new TH2D(zName.Data(),zTitle.Data(),b->hdetaBins(),b->detaMin(),b->detaMax(),b->hdphiBins(),b->dphiMin(),b->dphiMax());
147 for(
int ieta=0;ieta<b->detaBins();ieta++){
148 for(
int iphi=0;iphi<b->dphiBins();iphi++){
149 float eta1 = b->detaVal(ieta);
151 int ieta1 = b->hdetaBin(eta1);
152 int ieta2 = b->hdetaBin(eta2);
153 float phi1 = b->dphiVal(iphi,1);
154 float phi2 = b->dphiVal(iphi,2);
155 int iphi1 = b->hdphiBin(phi1);
156 int iphi2 = b->hdphiBin(phi2);
157 double val = outhist->GetBinContent(ieta+1,iphi+1);
158 double err = outhist->GetBinError(ieta+1,iphi+1);
159 tmp->SetBinContent(ieta1,iphi1,val);
160 tmp->SetBinContent(ieta2,iphi1,val);
161 tmp->SetBinContent(ieta1,iphi2,val);
162 tmp->SetBinContent(ieta2,iphi2,val);
163 tmp->SetBinError(ieta1,iphi1,err);
164 tmp->SetBinError(ieta2,iphi1,err);
165 tmp->SetBinError(ieta1,iphi2,err);
166 tmp->SetBinError(ieta2,iphi2,err);
173 float phi1 = b->dphiVal(0,1);
174 float phi2 = b->dphiVal(0,2);
175 int iphi1 = b->hdphiBin(phi1);
176 int iphi2 = b->hdphiBin(phi2);
177 if (iphi1 == iphi2) {
178 for (
int ieta=1;ieta<=b->hdetaBins();ieta++) {
179 double val = 2*tmp->GetBinContent(ieta,iphi1);
180 double err = 2*tmp->GetBinError(ieta,iphi1);
181 tmp->SetBinContent(ieta,iphi1,val);
182 tmp->SetBinError(ieta,iphi1,err);
186 phi1 = b->dphiVal(outhist->GetNbinsY()-1,1);
187 phi2 = b->dphiVal(outhist->GetNbinsY()-1,2);
188 iphi1 = b->hdphiBin(phi1);
189 iphi2 = b->hdphiBin(phi2);
190 if (iphi1 == iphi2) {
191 for (
int ieta=1;ieta<=b->hdetaBins();ieta++) {
192 double val = 2*tmp->GetBinContent(ieta,iphi1);
193 double err = 2*tmp->GetBinError(ieta,iphi1);
194 tmp->SetBinContent(ieta,iphi1,val);
195 tmp->SetBinError(ieta,iphi1,err);
198 float eta1 = b->detaVal(0);
200 int ieta1 = b->hdetaBin(eta1);
201 int ieta2 = b->hdetaBin(eta2);
202 if (ieta1 == ieta2) {
203 for (
int iphi=1;iphi<=b->hdphiBins();iphi++) {
204 double val = 2*tmp->GetBinContent(ieta1,iphi);
205 double err = 2*tmp->GetBinError(ieta1,iphi);
206 tmp->SetBinContent(ieta1,iphi,val);
207 tmp->SetBinError(ieta1,iphi,err);
211 if (0 == tmp->GetBinContent(1,1)) {
212 int iphi = b->hdphiBins();
213 for (
int ieta=1;ieta<=b->hdetaBins();ieta++) {
214 double val = tmp->GetBinContent(ieta,iphi);
215 double err = tmp->GetBinError(ieta,iphi);
216 tmp->SetBinContent(ieta,1,val);
217 tmp->SetBinError(ieta,1,err);
221 hname+=
"Rot"; hname +=
"_zBuf_", hname+=zBin;
222 htitle+=
"Rot"; htitle+=
"_zBuf_", htitle+=zBin;
223 TH2D* rot =
new TH2D(hname.Data(),htitle.Data(),b->hdetaBins(),b->detaMin(),b->detaMax(),b->hdphiBins(),-M_PI-M_PI/24,M_PI+M_PI/24);
224 for(
int ieta=0;ieta<b->detaBins();ieta++){
225 for(
int iphi=0;iphi<b->dphiBins();iphi++) {
226 float eta1 = b->detaVal(ieta);
228 float phi1 = b->dphiVal(iphi,1);
229 if (phi1>M_PI) phi1=2*M_PI - phi1;
231 double val = outhist->GetBinContent(ieta+1,iphi+1);
232 rot->Fill(eta1,phi1,val);
233 rot->Fill(eta2,phi1,val);
234 rot->Fill(eta1,phi2,val);
235 rot->Fill(eta2,phi2,val);
238 int bin1 = rot->GetYaxis()->FindBin(M_PI);
239 int bin2 = rot->GetYaxis()->FindBin(-M_PI);
240 for(
int ieta=0;ieta<rot->GetNbinsX();ieta++) {
241 rot->SetBinContent(ieta+1,bin1, 2*rot->GetBinContent(ieta+1,bin1));
242 rot->SetBinContent(ieta+1,bin2, 2*rot->GetBinContent(ieta+1,bin2));
253 for (
int isym=0;isym<5;isym++) {
254 if (!strncmp(symPhi[isym],knd[k],8)) {
255 b->setNSEtaBins(outhist->GetNbinsX());
256 b->setNDPhiBins(outhist->GetNbinsY());
257 TString hname(base[i]);
260 TString zName(hname);
263 TString htitle(Title[i]);
265 htitle+=symPhi[isym];
266 TString zTitle(htitle);
269 tmp =
new TH2D(zName.Data(),zTitle.Data(),b->hdetaBins(),b->detaMin(),b->detaMax(),b->hdphiBins(),b->dphiMin(),b->dphiMax());
270 for(
int ieta=0;ieta<b->setaBins();ieta++){
271 for(
int iphi=0;iphi<b->dphiBins();iphi++){
272 float eta1 = b->setaVal(ieta);
273 int ieta1 = b->hdetaBin(eta1);
274 float phi1 = b->dphiVal(iphi,1);
275 float phi2 = b->dphiVal(iphi,2);
276 int iphi1 = b->hdphiBin(phi1);
277 int iphi2 = b->hdphiBin(phi2);
278 double val = outhist->GetBinContent(ieta+1,iphi+1);
279 double err = outhist->GetBinError(ieta+1,iphi+1);
280 tmp->SetBinContent(ieta1,iphi1,val);
281 tmp->SetBinContent(ieta1,iphi2,val);
282 tmp->SetBinError(ieta1,iphi1,err);
283 tmp->SetBinError(ieta1,iphi2,err);
286 if (tmp->GetBinContent(1,1)==0) {
287 for (
int ieta=0;ieta<tmp->GetNbinsX();ieta++) {
288 double val = tmp->GetBinContent(ieta+1,tmp->GetNbinsY());
289 double err = tmp->GetBinError(ieta+1,tmp->GetNbinsY());
290 tmp->SetBinContent(ieta+1,1, val);
291 tmp->SetBinError(ieta+1,1, err);
313 TH1D* sib; inFile->GetObject(
"NEventsSame",sib);
314 TH1D* mix; inFile->GetObject(
"NEventsMixed",mix);
323 TString hSibName(
"NEventsSib_zBuf_");
324 TString hMixName(
"NEventsMix_zBuf_");
325 TString hSibPosName(
"NEventsPosSib_zBuf_");
326 TString hMixPosName(
"NEventsPosMix_zBuf_");
327 TString hSibNegName(
"NEventsNegSib_zBuf_");
328 TString hMixNegName(
"NEventsNegMix_zBuf_");
330 TString fullSibName(hSibName.Data()); fullSibName+=zBin;
331 TString fullMixName(hMixName.Data()); fullMixName+=zBin;
332 TString fullSibPosName(hSibPosName.Data()); fullSibPosName+=zBin;
333 TString fullMixPosName(hMixPosName.Data()); fullMixPosName+=zBin;
334 TString fullSibNegName(hSibNegName.Data()); fullSibNegName+=zBin;
335 TString fullMixNegName(hMixNegName.Data()); fullMixNegName+=zBin;
337 inFile->GetObject(fullSibName.Data(),sib);
338 inFile->GetObject(fullMixName.Data(),mix);
339 TH1D *sibPos; inFile->GetObject(fullSibPosName.Data(),sibPos);
340 TH1D *mixPos; inFile->GetObject(fullMixPosName.Data(),mixPos);
341 TH1D *sibNeg; inFile->GetObject(fullSibNegName.Data(),sibNeg);
342 TH1D *mixNeg; inFile->GetObject(fullMixNegName.Data(),mixNeg);
358 TH1 *tmp, *ptP, *ptM, *etaP, *etaM;
359 for (
int iSpecies=0;iSpecies<2;iSpecies++) {
361 for (
int iPar=0;iPar<nParentDist[iSpecies];iPar++) {
362 int jPar = parentDist[iPar][iSpecies];
363 ptPName =
"meanPtP_parentBin"; ptPName += jPar; ptPName +=
"_zBuf_"; ptPName += zBin;
364 ptMName =
"meanPtM_parentBin"; ptMName += jPar; ptMName +=
"_zBuf_"; ptMName += zBin;
365 etaPName =
"etaP_parentBin"; etaPName += jPar; etaPName +=
"_zBuf_"; etaPName += zBin;
366 etaMName =
"etaM_parentBin"; etaMName += jPar; etaMName +=
"_zBuf_"; etaMName += zBin;
368 inFile->GetObject(ptPName.Data(),ptP);
369 inFile->GetObject(ptMName.Data(),ptM);
370 inFile->GetObject(etaPName.Data(),etaP);
371 inFile->GetObject(etaMName.Data(),etaM);
373 inFile->GetObject(ptPName.Data(),tmp); ptP->Add(tmp);
374 inFile->GetObject(ptMName.Data(),tmp); ptM->Add(tmp);
375 inFile->GetObject(etaPName.Data(),tmp); etaP->Add(tmp);
376 inFile->GetObject(etaMName.Data(),tmp); etaM->Add(tmp);
381 ptPName =
"meanPtP"; ptPName += Species[iSpecies]; ptPName +=
"_zBuf_"; ptPName += zBin;
382 ptP->SetName(ptPName.Data());
386 ptMName =
"meanPtM"; ptMName += Species[iSpecies]; ptMName +=
"_zBuf_"; ptMName += zBin;
387 ptM->SetName(ptMName.Data());
391 etaPName =
"etaP"; etaPName += Species[iSpecies]; etaPName +=
"_zBuf_"; etaPName += zBin;
392 etaP->SetName(etaPName.Data());
396 etaMName =
"etaM"; etaMName += Species[iSpecies]; etaMName +=
"_zBuf_"; etaMName += zBin;
397 etaM->SetName(etaMName.Data());
408 void StEStructHAdd::addCuts(
const char* outfile,
const char* infile,
409 int* nlist,
int ntot,
int parentDist[][2],
int* nParentDist,
int symmXX) {
411 TFile* tf=
new TFile(infile);
413 addCuts(outfile,tf,nlist,ntot,parentDist,nParentDist,symmXX);
418 void StEStructHAdd::symmetrizeXX(TH2 *hist) {
419 for (
int ix=1;ix<=hist->GetNbinsX();ix++) {
420 for (
int iy=ix;iy<=hist->GetNbinsY();iy++) {
421 double sum = hist->GetBinContent(ix,iy) + hist->GetBinContent(iy,ix);
422 double err = sqrt(pow(hist->GetBinError(ix,iy),2) + pow(hist->GetBinError(iy,ix),2));
423 hist->SetBinContent(ix,iy,sum);
424 hist->SetBinContent(iy,ix,sum);
425 hist->SetBinError(ix,iy,err);
426 hist->SetBinError(iy,ix,err);
432 void StEStructHAdd::old_addDensities(
const char* outfile, TFile* inFile) {
434 TFile* outFile =
new TFile(outfile,
"RECREATE");
439 TH2 *sibDens; inFile->GetObject(
"SibppTPCMidTZ_cutBin_0_zBuf_0",sibDens);
440 TH2 *mixDens; inFile->GetObject(
"MixppTPCMidTZ_cutBin_0_zBuf_0",mixDens);
441 if(sibDens && mixDens) {
444 TString hSibName(
"SibppTPCMidTZ_cutBin_");
446 TString full(hSibName.Data()); full += nCut; full +=
"_zBuf_0";
447 inFile->GetObject(full.Data(),sibDens);
455 TString full(hSibName.Data()); full +=
"0_zBuf_"; full += nZBuf;
456 inFile->GetObject(full.Data(),sibDens);
464 TH2D *ls[6], *us[6], *tmp;
465 TH2D *cLS[6], *cUS[6];
466 inFile->GetObject(
"SibppTPCMidTZ_cutBin_0_zBuf_0",tmp);
467 for (
int i=0;i<6;i++) {
468 ls[i] = (TH2D *) tmp->Clone(); ls[i]->Clear();
469 us[i] = (TH2D *) tmp->Clone(); us[i]->Clear();
470 cLS[i] = (TH2D *) tmp->Clone();
471 cUS[i] = (TH2D *) tmp->Clone();
474 const char *typePP[] = {
"SibppTPCMidTZ_cutBin_",
"SibppTPCMidTZC_cutBin_",
"SibppTPCMidTZNC_cutBin_",
"MixppTPCMidTZ_cutBin_",
"MixppTPCMidTZC_cutBin_",
"MixppTPCMidTZNC_cutBin_"};
475 const char *typeMM[] = {
"SibmmTPCMidTZ_cutBin_",
"SibmmTPCMidTZC_cutBin_",
"SibmmTPCMidTZNC_cutBin_",
"MixmmTPCMidTZ_cutBin_",
"MixmmTPCMidTZC_cutBin_",
"MixmmTPCMidTZNC_cutBin_"};
476 const char *typePM[] = {
"SibpmTPCMidTZ_cutBin_",
"SibpmTPCMidTZC_cutBin_",
"SibpmTPCMidTZNC_cutBin_",
"MixpmTPCMidTZ_cutBin_",
"MixpmTPCMidTZC_cutBin_",
"MixpmTPCMidTZNC_cutBin_"};
477 const char *typeMP[] = {
"SibmpTPCMidTZ_cutBin_",
"SibmpTPCMidTZC_cutBin_",
"SibmpTPCMidTZNC_cutBin_",
"MixmpTPCMidTZ_cutBin_",
"MixmpTPCMidTZC_cutBin_",
"MixmpTPCMidTZNC_cutBin_"};
478 const char *pairPos[] = {
"TPCMidTZ_LS_",
"TPCMidTZC_LS_",
"TPCMidTZNC_LS_",
"TPCMidTZ_US_",
"TPCMidTZC_US_",
"TPCMidTZNC_US_"};
479 for (
int iCut=0;iCut<nCut;iCut++) {
481 for (
int i=0;i<6;i++) {
485 hDensName = pairPos[0]; hDensName += iCut; cLS[0]->SetName(hDensName.Data());
486 hDensName = pairPos[1]; hDensName += iCut; cLS[1]->SetName(hDensName.Data());
487 hDensName = pairPos[2]; hDensName += iCut; cLS[2]->SetName(hDensName.Data());
488 hDensName = pairPos[3]; hDensName += iCut; cUS[0]->SetName(hDensName.Data());
489 hDensName = pairPos[4]; hDensName += iCut; cUS[1]->SetName(hDensName.Data());
490 hDensName = pairPos[5]; hDensName += iCut; cUS[2]->SetName(hDensName.Data());
491 for (
int zBuf=0;zBuf<nZBuf;zBuf++) {
492 for (
int it=0;it<6;it++) {
493 hDensName = typePP[it]; hDensName += iCut; hDensName +=
"_zBuf_"; hDensName += zBuf;
494 inFile->GetObject(hDensName.Data(),tmp);
497 hDensName = typeMM[it]; hDensName += iCut; hDensName +=
"_zBuf_"; hDensName += zBuf;
498 inFile->GetObject(hDensName.Data(),tmp);
502 hDensName = typePM[it]; hDensName += iCut; hDensName +=
"_zBuf_"; hDensName += zBuf;
503 inFile->GetObject(hDensName.Data(),tmp);
506 hDensName = typeMP[it]; hDensName += iCut; hDensName +=
"_zBuf_"; hDensName += zBuf;
507 inFile->GetObject(hDensName.Data(),tmp);
512 cLS[0]->Divide(cLS[3]);
513 cLS[1]->Divide(cLS[4]);
514 cLS[2]->Divide(cLS[5]);
515 cUS[0]->Divide(cUS[3]);
516 cUS[1]->Divide(cUS[4]);
517 cUS[2]->Divide(cUS[5]);
526 ls[0]->Divide(ls[3]); ls[0]->SetName(
"TPCMidTZ_LS");
527 ls[1]->Divide(ls[4]); ls[1]->SetName(
"TPCMidTZC_LS");
528 ls[2]->Divide(ls[5]); ls[2]->SetName(
"TPCMidTZNC_LS");
529 us[0]->Divide(us[3]); us[0]->SetName(
"TPCMidTZ_US");
530 us[1]->Divide(us[4]); us[1]->SetName(
"TPCMidTZC_US");
531 us[2]->Divide(us[5]); us[2]->SetName(
"TPCMidTZNC_US");
539 for (
int i=0;i<6;i++) {
549 void StEStructHAdd::addDensities(
const char* outfile, TFile* inFile) {
554 TH2 *sibDens; inFile->GetObject(
"SibppTPCMidTZ_cutBin_0_zBuf_0",sibDens);
555 TH2 *mixDens; inFile->GetObject(
"MixppTPCMidTZ_cutBin_0_zBuf_0",mixDens);
556 if (!sibDens || !mixDens) {
563 TString hSibName(
"SibppTPCMidTZ_cutBin_");
565 TString full(hSibName.Data()); full += nCut; full +=
"_zBuf_0";
566 inFile->GetObject(full.Data(),sibDens);
574 TString full(hSibName.Data()); full +=
"0_zBuf_"; full += nZBuf;
575 inFile->GetObject(full.Data(),sibDens);
587 TH1D *sep1D[2][2][4][2];
588 TH1D *Sum_sep1D[2][2][4][2];
589 inFile->GetObject(
"SibppTPCAvgTSep_cutBin_0_zBuf_0",tmp1D);
590 for (
int irel=0;irel<2;irel++) {
591 for (
int ich=0;ich<2;ich++) {
592 for (
int ipos=0;ipos<4;ipos++) {
593 for (
int idir=0;idir<2;idir++) {
594 Sum_sep1D[irel][ich][ipos][idir] = (TH1D *) tmp1D->Clone();
600 TH1D *dpt1D[2][2][2][2];
601 TH1D *Sum_dpt1D[2][2][2][2];
602 inFile->GetObject(
"SibppTPCMidTdptP_cutBin_0_zBuf_0",tmp1D);
603 for (
int irel=0;irel<2;irel++) {
604 for (
int ich=0;ich<2;ich++) {
605 for (
int ity=0;ity<2;ity++) {
606 for (
int idir=0;idir<2;idir++) {
607 Sum_dpt1D[irel][ich][ity][idir] = (TH1D *) tmp1D->Clone();
613 TH2D *sep2D[2][2][4];
614 TH2D *Sum_sep2D[2][2][4];
615 inFile->GetObject(
"SibppTPCAvgTZ_cutBin_0_zBuf_0",tmp2D);
616 for (
int irel=0;irel<2;irel++) {
617 for (
int ich=0;ich<2;ich++) {
618 for (
int ipos=0;ipos<4;ipos++) {
619 Sum_sep2D[irel][ich][ipos] = (TH2D *) tmp2D->Clone();
624 TH2D *cross[2][2][2];
625 TH2D *Sum_cross[2][2][2];
626 inFile->GetObject(
"SibppTPCMidTZC_cutBin_0_zBuf_0",tmp2D);
627 for (
int irel=0;irel<2;irel++) {
628 for (
int ich=0;ich<2;ich++) {
629 for (
int icr=0;icr<2;icr++) {
630 Sum_cross[irel][ich][icr] = (TH2D *) tmp2D->Clone();
635 TH2D *dpt2D[2][2][3];
636 TH2D *Sum_dpt2D[2][2][3];
637 inFile->GetObject(
"SibppTPCEntTdpt_cutBin_0_zBuf_0",tmp2D);
638 for (
int irel=0;irel<2;irel++) {
639 for (
int ich=0;ich<2;ich++) {
640 for (
int ipos=0;ipos<3;ipos++) {
641 Sum_dpt2D[irel][ich][ipos] = (TH2D *) tmp2D->Clone();
647 const char *pos[] = {
"Ent",
"Mid",
"Exit",
"Avg"};
648 const char *dir[] = {
"T",
"Z"};
649 const char *ty[] = {
"P",
"N"};
650 const char *crs[] = {
"C",
"NC"};
655 const char *rel[] = {
"Sib",
"Mix"};
656 const char *ch[] = {
"pp",
"mm",
"pm",
"mp"};
657 const char *chType[] = {
"LS",
"US"};
659 TFile* outFile =
new TFile(outfile,
"RECREATE");
661 for (
int iCut=0;iCut<nCut;iCut++) {
664 for (
int irel=0;irel<2;irel++) {
665 for (
int ich=0;ich<2;ich++) {
666 for (
int ipos=0;ipos<4;ipos++) {
667 inFile->GetObject(
"SibppTPCAvgTSep_cutBin_0_zBuf_0",tmp1D);
668 for (
int idir=0;idir<2;idir++) {
669 sep1D[irel][ich][ipos][idir] = (TH1D *) tmp1D->Clone();
670 sep1D[irel][ich][ipos][idir]->Clear();
673 inFile->GetObject(
"SibppTPCMidTdptP_cutBin_0_zBuf_0",tmp1D);
674 for (
int ity=0;ity<2;ity++) {
675 for (
int idir=0;idir<2;idir++) {
676 dpt1D[irel][ich][ity][idir] = (TH1D *) tmp1D->Clone();
677 dpt1D[irel][ich][ity][idir]->Clear();
680 inFile->GetObject(
"SibppTPCAvgTZ_cutBin_0_zBuf_0",tmp2D);
681 for (
int ipos=0;ipos<4;ipos++) {
682 sep2D[irel][ich][ipos] = (TH2D *) tmp2D->Clone();
683 sep2D[irel][ich][ipos]->Clear();
685 inFile->GetObject(
"SibppTPCMidTZC_cutBin_0_zBuf_0",tmp2D);
686 for (
int icr=0;icr<2;icr++) {
687 cross[irel][ich][icr] = (TH2D *) tmp2D->Clone();
688 cross[irel][ich][icr]->Clear();
690 inFile->GetObject(
"SibppTPCEntTdpt_cutBin_0_zBuf_0",tmp2D);
691 for (
int ipos=0;ipos<3;ipos++) {
692 dpt2D[irel][ich][ipos] = (TH2D *) tmp2D->Clone();
693 dpt2D[irel][ich][ipos]->Clear();
698 for (
int zBuf=0;zBuf<nZBuf;zBuf++) {
700 for (
int ipos=0;ipos<4;ipos++) {
701 for (
int idir=0;idir<2;idir++) {
702 for (
int irel=0;irel<2;irel++) {
703 for (
int ich=0;ich<4;ich++) {
704 hName = rel[irel]; hName += ch[ich]; hName +=
"TPC"; hName += pos[ipos]; hName += dir[idir];
705 hName +=
"Sep_cutBin_"; hName += iCut; hName +=
"_zBuf_"; hName += zBuf;
706 inFile->GetObject(hName.Data(),tmp1D);
707 sep1D[irel][ich/2][ipos][idir]->Add(tmp1D);
708 Sum_sep1D[irel][ich/2][ipos][idir]->Add(tmp1D);
714 for (
int ity=0;ity<2;ity++) {
715 for (
int idir=0;idir<2;idir++) {
716 for (
int irel=0;irel<2;irel++) {
717 for (
int ich=0;ich<4;ich++) {
718 hName = rel[irel]; hName += ch[ich]; hName +=
"TPCMid"; hName += dir[idir]; hName +=
"dpt"; hName += ty[ity];
719 hName +=
"_cutBin_"; hName += iCut; hName +=
"_zBuf_"; hName += zBuf;
720 inFile->GetObject(hName.Data(),tmp1D);
721 dpt1D[irel][ich/2][ity][idir]->Add(tmp1D);
722 Sum_dpt1D[irel][ich/2][ity][idir]->Add(tmp1D);
728 for (
int ipos=0;ipos<4;ipos++) {
729 for (
int irel=0;irel<2;irel++) {
730 for (
int ich=0;ich<4;ich++) {
731 hName = rel[irel]; hName += ch[ich]; hName +=
"TPC"; hName += pos[ipos];
732 hName +=
"TZ_cutBin_"; hName += iCut; hName +=
"_zBuf_"; hName += zBuf;
733 inFile->GetObject(hName.Data(),tmp2D);
734 sep2D[irel][ich/2][ipos]->Add(tmp2D);
735 Sum_sep2D[irel][ich/2][ipos]->Add(tmp2D);
740 for (
int ipos=0;ipos<3;ipos++) {
741 for (
int irel=0;irel<2;irel++) {
742 for (
int ich=0;ich<4;ich++) {
743 hName = rel[irel]; hName += ch[ich]; hName +=
"TPC"; hName += pos[ipos];
744 hName +=
"Tdpt_cutBin_"; hName += iCut; hName +=
"_zBuf_"; hName += zBuf;
745 inFile->GetObject(hName.Data(),tmp2D);
746 dpt2D[irel][ich/2][ipos]->Add(tmp2D);
747 Sum_dpt2D[irel][ich/2][ipos]->Add(tmp2D);
752 for (
int icr=0;icr<2;icr++) {
753 for (
int irel=0;irel<2;irel++) {
754 for (
int ich=0;ich<4;ich++) {
755 hName = rel[irel]; hName += ch[ich]; hName +=
"TPCMidTZ"; hName += crs[icr];
756 hName +=
"_cutBin_"; hName += iCut; hName +=
"_zBuf_"; hName += zBuf;
757 inFile->GetObject(hName.Data(),tmp2D);
758 cross[irel][ich/2][icr]->Add(tmp2D);
759 Sum_cross[irel][ich/2][icr]->Add(tmp2D);
769 for (
int ipos=0;ipos<4;ipos++) {
770 for (
int idir=0;idir<2;idir++) {
771 for (
int ich=0;ich<2;ich++) {
772 sep1D[0][ich][ipos][idir]->Scale(sep1D[1][ich][ipos][idir]->Integral()/sep1D[0][ich][ipos][idir]->Integral());
773 sep1D[0][ich][ipos][idir]->Divide(sep1D[1][ich][ipos][idir]);
774 hName = chType[ich]; hName += pos[ipos]; hName += dir[idir]; hName +=
"Sep_cutBin_"; hName += iCut;
775 sep1D[0][ich][ipos][idir]->SetName(hName.Data());
776 sep1D[0][ich][ipos][idir]->SetTitle(hName.Data());
777 sep1D[0][ich][ipos][idir]->Write();
781 for (
int ity=0;ity<2;ity++) {
782 for (
int idir=0;idir<2;idir++) {
783 for (
int ich=0;ich<2;ich++) {
784 dpt1D[0][ich][ity][idir]->Scale(dpt1D[1][ich][ity][idir]->Integral()/dpt1D[0][ich][ity][idir]->Integral());
785 dpt1D[0][ich][ity][idir]->Divide(dpt1D[1][ich][ity][idir]);
786 hName = chType[ich]; hName += dir[idir]; hName += ty[ity]; hName +=
"_cutBin_"; hName += iCut;
787 dpt1D[0][ich][ity][idir]->SetName(hName.Data());
788 dpt1D[0][ich][ity][idir]->SetTitle(hName.Data());
789 dpt1D[0][ich][ity][idir]->Write();
793 for (
int ipos=0;ipos<4;ipos++) {
794 for (
int ich=0;ich<2;ich++) {
795 sep2D[0][ich][ipos]->Scale(sep2D[1][ich][ipos]->Integral()/sep2D[0][ich][ipos]->Integral());
796 sep2D[0][ich][ipos]->Divide(sep2D[1][ich][ipos]);
797 hName = chType[ich]; hName += pos[ipos]; hName +=
"TZ_cutBin_"; hName += iCut;
798 sep2D[0][ich][ipos]->SetName(hName.Data());
799 sep2D[0][ich][ipos]->SetTitle(hName.Data());
800 sep2D[0][ich][ipos]->Write();
803 for (
int ipos=0;ipos<3;ipos++) {
804 for (
int ich=0;ich<2;ich++) {
805 dpt2D[0][ich][ipos]->Scale(dpt2D[1][ich][ipos]->Integral()/dpt2D[0][ich][ipos]->Integral());
806 dpt2D[0][ich][ipos]->Divide(dpt2D[1][ich][ipos]);
807 hName = chType[ich]; hName += pos[ipos]; hName +=
"Tdpt_cutBin_"; hName += iCut;
808 dpt2D[0][ich][ipos]->SetName(hName.Data());
809 dpt2D[0][ich][ipos]->SetTitle(hName.Data());
810 dpt2D[0][ich][ipos]->Write();
813 for (
int icr=0;icr<2;icr++) {
814 for (
int ich=0;ich<2;ich++) {
815 cross[0][ich][icr]->Scale(cross[1][ich][icr]->Integral()/cross[0][ich][icr]->Integral());
816 cross[0][ich][icr]->Divide(cross[1][ich][icr]);
817 hName = chType[ich]; hName +=
"MidTZ"; hName += crs[icr]; hName +=
"_cutBin_"; hName += iCut;
818 cross[0][ich][icr]->SetName(hName.Data());
819 cross[0][ich][icr]->SetTitle(hName.Data());
820 cross[0][ich][icr]->Write();
824 for (
int irel=0;irel<2;irel++) {
825 for (
int ipos=0;ipos<4;ipos++) {
826 for (
int idir=0;idir<2;idir++) {
827 for (
int ich=0;ich<2;ich++) {
828 delete sep1D[irel][ich][ipos][idir];
832 for (
int ity=0;ity<2;ity++) {
833 for (
int idir=0;idir<2;idir++) {
834 for (
int ich=0;ich<2;ich++) {
835 delete dpt1D[irel][ich][ity][idir];
839 for (
int ipos=0;ipos<4;ipos++) {
840 for (
int ich=0;ich<2;ich++) {
841 delete sep2D[irel][ich][ipos];
844 for (
int ipos=0;ipos<3;ipos++) {
845 for (
int ich=0;ich<2;ich++) {
846 delete dpt2D[irel][ich][ipos];
849 for (
int icr=0;icr<2;icr++) {
850 for (
int ich=0;ich<2;ich++) {
851 delete cross[irel][ich][icr];
861 for (
int ipos=0;ipos<4;ipos++) {
862 for (
int idir=0;idir<2;idir++) {
863 for (
int ich=0;ich<2;ich++) {
864 Sum_sep1D[0][ich][ipos][idir]->Scale(Sum_sep1D[1][ich][ipos][idir]->Integral()/Sum_sep1D[0][ich][ipos][idir]->Integral());
865 Sum_sep1D[0][ich][ipos][idir]->Divide(Sum_sep1D[1][ich][ipos][idir]);
866 hName = chType[ich]; hName += pos[ipos]; hName += dir[idir]; hName +=
"Sep";
867 Sum_sep1D[0][ich][ipos][idir]->SetName(hName.Data());
868 Sum_sep1D[0][ich][ipos][idir]->SetTitle(hName.Data());
869 Sum_sep1D[0][ich][ipos][idir]->Write();
873 for (
int ity=0;ity<2;ity++) {
874 for (
int idir=0;idir<2;idir++) {
875 for (
int ich=0;ich<2;ich++) {
876 Sum_dpt1D[0][ich][ity][idir]->Scale(Sum_dpt1D[1][ich][ity][idir]->Integral()/Sum_dpt1D[0][ich][ity][idir]->Integral());
877 Sum_dpt1D[0][ich][ity][idir]->Divide(Sum_dpt1D[1][ich][ity][idir]);
878 hName = chType[ich]; hName += dir[idir]; hName += ty[ity];
879 Sum_dpt1D[0][ich][ity][idir]->SetName(hName.Data());
880 Sum_dpt1D[0][ich][ity][idir]->SetTitle(hName.Data());
881 Sum_dpt1D[0][ich][ity][idir]->Write();
885 for (
int ipos=0;ipos<4;ipos++) {
886 for (
int ich=0;ich<2;ich++) {
887 Sum_sep2D[0][ich][ipos]->Scale(Sum_sep2D[1][ich][ipos]->Integral()/Sum_sep2D[0][ich][ipos]->Integral());
888 Sum_sep2D[0][ich][ipos]->Divide(Sum_sep2D[1][ich][ipos]);
889 hName = chType[ich]; hName += pos[ipos]; hName +=
"TZ";
890 Sum_sep2D[0][ich][ipos]->SetName(hName.Data());
891 Sum_sep2D[0][ich][ipos]->SetTitle(hName.Data());
892 Sum_sep2D[0][ich][ipos]->Write();
895 for (
int ipos=0;ipos<3;ipos++) {
896 for (
int ich=0;ich<2;ich++) {
897 Sum_dpt2D[0][ich][ipos]->Scale(Sum_dpt2D[1][ich][ipos]->Integral()/Sum_dpt2D[0][ich][ipos]->Integral());
898 Sum_dpt2D[0][ich][ipos]->Divide(Sum_dpt2D[1][ich][ipos]);
899 hName = chType[ich]; hName += pos[ipos]; hName +=
"Tdpt";
900 Sum_dpt2D[0][ich][ipos]->SetName(hName.Data());
901 Sum_dpt2D[0][ich][ipos]->SetTitle(hName.Data());
902 Sum_dpt2D[0][ich][ipos]->Write();
905 for (
int icr=0;icr<2;icr++) {
906 for (
int ich=0;ich<2;ich++) {
907 Sum_cross[0][ich][icr]->Scale(Sum_cross[1][ich][icr]->Integral()/Sum_cross[0][ich][icr]->Integral());
908 Sum_cross[0][ich][icr]->Divide(Sum_cross[1][ich][icr]);
909 hName = chType[ich]; hName +=
"MidTZ"; hName += crs[icr];
910 Sum_cross[0][ich][icr]->SetName(hName.Data());
911 Sum_cross[0][ich][icr]->SetTitle(hName.Data());
912 Sum_cross[0][ich][icr]->Write();
920 for (
int irel=0;irel<2;irel++) {
921 for (
int ipos=0;ipos<4;ipos++) {
922 for (
int idir=0;idir<2;idir++) {
923 for (
int ich=0;ich<2;ich++) {
924 delete Sum_sep1D[irel][ich][ipos][idir];
928 for (
int ity=0;ity<2;ity++) {
929 for (
int idir=0;idir<2;idir++) {
930 for (
int ich=0;ich<2;ich++) {
931 delete Sum_dpt1D[irel][ich][ity][idir];
935 for (
int ipos=0;ipos<4;ipos++) {
936 for (
int ich=0;ich<2;ich++) {
937 delete Sum_sep2D[irel][ich][ipos];
940 for (
int ipos=0;ipos<3;ipos++) {
941 for (
int ich=0;ich<2;ich++) {
942 delete Sum_dpt2D[irel][ich][ipos];
945 for (
int icr=0;icr<2;icr++) {
946 for (
int ich=0;ich<2;ich++) {
947 delete Sum_cross[irel][ich][icr];
957 void StEStructHAdd::combineUS(TFile * modFile) {
965 const char* base[]={
"Sib",
"Mix"};
966 const char* tpe[]={
"pp",
"pm",
"mp",
"mm"};
967 const char* knd[]={
"YtYt",
"NYtYt",
"PtPt",
968 "PhiPhi",
"NPhiPhi",
"PrPhiPhi",
"PaPhiPhi",
"PbPhiPhi",
969 "EtaEta",
"PrEtaEta",
"PaEtaEta",
"PbEtaEta",
970 "DEtaDPhi",
"NDEtaDPhi",
"PrDEtaDPhi",
"PaDEtaDPhi",
"PbDEtaDPhi",
972 "SEtaDPhi",
"NSEtaDPhi",
"PrSEtaDPhi",
"PaSEtaDPhi",
"PbSEtaDPhi",
974 "DEtaDPhiRot",
"NDEtaDPhiRot",
"PrDEtaDPhiRot",
"PaDEtaDPhiRot",
"PbDEtaDPhiRot"};
978 for (
int i=0;i<2;i++) {
979 for (
int k=0;k<28;k++) {
988 TString pmHist; pmHist+=base[i]; pmHist+=tpe[1]; pmHist+=knd[k];
989 pmHist+=
"_zBuf_"; pmHist+=zBin;
990 hpm=(TH1*)modFile->Get(pmHist.Data());
995 TString mpHist; mpHist+=base[i]; mpHist+=tpe[2]; mpHist+=knd[k];
996 mpHist+=
"_zBuf_"; mpHist+=zBin;
997 hmp=(TH1*)modFile->Get(mpHist.Data());