Significance test applied to 2D histograms.  
 More...
#include <JTestSignificance_2D.hh>
 | 
|   | JTestSignificance_2D () | 
|   | Default constructor.  More...
  | 
|   | 
| std::istream &  | read (std::istream &in) override | 
|   | Read test parameters from input.  More...
  | 
|   | 
| void  | test (TObject *o1, TObject *o2) override | 
|   | Applies Significance test for two ROOT TH1 histograms.  More...
  | 
|   | 
| std::ostream &  | write (std::ostream &out, const char delimiter= ' ', const bool onlyFailures=false) const  | 
|   | Write test result to output.  More...
  | 
|   | 
| virtual void  | save (TFile *f, const std::string &path, const bool onlyFailures=false) | 
|   | Writes the test result to root file.  More...
  | 
|   | 
| virtual void  | clear () | 
|   | Clear results.  More...
  | 
|   | 
| const std::string &  | getTestName () | 
|   | Get test name.  More...
  | 
|   | 
| const std::string &  | getResultType () | 
|   | Get result type.  More...
  | 
|   | 
| template<class T >  | 
| JTestResult  | JSignificanceTest (T *h1, T *h2, double threshold, double K, std::string testName, std::string parameterName) | 
|   | Significance test for histograms.  More...
  | 
|   | 
 | 
| double  | threshold | 
|   | threshold p-value to decide if test is passed.  More...
  | 
|   | 
| double  | K | 
|   | normalization factor between histograms.  More...
  | 
|   | 
Significance test applied to 2D histograms. 
Definition at line 19 of file JTestSignificance_2D.hh.
 
  
  
      
        
          | JCOMPAREHISTOGRAMS::JTestSignificance_2D::JTestSignificance_2D  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Default constructor. 
Definition at line 28 of file JTestSignificance_2D.hh.
   29       JTest_t(
"Significance_2D", 
"Significance"),
 
JTestSignificance_t()
Default constructor. 
 
JTest_t(const std::string &name, const std::string &type)
Constructor. 
 
 
 
 
  
  
      
        
          | std::istream& JCOMPAREHISTOGRAMS::JTestSignificance_2D::read  | 
          ( | 
          std::istream &  | 
          in | ) | 
           | 
         
       
   | 
  
inlineoverridevirtual   | 
  
 
Read test parameters from input. 
- Parameters
 - 
  
  
 
- Returns
 - input stream 
 
Implements JCOMPAREHISTOGRAMS::JTest_t.
Definition at line 39 of file JTestSignificance_2D.hh.
double K
normalization factor between histograms. 
 
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
 
