5 doRatio(TString fill=
"F2201x", TString wrkDir=
"./") {
9 gStyle->SetPalette(1,0);
10 gStyle->SetOptStat(0);
12 TString fname=wrkDir+
"/"+fill+
".hist.root";
14 inpH=
new TFile(fname);
17 printf(
" %s not exits \n",fname.Data());
20 printf(
" %s opened \n",fname.Data());
25 fname.ReplaceAll(
"F",
"rF");
26 outH=
new TFile(fname,
"recreate");
27 if(outH->IsZombie()==kTRUE) {
28 printf(
"WARN file %s not created\n",fname.Data());
33 double PI=3.141592654;
35 ff =
new TF1(
"fCos012",Cos012,-PI ,PI,3);
36 ff->SetParameters(0,0,0); ff->SetParNames(
"a0",
"a1",
"a2");
41 ff->SetLineColor(kGreen);
45 char *cutL=
"All Pt1 Pt2 Pt3 Pt4 Pt5 Pt6 PtL PtM PtH EtaBB EtaBc EtaFc EtaFF Qpos Qneg";
49 char *cut=strtok(cutL,
" ");
52 int err=calcRatio(cut,hr);
56 }
while(cut=strtok(0,
" "));
65 void plotRatio(TString fill1, TH1F **hr){
66 c=
new TCanvas(fill1,fill1);
70 TLine *ln1=
new TLine(-3.14,0.,3.14,0.);
72 TGraphErrors *gr=
new TGraphErrors;
79 TF1 *ff=hr[k]->GetFunction(
"fCos012");
83 double val=ff->GetParameter(i);
84 double err=ff->GetParError(i);
86 gr->SetPoint(n,i+1+5*k,val);
87 gr->SetPointError(n,.0,err);
94 gr->SetMarkerSize(1.3);
95 gr->SetMarkerColor(4);
96 gr->SetMarkerStyle(21);
97 gr->SetTitle(
"Fit params: #2=Ay*P #7=-Ay*Q #11=A#Sigma*P*Q #13=A#Delta*P*Q");
102 ax->SetLimits(x1,x2);
103 TLine *ln0=
new TLine(x1,0.,x2,0.);
104 ln0->SetLineColor(kBlue);
115 void fitRatio( TH1F **hr){
116 c=
new TCanvas(
"aa",
"aa",50,100);
120 hr[k]-> Fit(
"fCos012");
121 TF1 *ff=hr[k]->GetFunction(
"fCos012");
123 if(k==0) ff->SetParNames(
"a0",
"a1",
"a2");
124 if(k==1) ff->SetParNames(
"b0",
"b1",
"b2");
125 if(k==2) ff->SetParNames(
"c0",
"c1",
"c2");
132 int calcRatio(
char *cut, TH1F **hr){
134 printf(
"doRatio for cut='%s'\n",cut);
137 char *cpolBY[mxPol]={
"B+Y+",
"B+Y-",
"B-Y+",
"B-Y-"};
145 for(k=0;k<mxPol;k++) {
147 sprintf(name,
"Phi%2s%s",cpolBY[k],cut);
148 h[k]=(TH1F *)inpH->Get(name);
150 sum1+=h[k]->Integral();
151 printf(
"%s int=%f min=%f\n",name,h[k]->Integral(),h[k]->GetMinimum());
152 if(h[k]->GetMinimum()<minContent)
return -1;
155 TAxis *phiAx=h[0]->GetXaxis();
163 sprintf(name,
"r%d*%s",k+1,cut);
164 char tit2[100]={
"aaa bbb"};
165 sprintf(tit2,
"R%d(#phi), LCP cut=%s, Neve=%.0f",k+1,cut,sum1);
166 hr[k]=
new TH1F(name,tit2,phiAx->GetNbins(),phiAx->GetXmin(), phiAx->GetXmax());
173 for(iph=1;iph<=phiAx->GetNbins();iph++) {
174 float m[mxPol], v[mxPol];
177 for(k=0;k<mxPol;k++){
178 m[k]=h[k]->GetBinContent(iph);
179 v[k]=h[k]->GetBinError(iph);
183 for(
int ir=0;ir<mxR;ir++) {
186 double s,s1,s2,r=900.,vs1,vs2;
189 s1 =m[0]+m[2]; s2=m[1]+m[3];
190 vs1=v[0]+v[2]; vs2=v[1]+v[3];
193 s1 =m[0]+m[1]; s2=m[2]+m[3];
194 vs1=v[0]+v[1]; vs2=v[2]+v[3];
197 s1 =m[0]+m[3]; s2=m[1]+m[2];
198 vs1=v[0]+v[3]; vs2=v[1]+v[2];
201 printf(
"wrong ir=%d\n",ir); assert(1==2);
206 printf(
"iph=%d s1=%f s2=%f s=%f \n",iph,s1,s2,s);
212 double vr = 4*( s2*s2*vs1 + s1*s1*vs2 )/s/s/s/s;
214 h3->SetBinContent(iph,r);
215 h3->SetBinError(iph,sqrt(vr));
220 printf(
"sum=%f sum1=%f r=%f\n",sum,sum1,sum/sum1);
235 Double_t Cos012(Double_t *x, Double_t *par)
237 float PI=3.141592654;
245 Double_t f =A0 +A1*cos(phi-phi0) + A2*cos(2*(phi-phi0));