Coincidence sorting

I wonder if some one can give me some pointers for an efficient way to do coincidence sorting between two Root trees.

I have two Root trees that contain Gamma events from two different detectors. One of the branches in each tree contains a 64-bit time stamp in increasing order(and sorted to the last significant bit). The two tree have diiferent number of events.

I would like to seek out those events from both trees that occur within a set time window, e.g., within 10 nanoseconds of each other.

I have had a good look into the ROOT classes. I understand “qSort” is available in Root for 64-bit integer. “TList” has the sort method implemented. But if I implement any sorting using the way I have in mind, it would be very inefficient.

I believe sorting for coincidence is a common requirements in high energy Physics experiments. Someone out there would have done a better job than what I can do, since there are many tricks of the trade when it come to sorting.

I would welcome any pointers; better still, some one willing to share their codes.

Much appreciated

Tim

May be you will get some inspiration from the example in the attachement.

Rene
prodtime.C (2.62 KB)

Hi Rene,

I can not believe my eyes when I see the example prodtime.C that is so customised to my needs.

I owe you a bunch for this.

Tim