1 #include "commonmacro/common.h"
2 #include "common/Name.cc"
3 #include "commonmacro/histutil.h"
5 void dca(
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);
22 cout <<
"cannot find the infile" << endl;
26 float ptAry[] = {2,3,4,5,6};
27 char* ptType[] = {
"PtPr",
"PtGl"};
28 char* chargeType[]= {
"Pos",
"Neg",
"PosPlusNeg"};
30 TCanvas c1(
"c1",
"c1",400,500);
32 TH2* h2a, *h2b; TH1* h1a, *h1b;
33 float dcaCut[]={0,1};
float dcaXYCut[]={-1,1};
34 char cname[100],ctitle[100];
37 float maxDcaPlot=.2;
float maxDcaXYPlot=.1;
39 if(nRebin>1){cout <<
">>Rebinning " << nRebin << endl;}
41 gStyle->SetOptStat(0);
46 for(
int ipt=0;ipt<npt;ipt++){
48 sprintf(name,
"Plus.h3DcaGlDcaXYGl%s",ptType[ipt]);
50 h3[ipt][0]=(TH3*)inRoot.Get(name);
52 sprintf(name,
"Minus.h3DcaGlDcaXYGl%s",ptType[ipt]);
54 h3[ipt][1]=(TH3*)inRoot.Get(name);
56 h3[ipt][2]=(TH3*)h3[ipt][0]->Clone();
57 sprintf(name,
"PlusPlusMinus.h3DcaGlDcaXYGl%s",ptType[ipt]);
58 h3[ipt][2]->SetName(name); h3[ipt][2]->SetTitle(name);
59 h3[ipt][2]->Add(h3[ipt][1]);
63 for(
int ipt=0;ipt<npt;ipt++){
64 cout <<
"***** " << ipt <<
"****** " << endl;
65 for(
int ic=0;ic<nc;ic++){
66 cout <<
"\t****" << ic <<
"*****" << endl;
69 sprintf(cname,
"DcaVDcaXY%s%s",chargeType[ic],ptType[ipt]);
70 sprintf(ctitle,
"dca3d vs dca xy, %s slices (%s) (cut %d)",
71 ptType[ipt],chargeType[ic],cut);
72 Divide(&c1,2,2,ctitle,inName);
76 h2a=(TH2*)HistSlice(h3[ipt][ic],
"",
"",0,
77 ptAry[j],ptAry[j+1],
"xy");
80 Print(&c1,psDir,cname);
83 sprintf(cname,
"Dca%s%s",chargeType[ic],ptType[ipt]);
84 sprintf(ctitle,
"dca 3d, %s slices, (%s) (cut %d)",
85 ptType[ipt],chargeType[ic],cut);
86 Divide(&c1,2,2,ctitle,inName);
89 c1.cd(j+1); gPad->SetLogy(1);
90 h2a=(TH2*)HistSlice(h3[ipt][ic],
"",
"",0,
91 ptAry[j],ptAry[j+1],
"yx");
92 h1a=HistSlice(h2a,
"",h2a->GetTitle(),0,0,0,
"x");
93 h1b=HistSlice(h2a,
"",h2a->GetTitle(),0,
94 dcaXYCut[0],dcaXYCut[1],
"x");
100 if(nRebin>1){h1a->Rebin(nRebin); h1b->Rebin(nRebin); }
101 h1a->Draw(); h1b->Draw(
"same");
103 PrintMeanRms(h1a,0.6,0.8);
104 PrintMeanRms(h1b,0.6,0.6);
108 Print(&c1,psDir,cname);
111 sprintf(cname,
"DcaXY%s%s",chargeType[ic],ptType[ipt]);
112 sprintf(ctitle,
"dca xy, %s slices, (%s) (cut %d)",
113 ptType[ipt],chargeType[ic],cut);
114 Divide(&c1,2,2,ctitle,inName);
116 for(
int j=0;j<4;j++){
117 c1.cd(j+1); gPad->SetLogy(1);
118 h2a=(TH2*)HistSlice(h3[ipt][ic],
"",
"",0,
119 ptAry[j],ptAry[j+1],
"xy");
120 h1a=HistSlice(h2a,
"",h2a->GetTitle(),0,0,0,
"x");
121 h1b=HistSlice(h2a,
"",h2a->GetTitle(),0,
122 dcaCut[0],dcaCut[1],
"x");
125 h1b->SetLineStyle(2);
127 if(nRebin>1){h1a->Rebin(nRebin); h1b->Rebin(nRebin); }
128 h1a->Draw(); h1b->Draw(
"same");
129 PrintMeanRms(h1a,0.6,0.8);
130 PrintMeanRms(h1b,0.6,0.6);
132 Print(&c1,psDir,cname);