00001 #include "commonmacro/common.h"
00002 #include "common/Name.cc"
00003 #include "commonmacro/histutil.h"
00004
00005 void dca(const char* inName=
00006 "links/P01hi.minbias.2000.hist/hianalysis_1000.hist.root",
00007 const char* psDir="ps",
00008 int cut = 1,
00009 const char* outDir="./",
00010 const char* more = "west",
00011 float extraValue = 1)
00012 {
00013 cout << "--------------------------" << endl;
00014 cout << "in name=" << inName << endl
00015 << "ps dir=" << psDir << endl
00016 << "cut=" << cut << endl;
00017 cout << "--------------------------" << endl;
00018
00019 inRoot = new TFile(inName);
00020
00021 if(!inRoot){
00022 cout << "cannot find the infile" << endl;
00023 return;
00024 }
00025 TText* t = new TText;
00026 float ptAry[] = {2,3,4,5,6};
00027 char* ptType[] = { "PtPr","PtGl"};
00028 char* chargeType[]= { "Pos","Neg","PosPlusNeg"};
00029 TH1 *ha, *hb;
00030 TCanvas c1("c1","c1",400,500);
00031 TH3* h3[2][3];
00032 TH2* h2a, *h2b; TH1* h1a, *h1b;
00033 float dcaCut[]={0,1}; float dcaXYCut[]={-1,1};
00034 char cname[100],ctitle[100];
00035 int nc=2;
00036 int npt=2;
00037 float maxDcaPlot=.2; float maxDcaXYPlot=.1;
00038 int nRebin=4;
00039 if(nRebin>1){cout << ">>Rebinning " << nRebin << endl;}
00040
00041 gStyle->SetOptStat(0);
00042
00043
00044
00045
00046 for(int ipt=0;ipt<npt;ipt++){
00047
00048 sprintf(name,"Plus.h3DcaGlDcaXYGl%s",ptType[ipt]);
00049 cout << name << endl;
00050 h3[ipt][0]=(TH3*)inRoot.Get(name);
00051
00052 sprintf(name,"Minus.h3DcaGlDcaXYGl%s",ptType[ipt]);
00053 cout << name << endl;
00054 h3[ipt][1]=(TH3*)inRoot.Get(name);
00055
00056 h3[ipt][2]=(TH3*)h3[ipt][0]->Clone();
00057 sprintf(name,"PlusPlusMinus.h3DcaGlDcaXYGl%s",ptType[ipt]);
00058 h3[ipt][2]->SetName(name); h3[ipt][2]->SetTitle(name);
00059 h3[ipt][2]->Add(h3[ipt][1]);
00060 }
00061
00062
00063 for(int ipt=0;ipt<npt;ipt++){
00064 cout << "***** " << ipt << "****** " << endl;
00065 for(int ic=0;ic<nc;ic++){
00066 cout << "\t****" << ic <<"*****" << endl;
00067
00068
00069 sprintf(cname,"DcaVDcaXY%s%s",chargeType[ic],ptType[ipt]);
00070 sprintf(ctitle,"dca3d vs dca xy, %s slices (%s) (cut %d)",
00071 ptType[ipt],chargeType[ic],cut);
00072 Divide(&c1,2,2,ctitle,inName);
00073
00074 for(int j=0;j<4;j++){
00075 c1.cd(j+1);
00076 h2a=(TH2*)HistSlice(h3[ipt][ic],"","",0,
00077 ptAry[j],ptAry[j+1],"xy");
00078 h2a->Draw("box");
00079 }
00080 Print(&c1,psDir,cname);
00081
00082
00083 sprintf(cname,"Dca%s%s",chargeType[ic],ptType[ipt]);
00084 sprintf(ctitle,"dca 3d, %s slices, (%s) (cut %d)",
00085 ptType[ipt],chargeType[ic],cut);
00086 Divide(&c1,2,2,ctitle,inName);
00087
00088 for(int j=0;j<4;j++){
00089 c1.cd(j+1); gPad->SetLogy(1);
00090 h2a=(TH2*)HistSlice(h3[ipt][ic],"","",0,
00091 ptAry[j],ptAry[j+1],"yx");
00092 h1a=HistSlice(h2a,"",h2a->GetTitle(),0,0,0,"x");
00093 h1b=HistSlice(h2a,"",h2a->GetTitle(),0,
00094 dcaXYCut[0],dcaXYCut[1],"x");
00095
00096
00097
00098 h1b->SetLineStyle(2);
00099
00100 if(nRebin>1){h1a->Rebin(nRebin); h1b->Rebin(nRebin); }
00101 h1a->Draw(); h1b->Draw("same");
00102
00103 PrintMeanRms(h1a,0.6,0.8);
00104 PrintMeanRms(h1b,0.6,0.6);
00105
00106
00107 }
00108 Print(&c1,psDir,cname);
00109
00110
00111 sprintf(cname,"DcaXY%s%s",chargeType[ic],ptType[ipt]);
00112 sprintf(ctitle,"dca xy, %s slices, (%s) (cut %d)",
00113 ptType[ipt],chargeType[ic],cut);
00114 Divide(&c1,2,2,ctitle,inName);
00115
00116 for(int j=0;j<4;j++){
00117 c1.cd(j+1); gPad->SetLogy(1);
00118 h2a=(TH2*)HistSlice(h3[ipt][ic],"","",0,
00119 ptAry[j],ptAry[j+1],"xy");
00120 h1a=HistSlice(h2a,"",h2a->GetTitle(),0,0,0,"x");
00121 h1b=HistSlice(h2a,"",h2a->GetTitle(),0,
00122 dcaCut[0],dcaCut[1],"x");
00123
00124
00125 h1b->SetLineStyle(2);
00126
00127 if(nRebin>1){h1a->Rebin(nRebin); h1b->Rebin(nRebin); }
00128 h1a->Draw(); h1b->Draw("same");
00129 PrintMeanRms(h1a,0.6,0.8);
00130 PrintMeanRms(h1b,0.6,0.6);
00131 }
00132 Print(&c1,psDir,cname);
00133
00134 }
00135 }
00136 }
00137
00138