11 |
|
// in the range of the function. |
12 |
|
TH1D* getBand(TF1 *f, TMatrixD const& m, std::string name, bool getRelativeBand, int npx) { |
13 |
|
|
14 |
– |
Bool_t islog = false; |
14 |
|
double xmin = f->GetXmin(); |
15 |
|
double xmax = f->GetXmax()*1.1; //fixes problem in drawing with c option |
16 |
|
int npar = f->GetNpar(); |
18 |
|
// Create binning (linear or log) |
19 |
|
Double_t xvec[npx]; |
20 |
|
xvec[0] = xmin; |
21 |
< |
double dx = (islog ? pow(xmax/xmin, 1./npx) : (xmax-xmin)/npx); |
21 |
> |
double dx = (xmax-xmin)/npx; |
22 |
|
for (int i = 0; i != npx; ++i) { |
23 |
< |
xvec[i+1] = (islog ? xvec[i]*dx : xvec[i]+dx); |
23 |
> |
xvec[i+1] = xvec[i]+dx; |
24 |
|
} |
25 |
|
|
26 |
|
|
37 |
|
Double_t partDeriv[npar]; |
38 |
|
|
39 |
|
//compute partial derivatives of f wrt its parameters: |
40 |
< |
for( unsigned ipar=1; ipar<npar; ++ipar ) { |
40 |
> |
for( unsigned ipar=0; ipar<npar; ++ipar ) { |
41 |
|
|
42 |
|
Float_t pi = f->GetParameter(ipar); |
43 |
|
Float_t dpi = sqrt(m[ipar][ipar])*0.01; //small compared to the par sigma |
44 |
|
f->SetParameter(ipar, pi+dpi); |
45 |
< |
Float_t fplus = f->Eval(0.5*(xvec[ipx]+xvec[ipx-1])); |
45 |
> |
Float_t fplus = f->Eval(xvec[ipx]-0.5*dx); |
46 |
|
f->SetParameter(ipar, pi-dpi); |
47 |
< |
Float_t fminus = f->Eval(0.5*(xvec[ipx]+xvec[ipx-1])); |
47 |
> |
Float_t fminus = f->Eval(xvec[ipx]-0.5*dx); |
48 |
|
f->SetParameter(ipar, pi); //put it back as it was |
49 |
|
|
50 |
|
partDeriv[ipar] = (fplus-fminus)/(2.*dpi); |
59 |
|
} |
60 |
|
sigmaf[ipx] = sqrt(sigmaf[ipx]); //absolute band |
61 |
|
|
62 |
< |
h1_band->SetBinContent( ipx, f->Eval(0.5*(xvec[ipx]+xvec[ipx-1])) ); |
62 |
> |
h1_band->SetBinContent( ipx, f->Eval(xvec[ipx]-0.5*dx) ); |
63 |
|
if( getRelativeBand ) |
64 |
< |
h1_band->SetBinError( ipx, sigmaf[ipx]/f->Eval(0.5*(xvec[ipx]+xvec[ipx-1])) ); |
64 |
> |
h1_band->SetBinError( ipx, sigmaf[ipx]/f->Eval(xvec[ipx]-0.5*dx) ); |
65 |
|
else |
66 |
|
h1_band->SetBinError( ipx, sigmaf[ipx] ); |
67 |
|
|
77 |
|
TMatrixD emat_resp_q(ndim_resp_q, ndim_resp_q); |
78 |
|
gMinuit->mnemat(&emat_resp_q[0][0], ndim_resp_q); |
79 |
|
|
80 |
< |
return getBand(f, emat_resp_q, name,false,10); |
80 |
> |
return getBand(f, emat_resp_q, name,false,1000); |
81 |
|
} |
82 |
|
|