#ifndef ZMENVIRONMENT_H # include "ZMutility/ZMenvironment.h" #endif #include "CLHEP/Random/Randomize.h" #include "HepTuple/HepRootHist1D.h" #include "HepTuple/HepRootHist2D.h" #include "HepTuple/HepRootHistProf.h" #include "HepTuple/HepRootFileManager.h" #include "HepTuple/HepHBookHist1D.h" #include "HepTuple/HepHBookHist2D.h" #include "HepTuple/HepHBookHistProf.h" #include "HepTuple/HBookFile.h" #include "ZMutility/iostream" #include "ZMutility/iomanip" #include "ZMutility/cmath" USING( namespace std ) int main() { RanluxEngine Ranlux(19735091); RandChiSquare Rchi(Ranlux); HBookFile * aManager = new HBookFile( "HBtoR.rz" ); HepRootFileManager * bManager = new HepRootFileManager( "HBtoR.root" ); int nbins = 50; int samples = 5000; double dev; // Instantiate a gang of 1D histograms. HepHist1D & hchi30 = aManager->hist1D("HChi30", nbins, 0.0f,100.0f); HepHist1D & hchi50 = bManager->hist1D("HChi50", nbins, 0.0f,100.0f); HepHist1D & hsum = bManager->hist1D("HSum", nbins, 0.0f,100.0f); HepHist1D & hdiff = bManager->hist1D("HDifference", nbins, 0.0f,100.0f); HepHist1D & hprod = bManager->hist1D("HProduct", nbins, 0.0f,100.0f); HepHist1D & hratio = bManager->hist1D("HRatio", nbins, 0.0f,100.0f); HepHist1D & hcopy = bManager->hist1D("HCopy", nbins, 0.0f,100.0f); HepHist1D & hflip = bManager->hist1D("HFlip", nbins, 0.0f,100.0f); // Make some entries. Fill with random numbers from various distributions. cout << "\nTests for 1D histograms" << endl; for( int j=0; jhist2D("Slego1", nbinsx, -10.0f,10.0f, nbinsy, -10.0f,10.0f,0); HepHist2D & lego2 = bManager->hist2D("Slego2", nbinsx, -10.0f,10.0f, nbinsy, -10.0f,10.0f,0); HepHist2D & ssum = bManager->hist2D("SSum", nbinsx, -10.0f,10.0f, nbinsy, -10.0f,10.0f,0); HepHist2D & sdiff = bManager->hist2D("SDifference",nbinsx, -10.0f,10.0f, nbinsy, -10.0f,10.0f,0); HepHist2D & sprod = bManager->hist2D("SProduct", nbinsx, -10.0f,10.0f, nbinsy, -10.0f,10.0f,0); HepHist2D & sratio= bManager->hist2D("SRatio", nbinsx, -10.0f,10.0f, nbinsy, -10.0f,10.0f,0); HepHist2D & scopy = bManager->hist2D("SCopy", nbinsx, -10.0f,10.0f, nbinsy, -10.0f,10.0f,0); HepHist2D & sflip = bManager->hist2D("SFlip", nbinsx, -10.0f,10.0f, nbinsy, -10.0f,10.0f,0); // Make some entries. Fill with random numbers from various distributions. cout << "\nTests for 2D histograms" << endl; float w = 1.1; for( int i=0; i<16; i++ ) { for( int j=0; jhistProf("PChi1", nbins, 0.0f,50.0f, -100.0f, 100.0f ); HepHistProf & pchi2 = bManager->histProf("PChi2", nbins, 0.0f,50.0f, -100.0f, 100.0f ); HepHistProf & psum = bManager->histProf("PSum", nbins, 0.0f,50.0f, -100.0f, 100.0f ); HepHistProf & pdiff = bManager->histProf("PDifference", nbins, 0.0f,50.0f, -100.0f, 100.0f ); HepHistProf & pprod = bManager->histProf("PProduct", nbins, 0.0f,50.0f, -100.0f, 100.0f ); HepHistProf & pratio= bManager->histProf("PRatio", nbins, 0.0f,50.0f, -100.0f, 100.0f ); HepHistProf & pcopy = bManager->histProf("PCopy", nbins, 0.0f,50.0f, -100.0f, 100.0f ); HepHistProf & pflip = bManager->histProf("PFlip", nbins, 0.0f,50.0f, -100.0f, 100.0f ); // Make some entries. Fill with random numbers from various distributions. cout << "\nTests for profile histograms" << endl; double x, y; samples = 500; for( int i=0; i