6 #include "CLHEP/Units/GlobalSystemOfUnits.h" 8 #include "Validation/SimG4GeometryValidation/interface/StatisticsComparator.h" 9 #include "StatisticsTesting/Chi2ComparisonAlgorithm.h" 13 #include "StatisticsTesting/ComparisonResult.h" 29 mih1::const_iterator ite1;
30 mih2::const_iterator ite2;
31 mihp1::const_iterator itep1;
32 mihp2::const_iterator itep2;
35 delete (*ite1).second;
38 delete (*ite2).second;
41 delete (*itep1).second;
53 std::cout <<
"=== save user histos ===" << std::endl;
54 TFile
fout(name.c_str(),
"recreate");
56 mih1::const_iterator ite1;
57 mih2::const_iterator ite2;
58 mihp1::const_iterator itep1;
59 mihp2::const_iterator itep2;
62 ((*ite1).second)->Write();
65 ((*ite2).second)->Write();
68 ((*itep1).second)->Write();
71 ((*itep2).second)->Write();
108 StatisticsTesting::StatisticsComparator< StatisticsTesting::Chi2ComparisonAlgorithm >
comparator;
112 qStatisticsTesting::ComparisonResult
result = comparator.compare(*histo1, *histo2);
114 double result = comparator.compare(*histo1, *histo2);
123 std::cout <<
" Result of the Chi2 Statistical Test: " << histo1->GetName() << std::endl
125 <<
" distance = " << result.distance() << std::endl
126 <<
" ndf = " << result.ndf() << std::endl
127 <<
" p-value = " << result.quality() << std::endl
129 <<
" p-value = " << result << std::endl
131 <<
"---------------- exampleReadXML ENDS ------------------ " 134 std::cout <<
"[OVAL]: HISTO_QUALITY " << histo1->GetName() <<
" " << result.quality() << std::endl;
136 std::cout <<
"[OVAL]: HISTO_QUALITY " << histo1->GetName() <<
" " << result << std::endl;
138 std::cout << std::endl <<
" mean= " << histo1->GetMean() <<
" " << histo1->GetName() <<
" " << histo1->GetTitle() << std::endl;
139 std::cout <<
" rms= " << histo1->GetRMS() <<
" " << histo1->GetName() <<
" " << histo1->GetTitle() << std::endl;
153 int ih = atoi(sih->GetName());
155 std::cout <<
" addHisto1 " << sih->GetName() <<
" = " << ih << std::endl;
162 int ih = atoi(sih->GetName());
171 int ih = atoi(sih->GetName());
173 std::cout <<
" addProfHisto1 " << sih->GetName() <<
" = " << ih << std::endl;
180 int ih = atoi(sih->GetName());
182 std::cout <<
" addProfHisto2 " << sih->GetName() <<
" = " << ih << std::endl;
192 mih1::const_iterator ite =
theHistos1.find( ih );
196 std::cerr <<
"!!!! FATAL ERROR Histogram does not exist " << ih << std::endl;
206 mih2::const_iterator ite =
theHistos2.find( ih );
210 std::cerr <<
"!!!! FATAL ERROR Histogram does not exist " << ih << std::endl;
218 TProfile* his =
nullptr;
223 std::cerr <<
"!!!! FATAL ERROR Profile Histogram 1D does not exist " << ih << std::endl;
234 TProfile2D* his =
nullptr;
239 std::cerr <<
"!!!! FATAL ERROR Profile Histogram 2D does not exist " << ih << std::endl;
249 TH1F* his =
new TH1F();
251 std::cerr <<
"!!!! FATAL ERROR Second file not yet opened " << std::endl;
254 his = (TH1F*)(*theFileRef).Get(hnam);
259 std::cerr <<
"!!!! FATAL ERROR Histogram does not exist in second file " << hnam << std::endl;
TProfile2D * getHistoProf2(int ih)
bool addHistoProf2(TProfile2D *ih)
void openSecondFile(const std::string &name)
TProfile * getHistoProf1(int ih)
void save(const std::string &name)
TH1F * getHisto1FromSecondFile(const char *hnam)
void printComparisonResult(int ih)
bool addHistoProf1(TProfile *ih)