#include "TROOT.h"
#include "TFile.h"
#include "TH1.h"
#include "TH2.h"
#include "TProfile.h"
#include "TNtuple.h"
#include "TRandom.h"
 
#ifdef __SC__
long G__globalvarpointer; // only for Symantec linker 
#endif
 
int Error;
 
main(int argc, char **argv)
{

  TROOT simple("simple","");
 
  TFile hfile("hsimple.root","RECREATE");
 
  TH1F *hx      = new TH1F("hx","1-dim",100,-4,4);
  TH2F *hxy     = new TH2F("hxy","2-dim",40,-4,4,40,-4,4);

  /*** 3-dim histogram is NOT working (?!) ***/
  // TH3F *hxyz    = new TH3F("hxyz","3-dim",20,-4,4,20,-4,4,20,-4,4);

  gRandom->SetSeed();

  float x, y, z;

  for (int i=0; i<100; i++) {

     gRandom->Rannor(x,y);
     z = x;

     float random = gRandom->Rndm(1);

     hx->Fill(x);
     hxy->Fill(x,y);

     /*** 3-dim histogram is NOT working (?!) ***/
     // hxyz->Fill(x,y,z);

  }
 
  /*** Save all objects in this file ***/
  hfile.Write();
 
  /*** Close the file ***/
  hfile.Close();
 
  return 0;

}

