6 #include "TGraphErrors.h"
22 Double_t f1=TMath::Exp((-(par[0]-x[0])*(par[0]-x[0]))/(2.*par[1]*par[1]));
23 Double_t f2=(x[0]-par[2])*(x[0]-par[2])+par[3]*par[3]/4.;
41 func->SetParameter(0,xx);
42 func->SetParameter(1,par[3]);
43 func->SetParameter(2,par[4]);
44 func->SetParameter(3,par[5]);
56 func->SetParameter(0,xx);
57 func->SetParameter(1,par[3]);
58 func->SetParameter(2,par[4]);
59 func->SetParameter(3,par[5]);
68 Double_t f2=(x[0]-par[1])*(x[0]-par[1])+par[2]*par[2]/4.;
81 fResponse->SetParameter(1,1./peaktobackground);
83 fResponse->FixParameter(3,beamresolution*1e-6);
85 fResponse->SetParameter(5,resonancewidth*1e-6);
92 for (Int_t
i=0;
i<
n;
i++)
102 Double_t xbins[15]={3.505, 3.523, 3.525, 3.5252, 3.5254, 3.5256, 3.5258, 3.5260, 3.5262, 3.5264, 3.5266, 3.5268, 3.527, 3.529, 3.545};
109 for (Int_t
i=0;
i<15;
i++)
111 masses[
i]=(xbins[
i]+xbins[
i+1])/2.;
115 sprintf(command,
"output_stat=%i_p2b=%i_pres=%i_width=%i.root",(
int) stat, (
int) peaktobackground, (
int) beamresolution, (
int) resonancewidth);
116 TFile *
f=
new TFile(command,
"RECREATE");
118 TH1D *hisData=
new TH1D(
"hisdata",
"",14,xbins);
119 TH1D *his=
new TH1D(
"his",
"",20,resonancewidth-10*beamresolution,resonancewidth+10*beamresolution);
120 TH1D *his2=
new TH1D(
"his2",
"",20,-resonancewidth*2e-7+(
xmin+
xmax)/2.,resonancewidth*2e-7+(
xmin+
xmax)/2.);
121 TH1D *hisxsq=
new TH1D(
"hisxsq",
"",30,0,5);
127 TGraphErrors *grData=
new TGraphErrors(14);
129 for (Int_t
i=0;
i<nroftests;
i++)
131 setShape(stat,peaktobackground,beamresolution,resonancewidth,resonancemass);
133 for (Int_t j=0; j<14; j++)
135 hisData->SetBinContent(j+1,counts[j]);
137 grData->SetPoint(j,masses[j],counts[j]);
140 cout <<
i <<
" of the " << nroftests << endl;
141 Int_t retval = hisData->Fit(
"fResponse",option);
151 cout <<
"Chisq = " << chisqr << endl;
152 cout <<
"Mass = " << (
Double_t) mass[0] <<
" +- " << (
Double_t) mass[1] <<
" GeV" << endl;
153 cout <<
"Width = " << (
Double_t) width[0] <<
" +- " << (
Double_t) width[1] <<
" keV" << endl;
156 hisxsq->Fill(chisqr);
167 for (Int_t
i=0;
i<6;
i++)
176 fBW->SetLineColor(kBlue);
184 cout <<
"Mass error " << 1e6*sumemass/((
Double_t) count) << endl;
185 cout <<
"Width error " << sumewidth/((
Double_t) count) << endl;
188 TH1D *dum=
new TH1D(
"dum",
"",100,
xmin,
xmax);
190 dum->SetMaximum(1.2*
fResponse->Eval(resonancemass));
193 fBW->SetParameter(0,val*
fBW->GetParameter(0));
Double_t val[nBoxes][nFEBox]
static T Sqrt(const T &x)
void setShape(Double_t stat, Double_t peaktobackground, Double_t beamresolution, Double_t resonancewidth, Double_t resonancemass)
void convolutionAnalysis(Int_t nroftests=1, Char_t option[]="LQN", Double_t stat=200, Double_t peaktobackground=8, Double_t beamresolution=50., Double_t resonancewidth=500., Double_t resonancemass=3.526, Int_t seed=0)
Double_t signalResponse(Double_t *x, Double_t *par)
Double_t pandaResponse(Double_t *x, Double_t *par)
Double_t nastyFunction(Double_t *x, Double_t *par)
friend F32vec4 fabs(const F32vec4 &a)
Double_t breitWigner(Double_t *x, Double_t *par)
void getCounts(Int_t n, Double_t *masses, Double_t *counts)