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:

r4640 - /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:

Sun, 18 Dec 2016 23:18:13 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (188 lines)

Author: [log in to unmask]
Date: Sun Dec 18 15:18:10 2016
New Revision: 4640

Log:
Recalculate the track state at the Ecal and add the track states at SVT layer 1 and 2.

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	Sun Dec 18 15:18:10 2016
@@ -2,12 +2,16 @@
 
 import java.util.List;
 
+import org.lcsim.detector.converter.compact.subdetector.HpsTracker2;
+import org.lcsim.detector.converter.compact.subdetector.SvtStereoLayer;
+import org.lcsim.detector.tracker.silicon.HpsSiSensor;
 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.geometry.FieldMap;
 import org.lcsim.util.Driver;
 
 /**
@@ -18,18 +22,56 @@
  */
 public final class TrackTweakDriver extends Driver {
 
+    /** 
+     * Name of the constant denoting the position of the Ecal face in the 
+     * compact description.
+     */
+    private static final String ECAL_POSITION_CONSTANT_NAME = "ecal_dface";
+
+    /** Name of the SVT subdetector volume. */
+    private static final String SUBDETECTOR_NAME = "Tracker";
+   
+    /** Layer 1 track state index. */
+    private static final int LAYER1_TS_INDEX = 6;
+
+    /** Layer 2 track state index. */
+    private static final int LAYER2_TS_INDEX = 7;
+    
+    /** The B field map */
+    FieldMap bFieldMap = null;
+    
     /** The magnitude of the B field used.  */
     private double bField = 0.24; // Tesla
     
+    /** Position along the beamline of the Ecal face */
+    private double ecalPosition = 0; // mm
+   
+    /** Z position to start extrapolation from */
+    private double extStartPos = 700; // mm
+
+    /** The extrapolation step size */ 
+    private double stepSize = 5.0; // mm
+    
+    /** Top SVT layer 1 z position */
+    private double topLayer1Z = 0;
+    
+    /** Bot SVT layer 1 z position */
+    private double botLayer1Z = 0;
+
+    /** Top SVT layer 2 z position */
+    private double topLayer2Z = 0;
+    
+    /** Bot SVT layer 2 z position */
+    private double botLayer2Z = 0;
+    
     /** 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};
-
     
     /** 
      * The track parameter corrections that will be applied to all bottom 
@@ -39,7 +81,7 @@
    
     /** List of collections to remove from an event. */
     private String[] removeCollections = {};
-    
+   
     /** Default constructor */
     public TrackTweakDriver() {}
    
@@ -113,9 +155,43 @@
    
     @Override
     protected void detectorChanged(Detector detector) {
-       
-        /** Get the B-field from the geometry description */
+      
+        // Get the field map from the detector object
+        bFieldMap = detector.getFieldMap(); 
+        
+        // Get the B-field from the geometry description 
         bField = TrackUtils.getBField(detector).magnitude();
+        
+        // Get the position of the Ecal from the compact description
+        ecalPosition = detector.getConstants().get(ECAL_POSITION_CONSTANT_NAME).getValue();
+    
+        // Get the stereo layers from the geometry and build the stereo
+        // layer maps
+        List<SvtStereoLayer> stereoLayers 
+            = ((HpsTracker2) detector.getSubdetector(SUBDETECTOR_NAME).getDetectorElement()).getStereoPairs();
+
+        // Loop through all of the stereo layers and find the midpoint between
+        // the sensors of layers 1 & 2.  This will be used to set the track 
+        // states at those layers.
+        for (SvtStereoLayer stereoLayer : stereoLayers) { 
+            System.out.println("Layer: " + stereoLayer.getLayerNumber());
+            if (stereoLayer.getLayerNumber() > 2) continue;
+            
+            HpsSiSensor axialSensor = stereoLayer.getAxialSensor();
+            HpsSiSensor stereoSensor = stereoLayer.getStereoSensor();
+            
+            double axialZ = axialSensor.getGeometry().getPosition().z();
+            double stereoZ = stereoSensor.getGeometry().getPosition().z(); 
+            double z = (axialZ + stereoZ)/2;
+            
+            if (stereoLayer.getLayerNumber() == 1) {
+                if (axialSensor.isTopLayer()) topLayer1Z = z; 
+                else botLayer1Z = z;
+            } else if(stereoLayer.getLayerNumber() == 2) {
+                if (axialSensor.isTopLayer()) topLayer2Z = z; 
+                else botLayer2Z = z;
+            }
+        }
     }
     
     @Override
@@ -123,7 +199,7 @@
     
         // If the event doesn't have the specified collection of tracks, throw
         // an exception.
-        if(!event.hasCollection(Track.class, trackCollectionName)) {
+        if (!event.hasCollection(Track.class, trackCollectionName)) {
             throw new RuntimeException("Track collection " + trackCollectionName + " doesn't exist");
         }
         
@@ -145,8 +221,30 @@
            }
            // Override the old track parameters with the tweaked parameters
            ((BaseTrack) track).setTrackParameters(tweakedTrackParameters, bField);
-        }
-       
+        
+           // Extrapolate the tweaked track to the face of the Ecal and get the
+           // track state
+           TrackState stateIP = TrackUtils.getTrackStateAtLocation(track, TrackState.AtIP);
+           if (stateIP == null) { 
+               throw new RuntimeException("IP track state for GBL track was not found");
+           }
+           TrackState stateEcalIP = TrackUtils.extrapolateTrackUsingFieldMap(stateIP, extStartPos, ecalPosition, stepSize, bFieldMap);
+           
+           // Replace the existing track state at the Ecal
+           int ecalTrackStateIndex = track.getTrackStates().indexOf(TrackUtils.getTrackStateAtLocation(track, TrackState.AtCalorimeter));
+           track.getTrackStates().set(ecalTrackStateIndex, stateEcalIP);
+            
+           // Get the track state at the first layer
+           double layer1Z = trackState.getTanLambda() > 0 ? topLayer1Z : botLayer1Z; 
+           TrackState stateLayer1 = TrackUtils.extrapolateTrackUsingFieldMap(stateIP, extStartPos, layer1Z, stepSize, bFieldMap);
+           track.getTrackStates().add(stateLayer1);
+
+           // Get the track state at the first layer
+           double layer2Z = trackState.getTanLambda() > 0 ? topLayer2Z : botLayer2Z; 
+           TrackState stateLayer2 = TrackUtils.extrapolateTrackUsingFieldMap(stateIP, extStartPos, layer2Z, stepSize, bFieldMap);
+           track.getTrackStates().add(stateLayer2);
+        }
+    
         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