15#include "EvtGenBase/EvtHis2F.hh"
46 HMC=(TH2F*) H2->Clone(
"HMC");
51 HDATA=(TH2F*) H2->Clone(
"HDATA");
68 TAxis* Xaxis=h2->GetXaxis();
69 TAxis* Yaxis=h2->GetYaxis();
71 int bx =Xaxis->GetLast();
72 int by =Yaxis->GetLast();
74 for(
int i=1;i<bx+1;i++){
75 for(
int j=1;j<by+1;j++){
76 int ij=h2->GetBin(i,j);
77 double xij=h2->GetBinContent(ij);
78 std::cout<<
"i,j,cell,value "<<i<<
" "<<j<<
" "<<ij<<
" "<<xij<<std::endl;
84 TAxis* Xaxis=h2->GetXaxis();
85 TAxis* Yaxis=h2->GetYaxis();
87 int bx =Xaxis->GetLast();
88 int by =Yaxis->GetLast();
90 double x1 =Xaxis->GetBinLowEdge(1);
91 double y1 =Yaxis->GetBinLowEdge(1);
92 double x2 =Xaxis->GetBinUpEdge(bx);
93 double y2 =Yaxis->GetBinUpEdge(by);
94 std::cout<<
"N_x, x_low, x_up; N_y, y_low, y_up "
95 <<bx<<
" "<<x1<<
" "<<x2<<
" "<<by<<
" "<<y1<<
" "<<y2<<std::endl;
103 HDATA = (TH2F*)dataf.Get(htitle);
105 double ndata=HDATA->Integral();
106 std::cout<<
"Number events in HDATA= "<<ndata<<std::endl;
108 TAxis* Xaxis=HDATA->GetXaxis();
109 TAxis* Yaxis=HDATA->GetYaxis();
111 BINSx =Xaxis->GetLast();
112 BINSy =Yaxis->GetLast();
114 xlow=Xaxis->GetBinLowEdge(1);
115 ylow=Yaxis->GetBinLowEdge(1);
116 xup =Xaxis->GetBinUpEdge(BINSx);
117 yup =Yaxis->GetBinUpEdge(BINSy);
119 std::cout<<
"BINSx,xlow,xup,BINSy,ylow,yup: "<<BINSx<<
" ,"<<xlow<<
", "<<xup<<
", "<<BINSy<<
", "<<ylow<<
", "<<yup<<std::endl;
120 HMC =
new TH2F(
"myHMC",
"",BINSx,xlow,xup,BINSy,ylow,yup);
121 HWT =
new TH2F(
"myHWT",
"",BINSx,xlow,xup,BINSy,ylow,yup);
122 HMC ->SetDirectory(0);
123 HWT ->SetDirectory(0);
124 HDATA->SetDirectory(0);
130 HMC->Fill(m12s,m13s,1.0);
138 std::cout<<
"Now I reweight the MC to the data Dalitz Plot"<<std::endl;
139 double ndata=HDATA->Integral();
140 std::cout<<
"Number events in Dalitz plot = "<<ndata<<std::endl;
141 double nmc=HMC->Integral();
142 std::cout<<
"Number of events in HMC reweight= "<<nmc<<std::endl;
143 HWT->Divide(HDATA,HMC);
144 ndata=HWT->Integral();
145 std::cout<<
"Number of events after reweight= "<<ndata<<std::endl;
146 double norm=nmc/ndata;
149 std::cout<<
"Number of events in HMC after scale= "<<nmc<<std::endl;
153 TAxis* Xaxis=h2->GetXaxis();
154 TAxis* Yaxis=h2->GetYaxis();
155 BINSx =Xaxis->GetLast();
156 BINSy =Yaxis->GetLast();
157 xlow=Xaxis->GetBinLowEdge(1);
158 ylow=Yaxis->GetBinLowEdge(1);
159 xup =Xaxis->GetBinUpEdge(BINSx);
160 yup =Yaxis->GetBinUpEdge(BINSy);
166 for(
int dx=1;dx <= BINSx;dx++){
167 for(
int dy=1;dy <= BINSy;dy++){
168 int nxy=hwt->GetBin(dx,dy);
169 double ncell=hwt->GetBinContent(nxy);
170 if(ncell<=0)
continue;
171 if(ncell>ymax){ymax=ncell;}
181 for(
int dx=1;dx <= BINSx;dx++){
182 for(
int dy=1;dy <= BINSy;dy++){
183 int nxy=HWT->GetBin(dx,dy);
184 double ncell=HWT->GetBinContent(nxy);
185 if(ncell<=0)
continue;
186 if(ncell>ymax){ymax=ncell;}
197 int xbin = HWT->GetXaxis()->FindBin(xmass2);
198 int ybin = HWT->GetYaxis()->FindBin(ymass2);
199 int xybin= HWT->GetBin(xbin,ybin);
200 double zvalue=HWT->GetBinContent(xybin);
209 if(xmass2<xlow || xmass2>xup || ymass2<ylow || ymass2>yup) {
return accept;}
211 double ratio=zvalue/zmax;
214 if(ratio > rndm){accept=
true;}
else {accept=
false;}
223 if(xmass2<xlow || xmass2>xup || ymass2<ylow || ymass2>yup) {
return accept;}
224 int xbin = h2->GetXaxis()->FindBin(xmass2);
225 int ybin = h2->GetYaxis()->FindBin(ymass2);
226 int xybin= h2->GetBin(xbin,ybin);
227 double zvalue=h2->GetBinContent(xybin);
229 double ratio=zvalue/zmax;
232 if(ratio > rndm){accept=
true;}
else {accept=
false;}
bool AR(double xmass2, double ymass2)
void HFill(double xmass2, double ymass2)
void setHTitle(const char *htitle)
double getZvalue(double m12_square, double m13_square)
void setFile(const char *dtfile)