#include <TestHistoMgr.h>
Public Member Functions | |
bool | addHisto1 (TH1F *ih) |
bool | addHisto2 (TH2F *ih) |
bool | addHistoProf1 (TProfile *ih) |
bool | addHistoProf2 (TProfile2D *ih) |
TH1F * | getHisto1 (int ih) |
TH1F * | getHisto1FromSecondFile (const char *hnam) |
TH2F * | getHisto2 (int ih) |
TProfile * | getHistoProf1 (int ih) |
TProfile2D * | getHistoProf2 (int ih) |
void | openSecondFile (const std::string &name) |
void | printComparisonResult (int ih) |
void | save (const std::string &name) |
TestHistoMgr () | |
~TestHistoMgr () | |
Private Attributes | |
TFile * | theFileRef |
mihp1 | theHistoProfs1 |
mihp2 | theHistoProfs2 |
mih1 | theHistos1 |
mih2 | theHistos2 |
Definition at line 20 of file TestHistoMgr.h.
TestHistoMgr::TestHistoMgr | ( | ) |
Definition at line 19 of file TestHistoMgr.cc.
{
// pi_aida::Proxy_Selector::setHistogramType(pi_aida::Histogram_Native);
}
TestHistoMgr::~TestHistoMgr | ( | ) |
Definition at line 27 of file TestHistoMgr.cc.
References theHistoProfs1, theHistoProfs2, theHistos1, and theHistos2.
{ mih1::const_iterator ite1; mih2::const_iterator ite2; mihp1::const_iterator itep1; mihp2::const_iterator itep2; for( ite1 = theHistos1.begin(); ite1 != theHistos1.end(); ite1++ ){ delete (*ite1).second; } for( ite2 = theHistos2.begin(); ite2 != theHistos2.end(); ite2++ ){ delete (*ite2).second; } for( itep1 = theHistoProfs1.begin(); itep1 != theHistoProfs1.end(); itep1++ ){ delete (*itep1).second; } for( itep2 = theHistoProfs2.begin(); itep2 != theHistoProfs2.end(); itep2++ ){ delete (*itep2).second; } }
bool TestHistoMgr::addHisto1 | ( | TH1F * | ih | ) |
Definition at line 151 of file TestHistoMgr.cc.
References gather_cfg::cout, and theHistos1.
Referenced by MaterialBudgetEcalHistos::book(), MaterialBudgetTrackerHistos::book(), and MaterialBudgetHistos::book().
{ int ih = atoi(sih->GetName()); theHistos1[ih] = sih; std::cout << " addHisto1 " << sih->GetName() << " = " << ih << std::endl; return true; }
bool TestHistoMgr::addHisto2 | ( | TH2F * | ih | ) |
Definition at line 160 of file TestHistoMgr.cc.
References theHistos2.
Referenced by MaterialBudgetEcalHistos::book(), MaterialBudgetTrackerHistos::book(), and MaterialBudgetHistos::book().
{ int ih = atoi(sih->GetName()); theHistos2[ih] = sih; return true; }
bool TestHistoMgr::addHistoProf1 | ( | TProfile * | ih | ) |
Definition at line 169 of file TestHistoMgr.cc.
References gather_cfg::cout, and theHistoProfs1.
Referenced by MaterialBudgetEcalHistos::book(), MaterialBudgetTrackerHistos::book(), and MaterialBudgetHistos::book().
{ int ih = atoi(sih->GetName()); theHistoProfs1[ih] = sih; std::cout << " addProfHisto1 " << sih->GetName() << " = " << ih << std::endl; return true; }
bool TestHistoMgr::addHistoProf2 | ( | TProfile2D * | ih | ) |
Definition at line 178 of file TestHistoMgr.cc.
References gather_cfg::cout, and theHistoProfs2.
Referenced by MaterialBudgetEcalHistos::book(), MaterialBudgetTrackerHistos::book(), and MaterialBudgetHistos::book().
{ int ih = atoi(sih->GetName()); theHistoProfs2[ih] = sih; std::cout << " addProfHisto2 " << sih->GetName() << " = " << ih << std::endl; return true; }
TH1F * TestHistoMgr::getHisto1 | ( | int | ih | ) |
Definition at line 188 of file TestHistoMgr.cc.
References dtNoiseDBValidation_cfg::cerr, exception, and theHistos1.
Referenced by MaterialBudgetEcalHistos::fillEndTrack(), MaterialBudgetHistos::fillEndTrack(), and MaterialBudgetTrackerHistos::fillEndTrack().
{ TH1F* his = 0; mih1::const_iterator ite = theHistos1.find( ih ); if( ite != theHistos1.end() ) { his = (*ite).second; } else { std::cerr << "!!!! FATAL ERROR Histogram does not exist " << ih << std::endl; std::exception(); } return his; }
TH1F * TestHistoMgr::getHisto1FromSecondFile | ( | const char * | hnam | ) |
Definition at line 247 of file TestHistoMgr.cc.
References dtNoiseDBValidation_cfg::cerr, exception, and theFileRef.
Referenced by printComparisonResult().
{ if( !theFileRef ){ std::cerr << "!!!! FATAL ERROR Second file not yet opened " << std::endl; std::exception(); } TH1F* his = (TH1F*)(*theFileRef).Get(hnam); if( !his ) { std::cerr << "!!!! FATAL ERROR Histogram does not exist in second file " << hnam << std::endl; theFileRef->ls(); std::exception(); /* } else { std::cout << " getHisto1FromSecondFile " << std::endl; std::cout << his->GetName() << std::endl; std::cout << his->title() << std::endl; std::cout << his->entries() << std::endl; std::cout << his->axis().bins() << std::endl; std::cout << " end getHisto1FromSecondFile " << std::endl; */ } return his; }
TH2F * TestHistoMgr::getHisto2 | ( | int | ih | ) |
Definition at line 203 of file TestHistoMgr.cc.
References dtNoiseDBValidation_cfg::cerr, exception, and theHistos2.
Referenced by MaterialBudgetEcalHistos::fillEndTrack(), MaterialBudgetHistos::fillEndTrack(), MaterialBudgetTrackerHistos::fillEndTrack(), and MaterialBudgetTrackerHistos::hend().
{ TH2F* his = 0; mih2::const_iterator ite = theHistos2.find( ih ); if( ite != theHistos2.end() ) { his = (*ite).second; } else { std::cerr << "!!!! FATAL ERROR Histogram does not exist " << ih << std::endl; std::exception(); } return his; }
TProfile * TestHistoMgr::getHistoProf1 | ( | int | ih | ) |
Definition at line 216 of file TestHistoMgr.cc.
References dtNoiseDBValidation_cfg::cerr, exception, and theHistoProfs1.
Referenced by MaterialBudgetEcalHistos::fillEndTrack(), MaterialBudgetHistos::fillEndTrack(), and MaterialBudgetTrackerHistos::fillEndTrack().
{ TProfile* his = 0; mihp1::const_iterator ite = theHistoProfs1.find( ih ); if( ite != theHistoProfs1.end() ) { his = (*ite).second; } else { std::cerr << "!!!! FATAL ERROR Profile Histogram 1D does not exist " << ih << std::endl; std::exception(); } return his; }
TProfile2D * TestHistoMgr::getHistoProf2 | ( | int | ih | ) |
Definition at line 232 of file TestHistoMgr.cc.
References dtNoiseDBValidation_cfg::cerr, exception, and theHistoProfs2.
Referenced by MaterialBudgetEcalHistos::fillEndTrack(), MaterialBudgetHistos::fillEndTrack(), and MaterialBudgetTrackerHistos::fillEndTrack().
{ TProfile2D* his = 0; mihp2::const_iterator ite = theHistoProfs2.find( ih ); if( ite != theHistoProfs2.end() ) { his = (*ite).second; } else { std::cerr << "!!!! FATAL ERROR Profile Histogram 2D does not exist " << ih << std::endl; std::exception(); } return his; }
void TestHistoMgr::openSecondFile | ( | const std::string & | name | ) |
Definition at line 76 of file TestHistoMgr.cc.
References theFileRef.
{ theFileRef = new TFile(name.c_str()); /* std::vector<std::string> objectNames = theStoreIn->listObjectNames(); std::vector<std::string> objectTypes = theStoreIn->listObjectTypes(); unsigned int siz = objectNames.size(); for( unsigned int ii = 0; ii < siz; ii++ ) { // std::cout << " HISTOS IN FILE " << std::endl; // std::cout << " HISTO: " << objectNames[ii] << " " << objectTypes[ii] << std::endl; }*/ }
void TestHistoMgr::printComparisonResult | ( | int | ih | ) |
Definition at line 92 of file TestHistoMgr.cc.
References gather_cfg::cout, getHisto1FromSecondFile(), and query::result.
{ /* TH1F* histo1 = getHisto1(ih); */ /* std::cout << ih << " Histo1 " << histo1; std::cout << histo1->GetName(); std::cout << histo1->title(); std::cout << histo1->entries(); std::cout << histo1->axis().bins() << std::endl; */ #ifdef StatTesting TH1F* histo2 = getHisto1FromSecondFile(histo1->GetName()); StatisticsTesting::StatisticsComparator< StatisticsTesting::Chi2ComparisonAlgorithm > comparator; // std::cout << " PrintComparisonResult " << histo1 << " " << histo2 << std::endl; #ifdef PI121 qStatisticsTesting::ComparisonResult result = comparator.compare(*histo1, *histo2); #else double result = comparator.compare(*histo1, *histo2); #endif // std::cout << " PrintComparisonResult " << histo1 << " " << histo2 << std::endl; // double distance = comparator.calculateDistance(histo1, histo2); // --------------------------------------------------------- // Do something with (e.g. print out) the result of the test // --------------------------------------------------------- std::cout << " Result of the Chi2 Statistical Test: " << histo1->GetName() << std::endl #ifdef PI121 << " distance = " << result.distance() << std::endl << " ndf = " << result.ndf() << std::endl << " p-value = " << result.quality() << std::endl #else << " p-value = " << result << std::endl #endif << "---------------- exampleReadXML ENDS ------------------ " << std::endl; #ifdef PI121 std::cout << "[OVAL]: HISTO_QUALITY " << histo1->GetName() <<" " << result.quality() << std::endl; #else std::cout << "[OVAL]: HISTO_QUALITY " << histo1->GetName() <<" " << result << std::endl; #endif std::cout << std::endl << " mean= " << histo1->GetMean() << " " << histo1->GetName() << " " << histo1->GetTitle() << std::endl; std::cout << " rms= " << histo1->GetRMS() << " " << histo1->GetName() << " " << histo1->GetTitle() << std::endl; #else /* std::cout << " LOG histo " << histo1->GetName() << " mean = " << histo1->mean() << " rms = " << histo1->rms() << std::endl; std::cout << " REF histo " << histo2->GetName() << " mean = " << histo2->mean() << " rms = " << histo2->rms() << std::endl; std::cout << " [OVAL]: " << histo1->GetName() << " DIFF_MEAN " << fabs(histo1->mean()-histo2->mean()) << " DIFF_RMS " << fabs(histo1->rms()-histo2->rms()) << std::endl; */ #endif }
void TestHistoMgr::save | ( | const std::string & | name | ) |
Definition at line 392 of file LeastSquares.cc.
References PhysicsTools::LeastSquares::coeffs, PhysicsTools::LeastSquares::corr, PhysicsTools::LeastSquares::covar, PhysicsTools::LeastSquares::n, dbtoconf::root, PhysicsTools::LeastSquares::rotation, PhysicsTools::saveMatrix(), PhysicsTools::saveVector(), PhysicsTools::LeastSquares::trace, PhysicsTools::LeastSquares::variance, and PhysicsTools::LeastSquares::weights.
Referenced by MaterialBudgetEcalHistos::hend(), MaterialBudgetHistos::hend(), and MaterialBudgetTrackerHistos::hend().
{ DOMElement *root = doc->createElement(XMLUniStr("LinearAnalysis")); XMLDocument::writeAttribute<unsigned int>(root, "version", 2); XMLDocument::writeAttribute<unsigned int>(root, "size", n); root->appendChild(saveMatrix(doc, n + 2, coeffs)); root->appendChild(saveMatrix(doc, n + 1, covar)); root->appendChild(saveMatrix(doc, n + 1, corr)); root->appendChild(saveMatrix(doc, n, rotation)); root->appendChild(saveVector(doc, n + 1, weights)); root->appendChild(saveVector(doc, n + 1, variance)); root->appendChild(saveVector(doc, n, trace)); return root; }
TFile* TestHistoMgr::theFileRef [private] |
Definition at line 49 of file TestHistoMgr.h.
Referenced by getHisto1FromSecondFile(), and openSecondFile().
mihp1 TestHistoMgr::theHistoProfs1 [private] |
Definition at line 46 of file TestHistoMgr.h.
Referenced by addHistoProf1(), getHistoProf1(), and ~TestHistoMgr().
mihp2 TestHistoMgr::theHistoProfs2 [private] |
Definition at line 47 of file TestHistoMgr.h.
Referenced by addHistoProf2(), getHistoProf2(), and ~TestHistoMgr().
mih1 TestHistoMgr::theHistos1 [private] |
Definition at line 44 of file TestHistoMgr.h.
Referenced by addHisto1(), getHisto1(), and ~TestHistoMgr().
mih2 TestHistoMgr::theHistos2 [private] |
Definition at line 45 of file TestHistoMgr.h.
Referenced by addHisto2(), getHisto2(), and ~TestHistoMgr().