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.4 by dnisson, Wed Sep 9 15:17:45 2009 UTC vs.
Revision 1.5 by dnisson, Wed Sep 23 03:12:15 2009 UTC

# Line 483 | Line 483 | namespace jetfit {
483      }
484    }
485  
486 +  void fill_histo_with_vec(TH2 *hist, vector< vector<double> > &vec) {
487 +    for (int i = 0; i < vec.size(); i++) {
488 +      for (int j = 0; j < vec[i].size(); j++) {
489 +        hist->Fill(i+1, j+1, vec[i][j]);
490 +      }
491 +    }
492 +  }
493 +
494    void par_init(TH2 *hist, TMinuit *gMinuit, vector<TString> &pars,
495                  double *pval, double *perr, double *plo, double *phi,
496                  int npar, results r) {
# Line 543 | Line 551 | namespace jetfit {
551            else {
552              sub_energy[i][j] = energy.bins[i][j];
553            }
546          if (sub_energy[i][j] > max_sub) {
547            max_sub = sub_energy[i][j];
548            max_x = x;
549            max_y = y;
550          }
554          }
555        }
556 +      TH2D *hist_sub = new TH2D("hist_sub", "Subtracted histo",
557 +                                sub_energy.size(), energy.Xlo,
558 +                                energy.Xhi,
559 +                                sub_energy[0].size(), energy.Ylo,
560 +                                energy.Yhi);
561 +      fill_histo_with_vec(hist_sub, sub_energy);
562 +      max_sub = hist_sub->GetSumOfWeights();
563 +      max_x = hist_sub->GetMean(1);
564 +      max_y = hist_sub->GetMean(2);
565  
566        for (int i = npar1; i < npar; i++) {
567          if (mdef->get_indiv_max_E() == i - npar1) {
# Line 559 | Line 571 | namespace jetfit {
571              nu = fit_fcn(max_x, max_y, pval_other) * XbinSize * YbinSize;
572              ngauss++;
573            }
574 <          pval[i] = (max_sub + (ngauss > 1 ? 2.2*mdef->chisquare_error(nu)
563 <                               : 0.0)
564 <                     - mdef->chisquare_error(nu))
565 <            * 2.0 * PI * 0.01 / XbinSize / YbinSize;
574 >          pval[i] = max_sub;
575            perr[i] = mdef->chisquare_error(pval[i])*0.5;
576            plo[i] = 0.0;
577            phi[i] = 1.0e6;
# Line 671 | Line 680 | namespace jetfit {
680  
681        // initialize parameters
682        par_init(hist, gMinuit, pars, pval, perr, plo, phi, npar, r);
683 <  
683 >
684        // minimize
685        double chisquare, edm, errdef;
686        int nvpar, nparx;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines