Again on TClonesArray & Co.

Diego Casadei (casadei@bo.infn.it)
Sat, 16 May 1998 12:06:05 -0500 (CDT)


Hello Rooters,
let me speak about a data structure I have adopted.

I'd like to have a tree (TTree or the future TOak) containing objects of
the class TAMSRun (a collection of events recorded by the AMS detector).

Each TAMSRun run object contains a TClonesArray (for the moment) of
TAMSEvent objects.
Each TAMSEvent event contains a TClonesArray (for the moment) of TTOFplane
objects.
Each of them contains a TClonesArray of TTOFcounter objects, containing a
TClonesArray("TTOFside",2).

TOF is the time of flight subdetector of AMS: 4 planes of 14 scintillator
bars with PMTs in both the ends. From here TTOFplane, TTOFcounter,
TTOFside.

Now, I expect that the majority of the counters will contain data coming
from both the sides, and the sizeof(TTOFside) is constant. Then I used
TClonesArray (and this shouls be OK).

Howewer, the sizeof(TTOFplane) in general will not be constant. E.g. I
expect more fired conters on the first plane than on the others (the soft
part of the CR spectrum). I'm not sure in this case if I should use
TObjArray instead of TClonesArray.

What do you think?

A final question. Both TClonesArray and TObjArray have a Delete() member
function, so that for example I guess that I could write

TAMSRun::~TAMSRun(){
events->Delete();
return;
}

instead of

TAMSRun::~TAMSRun(){
for(Int_t i=nEvt-1;i>=0;i--)
delete(*events)[i];
return;
}

where TAMSRun contains a TClonesArray *events; data member.

Is that correct?

Thanks

Diego Casadei
casadei@bo.infn.it
casadei@cern.ch
AMS-BO lab: tel. +39 51 630 5044
fax +39 51 630 5040