Commit in hps-java/src/main/java/org/lcsim/hps/users/phansson on MAIN | |||
WTrack.java | +17 | -8 | 1.1 -> 1.2 |
Added flip sign switch.
diff -u -r1.1 -r1.2 --- WTrack.java 9 Oct 2012 01:20:02 -0000 1.1 +++ WTrack.java 12 Oct 2012 05:54:07 -0000 1.2 @@ -40,14 +40,21 @@
_parameters = trk.getParameters(); }
-
public WTrack(HelicalTrackFit track, double bfield) {
- _bfield = bfield; - _q = (int) Math.signum(track.R());
+ this.initWithTrack(track, bfield, false); + } + + public WTrack(HelicalTrackFit track, double bfield, boolean flip) { + this.initWithTrack(track, bfield, flip); + } + public void initWithTrack(HelicalTrackFit track, double bfield, boolean flip) { + double signR = flip ? -1*Math.signum(track.R()): Math.signum(track.R()); + _bfield = bfield; + _q = (int) signR;
_bfield_constant = Constants.fieldConversion*_bfield*_q; double a = _bfield_constant;
- double c = 1/(2*track.R()); //note the different definition than in canonical track
+ double c = 1/(2*Math.abs(track.R())*signR); //note the different definition than in canonical track
double phi0 = track.phi0(); double lambda = track.slope(); // lambda = 1/tan(theta) double pt = track.pT(_bfield);
@@ -65,13 +72,15 @@
_parameters[5] = track.dca()*Math.cos(phi0); //y0 _parameters[6] = track.z0(); //z0
- double pt_tmp = Math.sqrt(_parameters[0]*_parameters[0] + _parameters[1]*_parameters[1]);
if(_debug) {
- System.out.println(this.getClass().getSimpleName() + ": a " + a + " R " + track.R() + " c " + c + " phi0 " + phi0 + " pt " + pt);
+ System.out.println(this.getClass().getSimpleName() + ": WTrack initialized from HelicalTrackFit with params"); + System.out.println(track.toString()); + System.out.println(this.getClass().getSimpleName() + ": B-field " + _bfield + " q " + _q + " a " + a); + System.out.println(this.getClass().getSimpleName() + ": R " + track.R() + " c " + c + " phi0 " + phi0 + " pt " + pt); + double pt_tmp = Math.sqrt(_parameters[0]*_parameters[0] + _parameters[1]*_parameters[1]);
System.out.println(this.getClass().getSimpleName() + ": P0x " + _parameters[0] + " P0y " + _parameters[1] + " -> pt " + pt_tmp); }
- } -
+ }
public void setTrackParameters(double [] params) { _parameters = params; }
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