Hi everybody,
I would like to have comments/suggestions on the following problem. I
try to use
ROOT in a Geant4 environment as a plain replacement of HBOOK Ntuples
under FORTRAN.
It essentially works, except for the this pathological detail: everytime
i fill the ntuple, the memory
occupation of my program grows (top under Linux). I can reproduce the
pathology in this small
self-consistent example. I removed in both cases the -lNew library from
compilation, and - i think - i'm using the histogram creation procedure
suggested by Rene' under roottalk. The ntuple is correctly created once,
and filled many. Am i doing something wrong - or there's a problem
underneath?
Regards,
Piero Zucchelli
----------------------------------
#include "TROOT.h"
#include "TFile.h"
#include "TH1.h"
#include "TH2.h"
#include "TProfile.h"
#include "TNtuple.h"
#include "TRandom.h"
#include "TCanvas.h"
#include "TFormula.h"
#include "TF1.h"
#include "TApplication.h"
#include <iostream>
class HistoManager
{
public: // with description
test();
HistoManager();
~HistoManager();
};
HistoManager::HistoManager()
{};
HistoManager::~HistoManager()
{};
HistoManager::test()
{
TNtuple *ntuple2;
if ((ntuple2=(TNtuple *)gDirectory->GetList()->FindObject("Tar"))==NULL)
{
cout <<"Tar Ntuple Being Created"<<endl;
ntuple2 = new TNtuple("Tar","Tar","pid:px:py:pz:x:y:z");
}
float pid=1,px=2,py=3,pz=4,x=5,y=6,z=7;
pid=pid*py;
ntuple2->Fill(pid,px,py,pz,x,y,z);
}
main(int argc, char **argv)
{
HistoManager pippo();
TROOT simple("simple","Test of histogramming and I/O");
TFile hfile("hsimple.root","RECREATE","Demo ROOT file with histograms");
for (int i=0;i<10;) pippo.test();
// Save all objects in this file
hfile.Write();
hfile.Close();
}
______________________
Piero.Zucchelli@cern.ch
CERN tel. 767-9941 room 1-1-058, http://home.cern.ch/~pzucchel
FAX:+41-22-767-3100
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:19 MET