5 #include "CLHEP/Units/GlobalSystemOfUnits.h" 7 #include "Validation/SimG4GeometryValidation/interface/StatisticsComparator.h" 8 #include "StatisticsTesting/Chi2ComparisonAlgorithm.h" 12 #include "StatisticsTesting/ComparisonResult.h" 44 edm::LogInfo(
"MaterialBudget") <<
"TestHistoMgr: Save user histos";
46 TFile
fout(name.c_str(),
"recreate");
49 mih1::const_iterator ite1;
50 mih2::const_iterator ite2;
51 mihp1::const_iterator itep1;
52 mihp2::const_iterator itep2;
55 ((*ite1).second)->Write();
58 ((*ite2).second)->Write();
61 ((*itep1).second)->Write();
64 ((*itep2).second)->Write();
72 theFileRef = std::make_unique<TFile>(name.c_str());
84 StatisticsTesting::StatisticsComparator< StatisticsTesting::Chi2ComparisonAlgorithm > comparator;
88 qStatisticsTesting::ComparisonResult
result = comparator.compare(*histo1, *histo2);
92 double result = comparator.compare(*histo1, *histo2);
99 edm::LogInfo <<
"TestHistoMgr: Result of the Chi2 Statistical Test: " << histo1->GetName();
101 <<
" distance = " << result.distance() << std::endl
102 <<
" ndf = " << result.ndf() << std::endl
103 <<
" p-value = " << result.quality() << std::endl
105 <<
" p-value = " << result << std::endl
107 <<
"---------------- exampleReadXML ENDS ------------------ " 110 std::cout <<
"[OVAL]: HISTO_QUALITY " << histo1->GetName() <<
" " << result.quality() << std::endl;
112 std::cout <<
"[OVAL]: HISTO_QUALITY " << histo1->GetName() <<
" " << result << std::endl;
114 std::cout << std::endl <<
" mean= " << histo1->GetMean() <<
" " << histo1->GetName() <<
" " << histo1->GetTitle() << std::endl;
115 std::cout <<
" rms= " << histo1->GetRMS() <<
" " << histo1->GetName() <<
" " << histo1->GetTitle() << std::endl;
124 int ih = atoi(sih->GetName());
126 edm::LogInfo(
"MaterialBudget") <<
"TestHistoMgr: addHisto1: " << ih <<
" = " << sih->GetTitle();
132 int ih = atoi(sih->GetName());
140 int ih = atoi(sih->GetName());
142 edm::LogInfo(
"MaterialBudget") <<
"TestHistoMgr: addHistoProf1: " << ih <<
" = " << sih->GetTitle();
148 int ih = atoi(sih->GetName());
150 edm::LogInfo(
"MaterialBudget") <<
"TestHistoMgr: addHistoProf2: " << ih <<
" = " << sih->GetTitle();
159 mih1::const_iterator ite =
theHistos1.find( ih );
163 edm::LogError(
"MaterialBudget") <<
"TestHistoMgr: getHisto1 Histogram does not exist " << ih;
172 mih2::const_iterator ite =
theHistos2.find( ih );
176 edm::LogError(
"MaterialBudget") <<
"TestHistoMgr: getHisto2 Histogram does not exist " << ih;
184 TProfile* his =
nullptr;
189 edm::LogError(
"MaterialBudget") <<
"TestHistoMgr: Profile Histogram 1D does not exist " << ih;
198 TProfile2D* his =
nullptr;
203 edm::LogError(
"MaterialBudget") <<
"TestHistoMgr: Profile Histogram 2D does not exist " << ih;
211 TH1F* his =
new TH1F();
213 edm::LogError(
"MaterialBudget") <<
"TestHistoMgr: Second file not yet opened ";
216 his = (TH1F*)(*theFileRef).Get(hnam);
220 edm::LogError(
"MaterialBudget") <<
"TestHistoMgr: FATAL ERROR Histogram does not exist in second file " << hnam;
TProfile2D * getHistoProf2(int ih)
bool addHistoProf2(TProfile2D *ih)
void openSecondFile(const std::string &name)
TProfile * getHistoProf1(int ih)
void save(const std::string &name)
std::unique_ptr< TFile > theFileRef
TH1F * getHisto1FromSecondFile(const char *hnam)
void printComparisonResult(int ih)
bool addHistoProf1(TProfile *ih)