Jpp  18.2.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Public Attributes | Protected Attributes | Private Attributes | List of all members
JCOMPAREHISTOGRAMS::JTestChi2_1D Class Reference

Implementation of the Chi2 test for 1D histograms. More...

#include <JTestChi2_1D.hh>

Inheritance diagram for JCOMPAREHISTOGRAMS::JTestChi2_1D:
JCOMPAREHISTOGRAMS::JTest_t JCOMPAREHISTOGRAMS::JTestChi2_t

Public Member Functions

 JTestChi2_1D ()
 Default constructor. More...
 
std::istream & read (std::istream &in) override
 Read test parameters from input. More...
 
void test (TObject *o1, TObject *o2) override
 Applies Chi2 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::stringgetTestName ()
 Get test name. More...
 
const std::stringgetResultType ()
 Get result type. More...
 
JTestResult JChi2Test (TH1 *h1, TH1 *h2, double threshold, std::string testName, std::string parameterName, std::string options)
 Chi2 test for 1D histograms. More...
 
JTestResult JChi2TestSlice (TH2 *h1, TH2 *h2, double threshold, double failuresThreshold, std::string testName, std::string parameterName, std::string options, char slice)
 Chi2 test for sliced 2D histograms. More...
 
JTestResult JChi2TestBin_2D (TH2 *h1, TH2 *h2, double outliersThreshold, double chi2Threshold, std::string testName, std::string parameterName)
 Bin-by-Bin Chi2 comparison of 2D histograms. More...
 

Public Attributes

std::vector< JTestResultresults
 Buffer to store results of multiple tests.*/. More...
 

Protected Attributes

const std::string testName
 test name More...
 
const std::string resultType
 result type More...
 

Private Attributes

double threshold
 threshold p-value to decide if test is passed. More...
 
std::string options
 options for the ROOT chi2 test. More...
 

Detailed Description

Implementation of the Chi2 test for 1D histograms.


This class is derived from the abstract class JTest_t(). For a general description of the implementation of this and other tests derived from JTest_t(), see its documentation.
The input parameter threshold(), is used to evaluate whether the test is passed or failed.
The evaluation is done by comparing the threshold() value with the result produced by JChi2Test(). The output of a Chi2 test is a p-value.
The parameter threshold() should therefore be a real value between 0 and 1.

Definition at line 21 of file JTestChi2_1D.hh.

Constructor & Destructor Documentation

JCOMPAREHISTOGRAMS::JTestChi2_1D::JTestChi2_1D ( )
inline

Default constructor.

Definition at line 30 of file JTestChi2_1D.hh.

30  :
31  JTest_t("Chi2_1D", "p-Value(chi2)"),
32  JTestChi2_t()
33  {}
JTestChi2_t()
Default constructor.
Definition: JTestChi2_t.hh:28
JTest_t(const std::string &name, const std::string &type)
Constructor.
Definition: JTest_t.hh:57

Member Function Documentation

std::istream& JCOMPAREHISTOGRAMS::JTestChi2_1D::read ( std::istream &  in)
inlineoverridevirtual

Read test parameters from input.

Parameters
ininput stream
Returns
input stream

Implements JCOMPAREHISTOGRAMS::JTest_t.

Definition at line 41 of file JTestChi2_1D.hh.

41  {
42  return in >> threshold >> options;
43  };
double threshold
threshold p-value to decide if test is passed.
Definition: JTestChi2_1D.hh:72
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
Definition: JCanberra.sh:46
std::string options
options for the ROOT chi2 test.
Definition: JTestChi2_1D.hh:77
void JCOMPAREHISTOGRAMS::JTestChi2_1D::test ( TObject o1,
TObject o2 
)
inlineoverridevirtual

Applies Chi2 test for two ROOT TH1 histograms.

Parameters
o1First histogram
o2Second histogram

Implements JCOMPAREHISTOGRAMS::JTest_t.

Definition at line 51 of file JTestChi2_1D.hh.

