ROOT logo
//
// This simple macro demonstrates persistency of FOAM object.
// First run macro foam_demo.C to create file foam_demo.root with FOAM object.
//
// Next type root -l foam_demopers.C from shell command line
//

Int_t foam_demopers()
{
  gSystem->Load("libFoam.so");
  gROOT->ProcessLine(".L foam_demo.C+");
  //******************************************
  cout<<"====================== TestVector ================================"<<endl;
  TFile fileA("foam_demo.root");
  fileA.cd();
  cout<<"------------------------------------------------------------------"<<endl;
  fileA.ls();
  cout<<"------------------------------------------------------------------"<<endl;
  fileA.Map();
  cout<<"------------------------------------------------------------------"<<endl;
  fileA.ShowStreamerInfo();
  cout<<"------------------------------------------------------------------"<<endl;
  fileA.GetListOfKeys()->Print();
  cout<<"------------------------------------------------------------------"<<endl;
  //*******************************************
  TFoam  *FoamX = (TFoam*)fileA.Get("FoamX");
  //*******************************************
//  FoamX->PrintCells();
  FoamX->CheckAll(1);

 Double_t *MCvect =new Double_t[2]; // 2-dim vector generated in the MC run

 for(long loop=0; loop<50000; loop++){
    FoamX->MakeEvent();            // generate MC event
    FoamX->GetMCvect( MCvect);     // get generated vector (x,y)
    Double_t x=MCvect[0];
    Double_t y=MCvect[1];
    if(loop<10) cout<<"(x,y) =  ( "<< x <<", "<< y <<" )"<<endl;
    }// loop
  //
  Double_t IntNorm, Errel;
  FoamX->Finalize(   IntNorm, Errel);     // final printout
  Double_t MCresult, MCerror;
  FoamX->GetIntegMC( MCresult, MCerror);  // get MC integral, should be one
  cout << " MCresult= " << MCresult << " +- " << MCerror <<endl;
  cout<<"===================== TestPers FINISHED ======================="<<endl;
  return 0;
}
//_____________________________________________________________________________
//

 foam_demopers.C:1
 foam_demopers.C:2
 foam_demopers.C:3
 foam_demopers.C:4
 foam_demopers.C:5
 foam_demopers.C:6
 foam_demopers.C:7
 foam_demopers.C:8
 foam_demopers.C:9
 foam_demopers.C:10
 foam_demopers.C:11
 foam_demopers.C:12
 foam_demopers.C:13
 foam_demopers.C:14
 foam_demopers.C:15
 foam_demopers.C:16
 foam_demopers.C:17
 foam_demopers.C:18
 foam_demopers.C:19
 foam_demopers.C:20
 foam_demopers.C:21
 foam_demopers.C:22
 foam_demopers.C:23
 foam_demopers.C:24
 foam_demopers.C:25
 foam_demopers.C:26
 foam_demopers.C:27
 foam_demopers.C:28
 foam_demopers.C:29
 foam_demopers.C:30
 foam_demopers.C:31
 foam_demopers.C:32
 foam_demopers.C:33
 foam_demopers.C:34
 foam_demopers.C:35
 foam_demopers.C:36
 foam_demopers.C:37
 foam_demopers.C:38
 foam_demopers.C:39
 foam_demopers.C:40
 foam_demopers.C:41
 foam_demopers.C:42
 foam_demopers.C:43
 foam_demopers.C:44
 foam_demopers.C:45
 foam_demopers.C:46
 foam_demopers.C:47
 foam_demopers.C:48
 foam_demopers.C:49
 foam_demopers.C:50
 foam_demopers.C:51
 foam_demopers.C:52