Sometimes going forwards means going backwards

At our group meeting today, it was pointed out that my pixels (not the helpers in super paper mario) looked a bit off and it was suggested I take a look at them. Each HiRA telescope has 32 Efront strips and 32 Ebacks for 1024 'pixels'. I calculated the position of all of them, but they didn't appear to cover a big enough area. So I checked, and the width of the active area was slightly less than it should be ~.6mm. You may think half a millimeter is really small and negligible, but remember, we're trying to do precision measurements on nuclei that are very small.

I calculate the pixels by finding the center of the detector and the horizontal and vertical unit vectors. I then 'build' the pixel matrix by going half a strip width in the vertical direction and half a strip width in the horizontal direction, etc until the position of all pixels are found. I triple checked the dimensions of the strip width, the gaps in between them, and the algebra in the code long ago, so I knew that wasn't the problem. The only thing I could think of was that my unit vectors weren't orthogonal. So I checked... and they weren't.

So tonight, while I was watching the Red Wings hand the Avalanche a loss, I was trying to figure out how to make two vectors perpendicular. The depth unit vector is easy, you just take the cross product of the other two. But what if the angle between those two is only 89.8 degrees? The vectors are a result of the laser measurements, so there's no guarantee they're prependicular.

I came up with an interesting solution that doesn't play favorites with either vector. Say we have vectors a and b which are almost, but not quite orthogonal. We want an orthogonal set x,y,z. I go ahead and take a cross b to get c perp to both. Then I find the angle between a and b. I rotate both a and b about c (in opposite directions) by half the difference between 90 degrees and the angle between them. Find the dot product of the new rotated vectors and voila, it's 0.

So tomorrow I get to redo a bunch of calculations. I only have a narrow window to work between doing fun hands-on marble nuclei activities with middle school kids and a friend's birthday party, but they'll get done. Sunday I get to move onto the exciting world of Cesium Iodide crystal calibrations!