How to link with GEANT part of ROOT (2)

Witold Przygoda (Witold.Przygoda@Physik.Tu-Muenchen.DE)
Mon, 6 Jul 1998 20:47:29 +0200 (MDT)


Hi all Rooters.

Excuse me to bother (all of you) once more.
I have added before my root-c++ code a line
TROOT root("Rint","The ROOT Interactive Interface");
which seems to initialize ROOT.

File opens, a tree with branches/leaves creates,
it even seems to fill (as I print it respectively in each event)
but when I want to call Write() /of TFile variable/ it crashes.
In particular of course it crashes if I finish GEANT with 'exit'
and the message I get is:

TFile Writing Name=rich.root Title=Simulation data
CustomReAlloc2: oldsize != size
Fatal in <CustomReAlloc2>: unreasonable size (-1056)
aborting
forrtl: error (76): IOT trap signal
Resources lost

Any help is wanted!
(please Reply to my e-mail, too)
Witold P.

p.s. let me include my c++ code below:

--------------------------------------------------------------

#include "cfortran.h"
#include <stdlib.h>
#include "TROOT.h"
#include "TRint.h"
#include "TFile.h"
#include "TTree.h"
#include "TBranch.h"
#include "TSystem.h"
#include "TObject.h"

struct dataset0 {
int idevt;
int ncer;
float xcer;
float ycer;
float ecer;
float parentcer;
};

TROOT root("Rint","The ROOT Interactive Interface");
static TFile *hfile;
static TTree *tre;
static TBranch *bre[1];
static dataset0 mytup0;

void booktree() {

hfile = new TFile("rich.root","RECREATE","Simulation data");
tre = new TTree("TRich","RICH tree");
bre[0]=tre->Branch("cerenkov",&mytup0.idevt,"idevt/I:ncer/I:xcer/F:ycer:ecer:parentcer");
hfile->Print();
}
FCALLSCSUB0(booktree,BOOKTREE,booktree)

void filltree(float sdata[18]) {

mytup0.idevt = (int)sdata[0];
mytup0.ncer = (int)sdata[1];
mytup0.xcer = sdata[2];
mytup0.ycer = sdata[3];
mytup0.ecer = sdata[4];
mytup0.parentcer = sdata[5];
tre->Fill();
hfile->Print();
}
FCALLSCSUB1(filltree,FILLTREE,filltree,FLOATV)

void closetree() {

hfile->Write();
hfile->Close();
}
FCALLSCSUB0(closetree,CLOSETREE,closetree)

--------------------------------------------------------

Function booktree is called inside ubook (geant part)
and closetree inside entry (last) of ubook called at the end.

Function filltree is called in udigi (geant part)
with the float array parameter containing data to be stored.

- - - -