00001 #include "commonmacro/common.h"
00002 #include "common/Name.cc"
00003 #include "commonmacro/histutil.h"
00004
00005 void compareFitPtsVeta(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 char* trigger = (strstr(inName,"central")) ? "central" :"minbias";
00025 sprintf(name,"~/wrk/assoc/links/P01hi.central.HighpT_piminus_%d.hist/assoc_cut%d.hist.root",(int)extraValue,cut);
00026 }
00027 else{
00028 cout << "Unknown embed file" << endl; return;
00029 }
00030
00031 TString half = "";
00032 if(strstr(inName,"east")){ half="east"; }
00033 if(strstr(inName,"west")){ half="west"; }
00034
00035 embedRoot = new TFile(name);
00036 cout << "--------------------------" << endl;
00037 cout << "in name=" << inName << endl
00038 << "ps dir=" << psDir << endl
00039 << "cut=" << cut << endl
00040 << "embed name=" << name << endl
00041 << "half = " << half << endl;
00042 cout << "--------------------------" << endl;
00043
00044 if(!inRoot){
00045 cout << "cannot find the infile" << endl;
00046 return;
00047 }
00048 if(!embedRoot){
00049 cout << "cannot find " << name << endl;
00050 }
00051 TH3* h3[2]; TH2* h2[2];
00052 TH1* h1[2];
00053 TProfile* p[2];
00054
00055 TH3* h3a; TH2* h2a;
00056
00057 h3[0]=(TH3*)inRoot.Get("Minus.h3VtxZFitPtsEtaPr");
00058 h3a=(TH3*)inRoot.Get("Plus.h3VtxZFitPtsEtaPr");
00059 if(!h3a){cout << "cannot find h3a" << endl; return; }
00060 h3[0]->Add(h3a);
00061 h3[1]=(TH3*)embedRoot.Get("Minus.h3VtxZFitPtsEtaPr");
00062 h3a=(TH3*)embedRoot.Get("Plus.h3VtxZFitPtsEtaPr");
00063 h3[1]->Add(h3a);
00064
00065 char* type[] = {"real","mc"}; int npt=4;
00066 int marker[] = {4,8};
00067 char* opt[] = { "p","psame"};
00068 char* optp[] = {"e","esame"};
00069 char ctitle[100],cname[100];
00070
00071 TCanvas c1("c1","c1",400,500);
00072 TText* t=new TText;
00073 gStyle->SetOptStat(0);
00074
00075 Cut::SetCut(cut);
00076 float fitPtsCut=20;
00077
00078 float vtxAry[]= {-150,-125,-100,-75,-50,-25,0,25,50,75,100,125,150};
00079 int nVtx = 12;
00080 float etaAry[][2] = { { .1,.3 }, {.5,.7}, {-.3,-.1}, {-.7,-.5}};
00081 int nEta = 4;
00082
00083
00084
00085
00086 for(int iEta=0; iEta<nEta; iEta++){
00087
00088
00089 sprintf(title,"fitpts (range %d-45), vtx z slices (%.1f < eta < %.1f) (cut %d)",
00090 fitPtsCut,etaAry[iEta][0],etaAry[iEta][1],cut);
00091 Divide(&c1,3,4,title,inName);
00092
00093
00094 for(int iVtx=0;iVtx<nVtx; iVtx++){
00095 c1.cd(iVtx+1);
00096 for(int i=0; i<2; i++){
00097 h2[i]=(TH2*)HistSlice(h3[i],"","",0,etaAry[iEta][0],etaAry[iEta][1],"xy");
00098 h1[i]=(TH1*)HistSlice(h2[i],"",h2[i]->GetTitle(),0,
00099 vtxAry[iVtx],vtxAry[iVtx+1],"x");
00100 SetRange(h1[i]->GetXaxis(),fitPtsCut,46);
00101 if(h1[i]->Integral()) h1[i]->Scale(1./h1[i]->Integral());
00102 h1[i]->SetMarkerSize(0.5); SetMinMax(h1[i],0.001,.12);
00103 h1[i]->SetMarkerStyle(marker[i]); h1[i]->Draw(opt[i]);
00104 PrintMeanRms(h1[i],0.1,0.8-.2*i,0.06);
00105 }
00106 }
00107 sprintf(name,"fitPtsVtxZSlicesEtaBin%d",iEta);
00108 Print(&c1,psDir,name);
00109 }
00110
00111
00112 sprintf(title,"mean fit pts (range %d-45) V vtx z (cut %d)",
00113 fitPtsCut,cut);
00114 Divide(&c1,2,2,title,inName);
00115
00116 for(int iEta=0; iEta<nEta; iEta++){
00117 c1.cd(iEta+1); gPad->SetGridx(); gPad->SetGridy();
00118 TLegend* l=new TLegend(0.1,0.1,0.3,0.2);
00119 for(int i=0; i<2; i++){
00120 h2[i]=(TH2*)HistSlice(h3[i],"","",0,etaAry[iEta][0],etaAry[iEta][1],"xy","e");
00121 p[i]=Profile(h2[i],"",h2[i]->GetTitle(),0,fitPtsCut,46,"y","e");
00122 SetMinMax(p[i],30,40);
00123 SetRange(p[i]->GetXaxis(),vtxAry[0],vtxAry[nVtx]);
00124 p[i]->SetMarkerStyle(marker[i]); p[i]->Draw(optp[i]);
00125 if(iEta==0){
00126 l->AddEntry(p[i],type[i],"p");
00127 }
00128
00129 }
00130 }
00131 sprintf(title,"fitPtsMeanVz");
00132 Print(&c1,psDir,title);
00133
00134 }
00135