1 #ifndef __JCOMPAREHISTOGRAMS__JTESTKOLMOGOROV_SLICE2D__ 
    2 #define __JCOMPAREHISTOGRAMS__JTESTKOLMOGOROV_SLICE2D__ 
   18 namespace JCOMPAREHISTOGRAMS {}
 
   19 namespace JPP { 
using namespace JCOMPAREHISTOGRAMS; }
 
   21 namespace JCOMPAREHISTOGRAMS {
 
   40       JTest_t(
"KS_Slice2D", 
"p-Value(KS)")
 
   55       const TH2* h1 = 
dynamic_cast<const TH2*
>(o1);
 
   56       const TH2* h2 = 
dynamic_cast<const TH2*
>(o2);
 
   58       if (h1 == NULL || h2 == NULL) {
 
   59         THROW(JValueOutOfRange, 
"JTestKolmogorov_Slice2D::test(): Could not cast given TObjects to TH2.");
 
   64       const char* 
const h3name = (h1->GetName() == h2->GetName() ?
 
   73         const int nSlices1 = h1->GetNbinsX();
 
   74         const int nSlices2 = h2->GetNbinsX();
 
   76         if (nSlices1 != nSlices2) {
 
   77           THROW(JValueOutOfRange, 
"JTestKolmogorov_Slice2D::test(): Histograms with different binning. The objects: " << h1->GetName() << 
" and " << h2->GetName() << 
" can not be compared." << endl);
 
   82         h3 = h1->ProjectionX(h3name);
 
   84         for (
int i=1 ; 
i<=nSlices1 ; ++
i) {
 
   88           const TH1* s1 = h1->ProjectionY (sliceName.c_str(),
i,
i);
 
   89           const TH1* s2 = h2->ProjectionY (sliceName.c_str(),
i,
i);
 
   91           if (!(s1->GetSumOfWeights() > 0 && s2->GetSumOfWeights() > 0)) { 
continue; }    
 
   93           const double p = s1 -> KolmogorovTest (s2);
 
   97           h3->SetBinContent(
i,p);
 
  102         const int nSlices1 = h1->GetNbinsY();
 
  103         const int nSlices2 = h2->GetNbinsY();
 
  105         if (nSlices1 != nSlices2) {
 
  106           THROW(JValueOutOfRange, 
"JTestKolmogorov_Slice2D::test(): Histograms with different binning. The objects: " << h1->GetName() << 
" and " << h2->GetName() << 
" can not be compared." << endl);
 
  111         h3 = h1->ProjectionY(h3name);
 
  113         for (
int i=1 ; 
i<=nSlices1 ; ++
i){
 
  117           const TH1* s1 = h1->ProjectionX (sliceName.c_str(),
i,
i);
 
  118           const TH1* s2 = h2->ProjectionX (sliceName.c_str(),
i,
i);
 
  120           if (!(s1->GetSumOfWeights() > 0 && s2->GetSumOfWeights() > 0)) { 
continue; }
 
  122           const double p = s1 -> KolmogorovTest (s2);
 
  126           h3->SetBinContent(
i,p);
 
  134       h3->SetTitle(title.
getTitle().c_str());
 
  152     std::istream& 
read(std::istream& 
in)
 override 
  158       if (threshold < 0.0 || threshold > 1.0) {
 
  159         THROW(JValueOutOfRange, 
"JTestKolmogorov_Slice2D::read(): Invalid threshold value " << 
threshold);
 
  162       if (failuresThreshold < 0.0 || failuresThreshold > 1.0) {
 
  163         THROW(JValueOutOfRange, 
"JTestKolmogorov_Slice2D::read(): Invalid failuresThreshold value " << 
failuresThreshold);
 
  167         THROW(JValueOutOfRange, 
"JTestKolmogorov_Slice2D::read(): Invalid slice option " << 
slice);
 
void test(const TObject *o1, const TObject *o2) override
Applies Kolmogorov test for two ROOT TH2 histograms. 
 
Interface to read input and write output for TObject tests. 
 
std::istream & read(std::istream &in) override
Read test parameters from input. 
 
std::string getTitle() const 
Returns a standard string to be used as title of a graphical root object. 
 
JTestKolmogorov_Slice2D()
Default constructor. 
 
Class dedicated to standardize the title of the graphical objects produced by the JTest_t() derived c...
 
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message. 
 
#define MAKE_CSTRING(A)
Make C-string. 
 
Auxiliary class to handle file name, ROOT directory and object name. 
 
#define MAKE_STRING(A)
Make string. 
 
double failuresThreshold
threshold p-value to decide if test is passed. 
 
char slice
axis to slice. x or X for x-axis, y or Y for y-axis, n or N for None. 
 
Implementation of the Kolmogorov test for 2D histograms. 
 
const std::string resultType
test result type 
 
const std::string testName
test name 
 
double threshold
threshold p-value to decide if test is passed. 
 
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
 
std::string to_string(const T &value)
Convert value to string. 
 
Structure containing the result of the test.