00001 #include "commonmacro/common.h"
00002 #include "commonmacro/histutil.h"
00003 #include "common/Name.cc"
00004
00005 void spectra(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 cout << "--------------------------" << endl;
00014 cout << "in name=" << inName << endl
00015 << "ps dir=" << psDir << endl
00016 << "cut=" << cut << endl;
00017 cout << "--------------------------" << endl;
00018
00019
00020
00021 TFile* inRoot;
00022 inRoot = new TFile(inName);
00023 if(!inRoot){
00024 cout << "cannot find the infile" << endl;
00025 return;
00026 }
00027
00028 TH1* h1[2]; TH1* ha[2]; TH1* hRatio;
00029 TGraphAsymmErrors* g;
00030
00031 TCanvas c1("c1","c1",400,500);
00032 float minpt=2,maxpt=6;
00033
00034
00035 const int nBin=2; const int nBase=1; const int nCharge=3;
00036 char* baseName[] = {"gSpecCorrected","gSpecCorrected" };
00037 char* baseTitle[] = { "raw","corrected"};
00038 char* charge[] = { 0,"Plus","Minus"};
00039 int markerStyle[] = {4,8,2};
00040 float min=1e-5,max=10.;
00041
00042 gStyle->SetOptStat(0);
00043 gStyle->SetTitleBorderSize(0);
00044 for(int iBin=0; iBin<nBin; iBin++){
00045 for(int iCharge=0; iCharge<nCharge; iCharge++){
00046
00047 sprintf(title,"bin %d %s (cut %d)",
00048 iBin,charge[iCharge],cut);
00049
00050
00051 c1.Clear();c1.cd(1); gPad->SetTickx(); gPad->SetTicky();
00052 gPad->SetGridx(); gPad->SetGridy();
00053 gPad->SetLogy();
00054
00055 for(int iBase=0; iBase<nBase; iBase++){
00056 setName(name,baseName[iBase],iBin,charge[iCharge]);
00057 g=(TGraphAsymmErrors*)inRoot->Get(name);
00058 g->SetMinimum(min); g->SetMaximum(max);
00059 sTitle=g->GetTitle();
00060 g->SetTitle(title);
00061 g->Draw("ap");
00062 }
00063 sprintf(title,"%s",g->GetTitle());
00064 Print(&c1,psDir,sTitle.Data());
00065
00066 }
00067 }
00068 }
00069