Hum I’m facing a tough challenge…

Here are the fact:

All my data are in a root file. This root file is filled with a TTree. The TTree presents 24 branches (corresponding to my number of detectors). Each branch is filled with TObjectArray (in this precise case 333). And each TObectArray is filled with TClonesArray (about 12000). Finally each TClonesArray is filled with three datas: Energy, time and a “marker” for each hit on a detector.
In the same branches TClonesArray are ordered in time…

What I want to do, is to fill a TH2F with the energy of hits coming from the first branch and of the second branch only if the time that separate these two hits is smaller than a defined value. I already have a algorithm to do that kind of coincidences… but I fear that the access time is to long. So I would like to kwon what are the fastest root functions I can use to reach my goal…

If someone have any proposition I’m ready to buy it!!

Thank you


If the number of TObjArrays is constant for a given branch (333), you should invert the structure, ie create a TClonesArray with objects of a class like
class myHit : public TObject {
int fTime[333];
double fEnergy[333];
short fMarker[333];


The problem is that my tree size is not constant…

So I can’t generate “standard TClonesArray”…

I continue to search…

What do you mean by “my tree size is not constant”?
A Tree size is never constant. In my example above, the TClonesArray
contains a variable number of myClass objects at each entry.
In case your number “333” is not a constant, simply change your class to something like

int fN; //current size of the arrays below
int *fTime; //[fN]
double *fEnergy; //[fN]
short *fMarker; //[fN]

In this case, you do not use al teh advantages of a TClonesArray, but it will work.