CERN Accelerating science

This website is no longer maintained. Its content may be obsolete. Please visit http://home.cern/ for current CERN information.

Software contributed by other people

Here we describe briefly software we consider relevant for the domain, but which is contributed by other people and solely distributed with the PI project. To make it very clear, we do not provide maintenance and only limited (front-end) support for the packages in here.

StatisticsTesting

A package to do "Goodness-of-fit" testing of 1D data/distributions which is being developed in collaboration with the testing system of the Geant-4 project. The package provides implementations for several comparison algorithms which are used from a user-layer based on AIDA interfaces for binned and unbinned histograms as well as "free format data".

More documentation

Examples of use

Simple examples of use in your code:

#include "StatisticsTesting/StatisticsComparator.h"

    // ... create and fill actual histogram (actHist)
    // ... create and fill (or read from file) reference histogram (refHist)

    // ... create a comparator using the Chi-square algorithm for binned data:
    StatisticsTesting::StatisticsComparator < StatisticsTesting::Chi2ComparisonAlgorithm > comparator;


    try {
	double avgHeight  = actHist->sumBinHeights()/double(actHist->axis().bins());
	double maxHeight  = actHist->maxBinHeight();
	// scale the contents of the histos to the content of the ref histos
	double scaleFactor = double(refHist->sumBinHeights())/double(actHist->sumBinHeights());
	actHist->scale(scaleFactor);
	// compare the scaled histos with the reference ones
	// result = comparator.compare( *actHist, *refHist );
        result = comparator.compare( *refHist, *actHist );
	std::cout << "    result of ChiSquare comparison for ID=" << id << " is: " << result 
		  << " avg height  = " << avgHeight
		  << " max height  = " << maxHeight
		  << std::endl;;
    } catch (StatisticsTesting::StatTestException &e) {
	std::cout << "    something went wrong in compare()... :-( " << std::endl;
    }  

    

Example of comparing histograms in files

A more complete example on how to read histograms from a file and compare all 1D histograms with the ones from another file can be found in the AIDA_Utilities package (in the tests subdirectory) in the compareHistos.cpp file. You can have a look at the LXR version of the file, or find it in the release (or checked out sources) at AnalysisServices/AIDA_Utilities/tests/compareHistos.cpp.


Last modified: Wed Mar 03 16:37:22 Europe de l'Ouest 2004