LISTSERV mailing list manager LISTSERV 16.5

Help for HPS-SVN Archives


HPS-SVN Archives

HPS-SVN Archives


HPS-SVN@LISTSERV.SLAC.STANFORD.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

HPS-SVN Home

HPS-SVN Home

HPS-SVN  February 2015

HPS-SVN February 2015

Subject:

r2038 - /java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/MakeGblTracks.java

From:

[log in to unmask]

Reply-To:

Notification of commits to the hps svn repository <[log in to unmask]>

Date:

Wed, 4 Feb 2015 01:02:26 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (157 lines)

Author: [log in to unmask]
Date: Tue Feb  3 17:02:21 2015
New Revision: 2038

Log:
Converting corrections in the curvilinear frame to new track parameters in the perigee frame. Needs verification.

Modified:
    java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/MakeGblTracks.java

Modified: java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/MakeGblTracks.java
 =============================================================================
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/MakeGblTracks.java	(original)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/MakeGblTracks.java	Tue Feb  3 17:02:21 2015
@@ -1,12 +1,21 @@
 package org.hps.recon.tracking.gbl;
 
 import hep.physics.matrix.SymmetricMatrix;
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.Hep3Matrix;
+import hep.physics.vec.Hep3Vector;
+import hep.physics.vec.VecOp;
 
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 
+import org.hps.recon.tracking.gbl.HpsGblRefitter.FittedGblTrajectory;
+import org.hps.recon.tracking.gbl.matrix.Matrix;
+import org.hps.recon.tracking.gbl.matrix.SymMatrix;
+import org.hps.recon.tracking.gbl.matrix.Vector;
+import org.lcsim.constants.Constants;
 import org.lcsim.event.EventHeader;
 import org.lcsim.event.Track;
 import org.lcsim.event.TrackerHit;
@@ -34,18 +43,16 @@
      * @param seed SeedTrack
      * @param bfield magnetic field (used to turn curvature into momentum)
      */
