1 #include "common/Name.cc"
2 #include "commonmacro/histutil.h"
3 #include "commonmacro/common.h"
4 void meanDca(
const char* inName=
5 "links/P01hi.minbias.2000.hist/hianalysis_1000.hist.root",
6 const char* psDir=
"ps",
8 const char* outDir=
"./",
14 cout <<
"--------------------------" << endl;
15 cout <<
"in name=" << inName << endl
16 <<
"ps dir=" << psDir << endl
17 <<
"cut=" << cut << endl;
18 cout <<
"--------------------------" << endl;
20 inRoot =
new TFile(inName);
23 cout <<
"cannot find the infile" << endl;
26 TCanvas c1(
"c1",
"c1",400,525);
29 const int nChargeType=4;
30 const int nZperHalf=4;
36 char* type[] = {
"Mean",
"Rms",
"Num"};
37 char* ptType[] = {
"PrPt",
"GlPt" };
38 char* chargeType[] = {
"Neg",
"Pos",
"PosPlusNeg",
"PosMinusNeg"};
39 gStyle->SetOptStat(0);
42 for(
int it=0; it<nType; it++){
43 for(
int ipt=0;ipt<nPtType;ipt++){
44 for(
int iew=0;iew<2;iew++){
46 TH1* h1[nChargeType][10];
48 for(
int ic=0; ic<nChargeType; ic++){
49 if(iew<1){ zBin=1; }
else { zBin=5; }
50 for(
int iz=0; iz<nZperHalf; iz++){
51 sprintf(name,
"h%s%sDcaXY%sVphiS0zBin%dSdcaXYBin1",
52 type[it],chargeType[ic],ptType[ipt],zBin++);
54 h1[ic][iz]=(TH1D*)inRoot.Get(name);
if(!h1[ic][iz])
return;
58 sprintf(name,
"%sPosNegDcaXY%sVphi%s",
59 type[it],ptType[ipt],sEW[iew].Data());
60 Divide(&c1,2,2,name,inName);
64 if(iew<1){ zBin = 3-i;}
else { zBin = i; }
67 ha=h1[0][zBin]; hb=h1[1][zBin]; hc=h1[2][zBin];
68 setMinMax(ha,hb,hc,type[it]);
69 TString s=ha->GetTitle();
71 s.Replace(0,s.First(
"("),
"");
72 s.Replace(s.First(
")")+1,s.Length(),
"");
73 ha->SetTitle(s.Data());
74 ha->SetMarkerColor(kBlue); ha->SetMarkerStyle(4);
76 ha->
Draw(
"p"); DrawLine(ha);
78 hb->SetMarkerColor(kRed);
79 hc->SetMarkerColor(kGreen);
80 hb->SetMarkerStyle(8);
81 hc->SetMarkerStyle(10);
87 Print(&c1,psDir,name);
91 sprintf(name,
"%sPosMinusNegDcaXY%sVphi%s",
92 type[it],ptType[ipt],sEW[iew].Data());
93 Divide(&c1,2,2,name,inName);
95 if(iew<1){ zBin = 3-i;}
else { zBin = i; }
97 setMinMax(h1[3][zBin],0,0,type[it]);
98 h1[3][zBin]->Draw(
"p");
100 Print(&c1,psDir,name);
109 for(
int it=0; it<nType; it++){
110 for(
int ipt=0;ipt<nPtType;ipt++){
113 for(
int ic=0; ic<nChargeType; ic++){
114 sprintf(name,
"h%s%sDcaXY%sVzS0phiBin1SdcaXYBin1",
115 type[it],chargeType[ic],ptType[ipt],zBin++);
117 h[ic]=(TH1*)inRoot.Get(name);
if(!h[ic])
return;
121 sprintf(name,
"%sPosNegDcaXY%sVz",
122 type[it],ptType[ipt]);
123 Divide(&c1,1,2,name,inName);
125 ha=h[0]; hb=h[1]; hc=h[2];
126 setMinMax(ha,hb,hc,type[it]);
127 ha->SetMarkerColor(kBlue);
128 ha->Draw(
"p"); ha->SetMarkerStyle(4);DrawLine(ha);
130 hb->SetMarkerColor(kRed);
131 hc->SetMarkerColor(kGreen);
132 hb->SetMarkerStyle(8);
133 hc->SetMarkerStyle(10);
134 hb->Draw(
"psame"); hc->Draw(
"psame");
139 setMinMax(h[3],0,0,type[it]);
142 Print(&c1,psDir,name);
151 void setMinMax(TH1* ha,TH1* hb,TH1* hc,TString t)
154 SetMinMax(ha,-.1,.1);
157 if(hc)SetMinMax(ha,ha->GetMinimum()*0.5,hc->GetMaximum()*1.2);
161 SetMinMax(ha,0.2,0.8);
163 else{ cout <<
"Unknown type " << t << endl; }
virtual void Draw(Option_t *depth="3")
Draw Referenced node with current parameters.