1 #include "commonmacro/common.h"
2 #include "common/Name.cc"
3 #include "commonmacro/histutil.h"
5 void yieldVptEW(
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;
20 if(strstr(inName,
"west")){ side=
"west"; }
21 else if(strstr(inName,
"east")){ side=
"east"; }
24 inRoot =
new TFile(inName);
27 cout <<
"cannot find the infile" << endl;
34 Stat_t max1, max, max2, min,min1,min2,maxary[2],minary[2];
38 TCanvas c1(
"c1",
"c1",400,500);
39 float dcaXYMin=-1.5,dcaXYMax=1.5;
40 float phiMin=-165,phiMax=195;
41 float ptMin=1.5,ptMax=6;
42 gStyle->SetPadGridX(1); gStyle->SetPadGridY(1);
43 gStyle->SetOptStat(0);
45 const Int_t nBase = 2;
50 "h3PhiGlDcaXYGlPtGl",
"h3PhiPrDcaXYGlPtPr"
58 for(
int i=0;i<nBase;i++){
61 for(
int ic=0; ic<2; ic++){
64 setName(name,baseName[i],sPM[ic].Data());
65 h3 = (TH3*) inRoot.Get(name);
69 h2 = HistSlice(h3,
"dummy2d",
"",0,
70 phiMin,phiMax,
"yz",
"e");
75 HistSlice(h2,
"dummy1d",
"",0,
76 dcaXYMin,dcaXYMax,
"x",
"e");
79 h1[i][0]->SetMarkerStyle(4); h1[i][1]->SetMarkerStyle(8);
81 max = FindMax(h1[i][0],h1[i][1]);
82 min = FindMin(h1[i][0],h1[i][1]);
87 sprintf(title,
"yield v %s %s (%s) (cut %d)",
88 h3->GetZaxis()->GetTitle(),h2->GetTitle(),side.Data(),cut);
91 Divide(&c1,1,2,title,inName);
92 TLegend legend(.1,.1,.25,.2);
95 sprintf(title,
"%s (%s)",h1[i][0]->GetTitle(),side.Data());
96 h1[i][0]->SetTitle(title);
97 c1.cd(1);h1[i][0]->Draw(
"e1"); h1[i][1]->Draw(
"e1same");
98 SetRange(h1[i][0]->GetXaxis(),ptMin,ptMax);
101 legend.AddEntry(h1[i][0],
"plus",
"p");
102 legend.AddEntry(h1[i][1],
"minus",
"p");
103 legend.SetFillColor(kWhite);
107 ha=(TH1*)h1[i][0]->Clone();
110 sprintf(title,
"plus+minus %s",side.Data());
112 SetRange(ha->GetXaxis(),ptMin,ptMax);
113 c1.cd(2);ha->Draw(
"e1");
116 sprintf(name,
"yieldV%s%s",h3->GetZaxis()->GetTitle(),side.Data());
117 Print(&c1,psDir,name);
123 sprintf(title,
"yield neg/pos v pT %s (%s)(cut %d)",
124 h2->GetTitle(),side.Data(),cut);
126 Divide(&c1,1,2,title,inName);
128 for(
int iBase=0; iBase<2; iBase++){
129 ha = (TH1*)h1[iBase][1]->Clone();
130 ha->Divide(h1[iBase][0]);
131 ha->SetMinimum(0.5); ha->SetMaximum(1.5);
132 sprintf(title,
"neg/pos V %s",h1[iBase][0]->GetXaxis()->GetTitle());
134 SetRange(ha->GetXaxis(),ptMin,ptMax);
135 c1.cd(iBase+1);ha->Draw(
"e1");
136 TLine* line=
new TLine;
137 line->DrawLine(ha->GetXaxis()->GetBinLowEdge(ha->GetXaxis()->GetFirst()),1,
138 ha->GetXaxis()->GetBinUpEdge(ha->GetXaxis()->GetLast()),1);
139 sprintf(name,
"yieldNegOverPosVpt%s",side.Data());
141 Print(&c1,psDir,name);