#ifndef ROOTHISTOPDFTESTER_H #define ROOTHISTOPDFTESTER_H #include "TH1.h" #include "TFile.h" namespace Pdf { class RootHistoPdfTester { public: RootHistoPdfTester( const char * fileName ) : _file( fileName, "RECREATE" ) {} ~RootHistoPdfTester() { _file.Close(); } template void test( const Generator& generator, const char * histoName, const char * histoDescr, int bins, double xmin, double xmax, int n = 100000 ) { TH1F histo( histoName, histoDescr, bins, xmin, xmax ); typename Generator::arg0 x; for( int i = 0; i < n; i ++ ) { generator.generate( x ); histo.Fill( x ); } histo.Write(); } private: TFile _file; }; } #endif