double threshold
threshold p-value to decide if test is passed. 
 
 
 
 
  
  
      
        
          | void JCOMPAREHISTOGRAMS::JTestSignificance_2D::test  | 
          ( | 
          TObject *  | 
          o1,  | 
         
        
           | 
           | 
          TObject *  | 
          o2  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inlineoverridevirtual   | 
  
 
Applies Significance test for two ROOT TH1 histograms. 
- Parameters
 - 
  
    | o1 | First histogram  | 
    | o2 | Second histogram  | 
  
   
Implements JCOMPAREHISTOGRAMS::JTest_t.
Definition at line 49 of file JTestSignificance_2D.hh.
   53       if (!(dynamic_cast<TH2*>(o1) == NULL) && !(dynamic_cast<TH2*>(o2) == NULL)) {
 
   55         TH2D* h1 =  
dynamic_cast<TH2D*
>(o1);
 
   56         TH2D* h2 =  
dynamic_cast<TH2D*
>(o2);
 
   58         if (h1 -> GetNbinsX() != h2 -> GetNbinsX() || h1 -> GetNbinsY() != h2 -> GetNbinsY())
 
   59           ERROR(
"Histograms with different bining. The objects: " << h1 -> GetName() << 
" can not be compared." << endl);
 
   62           K = h2->GetEntries()/h1->GetEntries();
 
double K
normalization factor between histograms. 
 
std::vector< JTestResult > results
Buffer to store results of multiple tests.*/. 
 
const std::string resultType
result type 
 
const std::string testName
test name 
 
double threshold
threshold p-value to decide if test is passed. 
 
 
 
 
  
  
      
        
          | std::ostream& JCOMPAREHISTOGRAMS::JTest_t::write  | 
          ( | 
          std::ostream &  | 
          out,  | 
         
        
           | 
           | 
          const char  | 
          delimiter = ' ',  | 
         
        
           | 
           | 
          const bool  | 
          onlyFailures = false  | 
         
        
           | 
          ) | 
           |  const | 
         
       
   | 
  
inlineinherited   | 
  
 
Write test result to output. 
- Parameters
 - 
  
    | out | output stream  | 
    | delimiter | field delimiter  | 
    | onlyFailures | if true, write only failures.  | 
  
   
- Returns
 - output stream 
 
Definition at line 81 of file JTest_t.hh.
   87         if (onlyFailures && 
r->passed) {
 
   91         print(out, *
r, delimiter, 
true);
 
std::ostream & print(std::ostream &out, const JTestSummary &summary, const char delimiter= ' ', const bool useColors=true)
Print test summary. 
 
std::vector< JTestResult > results
Buffer to store results of multiple tests.*/. 
 
 
 
 
  
  
      
        
          | virtual void JCOMPAREHISTOGRAMS::JTest_t::save  | 
          ( | 
          TFile *  | 
          f,  | 
         
        
           | 
           | 
          const std::string &  | 
          path,  | 
         
        
           | 
           | 
          const bool  | 
          onlyFailures = false  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inlinevirtualinherited   | 
  
 
Writes the test result to root file. 
- Parameters
 - 
  
    | f | A ROOT file  | 
    | path | Path in root file.  | 
    | onlyFailures | If true, write only failures.  | 
  
   
Definition at line 113 of file JTest_t.hh.
  119       if (
f -> GetDirectory(
path.c_str())==0) {
 
  120         f->mkdir(
path.c_str());
 
  127         if (!onlyFailures || !
r->passed){
 
o $QUALITY_ROOT d $DEBUG!JPlot1D f
 
std::vector< JTestResult > results
Buffer to store results of multiple tests.*/. 
 
$WORKDIR driver txt done cat $WORKDIR driver txt<< EOFprocess ${DATAFILTER}$FILTER_HOST csh-c '(setenv ROOTSYS $ROOTSYS &&source $JPP_DIR/setenv.csh $JPP_DIR &&(JDataFilter-H\$SERVER\$-M\$LOGGER\$-d $DEBUG-u ${DATAFILTER}-P $PORT</dev/null > &/dev/null &))';process ${DATAWRITER}$WRITER_HOST csh-c '(setenv ROOTSYS $ROOTSYS &&source $JPP_DIR/setenv.csh $JPP_DIR &&(JDataWriter-H\$SERVER\$-M\$LOGGER\$-d $DEBUG-u ${DATAWRITER}</dev/null > &/dev/null &))';print enterevent ev_init{RC_CMD}event ev_reset{RC_CMD}event ev_init{RC_CMD}event ev_configure{RC_DFLTR%<$WORKDIR/ev_configure_datafilter.txt > RC_DOM<$WORKDIR/ev_configure_domsimulator.txt > RC_DWRT path
 
 
 
 
  
  
      
        
          | virtual void JCOMPAREHISTOGRAMS::JTest_t::clear  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inlinevirtualinherited   | 
  
 
Clear results. 
Definition at line 137 of file JTest_t.hh.
std::vector< JTestResult > results
Buffer to store results of multiple tests.*/. 
 
 
 
 
  
  
      
        
          | const std::string& JCOMPAREHISTOGRAMS::JTest_t::getTestName  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inlineinherited   | 
  
 
Get test name. 
- Returns
 - test name 
 
Definition at line 147 of file JTest_t.hh.
const std::string testName
test name 
 
 
 
 
  
  
      
        
          | const std::string& JCOMPAREHISTOGRAMS::JTest_t::getResultType  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inlineinherited   | 
  
 
Get result type. 
- Returns
 - result type 
 
Definition at line 157 of file JTest_t.hh.
const std::string resultType
result type 
 
 
 
 
template<class T > 
  
  
      
        
          | JTestResult JCOMPAREHISTOGRAMS::JTestSignificance_t::JSignificanceTest  | 
          ( | 
          T *  | 
          h1,  | 
         
        
           | 
           | 
          T *  | 
          h2,  | 
         
        
           | 
           | 
          double  | 
          threshold,  | 
         
        
           | 
           | 
          double  | 
          K,  | 
         
        
           | 
           | 
          std::string  | 
          testName,  | 
         
        
           | 
           | 
          std::string  | 
          parameterName  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inlineinherited   | 
  
 
Significance test for histograms. 
 
- Parameters
 - 
  
    | h1 | First object  | 
    | h2 | Second object  | 
    | threshold | Significance threshold  | 
    | K | Normalisation parameter  | 
    | parameterName | Name of the parameter used to test the histograms  | 
    | testName | Name of the test used to compare the histograms | 
  
   
- Returns
 - Test result. 
 
Definition at line 59 of file JTestSignificance_t.hh.
   64       if(h1 -> GetNbinsX() != h2 -> GetNbinsX())
 
   65         ERROR(
"Histograms with different bining. The objects: " << h1 -> GetName() << 
" can not be compared." << endl);
 
   68       T* h3 = (
T*)h1->Clone(h1->GetName()==h2->GetName() ?
 
   76       for (
int i=0 ; i < h1->GetNbinsX() ; ++i){
 
   77         for (
int j=0 ; 
j< h1->GetNbinsY() ; ++
j){
 
   78           for (
int k=0 ; 
k< h1->GetNbinsZ() ; ++
k){
 
   80             double a = h1->GetBinContent(i+1,
j+1,
k+1);
 
   81             double b = h2->GetBinContent(i+1,
j+1,
k+1);
 
   84               S += fabs((a - 
K*b)/sqrt(a + 
K*
K*b));
 
   90       S /= (h1->GetNbinsX()*h1->GetNbinsY()*h1->GetNbinsZ());
 
   94       (S < threshold ? passed = 
false : passed = 
true);
 
   96       JResultTitle title(testName, parameterName, passed, S);
 
   98       h3->SetTitle(title.getTitle().c_str());
 
  100       JTestResult 
r (testName,
 
  101                      JRootObjectID(
MAKE_STRING(h1->GetDirectory()->GetPath() << h1->GetName())),
 
  102                      JRootObjectID(
MAKE_STRING(h2->GetDirectory()->GetPath() << h1->GetName())),
 
  103                      parameterName, S , threshold, h3, passed);
 
then fatal No hydrophone data file $HYDROPHONE_TXT fi sort gr k
 
static const uint32_t K[64]
 
#define MAKE_CSTRING(A)
Make C-string. 
 
#define MAKE_STRING(A)
Make string. 
 
do set_variable OUTPUT_DIRECTORY $WORKDIR T
 
std::string to_string(const T &value)
Convert value to string. 
 
 
 
 
  
  
      
        
          | double JCOMPAREHISTOGRAMS::JTestSignificance_2D::threshold | 
         
       
   | 
  
private   | 
  
 
 
  
  
      
        
          | double JCOMPAREHISTOGRAMS::JTestSignificance_2D::K | 
         
       
   | 
  
private   | 
  
 
 
Buffer to store results of multiple tests.*/. 
Definition at line 162 of file JTest_t.hh.
 
 
  
  
      
        
          | const std::string JCOMPAREHISTOGRAMS::JTest_t::testName | 
         
       
   | 
  
protectedinherited   | 
  
 
 
  
  
      
        
          | const std::string JCOMPAREHISTOGRAMS::JTest_t::resultType | 
         
       
   | 
  
protectedinherited   | 
  
 
 
The documentation for this class was generated from the following file: