00001 #include "commonmacro/histutil.h"
00002 #include "commonmacro/common.h"
00003
00004 void resPtVdcaXYGl(const char* inName="test.hist.root",
00005 const char* psDir="ps",
00006 int cut = 111,
00007 const char* outDir = "",
00008 const char* more="",
00009 float extraValue = 0)
00010
00011 {
00012 cout << "--------------------------" << endl;
00013 cout << "in name=" << inName << endl
00014 << "ps dir=" << psDir << endl
00015 << "cut=" << cut << endl;
00016 cout << "--------------------------" << endl;
00017
00018 inRoot = new TFile(inName);
00019
00020 if(!inRoot){
00021 cout << "cannot find the infile" << endl;
00022 return;
00023 }
00024
00025 TCanvas c1("c1","c1",400,500);
00026
00027 float ptary[] = {1.5,2,3,4,6};
00028 int nPt=4;
00029 int nBase = 2;
00030 const char* base[] =
00031 {
00032 "h3ResPtPrGlPtPrDcaXYGl","h3ResPtPrGlPtGlDcaXYGl",
00033
00034 };
00035 TH3* h3; TH2* h2; TH1* h1; TProfile* p;
00036 gStyle->SetOptStat(0);
00037
00038 for(int ib=0; ib<nBase; ib++){
00039 h3=(TH3*)inRoot.Get(base[ib]);
00040 cout << base[ib] << endl; if(!h3) return;
00041
00042
00043
00044 if(ib<6){
00045 sprintf(title,"%s vs dcaXYGl %s slices (cut %d)",
00046 h3->GetXaxis()->GetTitle(),h3->GetYaxis()->GetTitle(),cut);
00047 Divide(&c1,2,2,title,inName);
00048 for(int ipt=0;ipt<nPt;ipt++){
00049 c1.cd(ipt+1);
00050 h2=HistSlice(h3,name,"",0,ptary[ipt],ptary[ipt+1],"xz");
00051 h2->Draw("box");
00052 }
00053 sName=base[ib];getSub(sName);
00054 sprintf(title,"%sVdcaXY%sSlices",sName.Data(),
00055 h3->GetYaxis()->GetTitle());
00056 Print(&c1,psDir,title);
00057 }
00058
00059
00060
00061
00062
00063 sprintf(title,"mean %s va dcaXYGl %s slices (cut %d)",
00064 h3->GetXaxis()->GetTitle(),h3->GetYaxis()->GetTitle(),cut);
00065 Divide(&c1,2,2,title,inName);
00066 for(int ipt=0;ipt<nPt;ipt++){
00067
00068 c1.cd(ipt+1);
00069 p=Profile(h3,base[ib],"",0,ptary[ipt],ptary[ipt+1],"xz","x");
00070 SetMinMax(p,-0.4,0.4); SetRange(p->GetXaxis(),-1,1);
00071 p->Draw(); gPad->SetGridx(); gPad->SetGridy();
00072 }
00073 sName=base[ib];getSub(sName);
00074 sprintf(title,"mean%sVdcaXY%sSlices",sName.Data(),
00075 h3->GetYaxis()->GetTitle());
00076 Print(&c1,psDir,title);
00077
00078
00079
00080 sprintf(title,"rms %s va dcaXYGl %s slices (cut %d)",
00081 h3->GetXaxis()->GetTitle(),h3->GetYaxis()->GetTitle(),cut);
00082 Divide(&c1,2,2,title,inName);
00083 for(int ipt=0;ipt<nPt;ipt++){
00084 c1.cd(ipt+1);
00085 h1=Rms(h3,base[ib],"",0,ptary[ipt],ptary[ipt+1],"xz","x");
00086 h1->SetMarkerStyle(8);
00087 SetMinMax(h1,0,0.5); SetRange(h1->GetXaxis(),-0.8,0.8);
00088 h1->Draw();
00089 }
00090 sName=base[ib];getSub(sName);
00091 sprintf(title,"rms%sVdcaXY%sSlices",sName.Data(),
00092 h3->GetYaxis()->GetTitle());
00093 Print(&c1,psDir,title);
00094
00095 }
00096 }
00097
00098 void getSub(TString& ss){
00099 ss.Replace(ss.First("D")-4,ss.Length(),"");
00100 ss.ReplaceAll("h3","");
00101
00102 }