ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/cbrown/Development/Plotting/Modules/PandiTools.C
(Generate patch)

Comparing UserCode/cbrown/Development/Plotting/Modules/PandiTools.C (file contents):
Revision 1.1 by buchmann, Mon Mar 18 16:06:07 2013 UTC vs.
Revision 1.3 by buchmann, Tue Apr 23 20:02:30 2013 UTC

# Line 11 | Line 11
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();
# Line 19 | Line 18 | TH1D* getBand(TF1 *f, TMatrixD const& m,
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  
# Line 43 | Line 42 | TH1D* getBand(TF1 *f, TMatrixD const& m,
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(xvec[ipx]);
45 >      Float_t fplus = f->Eval(xvec[ipx]-0.5*dx);
46        f->SetParameter(ipar, pi-dpi);
47 <      Float_t fminus = f->Eval(xvec[ipx]);
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);
# Line 60 | Line 59 | TH1D* getBand(TF1 *f, TMatrixD const& m,
59      }
60      sigmaf[ipx] = sqrt(sigmaf[ipx]); //absolute band
61  
62 <    h1_band->SetBinContent( ipx, f->Eval(xvec[ipx]) );
62 >    h1_band->SetBinContent( ipx, f->Eval(xvec[ipx]-0.5*dx) );
63      if( getRelativeBand )
64 <      h1_band->SetBinError( ipx, sigmaf[ipx]/f->Eval(xvec[ipx]) );
64 >      h1_band->SetBinError( ipx, sigmaf[ipx]/f->Eval(xvec[ipx]-0.5*dx) );
65      else
66        h1_band->SetBinError( ipx, sigmaf[ipx] );
67  
# Line 78 | Line 77 | TH1D* getBand( TF1* f, const std::string
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,50);
80 >   return getBand(f, emat_resp_q, name,false,1000);
81   }
82  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines