# Linear Regression in Polar Space

1. Jan 15, 2013

### Nick.Kallas

I have posted this question before but I don't think I was clear on what i was trying to do exactly. I am trying to simulate a set of muon detecting drift tubes in 2d space. I have 2 sets of detector tubes (shown as black circles in the image), a particle trajectory goes through all tubes instantaneously (represented as a blue line 2 shown), if a particle passes through the tube you can tell how far from the center of the tube the particle was but not in what direction this closest point was (The closest point in the trajectory is represented omnidirectionaly as a colored circle). Using the information about how close the particle was to the center of the respective tubes it passed through, i need to recreate the trajectory of the particle. Fundamentally I am given one set of colored circles and need to find the best fit line that is tangent to all the circles. Since this data is represented as the distance from the center of a tube to the trajectory without any directional data (i.e. no θ) I believe a linear regression must be preformed in polar coordinates.

If anyone could point me in the right direction it would be greatly appreciated. I am trying to implement this in MATLAB so i cannot use any external programs.

Let me know if i need to clarify anything else about the problem.

2. Jan 16, 2013

### Staff: Mentor

This looks very similar to the outer tracker at LHCb. A simple solution would be to test all different options with a regression in cartesian coordinates - with a fit quality determined by the difference ((simulated radius)-(measured radius))/(estimated error) or something like that.
If your problem has a real application, I could try to contact someone at LHCb who worked with that.

3. Jan 16, 2013

### Nick.Kallas

I am developing this algorithm using matlab simulations so that I can test how accurate it is, but I will then map it into 3 dimensions and implement it on hardware. Once implemented on real hardware there will be no way to reliably test the accuracy. There are also some other considerations that I need to account for in the algorithm but this is a starting point. The algorithm I am trying to develop will probably be much simpler that those implemented on other similar drift tube muon detectors such as those installed at particle colliders and the like.

I cant convert the radi into Cartesian coordinates because they are represented as a circles. I only know how far from the center of a tube the trajectory was not in what direction.

Thanks

4. Jan 17, 2013

### Staff: Mentor

Your radius measurement gives something like "$r=300\pm 50 {\mu}m$". For a given track in cartesian coordinates, you can calculate the radius, and get the deviation from the measured radius. As there is an analytic expression for this radius (based on coordinates for track and straw), you can even calculate its derivative in your parameter space.

Each double layer gives 4 possible track layouts, for most tracks 2 or 3 of them should have a very bad fit, so you can quickly reduce the number of possible orientations and perform a regular regression for them afterwards.

5. Jan 17, 2013

### Stephen Tashi

You've made the geometry of your problem perfectly clear. However, it isn't clear why you mention regression. The mention of that suggests dealing with "noise" and "errors". Are you simulating measurement errors?

The inputs and outputs of your simulation aren't clear. Are you simulating a known muon trajectory as the input and computing the outputs of the detectors as if they worked perfectly? Or are you simulating a known muon trajectory and computing the outputs of the detectors as if they make random measurement error? - Or simulating something else entirely?

6. Jan 17, 2013

### Nick.Kallas

Sorry I forgot to mention it, I have added noise to the hit radii to simulate real world noise. I know the trajectories on the simulation but i need to implement this algorithm in a system where i will not know the actual trajectories. The reason for the simulation is so that i can compare the calculated trajectories with the simulated trajectories and determine how accurate my algorithm will calculate them before implementation. Here is a picture of one of the 2 layers of the final implementation just so you can get a better idea of what im dealing with.

7. Jan 17, 2013

### Stephen Tashi

The way I look at it, you have a problem of "estimation", not a problem of predicting a dependent variable as a linear function of some independent variables.

If this is a common problem in experimental physics, the physicists may have a slick way to do it. I can only suggest the first way that comes to mind:

To keep the number of variables to a minimum, we can visualize the detectors sitting between 2 parallel planes. Let the top plane be parallel to the xy plane through the point (0,0,z1) for some known constant value z1. Let the bottom plane be the xy plane (which passes through (0,0,0) ). Let the muon have a path that goes from the point (x1,y1,z1) to the point (x0,y0,0). If we estimate x1,y1,x0,y0 from the data then we can solve for any other properties of the path that are of interest.

One method of estimation is "maximum liklihood". Using that method, we would estimate x1,y1,x0,y0 to be the values that maximize the probability density function for the observed data. We must determine what the probability density function is.

A sketch of determining the density is:

Assume, for the time being, that x1,y1,x0,y0 are given and that the observed data from k = 1,2,..n detection tubes is o1 = r1 + d1 ,o2 = r2 + d2,..., on = rn + dn, where the ri are the actual min distance from the ith tube axis that the ray passes and the di are the errors in the measurement of that distance. ( The observed data is the values of the oi, not how it is broken down into the ri and di).

It's possible to solve for the ri given x1,y1,x0,y0. It might be messy, but this is a matter of geometry: "What is the minimum distance between the given path and the axis of the given tube?".

The observed data is oi = ri + di. Since we have solved for ri, we can find di by subtraction. The liklihood of the observed data is the joint probability density for the errors d1,d2,... dn. For example, if you assume the errors are jointly independently distribution with a density function f(x) then the value of the joint probability density (the "liklihood") is the product f(d1)f(d2),...f(dn).

The liklihood can be expressed as function of only (x1,y1,x0,y0) and (o1,o2,...on) since the di can be computed from that information. Treating, x1,y1,x0,y0 as variables we can seek the values of these variables that maximize the liklihood function.

You might also treat this as a least squares problem, if you have a faith in the magic of least squares. You could try to find the values of x1,y1,x0,y0 that minimze the function d1^2 + d2^2 + .... dn^2 . (I don't think finding those values amounts to a linear regression problem. )

Last edited: Jan 18, 2013