Commit in hps-java/src/main/java/org/lcsim/hps/users/phansson on MAIN | |||
ParticleHelixProducer.java | +23 | -14 | 1.1 -> 1.2 |
Fix for photon run when MC particles are created at the HARP target.
diff -u -r1.1 -r1.2 --- ParticleHelixProducer.java 9 Oct 2012 01:22:28 -0000 1.1 +++ ParticleHelixProducer.java 10 Oct 2012 18:53:10 -0000 1.2 @@ -51,7 +51,6 @@
Hep3Matrix detToTrk; SvtTrackExtrapolator extrapolator = new SvtTrackExtrapolator(); Hep3Vector _bfield;
- WTrackUtils wutils = new WTrackUtils();
TrackerHitType trackerType = new TrackerHitType(TrackerHitType.CoordinateSystem.GLOBAL, TrackerHitType.MeasurementType.STRIP_1D); CoordinateSystem coordinate_system = trackerType.getCoordinateSystem();
@@ -87,7 +86,6 @@
Hep3Vector IP = new BasicHep3Vector(0., 0., 1.); _bfield = new BasicHep3Vector(0,0,detector.getFieldMap().getField(IP).y()); detToTrk = trackerhitutils.detToTrackRotationMatrix();
- this.wutils.setDebug(true);
}
@@ -115,6 +113,22 @@
Hep3Vector p = part.getMomentum(); Hep3Vector org = part.getOrigin(); double q = -1*part.getCharge(); //since I flipped the B-field I need to flip the charge
+ + //propagate to start of field region if needed + double dz = 0-org.z(); + if(dz>0) { + System.out.print(this.getClass().getSimpleName() + ": Propagate MC particle to field region from org=" + org.toString()); + double tanPxPz = p.x()/p.z(); + double tanPyPz = p.y()/p.z(); + double dx = dz*tanPxPz; + double dy = dz*tanPyPz; + + org = new BasicHep3Vector(org.x()+dx,org.y()+dy,org.z()+dz); + + System.out.println( " to org=" + org.toString() + " (p=" + p.toString()+ ")"); + + } +
//if(debug) System.out.println(this.getClass().getSimpleName() + ": MC particle p=" + p.toString() +" org=" + org.toString() +" q = " + q); p = VecOp.mult(detToTrk, p); org = VecOp.mult(detToTrk, org);
@@ -129,24 +143,19 @@
double Rman = q*pt/(Constants.fieldConversion*bfield); double phi = Math.atan2(p.y(),p.x()); double xc = org.x() + Rman*Math.sin(phi);
- double yc = org.y() - Rman*Math.cos(phi);
+ double yc = org.y() - Rman*Math.cos(phi);
double Rc = Math.sqrt(xc*xc+yc*yc); double dca = q >0 ? (Rman - Rc) : (Rman + Rc);
- System.out.println(this.getClass().getSimpleName() + ": pt " + pt +" R " + Rman + " phi " + phi + " xc " + xc + " yc " + yc + " Rc " + Rc + " DCA " + dca );
+ System.out.println(this.getClass().getSimpleName() + ": manual calcualtion gives pt " + pt +" R " + Rman + " phi " + phi + " xc " + xc + " yc " + yc + " Rc " + Rc + " DCA " + dca );
} //HelixParamCalculator hpc = new HelixParamCalculator(part,bfield); HelixParamCalculator hpc = new HelixParamCalculator(p, org, (int)q,bfield); //remove sign from b-field
- double R = hpc.getRadius(); - double slope = hpc.getSlopeSZPlane(); - double d0 = hpc.getDCA(); - double phi0 = hpc.getPhi0(); - double z0 = hpc.getZ0();
double[] pars = new double[5];
- pars[0] = d0; - pars[1] = phi0; - pars[2] = 1/R; - pars[3] = z0; - pars[4] = slope;
+ pars[0] = hpc.getDCA(); + pars[1] = hpc.getPhi0(); + pars[2] = 1/hpc.getRadius(); + pars[3] = hpc.getZ0(); + pars[4] = hpc.getSlopeSZPlane();
HelicalTrackFit htf = this.trackUtils.makeHelicalTrackFit(pars); tracks.add(htf); if(debug) {
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