ROOT, oh… November 29, 2006Posted by gordonwatts in computers, physics.
We’ve been nailed by two ROOT gotcha’s this week.
The first one I lost almost 6 hours of debugging time to. It turns out that a function called GetRMS does not return the root-mean-square of a distribution. Rather, it returns the sigma. It is clearly stated in the documentation:
Note that this function returns the Standard Deviation (Sigma) of the distribution (not RMS). The name “RMS” was introduced many years ago (Hbook/PAW times). We kept the name for continuity.
Yes. Once a “bug” always a bug!
The second one was more insidious because it caused us to waste several peoples time. My post-doc was generating 1000’s of sample datasets to test our algorithm. Each dataset is generated using a random number generator. He choose the simplest one, from ROOT, called TRandom. Now, this is already marked as a bad algorithm, but we didn’t care much about the way it is listed as bad in the documentation. But we missed the following about the way the seed is initialized(central to the sequence of numbers a random number generator returns):
Set the random generator seed if seed is zero, the seed is set to the current machine clock. Note that the machine clock is returned with a precision of 1 second. If one calls SetSeed(0) within a loop and the loop time is less than 1s, all generated numbers will be identical!
We didn’t worry because we were generating only a single random number generator per job. The only problem: we submitted 100’s of jobs. And the batch manager we are using starts the jobs all as a group. Many of them started within one second of each other and we had many many duplicate samples! It took a while to figure that one out!