int GoalSideHistogramPredictor::histogramIntersection(Histogram histogramA,
		Histogram histogramB) const {
	if (histogramA.getMinBucketLabel() != histogramB.getMinBucketLabel()
			|| histogramA.getMaxBucketLabel() != histogramB.getMaxBucketLabel()
			|| histogramA.getBucketStepSize()
					!= histogramB.getBucketStepSize()) {
		Debugger::ERR("GoalSideHistogram",
				"Cannot calculate histogram intersection! "
						"The histogram parameters are different!");
		return 0;
	}
	std::map<int, int> histMapA = histogramA.getHistData();
	std::map<int, int> histMapB = histogramA.getHistData();

	int intersection = 0;
	for (std::map<int, int>::const_iterator itMapA = histMapA.begin();
			itMapA != histMapA.end(); ++itMapA) {
		intersection += min((*itMapA).second, histMapB[(*itMapA).first]);
	}
	return intersection;
}