13   class HistoChisqProjection
 
   20     void add( 
const HepMatrix& deriv, 
const HepSymMatrix& 
weight,  
 
   21           const HepSymMatrix& variance, 
const HepVector& 
residual ) {
 
   27     void add( 
const HepMatrix& deriv, 
const HepSymMatrix& 
weight, 
 
   28           const HepSymMatrix& variance, 
const HepVector& 
residual, 
const HepSymMatrix& secondweight) {
 
   40     void addfirst( 
const HepMatrix& deriv, 
const HepSymMatrix& 
weight, 
const HepSymMatrix& variance, 
const HepVector& 
residual ) ;
 
   61                       const HepSymMatrix& variance, 
const HepVector& 
residual )
 
   63     int dimr = 
weight.num_row() ;
 
   64     HepMatrix derivtimesweight(deriv*
weight) ;
 
   66     for(
int irow=1; irow<=dimr; ++irow) {
 
   67       double thissigma = sqrt( variance.fast(irow,irow) ) ;
 
   69       for(
int ipar=0; ipar<
m_dim; ++ipar) {
 
   70     double thisweight = derivtimesweight(ipar+1, irow ) * thissigma ;
 
   71     double thispull   = 
residual(irow) / thissigma ;
 
   76     m_h2->Fill( 
double(ipar), thispull, thisweight ) ;
 
   97     static double sqrt2pi = sqrt(2*
M_PI) ;
 
  100     return norm * 
exp(-0.5*xi*xi) ;
 
  106     HepVector halfDChisqDX(
m_dim,0) ;
 
  109     for(
int ipar=1; ipar<=
m_dim; ++ipar) {
 
  111       sprintf(hisname,
"tmph1_%d",ipar) ;
 
  112       TH1* tmph1 = 
m_h2->ProjectionY(hisname,ipar,ipar,
"e") ; 
 
  113       binwidth = tmph1->GetXaxis()->GetBinWidth(1) ;
 
  114       tmph1->SetDirectory(
m_h2->GetDirectory()) ;
 
  115       f1.SetParameter(0,tmph1->Integral());
 
  116       f1.SetParLimits(0,0.5*tmph1->Integral(),2*tmph1->Integral()) ;
 
  117       f1.SetParameter(1,0) ;
 
  118       f1.SetParameter(2,tmph1->GetRMS()) ;
 
  119       tmph1->Fit(&
f1,
"Q0I") ;
 
  120       tmph1->GetListOfFunctions()->Add(
f1.Clone()) ;
 
  121       halfDChisqDX(ipar) = 
f1.GetParameter(1) * 
m_integrals[ipar-1] ;
 
  122       os << 
"fitresult: " << 
f1.GetParameter(1) << 
" weight: " << 
m_integrals[ipar-1] << 
" integrated mean: " 
  125     return halfDChisqDX ;