Commit in lcsim/src/org/lcsim/fit/helicaltrack on MAIN | |||
HelixParamCalculator.java | +59 | 1.5 -> 1.6 |
add a method to calculate parameters from momentum and point on helix
diff -u -r1.5 -r1.6 --- HelixParamCalculator.java 14 Aug 2009 23:28:22 -0000 1.5 +++ HelixParamCalculator.java 5 Sep 2012 00:42:26 -0000 1.6 @@ -8,6 +8,7 @@
package org.lcsim.fit.helicaltrack; import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.Hep3Vector;
import org.lcsim.constants.Constants; import org.lcsim.event.MCParticle; import org.lcsim.event.EventHeader;
@@ -85,6 +86,64 @@
z0 = mcp.getOriginZ() - arclength * tanL; }
+ + + /* + * added 9/3/2012 by mgraham + * calculate the helix parameters given 3-momentum and a point (+ charge and field) + */ + public HelixParamCalculator(Hep3Vector momentum, Hep3Vector origin, int charge,double BField) + { + + //Calculate theta, the of the helix projected into an SZ plane, from the z axis + double px = momentum.x(); + double py = momentum.y(); + double pz = momentum.z(); + pt = Math.sqrt(px*px + py*py); + p = Math.sqrt(pt*pt + pz*pz); + double cth = pz / p; + theta = Math.acos(cth); +// System.out.println("pt = "+pt+"; costh = "+cth); + + //Calculate Radius of the Helix + R = charge* pt / (Constants.fieldConversion * BField); + + + //Slope in the Dz/Ds sense, tanL Calculation + tanL = pz / pt; + + // Azimuthal direction at origin + double mcphi = Math.atan2(py, px); + + //Distance of closest approach Calculation + double xc = origin.x() + R * Math.sin(mcphi); + double yc = origin.y() - R * Math.cos(mcphi); +// System.out.println("xc = "+xc+"; yc = "+yc); + double Rc = Math.sqrt(xc*xc + yc*yc); + + if(charge>0) + { + mcdca = R - Rc; + } + else + { + mcdca = R + Rc; + } + + + //azimuthal calculation of the momentum at the DCA, phi0, Calculation + mcphi0 = Math.atan2(xc/(R-mcdca), -yc/(R-mcdca)); + if(mcphi0<0) + { + mcphi0 += 2*Math.PI; + } + //z0 Calculation, z position of the particle at dca + x0 = -mcdca*Math.sin(mcphi0); + y0 = mcdca*Math.cos(mcphi0); + arclength = (((origin.x()-x0)*Math.cos(mcphi0))+((origin.y()-y0)*Math.sin(mcphi0))); + z0 =origin.x() - arclength * tanL; + + }
/** * Calculates the B-Field from event * @param mcpc
Use REPLY-ALL to reply to list
To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1