Thanks for your answers,
I put my remarks/question below :
[quote=“pcanal”]Hi,
However, it seems that you are misusing/misunderstanding how the TTree structure works. [Or maybe this is just an artefact of your simplify the real code] Your code reads: T->Branch("event","RootBox",&event,8000,2);
for (Int_t ev=0;ev<nev;ev++) {
traj = event->AddTraj(ev);
for (Int_t j=0;j<Ntraj;j++) {
traj->fX = (ev+1)*(j+1);
...
T->Fill();
}
}
Note in particular that you do not call event->Clear() in your loop.
By Definition T->Fill() copies to disk the entire event object. So the effect of the loop as is, is that the 10 event will contain exactly one Trajectory object with various value. The next 10 events will contain exactly two Trajectory object one with the same value for ALL 10 events and one with various values. The next 10 events will contain exactly 3 Trajectory object, two with the same values for ALL 10 events and one with various value for each event, etc.
Note also that given the code in the tar file and the look above, each of the TClonesArray contains at most one Trajectory.
If (and only if
) this code snippet represent your intent, it sounds like all you need a single TCloneArrays.
Cheers,
Philippe.[/quote]
You’re absolutely right, I forget the event->Clear()
when I created that example …
so concerning the code I really wanted to fill an array of TCloneArrays : in fact, my variable name (ev) :
represents the detector ID : I would like to fill one TCloneArray per detector. (I have maximum 20 detectors --> see in .cxx code). For each detector I fill X,Y,Z as following :
for (Int_t j=0;j<Ntraj;j++) {
traj->fX = (ev+1)*(j+1);
...
ps : X, Y, Z contains have no physical meaning … 
Again I come back to my problem :
If you look the output rootfile, it seems that I cannot read the Traj Array … 
Each time I try to Draw :
tree->Draw(“fTraj[i].fX”) (i=0,1,2,… etc) I get the following error message :
The output you saw during the execution of Iko.C is just :
cout<<
"x --> "<<(ev+1)*(j+1)<<
"y --> "<<(ev+1)*(j+4)<<
"z --> "<<(ev+1)*(j+412)<<
endl;
and if you type : T->Show() after the tree is filled, it seems that the TCloneArray is not properly filled … 
I don’t see why the TCloneArray cannot be filled in such a way … 
Thanks again 
Cheers