51  {
52 
53  using namespace std;
54 
55  if (!(dynamic_cast<TH2*>(o1) == NULL) || !(dynamic_cast<TH2*>(o2) == NULL)) {
56 
57  ERROR("For 2D histograms call JTestChi2_2D: " << o1->GetName() << endl);
58 
59  } else if (!(dynamic_cast<TH1*>(o1) == NULL) && !(dynamic_cast<TH1*>(o2) == NULL)) {
60 
61  TH1D* h1 = dynamic_cast<TH1D*>(o1);
62  TH1D* h2 = dynamic_cast<TH1D*>(o2);
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  JTestResult r = JChi2Test(h1, h2, threshold, testName, resultType, options);
69 
70  results.push_back(r);
71  }
72  };
JTestResult JChi2Test(TH1 *h1, TH1 *h2, double threshold, std::string testName, std::string parameterName, std::string options)
Chi2 test for 1D histograms.
Definition: JTestChi2_t.hh:45
data_type r[M+1]
Definition: JPolint.hh:868
std::vector< JTestResult > results
Buffer to store results of multiple tests.*/.
Definition: JTest_t.hh:162
#define ERROR(A)
Definition: JMessage.hh:66
const std::string resultType
result type
Definition: JTest_t.hh:167
const std::string testName
test name
Definition: JTest_t.hh:166
double threshold
threshold p-value to decide if test is passed.
Definition: JTestChi2_1D.hh:72
std::string options
options for the ROOT chi2 test.
Definition: JTestChi2_1D.hh:77
std::ostream& JCOMPAREHISTOGRAMS::JTest_t::write ( std::ostream &  out,
const char  delimiter = ' ',
const bool  onlyFailures = false 
) const
inlineinherited

Write test result to output.

Parameters
outoutput stream
delimiterfield delimiter
onlyFailuresif true, write only failures.
Returns
output stream

Definition at line 81 of file JTest_t.hh.

83  {
84 
85  for (std::vector<JTestResult>::const_iterator r = results.begin() ; r != results.end() ; ++r) {
86 
87  if (onlyFailures && r->passed) {
88  continue;
89  }
90 
91  print(out, *r, delimiter, true);
92  }
93 
94  return out;
95  }
std::ostream & print(std::ostream &out, const JTestSummary &summary, const char delimiter= ' ', const bool useColors=true)
Print test summary.
data_type r[M+1]
Definition: JPolint.hh:868
std::vector< JTestResult > results
Buffer to store results of multiple tests.*/.
Definition: JTest_t.hh:162
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
fA ROOT file
pathPath in root file.
onlyFailuresIf true, write only failures.

Definition at line 113 of file JTest_t.hh.

115  {
116 
117  using namespace std;
118 
119  if (f -> GetDirectory(path.c_str())==0) {
120  f->mkdir(path.c_str());
121  }
122 
123  f->cd(path.c_str());
124 
125  for (vector<JTestResult>::const_iterator r = results.begin() ; r != results.end() ; ++r){
126 
127  if (!onlyFailures || !r->passed){
128  r->obj->Write();
129  }
130  }
131  }
o $QUALITY_ROOT d $DEBUG!CHECK_EXIT_CODE JPlot1D f
Definition: JDataQuality.sh:76
data_type r[M+1]
Definition: JPolint.hh:868
std::vector< JTestResult > results
Buffer to store results of multiple tests.*/.
Definition: JTest_t.hh:162
$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_DQSIM<$WORKDIR/ev_configure_dqsimulator.txt > RC_DWRT path
virtual void JCOMPAREHISTOGRAMS::JTest_t::clear ( )
inlinevirtualinherited

Clear results.

Definition at line 137 of file JTest_t.hh.

137  {
138  results.clear();
139  }
std::vector< JTestResult > results
Buffer to store results of multiple tests.*/.
Definition: JTest_t.hh:162
const std::string& JCOMPAREHISTOGRAMS::JTest_t::getTestName ( )
inlineinherited

Get test name.

Returns
test name

Definition at line 147 of file JTest_t.hh.

