diff --git a/tests/regular-tests/900HorrifyingCovCheck.C b/tests/regular-tests/900HorrifyingCovCheck.C index c4eab7ae..c429c6b2 100755 --- a/tests/regular-tests/900HorrifyingCovCheck.C +++ b/tests/regular-tests/900HorrifyingCovCheck.C @@ -86,35 +86,59 @@ int main() { "/postFitErrors_TH1D")); EXPECT("postFitErrors must exist", postFitErrorsHesse); + TMatrixD* cov + = dynamic_cast(file->Get( + "FitterEngine" + "/postFit" + "/Hesse" + "/errors" + "/Horrifying" + "/matrices" + "/Covariance_TMatrixD")); + EXPECT("covariance must exist", cov); + // Don't try to continue if the data is missing from the file. if (not postFitErrorsMigrad) return status; if (not postFitErrorsHesse) return status; + if (not cov) return status; + + cov->Print(); + + double correlation = (*cov)(0,1); + correlation /= std::sqrt((*cov)(0,0)); + correlation /= std::sqrt((*cov)(1,1)); + + std::cout << "Correlation " << correlation << std::endl; postFitErrorsMigrad->Draw(); gPad->Print("900HorrifyingCovCheck.pdf["); + postFitErrorsMigrad->Draw(); + gPad->Print("900HorrifyingCovCheck.pdf"); postFitErrorsHesse->Draw(); gPad->Print("900HorrifyingCovCheck.pdf"); gPad->Print("900HorrifyingCovCheck.pdf]"); // Change this to set the expected absolute tolerance. - double tolerance = 1E-3; + double valueTolerance = 1E-3; + double correlationTolerance = 1E-3; // The expected values are for the data generated by // 100NormalizationTree.C. They need to be changed if that tree is // changed. TOLERANCE("Check MIGRAD value for #0_Norm_A", - postFitErrorsMigrad->GetBinContent(1), 1.0, tolerance); + postFitErrorsMigrad->GetBinContent(1), 1.0, valueTolerance); TOLERANCE("Check HESSE value for #0_Norm_A", - postFitErrorsHesse->GetBinContent(1), 1.0, tolerance); - TOLERANCE("Check HESSE error for #0_Norm_A", - postFitErrorsHesse->GetBinError(1), 0.21213, 0.05); + postFitErrorsHesse->GetBinContent(1), 1.0, valueTolerance); TOLERANCE("Check MIGRAD value for #1_Norm_B", - postFitErrorsMigrad->GetBinContent(2), 1.0, tolerance); + postFitErrorsMigrad->GetBinContent(2), 1.0, valueTolerance); TOLERANCE("Check HESSE value for #1_Norm_B", - postFitErrorsHesse->GetBinContent(2), 1.0, tolerance); - TOLERANCE("Check HESSE error for #0_Norm_B", - postFitErrorsHesse->GetBinError(2), 0.21213, 0.05); + postFitErrorsHesse->GetBinContent(2), 1.0, valueTolerance); + + TOLERANCE("Check HESSE correlation between #0_Norm_A and #0_Norm_B", + correlation, -1.0, correlationTolerance); + + file->Close();