1 #include "commonmacro/common.h"
2 #include "commonmacro/histutil.h"
4 void yieldEOverW(TString inName=
5 "links/P01hi.minbias.2000.hist/hianalysis_1000.hist.root",
6 const char* psDir=
"ps",
8 const char* outDir=
"./",
9 const char* more =
"west",
13 if(!strstr(inName.Data(),
"east")){
14 cout <<
"input must be east" << endl;
return;
17 TString inName2 = inName;
18 inName2.ReplaceAll(
"east",
"west");
21 inRoot[0] =
new TFile(inName.Data());
22 inRoot[1] =
new TFile(inName2.Data());
24 cout <<
"--------------------------" << endl;
25 cout <<
"in name east=" << inName << endl
26 <<
"in name west=" << inName2 << endl
27 <<
"ps dir=" << psDir << endl
28 <<
"cut=" << cut << endl;
29 cout <<
"--------------------------" << endl;
32 cout <<
"cannot find the infile" << endl;
36 TCanvas c1(
"c1",
"c1",400,500);
40 gStyle->SetOptStat(0); gStyle->SetPadGridX(1); gStyle->SetPadGridY(1);
44 float minpt=2,maxpt=6;
45 float mindca=-1.5, maxdca=1.5;
48 char* baseName[] = {
"h3PhiPrDcaXYGlPtPr",
"h3PhiGlDcaXYGlPtGl"};
50 gStyle->SetPadTickY(1);
54 for(
int i=0; i<n; i++){
55 TLegend legend(.1,.1,.25,.2);
57 for(
int iew=0; iew<2; iew++){
58 for(
int ic=0; ic<2; ic++){
61 sprintf(name,
"%s.%s",sPM[ic].Data(),baseName[i]);
62 h3 = (TH3*) inRoot[iew]->Get(name);
68 0,-165,195,0,mindca,maxdca,
70 SetRange(h1[iew][ic]->GetXaxis(),minpt,maxpt);
72 sName=h1[iew][ic]->GetTitle();
73 sName.Prepend(sEW[iew]);
74 h1[iew][ic]->SetTitle(sName.Data());
77 h1[iew][0]->SetMarkerStyle(4); h1[iew][1]->SetMarkerStyle(8);
82 sprintf(name,
"yieldV%sew",h3->GetZaxis()->GetTitle());
84 sprintf(title,
"yield V %s %s (east/west)",h3->GetZaxis()->GetTitle(),
85 h1[0][0]->GetTitle());
89 Divide(&c1,1,3,title,inName);c1.SetName(sName.Data());
91 int j=0; TLine* line=
new TLine;
92 for(
int ic=0; ic<2; ic++){
93 h1a = (TH1*)h1[0][ic]->Clone();
94 h1a->Divide(h1[1][ic]);
95 h1a->SetMinimum(0.5); h1a->SetMaximum(1.6);
96 ReplaceTitle(h1a,sEW[0].Data(),
"");
97 sprintf(title,
"%s (east/west)",sPM[ic].Data());
98 h1a->SetXTitle(h1[0][ic]->GetXaxis()->GetTitle());
100 c1.cd(ic+1); h1a->Draw(
"e");
102 TAxis* axis=h1a->GetXaxis();
103 line->DrawLine(axis->GetBinLowEdge(axis->GetFirst()),1,
104 axis->GetBinUpEdge(axis->GetLast()),1);
106 h1a=(TH1*)h1[0][0]->Clone();
108 h1b=(TH1*)h1[1][0]->Clone();
110 h1a->Divide(h1b); h1a->SetMinimum(0.5); h1a->SetMaximum(1.6);
111 sprintf(title,
"plus+minus (east/west)");
112 h1a->SetMinimum(0.8); h1a->SetMaximum(1.2);
113 h1a->SetTitle(title); c1.cd(3); h1a->Draw(
"e");
114 line->DrawLine(axis->GetBinLowEdge(axis->GetFirst()),1,
115 axis->GetBinUpEdge(axis->GetLast()),1);
116 Print(&c1,psDir,c1.GetName());
122 for(
int iew=0; iew<2; iew++){
123 for(
int ic=0; ic<2; ic++){
124 sprintf(name,
"%s.%s",sPM[ic].Data(),
"RawVarBin");
125 h1[iew][ic]=(TH1*)inRoot[iew]->Get(name);
126 h1[iew][ic]->Sumw2();
129 h1[iew][ic]->SetAxisRange(minpt,maxpt-.001);
132 h1[iew][0]->SetMarkerStyle(4); h1[iew][1]->SetMarkerStyle(8);
136 sprintf(name,
"yieldVptVarBinew");
137 sprintf(title,
"yield V ptPr (var binning) (east/west)");
139 Divide(&c1,1,3,title,inName);c1.SetName(name);
141 int j=0; TLine* line=
new TLine;
142 for(
int ic=0; ic<2; ic++){
143 h1a = (TH1*)h1[0][ic]->Clone();
144 h1a->Divide(h1[1][ic]);
145 h1a->SetMinimum(0.5); h1a->SetMaximum(1.6);
146 ReplaceTitle(h1a,sEW[0].Data(),
"");
147 sprintf(title,
"%s (east/west)",sPM[ic].Data());
148 h1a->SetXTitle(h1[0][ic]->GetXaxis()->GetTitle());
149 h1a->SetTitle(title);
150 c1.cd(ic+1); h1a->Draw(
"e");
152 cout << h1a->GetBinContent(4) <<
"\t" << h1a->GetBinError(4) << endl;
154 TAxis* axis=h1a->GetXaxis();
155 line->DrawLine(axis->GetBinLowEdge(axis->GetFirst()),1,
156 axis->GetBinUpEdge(axis->GetLast()),1);
158 h1a=(TH1*)h1[0][0]->Clone();
160 h1b=(TH1*)h1[1][0]->Clone();
162 h1a->Divide(h1b); h1a->SetMinimum(0.5); h1a->SetMaximum(1.6);
163 sprintf(title,
"plus+minus (east/west)");
164 h1a->SetMinimum(0.8); h1a->SetMaximum(1.2);
165 h1a->SetTitle(title); c1.cd(3); h1a->Draw(
"e");
166 line->DrawLine(axis->GetBinLowEdge(axis->GetFirst()),1,
167 axis->GetBinUpEdge(axis->GetLast()),1);
168 Print(&c1,psDir,c1.GetName());