> Dear Victor: let me disagree with what you're saying. Yes, to store an object in
> TClonesArray you're supposed to use `new with placement'. However if you look at
> its implementation (see NEW_NewDelete.cxx) you'll see that it has nothing to do
> with CINT.
Yes and No, from the first glance NEW_NewDelete does not depend of CINT.
But who provide the size of new object? Let see the example given in TClones:
// One better uses a TClonesArray which reduces the number of //
// new/delete calls to only O(10000): //
// //
// TCloneArray a("TTrack", 10000); //
See here. TCloneArray knows about TTrack only by string containing this name
// while (TEvent *ev = (TEvent *)next()) { // O(100000) events //
// for (int i = 0; i < ev->Ntracks; i++) { // O(10000) tracks //
// new(a[i]) TTrack(x,y,z,...); //
Addres of free space a[i] provided by TCloneArray. but how it could know
about it by "TTrack" string? Only via dictionary.
Theoretically you can add to TCloneArray constructor the size of object, like:
TCloneArray a("TTrack", sizeof(TTrack),10000):
then you can forget about CINT temporary. But if you still want I/O, then:
1. for output you need streemer provided by ROOTCINT.
2. OK, you wrote streamer for TTrack yourself. But how TCloneArray could know
which streamer to use? Very simple, your object inherited from TObject
and C++ via virtual function mechanizm can invoke your streamer. Still good.
3. On Input TCloneArray must invoke new operator and then fill object by streamer
C++ cannot invoke new by string name. It is possibly only via ROOTCINT.
You can try of course use malloc instead and fill object by streamer.
But in this case who will fill pointer to virtual table? Only ROOTCINT.
OK, let us limit ourselves by simple objects without any virtual function
But your object MUST be inherited from TObject and MUST have virtual streamers.
Look point 2 above.
So you can simplify TCloneArray to avoid CINT but then you immediately will lose I/O.
I mean not only split mode I/O but any I/O.
Happy new year, Victor
-- Victor M. Perevoztchikov perev@bnl.gov perev@vxcern.cern.ch Brookhaven National Laboratory MS 510A PO Box 5000 Upton NY 11973-5000 tel office : 516-344-7894; fax 516-344-4206; home 516-345-2690