147  {
148  return testName;
149  }
const std::string testName
test name
Definition: JTest_t.hh:166
const std::string& JCOMPAREHISTOGRAMS::JTest_t::getResultType ( )
inlineinherited

Get result type.

Returns
result type

Definition at line 157 of file JTest_t.hh.

157  {
158  return resultType;
159  }
const std::string resultType
result type
Definition: JTest_t.hh:167
JTestResult JCOMPAREHISTOGRAMS::JTestChi2_t::JChi2Test ( TH1 *  h1,
TH1 *  h2,
double  threshold,
std::string  testName,
std::string  parameterName,
std::string  options 
)
inlineinherited

Chi2 test for 1D histograms.


The input parameter threshold, is used to evaluate whether the test is passed or failed.
The evaluation is done by comparing the threshold value with the result of the Chi2 test. The output of a Chi2 test is a p-value.
The parameter threshold should therefore be a real value between 0 and 1.

Parameters
h1First histogram
h2Second histogram
thresholdThreshold value for the test result
parameterNameName of the parameter used to test the histograms
testNameName of the test used to compare the histograms
optionsROOT options for the test.
Returns
Test result.

Definition at line 45 of file JTestChi2_t.hh.

45  {
46 
47  using namespace std;
48  using namespace JPP;
49 
50  if(h1 -> GetNbinsX() != h2 -> GetNbinsX())
51  ERROR("Histograms with different bining. The objects: " << h1 -> GetName() << " can not be compared." << endl);
52 
53  double chi2 = h1 -> Chi2Test (h2 , options.c_str());
54 
55  double M = h1->Integral();
56  double N = h2->Integral();
57 
58  TH2D* h3 = (TH2D*)h1->Clone(h1->GetName()==h2->GetName() ?
59  MAKE_CSTRING(to_string(h1->GetName())) :
60  MAKE_CSTRING(to_string(h1->GetName()) + "_VS_" + to_string(h2->GetName())));
61 
62  h3->Reset();
63 
64  for (int i=1 ; i < h1->GetNbinsX() ; ++i){
65 
66  double m = h1->GetBinContent(i);
67  double n = h2->GetBinContent(i);
68  if(n!=0 && m!=0){
69 
70  double c = (M*n - N*m)/sqrt((n+m)*(N*M));
71  h3->SetBinContent(i,c);
72  }
73  }
74 
75  bool passed;
76 
77  if (options.find("CHI2") != std::string::npos) {
78  (chi2 > threshold ? passed = false : passed = true);
79  }else{
80  (chi2 < threshold ? passed = false : passed = true);
81  }
82 
83  JResultTitle title(testName, parameterName, passed , chi2);
84 
85  h3->SetTitle(title.getTitle().c_str());
86 
87  JTestResult r (testName,
88  JRootObjectID(MAKE_STRING(h1->GetDirectory()->GetPath() << h1->GetName())),
89  JRootObjectID(MAKE_STRING(h2->GetDirectory()->GetPath() << h1->GetName())),
90  parameterName, chi2, threshold, h3, passed);
91 
92  return r;
93 
94  };
#define MAKE_CSTRING(A)
Make C-string.
Definition: JPrint.hh:136
data_type r[M+1]
Definition: JPolint.hh:868
#define MAKE_STRING(A)
Make string.
Definition: JPrint.hh:127
const int n
Definition: JPolint.hh:786
then usage $script[port]< option > nPossible options
#define ERROR(A)
Definition: JMessage.hh:66
$WORKDIR ev_configure_dqsimulator txt echo process $DQ_SIMULATOR $i $SOURCE_HOST[$index] csh c(setenv ROOTSYS $ROOTSYS &&source $JPP_DIR/setenv.csh $JPP_DIR &&($DQ_SIMULATOR\-u\$NAME\$\-H\$SERVER\$\-M\$LOGGER\$\-d $DEBUG</dev/null > &/dev/null &))'
then usage $script< input file >[option[primary[working directory]]] nWhere option can be N
Definition: JMuonPostfit.sh:40
std::string to_string(const T &value)
Convert value to string.
then if[[!-f $DETECTOR]] then JDetector sh $DETECTOR fi cat $WORKDIR trigger_parameters txt<< EOFtrigger3DMuon.enabled=1;trigger3DMuon.numberOfHits=5;trigger3DMuon.gridAngle_deg=1;ctMin=0.0;TMaxLocal_ns=15.0;EOF set_variable TRIGGEREFFICIENCY_TRIGGERED_EVENTS_ONLY INPUT_FILES=() for((i=1;$i<=$NUMBER_OF_RUNS;++i));do JSirene.sh $DETECTOR $JPP_DATA/genhen.km3net_wpd_V2_0.evt.gz $WORKDIR/sirene_ ${i}.root JTriggerEfficiency.sh $DETECTOR $DETECTOR $WORKDIR/sirene_ ${i}.root $WORKDIR/trigger_efficiency_ ${i}.root $WORKDIR/trigger_parameters.txt $JPP_DATA/PMT_parameters.txt INPUT_FILES+=($WORKDIR/trigger_efficiency_ ${i}.root) done for ANGLE_DEG in $ANGLES_DEG[*];do set_variable SIGMA_NS 3.0 set_variable OUTLIERS 3 set_variable OUTPUT_FILE $WORKDIR/matrix\[${ANGLE_DEG}\deg\].root $JPP_DIR/examples/JReconstruction-f"$INPUT_FILES[*]"-o $OUTPUT_FILE-S ${SIGMA_NS}-A ${ANGLE_DEG}-O ${OUTLIERS}-d ${DEBUG}--!fiif[[$OPTION=="plot"]];then if((0));then for H1 in h0 h1;do JPlot1D-f"$WORKDIR/matrix["${^ANGLES_DEG}" deg].root:${H1}"-y"1 2e3"-Y-L TR-T""-\^"number of events [a.u.]"-> o chi2
Definition: JMatrixNZ.sh:106
JTestResult JCOMPAREHISTOGRAMS::JTestChi2_t::JChi2TestSlice ( TH2 *  h1,
TH2 *  h2,
double  threshold,
double  failuresThreshold,
std::string  testName,
std::string  parameterName,
std::string  options,
char  slice 
)
inlineinherited

Chi2 test for sliced 2D histograms.


The histograms are sliced along the axis specified by the slice parameter. A slice per bin is made.
For each of the slices, the input parameter threshold, is used to evaluate whether the test is passed or failed.
The evaluation is done by comparing the threshold value with the result of the Chi2 test. The output of a Chi2 test is a p-value.
The parameter threshold should therefore be a real value between 0 and 1.
The fraction of failed tests is compared to the input parameter failuresThreshold. If this fraction is larger than failuresThreshold, the test fails.

Parameters
h1First histogram
h2Second histogram
thresholdThreshold value for the test result
failuresThresholdThreshold value for the fraction of failed tests.
parameterNameName of the parameter used to test the histograms
testNameName of the test used to compare the histograms
optionsROOT options for the test.
sliceThe axis along which the histogram is sliced.
Returns
Test result.

Definition at line 115 of file JTestChi2_t.hh.

115  {
116 
117  using namespace std;
118  using namespace JPP;
119 
120  int nFailures = 0;
121 
122  JTestResult r;
123 
124  if(slice == 'x' || slice == 'X'){
125 
126  int nSlices1 = h1->GetNbinsX();
127  int nSlices2 = h2->GetNbinsX();
128 
129  TH1* h3 = h1->ProjectionX(MAKE_CSTRING(h1->GetName() << "_VS_" <<
130  h2->GetName() << "_Chi2TestSliceX"));
131 
132  if (nSlices1 != nSlices2) {
133  ERROR("Histograms with different binning. The objects: " << h1->GetName() << " and " << h2->GetName() << " can not be compared." << endl);
134  }
135 
136  for (int i=1 ; i<=nSlices1 ; ++i){
137 
138  std::string sliceName = MAKE_STRING(h3->GetName() << "_" << to_string(i));
139 
140  TH1D* s1 = h1->ProjectionY (sliceName.c_str(),i,i);
141  TH1D* s2 = h2->ProjectionY (sliceName.c_str(),i,i);
142 
143  if (!(s1->GetSumOfWeights() > 0 && s2->GetSumOfWeights() > 0)) { continue; }
144 
145  double chi2 = s1->Chi2Test(s2 , options.c_str());
146 
147  bool passed = (options.find("CHI2") != std::string::npos ?
148  (chi2 > threshold ? false : true) :
149  (chi2 < threshold ? false : true));
150 
151  if (!passed) nFailures++;
152 
153  h3->SetBinContent(i,chi2);
154  }
155 
156  bool passed = (nFailures/nSlices1 > failuresThreshold ? false : true);
157 
158  JResultTitle title(testName, parameterName, passed , nFailures);
159 
160  h3->SetTitle(title.getTitle().c_str());
161 
162  r = JTestResult(testName,
163  JRootObjectID(MAKE_STRING(h1->GetDirectory()->GetPath() << h1->GetName())),
164  JRootObjectID(MAKE_STRING(h2->GetDirectory()->GetPath() << h1->GetName())),
165  parameterName, nFailures, failuresThreshold, h3, passed);
166 
167  } else if (slice == 'y' || slice == 'Y') {
168 
169  int nSlices1 = h1->GetNbinsY();
170  int nSlices2 = h2->GetNbinsY();
171 
172  TH1* h3 = h1->ProjectionY(MAKE_CSTRING(h1->GetName() << "_VS_" <<
173  h2->GetName() << "_Chi2TestSliceY"));
174 
175  if (nSlices1 != nSlices2) {
176  ERROR("Histograms with different binning. The objects: " << h1->GetName() << " can not be compared." << endl);
177  }
178 
179  for (int i=1 ; i<=nSlices1 ; ++i){
180 
181  std::string sliceName = MAKE_STRING(h3->GetName() << "_" << to_string(i));
182 
183  TH1D* s1 = h1->ProjectionX (sliceName.c_str(),i,i);
184  TH1D* s2 = h2->ProjectionX (sliceName.c_str(),i,i);
185 
186  if (!(s1->GetSumOfWeights() > 0 && s2->GetSumOfWeights() > 0)) { continue; }
187 
188  double chi2 = s1 -> Chi2Test (s2 , options.c_str());
189 
190  bool passed = (options.find("CHI2") != std::string::npos ?
191  (chi2 > threshold ? false : true) :
192  (chi2 < threshold ? false : true));;
193 
194  if (!passed) nFailures++;
195 
196  h3->SetBinContent(i,chi2);
197  }
198 
199  bool passed = (nFailures/nSlices1 > failuresThreshold ? false : true);
200 
201  JResultTitle title(testName, parameterName, passed , nFailures);
202 
203  h3->SetTitle(title.getTitle().c_str());
204 
205  r = JTestResult (testName,
206  JRootObjectID(MAKE_STRING(h1->GetDirectory()->GetPath() << h1->GetName())),
207  JRootObjectID(MAKE_STRING(h2->GetDirectory()->GetPath() << h1->GetName())),
208  parameterName, nFailures, failuresThreshold, h3, passed);
209 
210  }
211 
212  return r;
213  };
#define MAKE_CSTRING(A)
Make C-string.
Definition: JPrint.hh:136
data_type r[M+1]
Definition: JPolint.hh:868
#define MAKE_STRING(A)
Make string.
Definition: JPrint.hh:127
then usage $script[port]< option > nPossible options
#define ERROR(A)
Definition: JMessage.hh:66
then awk string
std::string to_string(const T &value)
Convert value to string.
then if[[!-f $DETECTOR]] then JDetector sh $DETECTOR fi cat $WORKDIR trigger_parameters txt<< EOFtrigger3DMuon.enabled=1;trigger3DMuon.numberOfHits=5;trigger3DMuon.gridAngle_deg=1;ctMin=0.0;TMaxLocal_ns=15.0;EOF set_variable TRIGGEREFFICIENCY_TRIGGERED_EVENTS_ONLY INPUT_FILES=() for((i=1;$i<=$NUMBER_OF_RUNS;++i));do JSirene.sh $DETECTOR $JPP_DATA/genhen.km3net_wpd_V2_0.evt.gz $WORKDIR/sirene_ ${i}.root JTriggerEfficiency.sh $DETECTOR $DETECTOR $WORKDIR/sirene_ ${i}.root $WORKDIR/trigger_efficiency_ ${i}.root $WORKDIR/trigger_parameters.txt $JPP_DATA/PMT_parameters.txt INPUT_FILES+=($WORKDIR/trigger_efficiency_ ${i}.root) done for ANGLE_DEG in $ANGLES_DEG[*];do set_variable SIGMA_NS 3.0 set_variable OUTLIERS 3 set_variable OUTPUT_FILE $WORKDIR/matrix\[${ANGLE_DEG}\deg\].root $JPP_DIR/examples/JReconstruction-f"$INPUT_FILES[*]"-o $OUTPUT_FILE-S ${SIGMA_NS}-A ${ANGLE_DEG}-O ${OUTLIERS}-d ${DEBUG}--!fiif[[$OPTION=="plot"]];then if((0));then for H1 in h0 h1;do JPlot1D-f"$WORKDIR/matrix["${^ANGLES_DEG}" deg].root:${H1}"-y"1 2e3"-Y-L TR-T""-\^"number of events [a.u.]"-> o chi2
Definition: JMatrixNZ.sh:106
JTestResult JCOMPAREHISTOGRAMS::JTestChi2_t::JChi2TestBin_2D ( TH2 *  h1,
TH2 *  h2,
double  outliersThreshold,
double  chi2Threshold,
std::string  testName,
std::string  parameterName 
)
inlineinherited

