RE: [ROOT] cannot create object of class TIter

From: Philippe Canal (pcanal@fnal.gov)
Date: Wed Oct 15 2003 - 19:20:51 MEST


Hi Ondrej,

A TIter object can not be saved onto a file (hence the system you not even
try to look it up).
As a workaround (and a clarification of your code anyway, just modify your
class as follow:

   TClonesArray *fParticles; // Array with particles
   TIter *fpart_iter;                 //! caching the current ptr to
iterator

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch [mailto:owner-roottalk@pcroot.cern.ch]On
Behalf Of 0ndrej Chvala
Sent: Wednesday, October 15, 2003 7:05 AM
To: roottalk@pcroot.cern.ch
Subject: [ROOT] cannot create object of class TIter


Dear rooters,

I have 2 classes, one describes an event and the other a track in that
event. The event contains a TClonesArray with the tracks and the iterrator:

    TClonesArray *fParticles;            // Array with particles
    TIter *fpart_iter;                   // ptr to iterator

When an new event is created, the TClonesArray is created:

  fParticles = new TClonesArray("TBigDSWriteParticle",1000);
  fpart_iter = new TIter(fParticles);

The classes can be compiled, loaded into root runtime, but when I try to
make a branch, it complaints:
root [0] .L /cern/root/lib/libEG.so
root [1] .L /cern/root/lib/libPhysics.so
root [2] .L ../lib/libmicro.so
root [3]   TFile *tfile= new TFile("/tmp/dsttest.root","RECREATE");
root [4]   TTree *tft = new TTree("tft","");
root [5]   tfile->SetCompressionLevel(2);
root [6]   TBigDSWriteEvent *myevent=new TBigDSWriteEvent();
root [7]   TBigDSWriteParticle *mypart;
root [8]
tft->Branch("TBigDSWriteEvent","TBigDSWriteEvent",&myevent,5000000,1);
Error in <TClass::New>: cannot create object of class TIter

The source codes are atached.

Any help is greatly welcomed, I already tried to use other container
objects (TList, TObjArray), asked whom I can around but I'm still stucked.

Thank you
0ndrej Chvala, NA49 << File: TBigDSWriteEvent.h >>  << File:
TBigDSWriteParticle.h >>  << File: TBigDSWriteEvent.cxx >>  << File:
TBigDSWriteParticle.cxx >>



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:16 MET