Random assignment of data

I have to plot a coincidence timing resolution histogram (PET detector simulation). This is made by plotting the time differences between the first coincidence photon (time 1) and the second (time 2).

In my simulation time2 > time1 so when I plot the difference, the distribution of Time2-Time1 has only positive values. Since in reality Time1 can be > Time2, I want to plot randomly T1-T2 and T2-T1, but I am struggling a lot to find a way.

Any help on how to set this up would be appreciated.

Thank you,


_ROOT Version:5.34

Instead of (T2-T1), try ((gRandom->Rndm() < 0.5) ? (T2 - T1) : (T1 - T2))

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.