5 #include <CLHEP/Units/SystemOfUnits.h> 7 #include "Validation/SimG4GeometryValidation/interface/StatisticsComparator.h" 8 #include "StatisticsTesting/Chi2ComparisonAlgorithm.h" 12 #include "StatisticsTesting/ComparisonResult.h" 40 edm::LogInfo(
"MaterialBudget") <<
"TestHistoMgr: Save user histos";
42 TFile
fout(
name.c_str(),
"recreate");
45 mih1::const_iterator ite1;
46 mih2::const_iterator ite2;
47 mihp1::const_iterator itep1;
48 mihp2::const_iterator itep2;
51 ((*ite1).second)->Write();
54 ((*ite2).second)->Write();
57 ((*itep1).second)->Write();
60 ((*itep2).second)->Write();
71 StatisticsTesting::StatisticsComparator<StatisticsTesting::Chi2ComparisonAlgorithm> comparator;
75 qStatisticsTesting::ComparisonResult
result = comparator.compare(*histo1, *histo2);
79 double result = comparator.compare(*histo1, *histo2);
86 edm::LogInfo <<
"TestHistoMgr: Result of the Chi2 Statistical Test: " << histo1->GetName();
88 <<
" distance = " <<
result.distance() << std::endl
89 <<
" ndf = " <<
result.ndf() << std::endl
90 <<
" p-value = " <<
result.quality() << std::endl
92 <<
" p-value = " <<
result << std::endl
94 <<
"---------------- exampleReadXML ENDS ------------------ " << std::endl;
96 std::cout <<
"[OVAL]: HISTO_QUALITY " << histo1->GetName() <<
" " <<
result.quality() << std::endl;
98 std::cout <<
"[OVAL]: HISTO_QUALITY " << histo1->GetName() <<
" " <<
result << std::endl;
101 <<
" mean= " << histo1->GetMean() <<
" " << histo1->GetName() <<
" " << histo1->GetTitle() << std::endl;
102 std::cout <<
" rms= " << histo1->GetRMS() <<
" " << histo1->GetName() <<
" " << histo1->GetTitle() << std::endl;
109 int ih = atoi(sih->GetName());
111 edm::LogInfo(
"MaterialBudget") <<
"TestHistoMgr: addHisto1: " << ih <<
" = " << sih->GetTitle();
116 int ih = atoi(sih->GetName());
122 int ih = atoi(sih->GetName());
124 edm::LogInfo(
"MaterialBudget") <<
"TestHistoMgr: addHistoProf1: " << ih <<
" = " << sih->GetTitle();
129 int ih = atoi(sih->GetName());
131 edm::LogInfo(
"MaterialBudget") <<
"TestHistoMgr: addHistoProf2: " << ih <<
" = " << sih->GetTitle();
138 mih1::const_iterator ite =
theHistos1.find(ih);
142 edm::LogError(
"MaterialBudget") <<
"TestHistoMgr: getHisto1 Histogram does not exist " << ih;
150 mih2::const_iterator ite =
theHistos2.find(ih);
154 edm::LogError(
"MaterialBudget") <<
"TestHistoMgr: getHisto2 Histogram does not exist " << ih;
161 TProfile* his =
nullptr;
166 edm::LogError(
"MaterialBudget") <<
"TestHistoMgr: Profile Histogram 1D does not exist " << ih;
173 TProfile2D* his =
nullptr;
178 edm::LogError(
"MaterialBudget") <<
"TestHistoMgr: Profile Histogram 2D does not exist " << ih;
185 TH1F* his =
new TH1F();
187 edm::LogError(
"MaterialBudget") <<
"TestHistoMgr: Second file not yet opened ";
190 his = (TH1F*)(*theFileRef).Get(hnam);
194 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)
Log< level::Error, false > LogError
void save(const std::string &name)
Log< level::Info, false > LogInfo
std::unique_ptr< TFile > theFileRef
TH1F * getHisto1FromSecondFile(const char *hnam)
void printComparisonResult(int ih)
bool addHistoProf1(TProfile *ih)