//-------------------------------------------------------------------- // // Make some 1D histograms of Gamma and Poisson functions // // History: // 21-Feb-2000 WEB Improve standard C++ compatibility // //-------------------------------------------------------------------- #ifdef ISOCXX__ISOCXX #include #endif #include #include "CLHEP/Random/Randomize.h" #include "HepTuple/HepHBookHist1D.h" #include "HepTuple/TupleManager.h" #include "HepTuple/HBookFile.h" #include "ZMtools/fillRandom.h" #include "ZMutility/iostream" #include #include USING( std::cerr ) USING( std::endl ) int main() { RanluxEngine Ranlux(19735091); RandGamma Gamma(Ranlux,3.0,2.0); RandPoisson Pois(Ranlux,6.0); HBookFile * tManager = new HBookFile( "fillRandom.rz" ); HepHist1D & bin1 = tManager->hist1D("Gamma(3,2) 10000 entries", 50, 0.0f,10.0f); HepHist1D & bin2 = tManager->hist1D("Gamma(3,2) 100000 entries", 50, 0.0f,10.0f); HepHist1D & bin3 = tManager->hist1D("Poisson(6) 20000 entries", 30,-0.5f,29.5f); HepHist1D & bin4 = tManager->hist1D("Poisson(6) 100000 entries", 30,-0.5f,29.5f); HepHist1D & bin5 = tManager->hist1D("Gamma(3,2) 10000 samples", 40,-3.0f, 7.0f); HepHist1D & bin6 = tManager->hist1D("Poisson(6) 10000 samples", 25,-4.5f,21.5f); // Fill with random numbers from Gamma and Poisson distributions. fillRandom( Gamma, bin1, 10000 ); fillRandom( Gamma, bin2, 100000 ); fillRandom( Pois, bin3, 20000 ); fillRandom( Pois, bin4, 100000 ); // Generate subsamples from bin2 and bin4 fillRandom( bin2, bin5, 10000 ); fillRandom( bin4, bin6, 10000 ); // Write out the histograms and bail out tManager->write(); delete tManager; cerr << "\nNormal end" << endl; return 0; } // main()