Jpp  15.0.1-rc.1-highqe
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
JCOMPAREHISTOGRAMS::JTestSignificance_t Class Reference

#include <JTestSignificance_t.hh>

Inheritance diagram for JCOMPAREHISTOGRAMS::JTestSignificance_t:
JCOMPAREHISTOGRAMS::JTestSignificance_1D JCOMPAREHISTOGRAMS::JTestSignificance_2D

Public Member Functions

 JTestSignificance_t ()
 Default constructor. 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...
 

Detailed Description

Definition at line 37 of file JTestSignificance_t.hh.

Constructor & Destructor Documentation

JCOMPAREHISTOGRAMS::JTestSignificance_t::JTestSignificance_t ( )
inline

Default constructor.

Definition at line 44 of file JTestSignificance_t.hh.

44 {}

Member Function Documentation

template<class T >
JTestResult JCOMPAREHISTOGRAMS::JTestSignificance_t::JSignificanceTest ( T h1,
T h2,
double  threshold,
double  K,
std::string  testName,
std::string  parameterName 
)
inline

Significance test for histograms.


Parameters
h1First object
h2Second object
thresholdSignificance threshold
KNormalisation parameter
parameterNameName of the parameter used to test the histograms
testNameName of the test used to compare the histograms
Returns
Test result.

Definition at line 59 of file JTestSignificance_t.hh.

59  {
60 
61  using namespace std;
62  using namespace JPP;
63 
64  if(h1 -> GetNbinsX() != h2 -> GetNbinsX())
65  ERROR("Histograms with different bining. The objects: " << h1 -> GetName() << " can not be compared." << endl);
66 
67 
68  T* h3 = (T*)h1->Clone(h1->GetName()==h2->GetName() ?
69  MAKE_CSTRING(to_string(h1->GetName())) :
70  MAKE_CSTRING(to_string(h1->GetName()) + "_VS_" + to_string(h2->GetName())));
71 
72  h3->Add(h2,-1*K);
73 
74  double S = 0;
75 
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){
79 
80  double a = h1->GetBinContent(i+1,j+1,k+1);
81  double b = h2->GetBinContent(i+1,j+1,k+1);
82 
83  if(a!=0 || b!=0){
84  S += fabs((a - K*b)/sqrt(a + K*K*b));
85  }
86  }
87  }
88  }
89 
90  S /= (h1->GetNbinsX()*h1->GetNbinsY()*h1->GetNbinsZ());
91 
92  bool passed;
93 
94  (S < threshold ? passed = false : passed = true);
95 
96  JResultTitle title(testName, parameterName, passed, S);
97 
98  h3->SetTitle(title.getTitle().c_str());
99 
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);
104 
105  return r;
106  };
then fatal No hydrophone data file $HYDROPHONE_TXT fi sort gr k
static const uint32_t K[64]
Definition: crypt.cc:77
#define MAKE_CSTRING(A)
Make C-string.
Definition: JPrint.hh:151
then for HISTOGRAM in h0 h1
Definition: JMatrixNZ.sh:71
data_type r[M+1]
Definition: JPolint.hh:742
#define MAKE_STRING(A)
Make string.
Definition: JPrint.hh:142
do set_variable OUTPUT_DIRECTORY $WORKDIR T
#define ERROR(A)
Definition: JMessage.hh:66
do set_variable SIGMA_NS set_variable OUTLIERS set_variable OUTPUT_FILE matrix[${ALPHA_DEG}\deg\] root $JPP JMatrixNZ a $DETECTOR f $INPUT_FILE o $OUTPUT_FILE S
Definition: JMatrixNZ.sh:58
then JCalibrateToT a
Definition: JTuneHV.sh:116
std::string to_string(const T &value)
Convert value to string.
int j
Definition: JPolint.hh:666

The documentation for this class was generated from the following file: