Skip to content
Snippets Groups Projects
Commit ee06e568 authored by Pospelov, Gennady's avatar Pospelov, Gennady
Browse files

Additional check in ChiSquaredModule for mask consistency

parent dcc7ce65
No related branches found
No related tags found
No related merge requests found
......@@ -41,6 +41,7 @@ public:
//! Returns residual between data and simulation for single element.
virtual double getResidualValue(size_t index ) const;
};
#endif /* CHISQUAREDMODULE_H_ */
......
......@@ -46,6 +46,7 @@ double ChiSquaredModule::calculateChiSquared()
OutputData<double> *p_difference = createChi2DifferenceMap();
OutputData<double>::const_iterator it_weights = mp_weights->begin();
OutputData<double>::const_iterator it_diff = p_difference->begin();
double sum = 0;
while(it_diff != p_difference->end())
sum += (*it_diff++)*(*it_weights++);
......@@ -92,6 +93,9 @@ OutputData<double>* ChiSquaredModule::createChi2DifferenceMap() const
OutputData<double>::const_iterator it_real = mp_real_data->begin();
while (it_diff != p_difference->end()) {
if( (it_sim.getIndex() != it_real.getIndex()) || (it_sim.getIndex() != it_diff.getIndex()) ) {
throw DomainErrorException("ChiSquaredModule::calculateChiSquared() -> Iterator inconsistency");
}
double value_simu = *it_sim++;
double value_real = *it_real++;
double squared_difference =
......@@ -105,3 +109,4 @@ OutputData<double>* ChiSquaredModule::createChi2DifferenceMap() const
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment