Print

Print


Commit in lcsim/src/org/lcsim/recon/tracking/seedtracker on MAIN
HelixFitter.java+66-81.9 -> 1.10
Changed access level and added debug flag.

lcsim/src/org/lcsim/recon/tracking/seedtracker
HelixFitter.java 1.9 -> 1.10
diff -u -r1.9 -r1.10
--- HelixFitter.java	28 Feb 2011 19:19:11 -0000	1.9
+++ HelixFitter.java	12 Jul 2013 20:57:27 -0000	1.10
@@ -11,11 +11,8 @@
 import java.util.Map;
 
 import org.lcsim.fit.circle.CircleFit;
-import org.lcsim.fit.helicaltrack.HelicalTrackCross;
-import org.lcsim.fit.helicaltrack.HelicalTrackFit;
-import org.lcsim.fit.helicaltrack.HelicalTrackFitter;
+import org.lcsim.fit.helicaltrack.*;
 import org.lcsim.fit.helicaltrack.HelicalTrackFitter.FitStatus;
-import org.lcsim.fit.helicaltrack.HelicalTrackHit;
 import org.lcsim.fit.line.SlopeInterceptLineFit;
 import org.lcsim.recon.tracking.seedtracker.diagnostic.ISeedTrackerDiagnostics;
 import org.lcsim.fit.zsegment.ZSegmentFit;
@@ -27,7 +24,7 @@
  */
 public class HelixFitter {
     private HelicalTrackFitter _fitter = new HelicalTrackFitter();
-    private MultipleScattering _scattering;
+    protected MultipleScattering _scattering;
     private HelicalTrackFit _helix;
     private MaterialManager _materialmanager;
     private ConstrainHelix _constrain;
@@ -38,6 +35,7 @@
     private FitStatus _status;
     private ISeedTrackerDiagnostics _diag = null;
     TrackCheck _trackCheck; // set by SeedTracker
+    private boolean _debug = true;
 
     /**
      * Creates a new instance of HelixFitter
@@ -49,6 +47,7 @@
     }
     
     public boolean FitCandidate(SeedCandidate seed, SeedStrategy strategy) {
+        if(_debug) System.out.printf("%s: FitCandidate() with stategy: \"%s\"\n",this.getClass().getSimpleName(),strategy.getName());
         
         //  Initialize fit results to null objects
         _helix = null;
@@ -62,11 +61,30 @@
         //  Retrieve list of hits to be fit
         List<HelicalTrackHit> hitlist = seed.getHits();
         
+        if(_debug) {
+            System.out.println(this.getClass().getSimpleName()+": hitlist size " + hitlist.size() + ":");
+            double z_prev = -99999999.9;
+            for (HelicalTrackHit hit : hitlist) {
+                System.out.printf("%s: (%.2f,%.2f,%.2f) corrected  %s\n",
+                                    this.getClass().getSimpleName(),hit.getPosition()[0],hit.getPosition()[1],hit.getPosition()[2],
+                                    hit.getCorrectedPosition().toString());
+                if(z_prev<-99999999.0) z_prev=hit.getPosition()[2];
+                else {
+                    if(Math.signum(z_prev)!=Math.signum(hit.getPosition()[2])) {
+                        System.out.printf("%s: topBotHits in event\n",this.getClass().getSimpleName());
+                    }
+                    z_prev = hit.getPosition()[2];
+                }
+            }
+        }
         //  Retrieve the old helix
         HelicalTrackFit oldhelix = seed.getHelix();
         
         //  If this is the candidate's first helix fit, first do a fit without MS errors
         if (oldhelix == null) {
+     
+            if(_debug) 
+                System.out.println(this.getClass().getSimpleName()+": no old helix do the fit without MS scattering map" );
             
             //  Reset the stereo hit positions to their nominal value
             for (HelicalTrackHit hit : hitlist) {
@@ -85,15 +103,37 @@
             //  Retrieve the helix parameters from this fit and save them in the seed
             oldhelix = _fitter.getFit();
             seed.setHelix(oldhelix);
-            
+
+            if(_debug) System.out.printf("%s: fit succeeded, will be used as seed, with chi2=%.3f and helix:\n%s \n",this.getClass().getSimpleName(),oldhelix.chisqtot(),oldhelix.toString());
+
             //  Calculate the multiple scattering angles for this helix
             seed.setScatterAngles(_scattering.FindScatters(oldhelix));
+
+            if(_debug) {
+                System.out.printf("%s: after calculating the MS map it has %d size:\n",this.getClass().getSimpleName(),seed.getMSMap().size());
+                for(Map.Entry<HelicalTrackHit, MultipleScatter> ms : seed.getMSMap().entrySet()) {
+                    System.out.printf("%s: Hit at layer %d and position %s has MS drpdhi=%f and dz=%f\n",
+                                    this.getClass().getSimpleName(),ms.getKey().Layer(),ms.getKey().getCorrectedPosition().toString(),ms.getValue().drphi(),ms.getValue().dz());
+                }
+            }
+            
         }
         
+        if(_debug) 
+            System.out.printf("%s: update the stereo hit positions with the old helix:\n%s \n",this.getClass().getSimpleName(),oldhelix.toString());
+        
         //  Update the stereo hit positions and covariance matrices
         CorrectStereoHits(hitlist, oldhelix);
         
         //  Do a helix fit including MS errors
+        if(_debug) {
+            System.out.printf("%s: do the helix fit including MS map this time: \n",this.getClass().getSimpleName());
+            for(Map.Entry<HelicalTrackHit, MultipleScatter> ms : seed.getMSMap().entrySet()) {
+                    System.out.printf("%s: Hit at layer %d and position %s has MS drpdhi=%f and dz=%f\n",
+                                    this.getClass().getSimpleName(),ms.getKey().Layer(),ms.getKey().getCorrectedPosition().toString(),ms.getValue().drphi(),ms.getValue().dz());
+            }
+        }
+        
         _status = _fitter.fit(hitlist, seed.getMSMap(), oldhelix);
         SaveFit();
         
@@ -119,7 +159,21 @@
             if (_diag != null) _diag.fireFailedChisqCut(seed);
 
         //  If fit was successful, set the new multiple scattering angles
-        if (success) seed.setScatterAngles(_scattering.FindScatters(_helix));
+        if (success) {
+                
+            seed.setScatterAngles(_scattering.FindScatters(_helix));
+            if(_debug) {
+                System.out.printf("%s: this fit was successful, chi2=%f with resulting helix paramaters:\n%s\n",this.getClass().getSimpleName(),_helix.chisqtot(),_helix.toString());
+                System.out.printf("%s: updated MS map before returning from fitCandidate():\n",this.getClass().getSimpleName());       
+                for(Map.Entry<HelicalTrackHit, MultipleScatter> ms : seed.getMSMap().entrySet()) {
+                    System.out.printf("%s: Hit at layer %d and position %s has MS drpdhi=%f and dz=%f\n",
+                                    this.getClass().getSimpleName(),ms.getKey().Layer(),ms.getKey().getCorrectedPosition().toString(),ms.getValue().drphi(),ms.getValue().dz());
+                }
+            }
+        } else {
+            if(_debug) 
+                System.out.printf("%s: this fit with chi2=%f failed!\n",this.getClass().getSimpleName(),_helix.chisqtot());
+        }
         
         return success;
     }
@@ -197,4 +251,8 @@
         }
         return;
     }
-}
\ No newline at end of file
+
+    public void setDebug(boolean debug) {
+        this._debug = debug;
+    }
+ }
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