I found a great set of ROOT libraries developed at GANIL called KaliVeda. I haven't learned all about the libraries yet to fully exploit their awesomeness, and in fact, so far I'm using them for a purpose slightly other than they were intended.
Basically ROOT is a data analysis framework, and the KaliVeda libraries also fit this notion. I'm using the libraries for simulation. This likely is what allowed me to find a very surprising bug today.
In short, I'm using KV for doing nuclear kinematics mainly because the resulting code is much more elegant, and I didn't want to spend eons checking a bunch of complicated laboratory and center of mass frame conversion equation implementations. Life's funny sometimes...
(Side note:
fiendishx once lamented to me that we shouldn't have to do physics homework a computer can do. Homework you don't understand how to do is worth doing if you want to learn anything in this life. Solving equations you understand but want a computer to solve because you have better physics to do is just good time management. Computer programs have physics bugs, case-in-point, and without knowing the physics, how do you plan on coding the computer to do your work for you?)
So my simulation wants to randomize the center of mass angle (eventually with proper weighting, but it needs to be random, in any case). However, KV, as an experiment data analysis library set, mainly includes tools for getting information about the center of mass system based on laboratory frame data. Thus setting the laboratory angle, or inputting it as a parameter to other functions, is a cinch. Setting the center of mass angle has to be done outside the libraries in a normal style. Basically I just define an equation for the randomized laboratory angle of my neutrons which is a function of the center of mass angle I've randomly generated. If you ask why I don't randomize the laboratory angle instead, clearly you've not studied up on your thick target inverse kinematics nuclear techniques (post comment if you want to learn, nuclear physics is interesting).
KV has some great sanity check routines. In fact, they are so good, it turns out they are better than certain portions of the code! Without this I never would have noticed or found the error. The nice ROOT documentation system is certainly commendable, although I wish they'd get all get with the program and switch to doxygen. So, basically I got the error, and I was like, yeah, shit, my theta equations are missing Lorentz factors. I'm pretty lazy and I don't honestly trust most of my analytic equation solving, so I asked around for anyone who had a text on relativistic center-of-mass kinematics. "I could derive it, but I don't know a book," was the only answer I heard.
I forget why I went to the RIKEN library, honestly. I really, truly do. But for some reason I decided to read the title of every book in their physics section.
(one minute has passed in real time)
Oh, now I remember. I wanted to see if they had like some fucking conference proceeding from LBL from 1974 that had some paper on something relating to the rotating target neutron source. And then I stumbled upon Baldin's "Kinematics of Nuclear Reactions" 1961 text. And I said, "Oh great, maybe a book dedicated to the subject will derive the relativistic forms for me!
As anyone who has to deal with these kinds of people knows, they love doing natural things like setting c=1. "Natural fucking idiot," is more like it. I found an equation for one of the velocities, and I'm like, "...it's momentum over energy...I see...good thing I was actually reading your bloody chapter so I caught the c=1 footnote!" Granted, seeing p without c in relativity would set off alarm bells in my head anyway, so I worked it out, and sure enough, he's missing a factor of c2. If I had to guess how this happened, it's because he's actually just defining beta, but he calls it a velocity. Beta has an inverse speed of light usually. And like I said, p usually gets a c. So if you re-arrange it (or do some unit analysis, which was what I resorted to), then you get a c^2 term. (On a side note, people who call beta a velocity piss me off. I might have tons of gripes with high energy physicists (except Allan Bayntun!) but at least their theory with natural units is "you know it's energy, so you can figure out how many physical constants (how about fucking all of them) to zero. Okay, beta is a velocity parameter, it's not a velocity. It's a unitless parameter. So how'm I going to unit solve that?)
Blah blah blah, so I know there's an error in my code. Awhile later wasting time researching Molybdenum, I find the right library text and photocopy the chapter of interest. A nervous breakdown later, and I'm like, sigh, "Guess I should get that beam model code working and fix that relativity bug I made."
So, I had that bug.
But guess what?
KaliVeda had the exact same fucking bug. I'm not even joking. Verbatim in the code. Trying to do the same thing. Both missing 1/gamma. Don't believe me? See my
bug report, which in 4 minutes went from confirmed, to "High" importance to 30 minutes later "I applied your patch and released a new version."
Hence, Gentoo for the win. I learned how to file fucking bug reports, bitches.
I the mean time, I copied and destroyed my own source code trying to figure out why the fuck I didn't fix this relativity bug of mine. Yeah, laugh it up. Then I finally just took the absolutely most fool-proof case. "What the fuck? This library collision bugs yield!?" Yes, I was so surprised I used Japanese-styled English grammar.
I think within about 10 minutes of realizing I should be looking at the library source code instead of my own I had made a patch for it. I think deciding if I was awake enough to submit a bug report actually took longer.