Bin-by-Bin Chi2 comparison of 2D histograms.


The Chi distance between h1 and h2 is calculated for each bin, and compared to the chi2Threshold() parameter.
If the calculated Chi distance is above this threshold, the test is passed for that bin.
If the fraction of failures is above the input parameter outliersThreshold(), the test is failed.

Parameters
h1First object
h2Second object
outliersThresholdfraction of bins allowed to fail the test
chi2Thresholdp-value
parameterNameName of the parameter used to test the histograms
testNameName of the test used to compare the histograms
Returns
Test result.

Definition at line 231 of file JTestChi2_t.hh.

231  {
232 
233  using namespace std;
234  using namespace JPP;
235 
236  int nx1 = h1->GetNbinsX();
237  int nx2 = h2->GetNbinsX();
238  int ny1 = h1->GetNbinsY();
239  int ny2 = h2->GetNbinsY();
240 
241  double M = h1->Integral();
242  double N = h2->Integral();
243 
244  if(nx1 != nx2 || ny1 != ny2 || M == 0 || N == 0)
245  ERROR("Histograms with different binning. The objects: " << h1->GetName() << " can not be compared." << endl);
246 
247  TH2D* h3 = (TH2D*)h1->Clone(h1->GetName()==h2->GetName() ?
248  MAKE_CSTRING(to_string(h1->GetName())) :
249  MAKE_CSTRING(to_string(h1->GetName()) + "_VS_" + to_string(h2->GetName())));
250 
251  h3->Reset();
252 
253  double outliers = 0;
254 
255  for (int i=1 ; i<nx1 ; ++i){
256  for (int j=1 ; j<ny1 ; ++j){
257 
258  double m = h1 -> GetBinContent(i,j);
259  double n = h2 -> GetBinContent(i,j);
260  double chi2 = (n-m*N/M)/sqrt(m*N/M);
261  (fabs(chi2) > chi2Threshold ? outliers+=1./(nx1*ny1) : outliers+=0 );
262  h3->SetBinContent(i,j,chi2);
263  }
264  }
265 
266  bool passed;
267 
268  (outliers > outliersThreshold ? passed = false : passed = true);
269 
270  JResultTitle title(testName, parameterName , passed , 100*outliers);
271 
272  h3->SetTitle(title.getTitle().c_str());
273 
274  JTestResult r (testName,
275  JRootObjectID(MAKE_STRING(h1->GetDirectory()->GetPath() << h1->GetName())),
276  JRootObjectID(MAKE_STRING(h2->GetDirectory()->GetPath() << h1->GetName())),
277  parameterName, 100*outliers, 100*outliersThreshold, h3, passed);
278 
279  return r;
280  };
#define MAKE_CSTRING(A)
Make C-string.
Definition: JPrint.hh:136
data_type r[M+1]
Definition: JPolint.hh:868
#define MAKE_STRING(A)
Make string.
Definition: JPrint.hh:127
const int n
Definition: JPolint.hh:786
#define ERROR(A)
Definition: JMessage.hh:66
then usage $script< input file >[option[primary[working directory]]] nWhere option can be N
Definition: JMuonPostfit.sh:40
std::string to_string(const T &value)
Convert value to string.
then if[[!-f $DETECTOR]] then JDetector sh $DETECTOR fi cat $WORKDIR trigger_parameters txt<< EOFtrigger3DMuon.enabled=1;trigger3DMuon.numberOfHits=5;trigger3DMuon.gridAngle_deg=1;ctMin=0.0;TMaxLocal_ns=15.0;EOF set_variable TRIGGEREFFICIENCY_TRIGGERED_EVENTS_ONLY INPUT_FILES=() for((i=1;$i<=$NUMBER_OF_RUNS;++i));do JSirene.sh $DETECTOR $JPP_DATA/genhen.km3net_wpd_V2_0.evt.gz $WORKDIR/sirene_ ${i}.root JTriggerEfficiency.sh $DETECTOR $DETECTOR $WORKDIR/sirene_ ${i}.root $WORKDIR/trigger_efficiency_ ${i}.root $WORKDIR/trigger_parameters.txt $JPP_DATA/PMT_parameters.txt INPUT_FILES+=($WORKDIR/trigger_efficiency_ ${i}.root) done for ANGLE_DEG in $ANGLES_DEG[*];do set_variable SIGMA_NS 3.0 set_variable OUTLIERS 3 set_variable OUTPUT_FILE $WORKDIR/matrix\[${ANGLE_DEG}\deg\].root $JPP_DIR/examples/JReconstruction-f"$INPUT_FILES[*]"-o $OUTPUT_FILE-S ${SIGMA_NS}-A ${ANGLE_DEG}-O ${OUTLIERS}-d ${DEBUG}--!fiif[[$OPTION=="plot"]];then if((0));then for H1 in h0 h1;do JPlot1D-f"$WORKDIR/matrix["${^ANGLES_DEG}" deg].root:${H1}"-y"1 2e3"-Y-L TR-T""-\^"number of events [a.u.]"-> o chi2
Definition: JMatrixNZ.sh:106
int j
Definition: JPolint.hh:792

Member Data Documentation

double JCOMPAREHISTOGRAMS::JTestChi2_1D::threshold
private

threshold p-value to decide if test is passed.

Definition at line 72 of file JTestChi2_1D.hh.

std::string JCOMPAREHISTOGRAMS::JTestChi2_1D::options
private

options for the ROOT chi2 test.

Definition at line 77 of file JTestChi2_1D.hh.

std::vector<JTestResult> JCOMPAREHISTOGRAMS::JTest_t::results
inherited

Buffer to store results of multiple tests.*/.

Definition at line 162 of file JTest_t.hh.

const std::string JCOMPAREHISTOGRAMS::JTest_t::testName
protectedinherited

test name

Definition at line 166 of file JTest_t.hh.

const std::string JCOMPAREHISTOGRAMS::JTest_t::resultType
protectedinherited

result type

Definition at line 167 of file JTest_t.hh.


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