-    public void Process(EventHeader event, Map<GblTrajectory, Track> gblTrajectories, double bfield) {
+    public void Process(EventHeader event, List<FittedGblTrajectory> gblTrajectories, double bfield) {
         
         List<Track> tracks = new ArrayList<Track>();
         
-        for(Entry<GblTrajectory, Track> entry : gblTrajectories.entrySet()) {
+        for(FittedGblTrajectory fittedTraj : gblTrajectories) {
             
-            GblTrajectory traj = entry.getKey();
-            Track seed = entry.getValue();
-
+            
             //  Initialize the reference point to the origin
             double[] ref = new double[] {0., 0., 0.};
-            SeedTrack seedTrack = (SeedTrack) seed;
+            SeedTrack seedTrack = (SeedTrack) fittedTraj.get_seed();
             SeedCandidate trackseed = seedTrack.getSeedCandidate();
 
             //  Create a new SeedTrack (SeedTrack extends BaseTrack)
@@ -58,10 +65,10 @@
 
             //  Retrieve the helix and save the relevant bits of helix info
             HelicalTrackFit helix = trackseed.getHelix();
-            double gblParameters[] = getGblCorrectedHelixParameters(helix,traj);
+            double gblParameters[] = getGblCorrectedHelixParameters(helix,fittedTraj, bfield);
             trk.setTrackParameters(gblParameters, bfield); // Sets first TrackState.
             //trk.setTrackParameters(helix.parameters(), bfield); // Sets first TrackState.
-            SymmetricMatrix gblCovariance = getGblCorrectedHelixCovariance(helix, traj);
+            SymmetricMatrix gblCovariance = getGblCorrectedHelixCovariance(helix, fittedTraj, bfield);
             trk.setCovarianceMatrix(gblCovariance); // Modifies first TrackState.
             //trk.setCovarianceMatrix(helix.covariance()); // Modifies first TrackState.
             trk.setChisq(helix.chisqtot());
@@ -99,7 +106,7 @@
      * @return covariance matrix.
      */
     private SymmetricMatrix getGblCorrectedHelixCovariance(
-            HelicalTrackFit helix, GblTrajectory traj) {
+            HelicalTrackFit helix, FittedGblTrajectory traj, double bfield) {
         // TODO Actually implement this method
         return helix.covariance();
     }
@@ -110,9 +117,71 @@
      * @param traj - fitted GBL trajectory
      * @return corrected parameters.
      */
-    private double[] getGblCorrectedHelixParameters(HelicalTrackFit helix, GblTrajectory traj) {
-        //TODO Actually implement this method
-        return helix.parameters();
+    private double[] getGblCorrectedHelixParameters(HelicalTrackFit helix, FittedGblTrajectory traj, double bfield) {
+        
+        // get seed helix parameters
+        double d0 = helix.dca();
+        double z0 = helix.z0();
+        double phi0 = helix.phi0();
+        double slope = helix.slope();
+        double p = helix.p(bfield);
+        double qOverP = traj.get_seed().getCharge()/p;
+        
+        // get corrections from GBL fit
+        Vector locPar = new Vector(5);
+        SymMatrix locCov = new SymMatrix(5);
+        traj.get_traj().getResults(1, locPar, locCov); // vertex point
+        double qOverPCorr = locPar.get(FittedGblTrajectory.GBLPARIDX.QOVERP.getValue());
+        double xTCorr = locPar.get(FittedGblTrajectory.GBLPARIDX.XT.getValue());
+        double yTCorr = locPar.get(FittedGblTrajectory.GBLPARIDX.YT.getValue());
+        double xTPrimeCorr = locPar.get(FittedGblTrajectory.GBLPARIDX.XTPRIME.getValue());
+        double yTPrimeCorr = locPar.get(FittedGblTrajectory.GBLPARIDX.YTPRIME.getValue());
+        
+        // calculate new d0
+        // correct for different sign convention of d0 in curvilinear frame
+        Hep3Matrix perToClPrj = traj.get_track_data().getPrjPerToCl();
+        Hep3Matrix clToPerPrj = VecOp.inverse(perToClPrj);
+        Hep3Vector vec_out = VecOp.mult(clToPerPrj, new BasicHep3Vector(xTCorr, yTCorr, 0.0));
+        //double d0_corr = -1.0 * self.track.prjClToPer(self.xTCorr(label),self.yTCorr(label))[1];
+        double d0_corr = -1.0*vec_out.y(); // correct for different sign convention of d0 in curvilinear frame
+        double d0_gbl = d0 + d0_corr;
+        
+        // calculate new z0
+        //return self.track.prjClToPer(self.xTCorr(label),self.yTCorr(label))[2]
+        double z0_corr = vec_out.z();
+        double z0_gbl = z0 + z0_corr;
+        
+        // calculate new curvature
+        //      return self.track.qOverP(bfac) + self.curvCorr()
+        double qOverP_gbl = qOverP + qOverPCorr;
+        double p_gbl = traj.get_seed().getCharge()/qOverP_gbl;
+        double pt_gbl = p_gbl * helix.sth();
+        double C_gbl = Constants.fieldConversion * bfield / pt_gbl;
+        C_gbl = Math.signum(helix.curvature())*Math.abs(C_gbl); // fix sign, don't think I need to do all this
+        
+
+        // TODO Is the below really true?
+        
+        //calculate new phi0
+        double phi0_gbl = phi0 + Math.atan(xTPrimeCorr);
+        // prorate by dip angle
+        phi0_gbl = phi0_gbl/Math.sin(Math.atan(slope));
+
+        //calculate new slope
+        // A correction to track direction yT' in curvilinear frame is proportional 
+        // to a correction on the dip angle lambda
+        double slope_gbl = Math.tan( Math.atan(helix.slope()) + yTPrimeCorr);
+        
+        
+        
+        double parameters_gbl[] = new double[5];
+        parameters_gbl[HelicalTrackFit.dcaIndex] = d0_gbl;
+        parameters_gbl[HelicalTrackFit.z0Index] =  z0_gbl;
+        parameters_gbl[HelicalTrackFit.curvatureIndex] = C_gbl;
+        parameters_gbl[HelicalTrackFit.slopeIndex] = slope_gbl;
+        parameters_gbl[HelicalTrackFit.phi0Index] = phi0_gbl;
+        
+        return parameters_gbl;
     }
     
     public void setTrkCollectionName(String name) {

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

November 2017
August 2017
July 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013

ATOM RSS1 RSS2



LISTSERV.SLAC.STANFORD.EDU

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager

Privacy Notice, Security Notice and Terms of Use