1 #include "commonmacro/common.h"
2 #include "common/Name.cc"
3 #include "commonmacro/histutil.h"
5 void makeMinbiasUA1Ratio(
7 "links/P01hi.minbias.2000.hist/hianalysis_1000.hist.root",
8 const char* psDir=
"ps",
10 const char* outDir=
"./",
11 const char* more =
"west",
12 float extraValue = 10)
14 cout <<
"--------------------------" << endl;
15 cout <<
"in name=" << inName << endl
16 <<
"ps dir=" << psDir << endl
17 <<
"cut=" << cut << endl;
18 cout <<
"--------------------------" << endl;
20 inRoot =
new TFile(inName);
23 cout <<
"cannot find the infile" << endl;
26 gStyle->SetOptStat(0);gStyle->SetPadTickX(1);gStyle->SetPadTickY(1);
27 TCanvas c1(
"c1",
"c1",500,400);
30 TGraphAsymmErrors* gSpec[2];
31 TGraphAsymmErrors* gSpecPM[2][2];
32 TGraphAsymmErrors* gUA1, *gRatio;
34 float min=0.0,max=1.2;
39 for(
int ibin=0;ibin<nbin;ibin++){
40 setName(name,
"gSpecCorrected",ibin);
41 gSpec[ibin]=(TGraphAsymmErrors*)inRoot.Get(name);
42 cout << gSpec[ibin]->GetName() << endl;
43 if(!gSpec[ibin])
return;
44 for(
int ipm=0;ipm<2;ipm++){
45 setName(name,
"gSpecCorrected",ibin,sPM[ipm].Data());
47 gSpecPM[ibin][ipm]=(TGraphAsymmErrors*)inRoot.Get(name);
48 if(!gSpecPM[ibin][ipm])
return;
52 for(
int ibin=0;ibin<2; ibin++){
53 cout <<
"setting title"<< endl;
54 sprintf(title,
"%s / UA1 (bin %d)(cut %d)",
55 gSpec[ibin]->GetName(),ibin,cut);
56 Divide(&c1,1,1,title,inName);
57 cout <<
"making" << endl;
58 gUA1=makeUA1(gSpec[ibin]);
59 cout <<
"done" << endl;
60 cout <<
"making ratio" << endl;
61 gRatio=makeRatio(gSpec[ibin],gUA1);
62 cout <<
"done " << endl;
64 double* x=gRatio->GetX();
double* y=gRatio->GetY();
65 double* exHigh=gRatio->GetEXhigh();
66 double* exLow =gRatio->GetEXlow();
67 double* ey=gRatio->GetEYhigh();
68 for(
int i=0; i<gRatio->GetN(); i++){
69 gRatio->SetPoint(i,x[i],y[i]*geom);
70 gRatio->SetPointError(i,exLow[i],exHigh[i],ey[i]*7200,ey[i]*7200);
76 sprintf(title,
"%sOverUA1",gSpec[ibin]->GetName());
77 gRatio->SetMaximum(max); gRatio->SetMinimum(min);
78 Print(&c1,psDir,title);
108 makeUA1(
const TGraphAsymmErrors* graph)
114 const Int_t nBin = graph->GetN();
115 Double_t* xValues = graph->GetX();
116 Double_t* yValues = graph->GetY();
117 Double_t* errXLow = graph->GetEXlow();
118 Double_t* errXHigh = graph->GetEXhigh();
136 sprintf(name,
"h1tmp%s",graph->GetName());
137 TH1D* h1 =
new TH1D(name,name,9,1.5,6.0);
139 h1->SetBinContent(1,.61467);
140 h1->SetBinContent(2,.58835);
141 h1->SetBinContent(3,.55895);
142 h1->SetBinContent(4,.52837);
143 h1->SetBinContent(5,.50290);
144 h1->SetBinContent(6,.47903);
145 h1->SetBinContent(7,.45747);
146 h1->SetBinContent(8,.43787);
147 h1->SetBinContent(9,.40195);
165 char func[200], mean[200];
167 sprintf(func,
"2*pi*%.1f*%.0f*(1+x/%.2f)^(-%.2f)",A,A_ion*A_ion,p0,n);
169 sprintf(mean,
"2*pi*x*%.1f*%.0f*(1+x/%.2f)^(-%.2f)",A,TAA,p0,n);
172 TF1* fUA1 =
new TF1(
"fUA1",func,lowPt,highPt);
173 TF1* fMean =
new TF1(
"fUA1Mean",mean,lowPt,highPt);
175 gUA1 =
new TGraphAsymmErrors;
177 for(Int_t i=0; i<nBin; i++){
181 Double_t lowEdge = xValues[i]-errXLow[i];
182 Double_t highEdge = xValues[i]+errXHigh[i];
185 Double_t num = fMean->Integral(lowEdge,highEdge);
186 Double_t denom = fUA1->Integral(lowEdge,highEdge);
192 Double_t UA1ErrLow = fabs(lowEdge-xValues[i]);
193 Double_t UA1ErrHigh= fabs(highEdge-xValues[i]);
196 double y = denom/(highEdge-lowEdge);
208 double yCorrected = y;
210 cout <<
"UA1 uncorrected " << y <<
", corrected y " << yCorrected
211 <<
" graph y " << yValues[i] << endl;
213 gUA1->SetPoint(i,xValues[i],yCorrected);
214 gUA1->SetPointError(i,UA1ErrLow,UA1ErrHigh,0,0);
217 gUA1->SetName(
"gUA1Spectrum");
218 gUA1->SetTitle(
"gUA1Spectrum");
225 makeRatio(TGraphAsymmErrors* gStar, TGraphAsymmErrors* gUA1)
227 cout <<
"********************************" << endl;
228 cout << gStar->GetName() << endl;
229 const Int_t nBin = gStar->GetN();
231 Double_t* starY = gStar->GetY();
232 Double_t* starX = gStar->GetX();
233 Double_t* starXErrLow = gStar->GetEXlow();
234 Double_t* starXErrHigh = gStar->GetEXhigh();
235 Double_t* starYErrHigh = gStar->GetEYhigh();
237 Double_t* ua1Y = gUA1->GetY();
238 Double_t* ua1YErrHigh = gUA1->GetEYhigh();
240 TGraphAsymmErrors* gRatio =
new TGraphAsymmErrors;
242 for(Int_t i=0; i<nBin; i++){
244 Double_t ratio = starY[i]/ua1Y[i];
247 TMath::Sqrt(ratio*ratio*(starYErrHigh[i]*starYErrHigh[i]/(starY[i]*starY[i])));
250 cout <<
"star x : " << starX[i] << endl;
251 cout <<
"star y : " << starY[i] <<
" ua1 Y : " << ua1Y[i]
252 <<
" ratio : " << ratio << endl
253 <<
"error : " << yError << endl;
255 gRatio->SetPoint(i,starX[i],ratio);
256 gRatio->SetPointError(i,starXErrLow[i],starXErrHigh[i],yError,yError);
259 TString sName = gStar->GetName();
260 sName.Append(
"UA1Ratio");
262 gRatio->SetName(sName.Data());
263 gRatio->SetTitle(sName.Data());