00001 #include "commonmacro/common.h"
00002 #include "common/Name.cc"
00003 #include "commonmacro/histutil.h"
00004
00005 void yieldVphiEW(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 = 0)
00012
00013 {
00014
00015 cout << "--------------------------" << endl;
00016 cout << "in name=" << inName << endl
00017 << "ps dir=" << psDir << endl
00018 << "cut=" << cut << endl;
00019 cout << "--------------------------" << endl;
00020
00021 TString side;
00022 if(strstr(inName,"west")){ side="west"; }
00023 else if(strstr(inName,"east")){ side="east"; }
00024 else {side =more; }
00025
00026 inRoot = new TFile(inName);
00027
00028 if(!inRoot){
00029 cout << "cannot find the infile" << endl;
00030 return;
00031 }
00032 TCanvas c1("c1","c1",400,500);
00033 TH1* ha, *hb;
00034 float dcaMin=-1.5,dcaMax=1.5;
00035
00036
00037 gStyle->SetOptStat(0);
00038
00039 Int_t nBase = 2;
00040
00041 char* baseName[] = {
00042 "h3PhiPrDcaXYGlPtPr",
00043 "h3PhiGlDcaXYGlPtGl"
00044 };
00045 const int nPt=4;
00046 float ptary[]={1.5,2,3,4,6};
00047
00048
00049
00050
00051
00052 for(int i=0; i<nBase; i++){
00053 cout << border << endl;
00054
00055 TH1D* h1[2][nPt];
00056 TH3* h3; TH2* h2;
00057 TLegend legend(.1,.1,.25,.2);
00058 legend.SetFillColor(kWhite); legend.SetBorderSize(0);
00059
00060 for(int ic=0; ic<2; ic++){
00061
00062 setName(name,baseName[i],sPM[ic].Data());
00063 h3 = (TH3D*) inRoot.Get(name);
00064
00065
00066 h2 =
00067 HistSlice(h3,"dummy2d","",0,dcaMin,dcaMax,"zx","e");
00068
00069
00070 for(int is=0; is<nPt; is++){
00071 h1[ic][is]=HistSlice(h2,"dummy1d","",0,
00072 ptary[is],ptary[is+1],"x","e");
00073 }
00074 }
00075 float min,max;
00076
00077 sprintf(title,"yield v phi %s %s slices (%s) (cut %d)",
00078 h2->GetTitle(),h3->GetZaxis()->GetTitle(),side.Data(),cut);
00079 sTitle=title;
00080 sprintf(name,"yieldVphi%s%s",h3->GetZaxis()->GetTitle(),side.Data());
00081 sName=name;
00082
00083 Divide(&c1,2,2,sTitle.Data(),inName);
00084 for(int iSlice=0; iSlice<nPt;iSlice++){
00085 ha=h1[0][iSlice];
00086 hb=h1[1][iSlice];
00087 ha->SetMarkerStyle(4);
00088 hb->SetMarkerStyle(8);
00089
00090 max = FindMax(ha,hb);
00091 min = FindMin(ha,hb);
00092 SetMinMax(ha,min*0.5,max*1.2);
00093
00094 c1.cd(iSlice+1); ha->Draw("e");
00095 hb->Draw("esame");
00096 gPad->SetGridx(); gPad->SetGridy();
00097
00098 if(iSlice==0){
00099 legend.AddEntry(h1[0][0],"plus","p");
00100 legend.AddEntry(h1[1][0],"minus","p");
00101 legend.Draw();
00102 }
00103 }
00104 Print(&c1,psDir,sName.Data());
00105
00106
00107 sName += "_sum"; sTitle += "sum";
00108 Divide(&c1,2,2,sTitle.Data(),inName);
00109 for(int iSlice=0; iSlice<nPt;iSlice++){
00110 TH1* ha = (TH1*)h1[0][iSlice]->Clone();
00111 ha->Add(h1[1][iSlice]);
00112
00113 SetMinMax(ha,ha->GetMinimum()*0.5,ha->GetMaximum()*2.2);
00114
00115 c1.cd(iSlice+1); ha->Draw("e");
00116
00117 gPad->SetGridx(); gPad->SetGridy();
00118
00119 }
00120 Print(&c1,psDir,sName.Data());
00121
00122
00123
00124
00125
00126 }
00127
00128
00129 }