1 #include "commonmacro/common.h"
2 #include "common/Name.cc"
3 #include "commonmacro/histutil.h"
5 void yieldVvtxZ(
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(
"StHiMicroAnalysis");
19 TFile* inRoot =
new TFile(inName);
24 else if(extraValue>0){
26 char* trigger = (strstr(inName,
"central")) ?
"central" :
"minbias";
27 sprintf(name,
"~/wrk/assoc/links/P01hi.%s.HighpT_piminus_%d.hist/efficiency_cut%d.hist.root",trigger,(
int)extraValue,cut);
30 cout <<
"Unknown embed file" << endl;
return;
34 if(strstr(inName,
"east")){ half=
"east"; }
35 if(strstr(inName,
"west")){ half=
"west"; }
37 embedRoot =
new TFile(name);
38 cout <<
"--------------------------" << endl;
39 cout <<
"in name=" << inName << endl
40 <<
"ps dir=" << psDir << endl
41 <<
"cut=" << cut << endl
42 <<
"embed name=" << name << endl
43 <<
"half = " << half << endl;
44 cout <<
"--------------------------" << endl;
47 cout <<
"cannot find the infile" << endl;
51 cout <<
"cannot find " << name << endl;
53 float minRealPt=2,maxRealPt=3;
54 float minMcPt=2,maxMcPt=8;
56 float minVtxZ=-160,maxVtxZ=160;
57 float etaAry[][2] = { { .0,.1}, {.2,.3}, {.4,.5}, {.6,.7},
58 {-.1,0}, {-.3,-.2},{-.5,-.4},{-.7,-.6} };
59 const int nEta = 8;
int nx=2;
int ny=4;
74 h3Real=(TH3*)inRoot.Get(
"Minus.h3VtxZEtaPrPtPr");
75 h3 = (TH3*)inRoot.Get(
"Plus.h3VtxZEtaPrPtPr");
78 h2Real=HistSlice(h3Real,
"",
"",0,minRealPt,maxRealPt,
"yx",
"e");
81 h3Mc[0]=(TH3*)embedRoot.Get(
"h3McRawVtxZEtaPt");
82 h3Mc[1]=(TH3*)embedRoot.Get(
"h3MatchedVtxZEtaPt");
84 h2Mc[0]=HistSlice(h3Mc[0],
"",
"",0,minMcPt,maxMcPt,
"yx",
"e");
85 h2Mc[1]=HistSlice(h3Mc[1],
"",
"",0,minMcPt,maxMcPt,
"yx",
"e");
87 h3=(TH3*)inRoot.Get(
"h3VtxXYZ");
88 h1VtxZ=(TH3*)h3->Project3D(
"ze"); h1VtxZ->Rebin(nMcRebin);
90 char* type[] = {
"real",
"mc"};
92 char* opt[] = {
"p",
"psame"};
93 char* opte[] = {
"e",
"esame"};
94 float markerSize = 0.4;
97 TCanvas c1(
"c1",
"c1",400,500);
99 gStyle->SetOptStat(0);
105 TH1* hSlice =
new TH1D(
"hSlice",
"hSlice",20,-200,200);
106 SetRange(hSlice->GetXaxis(),minVtxZ,maxVtxZ);
107 hSlice->SetMinimum(0); hSlice->SetMaximum(200);
109 sprintf(title,
"eta range(cut %d)",cut);
111 Divide(&c1,nx,ny,title,inName);
112 for(
int iEta=0;iEta<nEta;iEta++){
115 sprintf(title,
"%.1f<eta<%.1f",etaAry[iEta][0],etaAry[iEta][1]);
116 h1=(TH1*)hSlice->Clone();
118 h1->Draw(); TAxis* axis=h1->GetXaxis();
120 for(
int i=axis->GetFirst();i<=axis->GetLast();i++){
121 float dip1 = 3.14159/2.-2.*atan(TMath::Exp(-etaAry[iEta][0]));
122 float dip2 = 3.14159/2.-2.*atan(TMath::Exp(-etaAry[iEta][1]));
127 cout <<
"eta="<< etaAry[iEta][1] <<
",z=" << 192*tan(dip2) << endl;
129 float xmax1 = 200*tan(dip2) + axis->GetBinLowEdge(i);
130 float xmax2 = 200*tan(dip1) + axis->GetBinLowEdge(i);
132 float xmin = axis->GetBinLowEdge(i);
133 line.SetLineStyle(2);
134 line.SetLineColor(kBlue);
135 line.DrawLine(xmin,0,xmax1,200);
136 line.SetLineStyle(1);
137 line.SetLineColor(kRed);
138 line.DrawLine(xmin,0,xmax2,200);
140 line.SetLineStyle(1);
141 line.SetLineColor(kBlack);
142 line.DrawLine(0,0,0,200);
144 line.DrawLine(minVtxZ,60,maxVtxZ,60);
147 sprintf(name,
"etaRange");
148 Print(&c1,psDir,name);
153 sprintf(title,
"raw and matched yield V vtxZ (eta slices) (cut %d)",cut);
154 Divide(&c1,nx,ny,title,inName);
155 for(
int iEta=0;iEta<nEta;iEta++){
157 for(
int i=0; i<2; i++){
158 h1Mc[i][iEta]=HistSlice(h2Mc[i],
"",h2Mc[i]->GetTitle(),0,
159 etaAry[iEta][0],etaAry[iEta][1],
"x",
"e");
160 h1Mc[i][iEta]->SetMarkerStyle(marker[i]);
161 if(nMcRebin>1)h1Mc[i][iEta]->Rebin(nMcRebin);
162 if(i==0)SetMinMax(h1Mc[i][iEta],h1Mc[i][iEta]->GetMinimum()*0.2,
163 h1Mc[i][iEta]->GetMaximum()*1.2);
164 SetRange(h1Mc[i][iEta]->GetXaxis(),minVtxZ,maxVtxZ);
165 h1Mc[i][iEta]->SetMarkerSize(markerSize);
166 h1Mc[i][iEta]->Draw(opt[i]);
169 sprintf(name,
"mcYieldVvtxZEtaSlices");
170 Print(&c1,psDir,name);
173 sprintf(title,
"efficiency*acceptance V vtxZ (eta slices) (cut %d)",cut);
174 Divide(&c1,nx,ny,title,inName);
175 for(
int iEta=0;iEta<nEta;iEta++){
176 c1.cd(iEta+1); gPad->SetGridx(); gPad->SetGridy();
177 h1Mc[1][iEta]->Divide(h1Mc[0][iEta]); SetMinMax(h1Mc[1][iEta],0,1);
178 h1Mc[1][iEta]->SetXTitle(
"vtxZ");
179 h1Mc[1][iEta]->Draw(
"e");
182 sprintf(name,
"efficiencyVvtxZEtaSlices");
183 Print(&c1,psDir,name);
186 sprintf(title,
"raw and corrected yield/Nevent V vtxZ (eta slices) (cut %d)",cut);
187 Divide(&c1,nx,ny,title,inName);
188 for(
int iEta=0;iEta<nEta;iEta++){
189 c1.cd(iEta+1); gPad->SetGridx(); gPad->SetGridy();
190 h1Real[0]=HistSlice(h2Real,
"",h2Real->GetTitle(),0,
191 etaAry[iEta][0],etaAry[iEta][1],
"x",
"e");
192 h1Real[0]->Rebin(nRebin);
193 h1Real[0]->Divide(h1VtxZ);
194 h1Real[1]=(TH1*)h1Real[0]->Clone();
195 h1Real[1]->Divide(h1Mc[1][iEta]);
198 for(
int i=0; i<2; i++){
199 h1Real[i]->SetMarkerStyle(marker[i]);
200 if(i==0)SetMinMax(h1Real[i],0,.5);
201 SetRange(h1Mc[i][iEta]->GetXaxis(),minVtxZ,maxVtxZ);
202 h1Real[i]->SetMarkerSize(markerSize);
203 h1Real[i]->SetXTitle(
"vtxZ");
204 h1Real[i]->Draw(opte[i]);
207 Print(&c1,psDir,
"yieldVvtxZEtaSlices");