1 #include "commonmacro/common.h"
2 #include "commonmacro/histutil.h"
3 #include "common/Name.cc"
5 void divideSpectra(
const char* inName=
6 "links/P01hi.minbias.2000.hist/hianalysis_1000.hist.root",
7 const char* psDir=
"ps",
9 const char* outDir=
"./",
10 const char* more =
"west",
13 cout <<
"--------------------------" << endl;
14 cout <<
"in name=" << inName << endl
15 <<
"ps dir=" << psDir << endl
16 <<
"cut=" << cut << endl;
17 cout <<
"--------------------------" << endl;
22 inRoot =
new TFile(inName);
24 cout <<
"cannot find the infile" << endl;
29 TGraphAsymmErrors* g[2];
31 TCanvas c1(
"c1",
"c1",400,500);
32 float minpt=2,maxpt=6;
35 char* charge[] = { 0,
"Plus",
"Minus"};
37 float ratioMin=0.2,ratioMax=1.5;
38 float ptMin=2,ptMax=6;
40 char name1[100],name2[100];
44 {
"h1Raw",
"h1EffCorrected"},
45 {
"h1Corrected",
"h1EffCorrected"}
49 gStyle->SetOptStat(0); gStyle->SetTitleBorderSize(0);
50 gStyle->SetPadTickY(1); gStyle->SetPadTickX(1);
58 for(
int ib=0; ib<nBin; ib++){
59 for(
int ic=0; ic<nCharge; ic++){
61 sprintf(title,
"spectra ratios (binning %d, cut %d)",cut);
62 Divide(&c1,nx,ny,title,inName);
64 for(
int ip=0; ip<nPair; ip++){
65 c1.cd(ip+1); gPad->SetGridx(); gPad->SetGridy();
66 setName(name1,namePair[ip][0],ib,charge[ic]);
67 cout << name1 <<
"\t";
68 h1[0]=(TH1*)inRoot->Get(name1);
69 setName(name2,namePair[ip][1],ib,charge[ic]);
70 cout << name2 << endl;
71 h1[1]=(TH1*)inRoot->Get(name2);
73 sprintf(title,
"%s / %s",name1,name2);
74 cout << h1[0]->GetBinContent(5)
75 <<
"\t" << h1[1]->GetBinContent(5) << endl;
78 h1[0]->SetTitle(title);
81 h1[0]->SetAxisRange(ptMin,ptMax-.00001);
83 h1[0]->SetMinimum(); h1[0]->SetMaximum(1.2);
87 sprintf(title,
"bin%d.divideSpectra",ib);
89 sprintf(title,
"bin%d.%s.divideSpectra",ib,ic);
90 Print(&c1,psDir,title);