ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/JetFitAnalyzer/src/jetfit.cpp
(Generate patch)

Comparing UserCode/JetFitAnalyzer/src/jetfit.cpp (file contents):
Revision 1.7 by dnisson, Tue Nov 10 01:25:48 2009 UTC vs.
Revision 1.9 by dnisson, Tue Nov 10 17:03:15 2009 UTC

# Line 83 | Line 83 | namespace jetfit {
83      return val;
84    }
85  
86 <  // Integral of model formula / chisquare sigma
86 >  // Integral of (model formula)^2 / chisquare sigma
87    double formula_int(double xlo, double xhi, double ylo, double yhi,
88                       double *pval, double XbinSize, double YbinSize,
89                       double *xval) {
# Line 558 | Line 558 | namespace jetfit {
558                                  sub_energy[0].size(), energy.Ylo,
559                                  energy.Yhi);
560        fill_histo_with_vec(hist_sub, sub_energy);
561 <      max_sub = hist_sub->GetSumOfWeights();
562 <      max_x = hist_sub->GetMean(1);
563 <      max_y = hist_sub->GetMean(2);
561 >      max_sub = 0.0;
562 >      max_x = 0.0;
563 >      max_y = 0.0;
564 >      for (int i = 1; i <= hist_sub->GetXaxis()->GetNbins(); i++) {
565 >        for (int j = 1; j <= hist_sub->GetYaxis()->GetNbins(); j++) {
566 >          double nu = energy.bins[i-1][j-1] - sub_energy[i-1][j-1];
567 >          if (hist_sub->GetBinContent(i, j)
568 >              - 3.0*pow(mdef->chisquare_error(nu), 2.0) > max_sub) {
569 >            max_sub = hist_sub->GetBinContent(i, j);
570 >            max_x = static_cast<double>(i-1)*XbinSize
571 >              + hist_sub->GetXaxis()->GetXmin();
572 >            max_y = static_cast<double>(j-1)*YbinSize
573 >              + hist_sub->GetYaxis()->GetXmin();
574 >          }
575 >        }
576 >      }  
577  
578        for (int i = npar1; i < npar; i++) {
579          if (mdef->get_indiv_max_E() == i - npar1) {
580 <          double nu = 0.0;
568 <          if (ngauss > 1) {
569 <            ngauss--;
570 <            nu = fit_fcn(max_x, max_y, pval_other) * XbinSize * YbinSize;
571 <            ngauss++;
572 <          }
573 <          pval[i] = max_sub;
580 >          pval[i] = max_sub / XbinSize / YbinSize;
581            perr[i] = mdef->chisquare_error(pval[i])*0.5;
582            plo[i] = 0.0;
583            phi[i] = 1.0e6;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines