Changeset View
Changeset View
Standalone View
Standalone View
test/testDecayModel.cc
Show First 20 Lines • Show All 1,058 Lines • ▼ Show 20 Lines | for ( auto& [_, hist] : m_1DhistVect ) { | ||||
// Get equivalent reference histogram | // Get equivalent reference histogram | ||||
const TH1* refHist{ | const TH1* refHist{ | ||||
dynamic_cast<TH1*>( refFile->Get( histName.c_str() ) ) }; | dynamic_cast<TH1*>( refFile->Get( histName.c_str() ) ) }; | ||||
if ( refHist ) { | if ( refHist ) { | ||||
double chiSq{ 0.0 }; | double chiSq{ 0.0 }; | ||||
int nDof{ 0 }; | int nDof{ 0 }; | ||||
int iGood{ 0 }; | int iGood{ 0 }; | ||||
double pValue{ refHist->Chi2TestX( hist, chiSq, nDof, iGood, "WW" ) }; | const double pValue{ | ||||
refHist->Chi2TestX( hist, chiSq, nDof, iGood, "WW" ) }; | |||||
const double integral{ refHist->Integral() }; | |||||
std::cout << "Histogram " << histName << " chiSq/nDof = " << chiSq | std::cout << "Histogram " << histName << " chiSq/nDof = " << chiSq | ||||
<< "/" << nDof << ", pValue = " << pValue << std::endl; | << "/" << nDof << ", pValue = " << pValue | ||||
<< ", integral = " << integral << std::endl; | |||||
} else { | } else { | ||||
std::cerr << "Could not find reference histogram " << histName | std::cerr << "Could not find reference histogram " << histName | ||||
<< std::endl; | << std::endl; | ||||
} | } | ||||
} | } | ||||
for ( auto& [_, hist] : m_2DhistVect ) { | for ( auto& [_, hist] : m_2DhistVect ) { | ||||
const std::string histName{ hist->GetName() }; | const std::string histName{ hist->GetName() }; | ||||
// Get equivalent reference histogram | // Get equivalent reference histogram | ||||
const TH2* refHist{ | const TH2* refHist{ | ||||
dynamic_cast<TH2*>( refFile->Get( histName.c_str() ) ) }; | dynamic_cast<TH2*>( refFile->Get( histName.c_str() ) ) }; | ||||
if ( refHist ) { | if ( refHist ) { | ||||
double chiSq{ 0.0 }; | double chiSq{ 0.0 }; | ||||
int nDof{ 0 }; | int nDof{ 0 }; | ||||
int iGood{ 0 }; | int iGood{ 0 }; | ||||
double pValue{ refHist->Chi2TestX( hist, chiSq, nDof, iGood, "WW" ) }; | const double pValue{ | ||||
refHist->Chi2TestX( hist, chiSq, nDof, iGood, "WW" ) }; | |||||
const double integral{ refHist->Integral() }; | |||||
std::cout << "Histogram " << histName << " chiSq/nDof = " << chiSq | std::cout << "Histogram " << histName << " chiSq/nDof = " << chiSq | ||||
<< "/" << nDof << ", pValue = " << pValue << std::endl; | << "/" << nDof << ", pValue = " << pValue | ||||
<< ", integral = " << integral << std::endl; | |||||
} else { | } else { | ||||
std::cerr << "Could not find reference histogram " << histName | std::cerr << "Could not find reference histogram " << histName | ||||
<< std::endl; | << std::endl; | ||||
} | } | ||||
} | } | ||||
refFile->Close(); | refFile->Close(); | ||||
▲ Show 20 Lines • Show All 118 Lines • Show Last 20 Lines |