jump to navigation

ROOT, oh… November 29, 2006

Posted 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!



1. superweak - December 9, 2006

I’ve been bitten by the something very similar to the second bug — we had (full) Monte Carlo generation whose seeds were keyed off of the start time of the job, and were confused for a while as to why we were getting repeated events, but only when files were generated when the batch queues were empty … we eventually “solved” this by adding long random delays at the beginning of each job.

2. Gordon Watts - December 18, 2006

Indeed — that is what we do as well. Isn’t this silly!?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: