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  December 2016

HPS-SVN December 2016

Subject:

r4636 - /java/trunk/tracking/src/main/java/org/hps/recon/tracking/TrackTweakDriver.java

From:

[log in to unmask]

Reply-To:

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

Date:

Sat, 17 Dec 2016 01:22:23 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (164 lines)

Author: [log in to unmask]
Date: Fri Dec 16 17:22:20 2016
New Revision: 4636

Log:
Modify the track parameters of the track state at the target. Add ability to specify what collections to remove. Add documentation.

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

Modified: java/trunk/tracking/src/main/java/org/hps/recon/tracking/TrackTweakDriver.java
 =============================================================================
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/TrackTweakDriver.java	(original)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/TrackTweakDriver.java	Fri Dec 16 17:22:20 2016
@@ -4,8 +4,10 @@
 
 import org.lcsim.event.EventHeader;
 import org.lcsim.event.Track;
+import org.lcsim.event.TrackState;
 import org.lcsim.event.base.BaseTrack;
 import org.lcsim.fit.helicaltrack.HelicalTrackFit;
+import org.lcsim.geometry.Detector;
 import org.lcsim.util.Driver;
 
 /**
@@ -16,53 +18,104 @@
  */
 public final class TrackTweakDriver extends Driver {
 
-    /** Name of the collection of tracks to tweak. */
+    /** The magnitude of the B field used.  */
+    private double bField = 0.24; // Tesla
+    
+    /** Name of the collection of tracks to apply corrections to. */
     private String trackCollectionName = "GBLTracks";
+   
+    /** 
+     * The track parameter corrections that will be applied to all top 
+     * tracks. 
+     */
+    private double[] topTrackCorrection = {0, 0, 0, 0, 0};
+
     
-    private final double[] topTrackCorrection = {0, 0, 0, 0, 0};
-    private final double[] botTrackCorrection = {0, 0, 0, 0, 0};
+    /** 
+     * The track parameter corrections that will be applied to all bottom 
+     * tracks. 
+     */
+    private double[] botTrackCorrection = {0, 0, 0, 0, 0};
+   
+    /** List of collections to remove from an event. */
+    private String[] removeCollections = {};
     
     /** Default constructor */
     public TrackTweakDriver() {}
-    
+   
+    /** @param topZ0Correction Z0 correction to apply to top tracks. */
     public void setTopZ0Correction(double topZ0Correction) {
         topTrackCorrection[HelicalTrackFit.z0Index] = topZ0Correction;
     }
 
+    /** 
+     * @param topLambdaorrection tan(lambda) correction to apply to top 
+     *        tracks. 
+     */
     public void setTopLambdaCorrection(double topLambdaCorrection) {
         topTrackCorrection[HelicalTrackFit.slopeIndex] = topLambdaCorrection;
     }
 
+    /** @param topD0Correction D0 correction to apply to top tracks. */
     public void setTopD0Correction(double topD0Correction) {
         topTrackCorrection[HelicalTrackFit.dcaIndex] = topD0Correction;
     }
 
+    /** @param topPhiCorrection phi0 correction to apply to top tracks. */
     public void setTopPhiCorrection(double topPhiCorrection) {
         topTrackCorrection[HelicalTrackFit.phi0Index] = topPhiCorrection;
     }
 
+    /** @param topOmegaCorrection 1/R correction to apply to top tracks. */
     public void setTopOmegaCorrection(double topOmegaCorrection) {
         topTrackCorrection[HelicalTrackFit.curvatureIndex] = topOmegaCorrection;
     }
 
+    /** @param botZ0Correction Z0 correction to apply to bottom tracks. */
     public void setBotZ0Correction(double botZ0Correction) {
         botTrackCorrection[HelicalTrackFit.z0Index] = botZ0Correction;
     }
 
+    /** 
+     * @param botLambdaorrection tan(lambda) correction to apply to bottom 
+     *        tracks. 
+     */
     public void setBotLambdaCorrection(double botLambdaCorrection) {
         botTrackCorrection[HelicalTrackFit.slopeIndex] = botLambdaCorrection;
     }
 
+    /** @param botD0Correction D0 correction to apply to bottom tracks. */
     public void setBotD0Correction(double botD0Correction) {
         botTrackCorrection[HelicalTrackFit.dcaIndex] = botD0Correction;
     }
 
+    /** @param botPhiCorrection phi0 correction to apply to bottom tracks. */
     public void setBotPhiCorrection(double botPhiCorrection) {
         botTrackCorrection[HelicalTrackFit.phi0Index] = botPhiCorrection;
     }
 
+    /** @param botOmegaCorrection 1/R correction to apply to bottom tracks. */
     public void setBotOmegaCorrection(double botOmegaCorrection) {
         botTrackCorrection[HelicalTrackFit.curvatureIndex] = botOmegaCorrection;
+    }
+    
+    /**
+     * Specify the collections that will be removed from the event.  This 
+     * is meant to be used in cases where the tweaked tracks are used to
+     * regenerate other collections e.g. V0Candidates to replace exisiting
+     * collections. 
+     *  
+     * @param collections Collections that will be removed from the event. 
+     */
+    public void setRemoveCollections(String[] removeCollections) { 
+       this.removeCollections = removeCollections; 
+    }
+   
+    @Override
+    protected void detectorChanged(Detector detector) {
+       
+        /** Get the B-field from the geometry description */
+        bField = TrackUtils.getBField(detector).magnitude();
     }
     
     @Override
@@ -79,10 +132,23 @@
         
         // Loop through all tracks in an event and tweak the track parameters
         for (Track track : tracks) { 
-            
-           BaseTrack tweakedTrack = (BaseTrack) track;
-           double[] tweakedTrackParameters = tweakedTrack.getTrackParameters();
-           tweakedTrack.setTrackParameters(tweakedTrackParameters, 0);
-        } 
+           
+           // Get the track state at the target
+           TrackState trackState = track.getTrackStates().get(0);
+           
+           // Loop through the track parameters and apply the corrections
+           double[] tweakedTrackParameters = new double[trackState.getParameters().length];
+           for (int param_index = 0; param_index < tweakedTrackParameters.length; ++param_index) {
+               tweakedTrackParameters[param_index] 
+                       = trackState.getParameter(param_index) 
+                           + ((trackState.getTanLambda() > 0) ? topTrackCorrection[param_index] : botTrackCorrection[param_index]);
+           }
+           // Override the old track parameters with the tweaked parameters
+           ((BaseTrack) track).setTrackParameters(tweakedTrackParameters, bField);
+        }
+       
+        for (String collection : removeCollections) { 
+            event.remove(collection);
+        }
     }
 }

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