Print

Print


Commit in hps-java/src/main/java/org/lcsim/hps/recon/tracking on MAIN
HPSHelicalTrackHitDriver.java+53-201.13 -> 1.14
Added debug output and option to save all strips that are created.

hps-java/src/main/java/org/lcsim/hps/recon/tracking
HPSHelicalTrackHitDriver.java 1.13 -> 1.14
diff -u -r1.13 -r1.14
--- HPSHelicalTrackHitDriver.java	6 Sep 2012 18:08:08 -0000	1.13
+++ HPSHelicalTrackHitDriver.java	28 Sep 2012 22:09:49 -0000	1.14
@@ -10,13 +10,7 @@
 import hep.physics.vec.BasicHep3Vector;
 import hep.physics.vec.Hep3Vector;
 import hep.physics.vec.VecOp;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import java.util.*;
 import org.lcsim.detector.IDetectorElement;
 import org.lcsim.detector.ITransform3D;
 import org.lcsim.detector.tracker.silicon.SiTrackerModule;
@@ -25,13 +19,7 @@
 import org.lcsim.event.LCRelation;
 import org.lcsim.event.MCParticle;
 import org.lcsim.event.RawTrackerHit;
-import org.lcsim.fit.helicaltrack.HelicalTrack2DHit;
-import org.lcsim.fit.helicaltrack.HelicalTrack3DHit;
-import org.lcsim.fit.helicaltrack.HelicalTrackCross;
-import org.lcsim.fit.helicaltrack.HelicalTrackHit;
-import org.lcsim.fit.helicaltrack.HelicalTrackStrip;
-import org.lcsim.fit.helicaltrack.HitIdentifier;
-import org.lcsim.fit.helicaltrack.StereoHitMaker;
+import org.lcsim.fit.helicaltrack.*;
 import org.lcsim.geometry.Detector;
 import org.lcsim.geometry.subdetector.BarrelEndcapFlag;
 import org.lcsim.hps.event.HPSTransformations;
@@ -71,6 +59,7 @@
     private Map<String, String> _stereomap = new HashMap<String, String>();
     private Hep3Vector _orgloc = new BasicHep3Vector(0., 0., 0.);
     private boolean _doTranformToTracking = true;
+    private boolean addAllStripsToEventForDebug = false;
     private HPSTransformations _detToTrk;
     String subdetectorName = "Tracker";
 
@@ -129,6 +118,8 @@
         List<LCRelation> hitrelations = new ArrayList<LCRelation>();
 
         List<HelicalTrackCross> stereoCrosses = new ArrayList<HelicalTrackCross>();
+        
+        List<HelicalTrackStrip> allstrips = new ArrayList<HelicalTrackStrip>();
 
         for (String _colname : _colnames) {
 
@@ -176,6 +167,8 @@
 
                         //  Map a reference back to the hit needed to create the stereo hit LC relations
                         stripmap.put(strip, h);
+                        
+                        if( addAllStripsToEventForDebug ) allstrips.add(strip);
 
                     } else {
 
@@ -199,6 +192,9 @@
                     String ident = entry.getKey();
                     List<HelicalTrackStrip> hts = entry.getValue();
                     System.out.println(this.getClass().getSimpleName() + ": Total number of HelicalTrackStrips: " + ident + ": " + hts.size());
+                    for(HelicalTrackStrip strip : hts) {
+                        System.out.println(this.getClass().getSimpleName() + ": strip at origin " + strip.origin().toString());
+                    }
                 }
             }
 
@@ -206,7 +202,7 @@
             //  Create a list of stereo hits
             List<HelicalTrackCross> stereohits = new ArrayList<HelicalTrackCross>();
             if (_debug) {
-                System.out.println("Map size = " + striplistmap.size());
+                System.out.println(this.getClass().getSimpleName() + ": Map size = " + striplistmap.size());
             }
             //  Loop over the stereo layer pairs
             for (String id1 : _stereomap.keySet()) {
@@ -219,7 +215,7 @@
             }
 
             if (_debug) {
-                System.out.println("Number of stereo hits = " + stereohits.size());
+                System.out.println(this.getClass().getSimpleName() + ":Number of stereo hits = " + stereohits.size());
             }
 
             //  Add the stereo hits to our list of HelicalTrackHits
@@ -231,15 +227,20 @@
                     hitrelations.add(new MyLCRelation(cross, stripmap.get(strip)));
                 }
                 if (_debug)
