1 #include "commonmacro/common.h"
2 #include "common/Name.cc"
3 #include "commonmacro/histutil.h"
5 void fitPts(
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 =
"west",
13 cout <<
"--------------------------" << endl;
14 cout <<
"in name=" << inName << endl
15 <<
"ps dir=" << psDir << endl
16 <<
"cut=" << cut << endl;
17 cout <<
"--------------------------" << endl;
19 inRoot =
new TFile(inName);
21 gSystem->Load(
"StHiMicroEvent");
22 gSystem->Load(
"StHiMicroAnalysis");
27 cout <<
"cannot find the infile" << endl;
31 float ptAry[] = {2,3,4,5,6};
32 char* ptType[] = {
"PtPr",
"PtGl"};
33 char* chargeType[]= {
"Pos",
"Neg",
"PosPlusNeg"};
35 TCanvas c1(
"c1",
"c1",400,500);
37 TH2* h2a, *h2b; TH1* h1a, *h1b;
38 float ptmin=1.5,ptmax=4.0;
39 char cname[100],ctitle[100];
43 int fitPtsCut=Cut::mFitPts[0];
44 float fitptsary[] = { 3,fitPtsCut};
45 char* fitptstitle[] = {
"Wide",
"Cut"};
47 gStyle->SetOptStat(0);
52 for(
int iptType=0;iptType<nptType;iptType++){
54 sprintf(name,
"Minus.h3PhiPrFitPts%s",ptType[iptType]);
56 h3[iptType][0]=(TH3*)inRoot.Get(name);
58 sprintf(name,
"Plus.h3PhiPrFitPts%s",ptType[iptType]);
59 h3[iptType][1]=(TH3*)inRoot.Get(name);
61 h3[iptType][2]=(TH3*)h3[iptType][0]->Clone();
62 sprintf(name,
"PlusPlusMinus.h3PhiPrFitPts");
63 h3[iptType][2]->SetName(name); h3[iptType][2]->SetTitle(name);
64 h3[iptType][2]->Add(h3[iptType][1]);
67 for(
int if=0;
if<2;
if++){
68 for(
int iptType=0;iptType<nptType;iptType++){
71 sprintf(cname,
"fitPts%s%s",ptType[iptType],
73 sprintf(ctitle,
"fit pts, %s slices %d-45 (cut %d)",
74 ptType[iptType],fitptsary[
if],cut);
75 Divide(&c1,2,2,ctitle,inName);
80 TLegend l(0.1,0.4,0.3,0.5); l.SetBorderSize(0);
83 for(
int ic=0;ic<nc;ic++){
84 h2a=(TH2*)HistSlice(h3[iptType][ic],
"",
"",0,
85 ptAry[j],ptAry[j+1],
"xy");
86 h1a=HistSlice(h2a,
"",h2a->GetTitle(),0,0,0,
"x");
87 SetRange(h1a->GetXaxis(),fitptsary[
if],46);
88 h1a->SetMarkerSize(0.6);
90 SetMinMax(h1a,0,h1a->GetMaximum()*2.5);
91 h1a->SetMarkerStyle(4);
93 PrintMeanRms(h1a,0.1,.8);
97 h1a->SetMarkerStyle(8);
99 PrintMeanRms(h1a,0.1,.7);
102 h1a->SetMarkerStyle(12);
104 PrintMeanRms(h1a,0.1,.6);
106 if(j==0) l.AddEntry(h1a,chargeType[ic],
"p");
110 Print(&c1,psDir,cname);
116 for(
int ic=0;ic<nc;ic++){
117 sprintf(cname,
"fitPts%s%sPhiSlices%s",
118 ptType[iptType],chargeType[ic],fitptstitle[
if]);
119 sprintf(ctitle,
"fit pts %d-45, phi slices (%.1f<%s<%.1f) %s (cut %d)",
120 fitptsary[
if],ptmin,ptType[iptType],ptmax,chargeType[ic],cut);
121 Divide(&c1,3,4,ctitle,inName);
123 h2a=(TH2*)HistSlice(h3[iptType][ic],
"",
"",0,
125 for(
int iPhi=1; iPhi<=h2a->GetNbinsY(); iPhi++){
127 TAxis *axis = h2a->GetYaxis();
128 sprintf(title,
"%d<phi<%d",
129 axis->GetBinLowEdge(iPhi),axis->GetBinUpEdge(iPhi));
130 sprintf(name,
"%s%s%s%s",
131 chargeType[ic],ptType[iptType],fitptstitle[
if],title);
133 h1a = h2a->ProjectionX(name,iPhi,iPhi);
134 h1a->SetMarkerStyle(8); h1a->SetMarkerSize(0.6);
135 h1a->SetTitle(title); SetRange(h1a->GetXaxis(),fitptsary[
if],45.5);
137 PrintMeanRms(h1a,0.1,0.6,0.08);
139 Print(&c1,psDir,cname);
144 for(
int ic=0;ic<nc;ic++){
145 sprintf(cname,
"fitPtsMeanVPhi%s%s%s",
146 ptType[iptType],chargeType[ic],fitptstitle[
if]);
147 sprintf(ctitle,
"mean fit pts V phi %d-45 (%.1f<%s<%.1f) %s (cut %d)",
148 fitptsary[
if],ptmin,ptType[iptType],ptmax,chargeType[ic],cut);
149 Divide(&c1,1,1,ctitle,inName);
150 c1.cd(1); gPad->SetGridx(); gPad->SetGridy();
151 h2a=(TH2*)HistSlice(h3[iptType][ic],
"",
"",0,
153 int low=h2a->GetXaxis()->FindBin(fitptsary[
if]);
154 sprintf(name,
"meanVphi%s%s%s",
155 chargeType[ic],ptType[iptType],fitptstitle[
if]);
156 TProfile *p=h2a->ProfileY(name,low,9999); p->SetTitle(
"");
158 p->SetMarkerStyle(8);
161 Print(&c1,psDir,cname);