1 #include "commonmacro/common.h"
2 #include "common/Name.cc"
3 #include "commonmacro/histutil.h"
5 void compareFitPts(
const char* inName=
6 "links/P01hi.minbias.2000.hist/hianalysis_1000.hist.root",
7 const char* psDir=
"ps",
9 const char* outDir=
"./",
10 const char* more =
"embeddingfile",
14 gSystem->Load(
"StHiMicroEvent");
15 gSystem->Load(
"StHiMicroAnalysis");
17 TFile* inRoot =
new TFile(inName);
20 if(strstr(inName,
"central")){
21 strcpy(trigger,
"central");
24 strcpy(trigger,
"minbias");
30 else if(extraValue>0){
32 sprintf(name,
"~/wrk/assoc/links/P01hi.%s.HighpT_piminus_%d.hist/assoc_cut%d.hist.root",trigger,(
int)extraValue,cut);
35 cout <<
"Unknown embed file" << endl;
return;
39 if(strstr(inName,
"east")){ half=
"east"; }
40 if(strstr(inName,
"west")){ half=
"west"; }
43 inRoot2 =
new TFile(name);
44 cout <<
"--------------------------" << endl;
45 cout <<
"in name=" << inName << endl
46 <<
"ps dir=" << psDir << endl
47 <<
"cut=" << cut << endl
48 <<
"embed name=" << name << endl
49 <<
"half = " << half << endl;
50 cout <<
"--------------------------" << endl;
53 cout <<
"cannot find the infile" << endl;
57 cout <<
"cannot find " << name << endl;
59 TH3* h3[2]; TH2* h2[2];
65 h3[0]=(TH3*)inRoot.Get(
"Minus.h3PhiPrFitPtsPtPr");
66 h3a=(TH3*)inRoot.Get(
"Plus.h3PhiPrFitPtsPtPr");
67 if(!h3a){cout <<
"cannot find h3a" << endl;
return; }
72 if(!strstr(name,
"HighpT")) {
73 cout <<
"###Second file is real" << endl;
76 h3[1]=(TH3*)inRoot2.Get(
"Minus.h3PhiPrFitPtsPtPr");
78 h3a=(TH3*)inRoot2.Get(
"Plus.h3PhiPrFitPtsPtPr");
84 char* type[] = {
"P01hi",
"mc"};
86 char* opt[] = {
"e",
"esame"};
88 if(isReal) type[1]=real2;
91 float ptary[] = {2,3,4,5,6};
92 char ctitle[100],cname[100];
95 float minMean=0,maxMean=0;
97 if(strcmp(trigger,
"central")==0){
98 maxFitPts=.14; minMean=30; maxMean=40;
101 maxFitPts=.24; minMean=35; maxMean=45;
105 TCanvas c1(
"c1",
"c1",400,500);
107 gStyle->SetOptStat(0);
110 int fitPtsCut=Cut::mFitPts[0];
111 float ptmin=2, ptmax=4;
112 float fitptsary[] = { 3,fitPtsCut};
113 char* fitptstitle[] = {
"Wide",
"Cut"};
116 for(
int if=0;
if<2;
if++){
118 for(
int i=0;i<2;i++){
119 sprintf(name,
"%s",type[i]);
120 h2[i]=HistSlice(h3[i],name,
"",0,-165,195,
"zy",
"e");
123 sprintf(title,
"fit pts range %d-45 (cut %d) %s",
124 fitptsary[
if],cut,half.Data());
125 Divide(&c1,2,2,title,inName);
126 for(
int ipt=0;ipt<npt;ipt++){
128 for(
int i=0;i<2;i++){
130 h1[i]= HistSlice(h2[i],
"",
"",0,ptary[ipt],ptary[ipt+1],
"x",
"e");
131 SetRange(h1[i]->GetXaxis(),fitptsary[
if],45.5);
132 h1[i]->Scale(1./h1[i]->Integral());
133 if(i==0)SetMinMax(h1[i],0,maxFitPts);
134 h1[i]->SetMarkerSize(0.6);
135 h1[i]->SetMarkerStyle(marker[i]); h1[i]->Draw(opt[i]);
137 PrintMeanRms(h1[i],0.15,0.8-.1*i);
140 TLegend l(0.15,0.4,0.3,0.5); l.SetFillColor(kWhite);
142 l.AddEntry(h1[0],type[0],
"p"); l.AddEntry(h1[1],type[1],
"p");
146 sprintf(title,
"fitPts%sC%s",fitptstitle[
if],type[1]);
147 Print(&c1,psDir,title);
185 sprintf(cname,
"fitPtsMeanVPhi%sC%s",fitptstitle[
if],type[1]);
186 sprintf(ctitle,
"mean fit pts V phi (%.1f<ptPr<%.1f) %s %d-45 (cut %d)",
187 ptmin,ptmax,half.Data(),fitptsary[
if],cut);
188 Divide(&c1,1,1,ctitle,inName);
189 c1.cd(1); gPad->SetGridx(); gPad->SetGridy();
190 for(
int i=0;i<2;i++){
191 h2a=(TH2*)HistSlice(h3[i],
"",
"",0,ptmin,ptmax,
"xy");
192 sprintf(name,
"meanVphi%s%s",type[i],fitptstitle[
if]);
193 int low=h2a->GetXaxis()->FindBin(fitptsary[
if]);
194 TProfile *p=h2a->ProfileY(name,low,9999); p->SetTitle(
"");
195 SetMinMax(p,minMean,maxMean);
197 p->SetMarkerStyle(marker[i]); p->Draw(opt[i]);
201 Print(&c1,psDir,cname);