-                    System.out.println("Found HTC in Layer :  " + cross.Layer());
+                    System.out.println(this.getClass().getSimpleName() + ": Found HTC in Layer :  " + cross.Layer());
             }
         }
 
         //mg...6/24/11  add new set of helical track hits that are rotated to from jlab to tracking frame
         if (_doTranformToTracking) {
             addRotatedHitsToEvent(event, stereoCrosses);
+            
         }
 
+        
+        if( addAllStripsToEventForDebug ) addStripsToEvent(event,allstrips);
+        
+        
         //  Create the LCRelations between HelicalTrackHits and MC particles
         List<LCRelation> mcrelations = new ArrayList<LCRelation>();
         for (HelicalTrackHit hit : helhits) {
@@ -251,7 +252,7 @@
         //  Put the HelicalTrackHits back into the event
         event.put(_outname, helhits, HelicalTrackHit.class, 0);
         if (_debug) {
-            System.out.println("The HelicalTrackHit collection " + _outname + " has " + helhits.size() + " hits.");
+            System.out.println(this.getClass().getSimpleName() + ":The HelicalTrackHit collection " + _outname + " has " + helhits.size() + " hits.");
         }
         event.put(_hitrelname, hitrelations, LCRelation.class, 0);
         event.put(_mcrelname, mcrelations, LCRelation.class, 0);
@@ -356,20 +357,45 @@
     }
 
     private HelicalTrackStrip makeDigiStrip(SiTrackerHitStrip1D h) {
-
+        
+        if(_debug) {
+            System.out.println(this.getClass().getSimpleName() + ": makeDigiStrip--");
+            System.out.println(this.getClass().getSimpleName() + ": SiTrackerHitStrip1D at " + h.getPositionAsVector().toString());
+        }
+        
         SiTrackerHitStrip1D local = h.getTransformedHit(CoordinateSystem.SENSOR);
         SiTrackerHitStrip1D global = h.getTransformedHit(CoordinateSystem.GLOBAL);
-
+    
+        if(_debug) {
+            System.out.println(this.getClass().getSimpleName() + ": local at  " + local.getPositionAsVector().toString());
+            System.out.println(this.getClass().getSimpleName() + ": global at " + global.getPositionAsVector().toString());
+        }
+        
         ITransform3D trans = local.getLocalToGlobal();
         Hep3Vector org = trans.transformed(_orgloc);
         Hep3Vector u = global.getMeasuredCoordinate();
         Hep3Vector v = global.getUnmeasuredCoordinate();
 
+        if(_debug) {
+            System.out.println(this.getClass().getSimpleName() + ": local to global using transform:");
+            System.out.println(this.getClass().getSimpleName() + ": rotation:");
+            System.out.println(trans.getRotation().getRotationMatrix().toString());
+            System.out.println(this.getClass().getSimpleName() + ": translation:");
+            System.out.println(trans.getTranslation().getTranslationVector().toString());
+        }
+        
         double umeas = local.getPosition()[0];
         double vmin = VecOp.dot(local.getUnmeasuredCoordinate(), local.getHitSegment().getStartPoint());
         double vmax = VecOp.dot(local.getUnmeasuredCoordinate(), local.getHitSegment().getEndPoint());
         double du = Math.sqrt(local.getCovarianceAsMatrix().diagonal(0));
 
+        if(_debug) {
+            System.out.println(this.getClass().getSimpleName() + ": resulting org " + org.toString());
+            System.out.println(this.getClass().getSimpleName() + ": resulting u " + u.toString());
+            System.out.println(this.getClass().getSimpleName() + ": resulting v " + v.toString());
+            System.out.println(this.getClass().getSimpleName() + ": resulting umeas " + umeas);
+        }
+        
         IDetectorElement de = h.getSensor();
         String det = _ID.getName(de);
         int lyr = _ID.getLayer(de);
@@ -390,6 +416,9 @@
         } catch (RuntimeException e) {
             // Okay when MC info not present.
         }
+        
+        if(_debug) System.out.println(this.getClass().getSimpleName() + ": produce final strip at " + strip.origin().toString());
+
         return strip;
     }
 
@@ -444,6 +473,10 @@
         //  Create the LCRelations between HelicalTrackHits and MC particles
 
     }
+    
+    private void addStripsToEvent(EventHeader event, List<HelicalTrackStrip> strips) {
+        event.put("HelicalTrackStrips", strips, HelicalTrackStrip.class,0);
+    }
 
     private Hep3Vector getPosTrkSystem(Hep3Vector pos) {
         return _detToTrk.transformVectorToTracking(pos);
CVSspam 0.2.12


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