14 ,
const TMatrixTSym<double>& fc
20 , _needToRecalculate(true)
25 , _interferenceFracSumCov(1)
26 , _totalFractionSumCov(1)
27 , _dFitAmpPair_by_dFitParameters(1, fc.GetNcols())
28 , _dFraction_by_dFitAmpPair(1, 1)
29 , _dFractionSum_by_dFraction(1, 1)
30 , _dInterferenceFracSum_by_dFraction(1, 1)
31 , _dTotalFractionSum_by_dFraction(1, 1)
37 cout <<
"FitAmpPairFitCovariance constructor called with this cov matrix:" 43 : _myList(other._myList)
44 , _fitCov(other._fitCov)
45 , _Nevents(other._Nevents)
47 , _needToRecalculate(false)
48 , _pairCov(other._pairCov)
49 , _pairCorr(other._pairCorr)
50 , _fractionCov(other._fractionCov)
51 , _fractionSumCov(other._fractionSumCov)
52 , _interferenceFracSumCov(other._interferenceFracSumCov)
53 , _totalFractionSumCov(other._totalFractionSumCov)
54 , _dFitAmpPair_by_dFitParameters(other._dFitAmpPair_by_dFitParameters)
55 , _dFraction_by_dFitAmpPair(other._dFraction_by_dFitAmpPair)
56 , _dFractionSum_by_dFraction(other._dFractionSum_by_dFraction)
57 , _dInterferenceFracSum_by_dFraction(other._dInterferenceFracSum_by_dFraction)
58 , _dTotalFractionSum_by_dFraction(other._dTotalFractionSum_by_dFraction)
68 cout <<
"FitAmpPairFitCovariance::resize()" 69 <<
" resizing from " <<
size()
71 <<
" with maxSize() = " <<
maxSize() <<
"." 80 cout <<
"FitAmpPairFitCovariance::resize size() = " <<
size()
81 <<
" that's too big! won't do it!" << endl;
103 return (*
_myList)[i].name() +
"_real";
106 return (*
_myList)[i].name() +
"_imag";
112 if(dbThis) cout <<
"FitAmpPairFitCovariance::calculateAll" 113 <<
" making dFitAmpPair_by_dFitParameters" << endl;
116 if(dbThis) cout <<
"FitAmpPairFitCovariance::calculateAll" 117 <<
" making dFraction_by_dFitAmpPair" << endl;
120 if(dbThis) cout <<
"FitAmpPairFitCovariance::calculateAll" 121 <<
" making dFractionSum_by_dFraction" << endl;
124 if(dbThis) cout <<
"FitAmpPairFitCovariance::calculateAll" 125 <<
" making dInterferenceFrac_by_dFraction" << endl;
128 if(dbThis) cout <<
"FitAmpPairFitCovariance::calculateAll" 129 <<
" making dTotalFractionSum_by_dFraction" << endl;
132 if(dbThis) cout <<
"FitAmpPairFitCovariance::calculateAll" 133 <<
" making FitAmpPairCov" << endl;
135 if(dbThis) cout <<
"FitAmpPairFitCovariance::calculateAll" 136 <<
" making FractionCovariance" << endl;
138 if(dbThis) cout <<
"FitAmpPairFitCovariance::calculateAll" 139 <<
" making FractionSumCovariance" << endl;
141 if(dbThis) cout <<
"FitAmpPairFitCovariance::calculateAll" 142 <<
" making InterferenceFracSumCovariance" << endl;
144 if(dbThis) cout <<
"FitAmpPairFitCovariance::calculateAll" 145 <<
" making TotalFractionSumCovariance" << endl;
153 if(dbThis) cout <<
"FitAmpPairFitCovariance::" 154 <<
"make_dFitAmpPair_by_dFitParameters called" << endl;
190 complex<double> p = (*_myList)[i].complexVal();
191 complex<double> z1 = (*_myList)[i].fitAmp1().FitAmpPhase();
192 complex<double> z2 = (*_myList)[i].fitAmp2().FitAmpPhase();
193 complex<double> z2star(conj(z2));
194 complex<double> number_i(0, 1);
198 int index_1a = (*_myList)[i].fitAmp1().FitAmpPhase().p1().parSetIndex();
199 int index_1b = (*_myList)[i].fitAmp1().FitAmpPhase().p2().parSetIndex();
201 if(FitComplex::CARTESIAN == t1){
202 complex<double> dpdx1 = p/z1;
203 complex<double> dpdy1 = number_i * p / z1;
207 }
else if(FitComplex::POLAR == t1){
213 complex<double> r1 = abs(z1);
215 complex<double> dpdr1 = p/r1;
216 complex<double> dpdphi1 = number_i * p * degFac;
220 cout <<
"ERROR in FitAmpPairFitCovariance::" 221 <<
"make_dFitAmpPair_by_dFitParameters()" 222 <<
" don't know type of FitComplex in " 223 << (*_myList)[i].fitAmp1()
225 throw "shouldn't be possible";
229 int index_2a = (*_myList)[i].fitAmp2().FitAmpPhase().p1().parSetIndex();
230 int index_2b = (*_myList)[i].fitAmp2().FitAmpPhase().p2().parSetIndex();
239 if(FitComplex::CARTESIAN == t2){
240 complex<double> dpdx2 = p/z2star;
241 complex<double> dpdy2 = - number_i * p / z2star;
245 }
else if(FitComplex::POLAR == t2){
250 complex<double> r2 = abs(z2);
252 complex<double> dpdr2 = p/r2;
253 complex<double> dpdphi2 = - number_i * p *degFac;
257 cout <<
"ERROR in FitAmpPairFitCovariance::" 258 <<
"make_dFitAmpPair_by_dFitParameters()" 259 <<
" don't know type of FitComplex in " << (*_myList)[i].fitAmp2()
261 throw "shouldn't be possible";
269 if(dbThis) cout <<
"FitAmpPairFitCovariance::make_dFraction_by_dFitAmpPair()" 270 <<
" called" << endl;
287 double integ2 = integ*integ;
295 double num = (*_myList)[i].integral();
306 if(dbThis) cout <<
"FitAmpPairFitCovariance::make_dFractionSum_by_dFraction()" 307 <<
" called" << endl;
317 if((*
_myList)[i].isSingleAmp()){
328 if(dbThis) cout <<
"FitAmpPairFitCovariance::make_dInterferenceFracSum_by_dFraction()" 329 <<
" called" << endl;
339 if((*
_myList)[i].isSingleAmp()){
351 if(dbThis) cout <<
"FitAmpPairFitCovariance::" 352 <<
"make_dTotalFractionSum_by_dFraction()" 353 <<
" called" << endl;
379 cout <<
"FitAmpPairFitCovariance::makeFitAmpPairCov()" 380 <<
" _dFitAmpPair_by_dFitParameters(): " 383 cout <<
"and its transpose:" << endl;
384 dFitAmpPair_by_dFitParameters_Transpose.Print();
389 dFitAmpPair_by_dFitParameters_Transpose);
402 cout <<
"After " <<
_Nevents <<
"events" << endl;
403 cout <<
"Covariance Matrix N" << endl;
405 cout <<
"Correlation Matrix N" << endl;
416 TMatrixT<double> dFraction_by_dFitAmpPair_Transpose(cols,rows);
421 dFraction_by_dFitAmpPair_Transpose);
424 cout <<
"Correlation Matrix Fractions" << endl;
433 TMatrixT<double> dFractionSum_by_dFraction_Transpose(
size(), 1);
438 dFractionSum_by_dFraction_Transpose);
441 cout <<
"After " <<
_Nevents <<
"events" << endl;
442 cout <<
"Covariance Matrix for FractionSum" << endl;
451 TMatrixT<double> dInterferenceFracSum_by_dFraction_Transpose(
size(), 1);
456 dInterferenceFracSum_by_dFraction_Transpose);
459 cout <<
"After " <<
_Nevents <<
"events" << endl;
460 cout <<
"Covariance Matrix for FractionSum" << endl;
470 TMatrixT<double> dTotalFractionSum_by_dFraction_Transpose(
size(), 1);
475 dTotalFractionSum_by_dFraction_Transpose);
478 cout <<
"After " <<
_Nevents <<
"events" << endl;
479 cout <<
"Covariance Matrix for TotalFractionSum" << endl;
488 if(i < 0 || i >=
_pairCov.GetNrows() )
return -9999.0;
489 if(j < 0 || j >=
_fractionCov.GetNcols() )
return -9999.0;
495 cout <<
"ERROR in FitAmpPairFitCovariance::getPairError" 496 <<
" variance is " << V <<
" which is < 0." 497 <<
" will return -9999." 506 if(i < 0 || i >=
_fractionCov.GetNcols() )
return -9999.0;
507 if(i < 0 || i >=
_fractionCov.GetNrows() )
return -9999.0;
513 cout <<
"ERROR in FitAmpPairFitCovariance::getFractionError" 514 <<
" variance is " << V <<
" which is < 0." 515 <<
" will return -9999." 530 if(V < 0)
return -sqrt(-V);
540 cout <<
"ERROR in FitAmpPairFitCovariance::getInterferenceFracSumError" 541 <<
" variance is " << V <<
" which is < 0." 556 cout <<
"ERROR in FitAmpPairFitCovariance::getFractionSumError" 557 <<
" variance is " << V <<
" which is < 0." 566 if(
size() <= 0)
return false;
567 if((
unsigned int)
_pairCov.GetNcols() !=
size())
return false;
TMatrixTSym< double > _fitCov
TMatrixTSym< double > _totalFractionSumCov
TMatrixTSym< double > _fractionCov
const FitAmpPairList * _myList
bool makeFractionCovariance()
TMatrixTSym< double > _interferenceFracSumCov
TMatrixTSym< double > _pairCorr
double getFractionSumError()
bool make_dFitAmpPair_by_dFitParameters()
double getInterferenceFracSumError()
bool make_dFractionSum_by_dFraction()
TMatrixTSym< double > _pairCov
TMatrixTSym< T > makeTMatrixTSym(const TMatrixT< T > &m)
double getInterferenceFracSumVariance()
double getPairVariance(int i, int j)
bool makeFractionSumCovariance()
TMatrixT< double > _dTotalFractionSum_by_dFraction
TMatrixT< double > _dFractionSum_by_dFraction
double getTotalFractionSumVariance()
double getTotalFractionSumError()
virtual double integral() const
double getFractionSumVariance()
FitAmpPairFitCovariance(const FitAmpPairList *myList, const TMatrixTSym< double > &fitCov)
double getFractionVariance(int i)
unsigned int maxSize() const
TMatrixT< double > _dFitAmpPair_by_dFitParameters
unsigned int size() const
TMatrixT< double > _dInterferenceFracSum_by_dFraction
std::string realName(int i) const
bool make_dTotalFractionSum_by_dFraction()
bool makeTotalFractionSumCovariance()
bool make_dFraction_by_dFitAmpPair()
static unsigned int _maxSize
unsigned int size() const
double getFractionError(int i)
double getPairError(int i, int j)
bool makeInterferenceFracSumCovariance()
TMatrixTSym< double > _fractionSumCov
TMatrixT< double > _dFraction_by_dFitAmpPair
std::string imagName(int i) const
bool make_dInterferenceFracSum_by_dFraction()