9 #include <CLHEP/Matrix/Matrix.h>
15 : m_dim(
dim), m_integrals(
dim,0),m_halfdChisqdX(
dim,0)
23 const CLHEP::HepSymMatrix& variance,
const CLHEP::HepVector&
residual )
25 int dimr =
weight.num_row() ;
26 CLHEP::HepMatrix derivtimesweight(deriv*
weight) ;
28 for(
int irow=1; irow<=dimr; ++irow) {
29 double thissigma = sqrt( variance.fast(irow,irow) ) ;
31 for(
int ipar=0; ipar<
m_dim; ++ipar) {
32 double thisweight = derivtimesweight(ipar+1, irow ) * thissigma ;
33 double thispull =
residual(irow) / thissigma ;
38 m_h2->Fill(
double(ipar), thispull, thisweight ) ;
59 static double sqrt2pi = sqrt(2*
M_PI) ;
69 CLHEP::HepVector halfDChisqDX(
m_dim,0) ;
72 for(
int ipar=1; ipar<=
m_dim; ++ipar) {
74 sprintf(hisname,
"tmph1_%d",ipar) ;
75 TH1* tmph1 =
m_h2->ProjectionY(hisname,ipar,ipar,
"e") ;
76 binwidth = tmph1->GetXaxis()->GetBinWidth(1) ;
77 tmph1->SetDirectory(
m_h2->GetDirectory()) ;
78 f1.SetParameter(0,tmph1->Integral());
79 f1.SetParLimits(0,0.5*tmph1->Integral(),2*tmph1->Integral()) ;
80 f1.SetParameter(1,0) ;
81 f1.SetParameter(2,tmph1->GetRMS()) ;
82 tmph1->Fit(&
f1,
"Q0I") ;
83 tmph1->GetListOfFunctions()->Add(
f1.Clone()) ;
84 halfDChisqDX(ipar) =
f1.GetParameter(1) *
m_integrals[ipar-1] ;
85 os <<
"fitresult: " <<
f1.GetParameter(1) <<
" weight: " <<
m_integrals[ipar-1] <<
" integrated mean: "