00001 #include "commonmacro/common.h"
00002 #include "common/Name.cc"
00003 #include "commonmacro/histutil.h"
00004
00005 void compareDca(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 = "embeddingfile",
00011 float extraValue = 0)
00012 {
00013
00014 gSystem->Load("StHiMicroEvent");
00015 gSystem->Load("StHiMicroAnalysis");
00016
00017 TFile* inRoot = new TFile(inName);
00018 TFile* embedRoot;
00019 if(more){
00020 strcpy(name,more);
00021 }
00022 else if(extraValue>0){
00023
00024 TString s=inName;
00025 char* trigger = (s.Contains("central")) ? "central" :"minbias";
00026 sprintf(name,"~/wrk/assoc/links/P01hi.central.HighpT_piminus_%d.hist/assoc_cut%d.hist.root",(int)extraValue,cut);
00027 }
00028 else{
00029 cout << "Unknown embed file" << endl; return;
00030 }
00031
00032 embedRoot = new TFile(name);
00033 cout << "--------------------------" << endl;
00034 cout << "in name=" << inName << endl
00035 << "ps dir=" << psDir << endl
00036 << "cut=" << cut << endl
00037 << "embed name=" << name << endl;
00038 cout << "--------------------------" << endl;
00039
00040 if(!inRoot){
00041 cout << "cannot find the infile" << endl;
00042 return;
00043 }
00044 if(!embedRoot){
00045 cout << "cannot find " << name << endl;
00046 }
00047 TH3* h3[2]; TH2* h2[2];
00048 TH1* h1[2];
00049
00050 TH3* h3a;
00051
00052 h3[0]=(TH3*)inRoot.Get("Minus.h3DcaGlDcaXYGlPtPr");
00053
00054
00055
00056
00057 h3[1]=(TH3*)embedRoot.Get("Minus.h3DcaGlDcaXYGlPtPr");
00058 if(!h3[1]) { cout << "huh" << endl; return; }
00059
00060
00061
00062
00063 char* type[] = {"real","embed"}; int npt=4;
00064 float ptary[] = {2,3,4,5,6};
00065
00066 for(int i=0;i<2;i++){
00067 sprintf(name,"%s",type[i]);
00068 h2[i]=HistSlice(h3[i],"","",0,0,3,"zy");
00069 }
00070
00071 TCanvas c1("c1","c1",400,500);
00072 TText* t=new TText;
00073 gStyle->SetOptStat(0);
00074
00075
00076
00077 float dcaCutAry[] = { 3,1};
00078 char* dcatitle[] = { "Wide","Cut"};
00079 int nRebin=4;
00080
00081
00082 for(int id=0;id<2;id++){
00083
00084 sprintf(title,"dcaXY |dca|<%.f (cut %d)",dcaary[id],cut);
00085 Divide(&c1,2,2,title,inName);
00086 for(int ipt=0;ipt<npt;ipt++){
00087 c1.cd(ipt+1); gPad->SetLogy();
00088 for(int i=0;i<2;i++){
00089 h1[i]= HistSlice(h2[i],"","",0,ptary[ipt],ptary[ipt+1],"x");
00090 SetRange(h1[i]->GetXaxis(),-dcaary[id],dcaary[id]);
00091 if(nRebin>1)h1[i]->Rebin(nRebin);
00092 h1[i]->Scale(1./h1[i]->Integral());
00093 h1[i]->SetMaximum(.40);
00094 h1[i]->SetMarkerStyle(4+4*i);
00095 if(i==0){
00096 h1[i]->SetLineColor(kBlue); h1[i]->Draw("");
00097 }
00098 else{
00099 h1[i]->SetLineColor(kRed); h1[i]->Draw("same");
00100 }
00101 PrintMeanRms(h1[i],0.15,0.8-.1*i);
00102 }
00103
00104 if(ipt==0){
00105 TLegend l(0.15,0.4,0.3,0.5); l.SetFillColor(kWhite);
00106 l.SetBorderSize(0);
00107 l.AddEntry(h1[0],"real","l"); l.AddEntry(h1[1],"mc","l");
00108 l.Draw();
00109 }
00110 }
00111 sprintf(title,"dcaXYGl%s",dcatitle[id]);
00112 Print(&c1,psDir,title);
00113 }
00114 }