Commit in hps-java/src/main/java/org/lcsim/hps/recon/tracking on MAIN
TrackerReconDriver.java+168-1681.10 -> 1.11
code format; no functional changes

hps-java/src/main/java/org/lcsim/hps/recon/tracking
TrackerReconDriver.java 1.10 -> 1.11
diff -u -r1.10 -r1.11
--- TrackerReconDriver.java	22 Feb 2012 21:17:25 -0000	1.10
+++ TrackerReconDriver.java	1 Mar 2012 22:46:09 -0000	1.11
@@ -23,256 +23,256 @@
  * It is intended to work with the {@link TrackerDigiDriver} digitization Driver.
  * 
  * @author jeremym
- * @version $Id: TrackerReconDriver.java,v 1.10 2012/02/22 21:17:25 jeremy Exp $
+ * @version $Id: TrackerReconDriver.java,v 1.11 2012/03/01 22:46:09 jeremy Exp $
  */
 public final class TrackerReconDriver extends Driver 
 {
-	// Debug flag.
-	private final static boolean DEBUG = true;
-		
-	// Tracks found across all events.
-	int ntracks = 0;
-	
-	// Number of events processed.
-	int nevents = 0;
-	
-	// Cache detector object.
-	Detector detector = null;
-	
+    // Debug flag.
+    private final static boolean DEBUG = true;
+
+    // Tracks found across all events.
+    int ntracks = 0;
+
+    // Number of events processed.
+    int nevents = 0;
+
+    // Cache detector object.
+    Detector detector = null;
+
     // Default B-field value.
     private double bfield = 0.5;
-    
+
     // Name of the SVT subdetector.
     private String subdetectorName = "Tracker";
-            
+
     // SimTrackerHit input collection for readout cleanup.
     private String simTrackerHitCollectionName = "TrackerHits";
-    
+
     // Tracking strategies resource path. 
     private String strategyResource = "HPS-Test-1pt3.xml";
-        
+
     // Output track collection.
     private String trackCollectionName = "MatchedTracks";
-    
+
     // HelicalTrackHit input collection.
     private String stInputCollectionName = "RotatedHelicalTrackHits";
-    
+
     // Output hit collection for HelicalTrackHits.
     private String hthOutputCollectionName = "HelicalTrackHits";
-    
+
     // Input strip hits collection from digi.
     private String stripHitsCollectionName = "StripClusterer_SiTrackerHitStrip1D";
-    
+
     // Hit relations output collection.
-	private String helicalTrackHitRelationsCollectionName = "HelicalTrackHitRelations";
-	
-	// Track to MC relations output collection.
-	private String helicalTrackMCRelationsCollectionName = "HelicalTrackMCRelations";
-	
-	// Max strip separation when making HelicalTrackHits.
-	private double stripMaxSeparation = 10.01;	
-	
-	// Tolerance factor when making HelicalTrackHits.
-	private double stripTolerance = 0.01;
-		
+    private String helicalTrackHitRelationsCollectionName = "HelicalTrackHitRelations";
+
+    // Track to MC relations output collection.
+    private String helicalTrackMCRelationsCollectionName = "HelicalTrackMCRelations";
+
+    // Max strip separation when making HelicalTrackHits.
+    private double stripMaxSeparation = 10.01;	
+
+    // Tolerance factor when making HelicalTrackHits.
+    private double stripTolerance = 0.01;
+
     public TrackerReconDriver()
     {}
-        
+
     public void setSubdetectorName(String subdetectorName)
     {
-    	this.subdetectorName = subdetectorName;
+	this.subdetectorName = subdetectorName;
     }
-    
+
     /**
      * Set the tracking strategy resource.
      * @param strategyResource The absolute path to the strategy resource in the hps-java jar.
      */        
     public void setStrategyResource(String strategyResource)
     {
-        this.strategyResource = strategyResource;
+	this.strategyResource = strategyResource;
     }
-  
-	public void setHelicalTrackHitRelationsCollectionName(String helicalTrackHitRelationsCollectionName)
-	{
-		this.helicalTrackHitRelationsCollectionName = helicalTrackHitRelationsCollectionName;				
-	}
-	
-	public void setHelicalTrackMCRelationsCollectionName(String helicalTrackMCRelationsCollectionName)
-	{
-		this.helicalTrackMCRelationsCollectionName = helicalTrackMCRelationsCollectionName;
-	}
-	    
+
+    public void setHelicalTrackHitRelationsCollectionName(String helicalTrackHitRelationsCollectionName)
+    {
+	this.helicalTrackHitRelationsCollectionName = helicalTrackHitRelationsCollectionName;				
+    }
+
+    public void setHelicalTrackMCRelationsCollectionName(String helicalTrackMCRelationsCollectionName)
+    {
+	this.helicalTrackMCRelationsCollectionName = helicalTrackMCRelationsCollectionName;
+    }
+
     public void setInputHitCollectionName(String inputHitCollectionName)
     {
-    	this.stInputCollectionName = inputHitCollectionName;
+	this.stInputCollectionName = inputHitCollectionName;
     }
-    
+
     public void setOutputHitCollectionName(String outputHitCollectionName)
     {
-    	this.hthOutputCollectionName = outputHitCollectionName;
+	this.hthOutputCollectionName = outputHitCollectionName;
     }
-    
+
     public void setStripHitsCollectionName(String stripHitsCollectionName)
     {
-    	this.stripHitsCollectionName = stripHitsCollectionName;
+	this.stripHitsCollectionName = stripHitsCollectionName;
     }
-            
+
     public void setTrackCollectionName(String trackCollectionName)
     {
-    	this.trackCollectionName = trackCollectionName;
+	this.trackCollectionName = trackCollectionName;
     }
-    
+
     public void setStripMaxSeparation(double stripMaxSeparation)
     {
-    	this.stripMaxSeparation = stripMaxSeparation;
+	this.stripMaxSeparation = stripMaxSeparation;
     }
-    
+
     public void setStripTolerance(double stripTolerance)
     {
-    	this.stripTolerance = stripTolerance;
+	this.stripTolerance = stripTolerance;
     }
-                
+
     /**
      * Set the SimTrackerHit collection to be used for tracking.
      * @param simTrackerHitCollectionName The name of the SimTrackerHit collection in the event.
      */
     public void setSimTrackerHitCollectionName(String simTrackerHitCollectionName)
     {
-        this.simTrackerHitCollectionName = simTrackerHitCollectionName;
+	this.simTrackerHitCollectionName = simTrackerHitCollectionName;
     }
-    
+
     /**
      * This is used to setup the Drivers after XML config.
      */
     public void detectorChanged(Detector detector)
     {    	
-    	// Cache Detector object.
-    	this.detector = detector;
-    	
-    	// Get B-field Y with no sign.  Seed Tracker doesn't like signed B-field components.
-    	// FIXME Is this always right?
-    	this.bfield = Math.abs((detector.getFieldMap().getField(new BasicHep3Vector(0,0,0)).y()));       	
-    	if (DEBUG)
-    		System.out.println("Set B-field to " + this.bfield);
-    	
-        initialize();
-        
-        super.detectorChanged(detector);
+	// Cache Detector object.
+	this.detector = detector;
+
+	// Get B-field Y with no sign.  Seed Tracker doesn't like signed B-field components.
+	// FIXME Is this always right?
+	this.bfield = Math.abs((detector.getFieldMap().getField(new BasicHep3Vector(0,0,0)).y()));       	
+	if (DEBUG)
+	    System.out.println("Set B-field to " + this.bfield);
+
+	initialize();
+
+	super.detectorChanged(detector);
     }
-        
+
     /** 
      * Setup all the child Drivers necessary for track reconstruction.
      */
     private void initialize()
     {                
-    	//
-        // 1) Driver to create HelicalTrackHits expected by Seedtracker.
-    	//
-    	// TODO Make this step its own separate Driver??? (Matt)
-        
-        // Setup default stereo pairings, which should work for even number of modules.
-    	List<SiTrackerModule> modules = detector.getSubdetector(subdetectorName).getDetectorElement().findDescendants(SiTrackerModule.class);
-    	if (modules.size() == 0)
-    		throw new RuntimeException("No SiTrackerModules found in detector.");
-    	int nmodules = modules.size();
-    	if (nmodules % 2 != 0)
-    		throw new RuntimeException("Don't know how to do stereo pairing for odd number of modules.");        
-    	List<int[]> pairs = new ArrayList<int[]>();
-        for (int i=1; i<=(nmodules/2)-1; i+=2)
-        {
-        	int[] pair = {i, i+1};
-        	if (DEBUG)
-        		System.out.println("Adding stereo pair: " + pair[0] + ", " + pair[1]);
-        	pairs.add(pair);
-        }
-        
-        // Create the Driver.
-        HPSHelicalTrackHitDriver hthdriver = new HPSHelicalTrackHitDriver();
-        hthdriver.addCollection(stripHitsCollectionName);
-        hthdriver.OutputCollection(hthOutputCollectionName);
-        hthdriver.HitRelationName(helicalTrackHitRelationsCollectionName);
-        hthdriver.MCRelationName(helicalTrackMCRelationsCollectionName);
-        for (int[] pair : pairs)
-        {
-            hthdriver.setStereoPair(subdetectorName, pair[0], pair[1]);
-        }       
-        hthdriver.setMaxSeperation(stripMaxSeparation);
-        hthdriver.setTolerance(stripTolerance); // user parameter?        
-        hthdriver.setTransformToTracking(true);
-        add(hthdriver);
-        
-        //
-        // 2) Driver to run Seed Tracker.
-        //
-
-        if (!strategyResource.startsWith("/"))
-            strategyResource = "/" + strategyResource; 
-        List<SeedStrategy> sFinallist = StrategyXMLUtils.getStrategyListFromInputStream(
-                this.getClass().getResourceAsStream(strategyResource));
-        SeedTracker stFinal = new SeedTracker(sFinallist);
-        HPSTransformations hpstrans = new HPSTransformations();
-        stFinal.setMaterialManagerTransform(hpstrans.getTransform());
-        stFinal.setInputCollectionName(stInputCollectionName);
-        stFinal.setTrkCollectionName(trackCollectionName);
-        stFinal.setBField(bfield);
-        stFinal.setSectorParams(false);
-        add(stFinal);
-        
-        //
-        // 3) Cleanup the readouts for next event.
-        //               
-        List<String> readoutCleanup = new ArrayList<String>();
-        readoutCleanup.add(this.simTrackerHitCollectionName);
-        add(new ReadoutCleanupDriver(readoutCleanup));
+	//
+	// 1) Driver to create HelicalTrackHits expected by Seedtracker.
+	//
+	// TODO Make this step its own separate Driver??? (Matt)
+
+	// Setup default stereo pairings, which should work for even number of modules.
+	List<SiTrackerModule> modules = detector.getSubdetector(subdetectorName).getDetectorElement().findDescendants(SiTrackerModule.class);
+	if (modules.size() == 0)
+	    throw new RuntimeException("No SiTrackerModules found in detector.");
+	int nmodules = modules.size();
+	if (nmodules % 2 != 0)
+	    throw new RuntimeException("Don't know how to do stereo pairing for odd number of modules.");        
+	List<int[]> pairs = new ArrayList<int[]>();
+	for (int i=1; i<=(nmodules/2)-1; i+=2)
+	{
+	    int[] pair = {i, i+1};
+	    if (DEBUG)
+		System.out.println("Adding stereo pair: " + pair[0] + ", " + pair[1]);
+	    pairs.add(pair);
+	}
+
+	// Create the Driver.
+	HPSHelicalTrackHitDriver hthdriver = new HPSHelicalTrackHitDriver();
+	hthdriver.addCollection(stripHitsCollectionName);
+	hthdriver.OutputCollection(hthOutputCollectionName);
+	hthdriver.HitRelationName(helicalTrackHitRelationsCollectionName);
+	hthdriver.MCRelationName(helicalTrackMCRelationsCollectionName);
+	for (int[] pair : pairs)
+	{
+	    hthdriver.setStereoPair(subdetectorName, pair[0], pair[1]);
+	}       
+	hthdriver.setMaxSeperation(stripMaxSeparation);
+	hthdriver.setTolerance(stripTolerance); // user parameter?        
+	hthdriver.setTransformToTracking(true);
+	add(hthdriver);
+
+	//
+	// 2) Driver to run Seed Tracker.
+	//
+
+	if (!strategyResource.startsWith("/"))
+	    strategyResource = "/" + strategyResource; 
+	List<SeedStrategy> sFinallist = StrategyXMLUtils.getStrategyListFromInputStream(
+		this.getClass().getResourceAsStream(strategyResource));
+	SeedTracker stFinal = new SeedTracker(sFinallist);
+	HPSTransformations hpstrans = new HPSTransformations();
+	stFinal.setMaterialManagerTransform(hpstrans.getTransform());
+	stFinal.setInputCollectionName(stInputCollectionName);
+	stFinal.setTrkCollectionName(trackCollectionName);
+	stFinal.setBField(bfield);
+	stFinal.setSectorParams(false);
+	add(stFinal);
+
+	//
+	// 3) Cleanup the readouts for next event.
+	//               
+	List<String> readoutCleanup = new ArrayList<String>();
+	readoutCleanup.add(this.simTrackerHitCollectionName);
+	add(new ReadoutCleanupDriver(readoutCleanup));
     }   
-    
+
     /**
      * Call super for child processing at start of data.
      */
     public void startOfData()
     {
-        super.startOfData();
+	super.startOfData();
     }    
-    
+
     /**    
      * This method is used to run the reconstruction and print debug information.
      */
     public void process(EventHeader event)
     {    	
-        // This call runs the track reconstruction using the sub-Drivers.
-        super.process(event);
-                
-        // Debug printouts.
-        if (DEBUG)
-        {
-        	// Check for HelicalTrackHits.
-        	List<TrackerHit> hth = event.get(TrackerHit.class, hthOutputCollectionName);
-        	System.out.println("The HelicalTrackHit collection " + hthOutputCollectionName + " has " + hth.size() + " hits.");
-        	       
-        	// Check for Tracks.
-        	List<Track> tracks = event.get(Track.class, trackCollectionName);
-        	System.out.println("The Track collection " + trackCollectionName + " has " + tracks.size() + " tracks.");
-        	        
-        	// Print out track info.
-        	for (Track track : tracks)
-        	{
-        		System.out.println(track.toString());
-        	}
-        }
-        
-    	// Increment number of events.
-    	++nevents;
-        
-        // Add to tracks found.
-        ntracks += event.get(Track.class, trackCollectionName).size();
+	// This call runs the track reconstruction using the sub-Drivers.
+	super.process(event);
+
+	// Debug printouts.
+	if (DEBUG)
+	{
+	    // Check for HelicalTrackHits.
+	    List<TrackerHit> hth = event.get(TrackerHit.class, hthOutputCollectionName);
+	    System.out.println("The HelicalTrackHit collection " + hthOutputCollectionName + " has " + hth.size() + " hits.");
+
+	    // Check for Tracks.
+	    List<Track> tracks = event.get(Track.class, trackCollectionName);
+	    System.out.println("The Track collection " + trackCollectionName + " has " + tracks.size() + " tracks.");
+
+	    // Print out track info.
+	    for (Track track : tracks)
+	    {
+		System.out.println(track.toString());
+	    }
+	}
+
+	// Increment number of events.
+	++nevents;
+
+	// Add to tracks found.
+	ntracks += event.get(Track.class, trackCollectionName).size();
     }   
-    
+
     public void endOfData()
     {
-    	if (DEBUG)
-    	{
-    		System.out.println("-------------------------------------------");
-    		System.out.println(this.getName() + " found " + ntracks + " tracks in " + nevents + " events which is " + ((double)ntracks/(double)nevents) + " tracks per event.");
-    	}
+	if (DEBUG)
+	{
+	    System.out.println("-------------------------------------------");
+	    System.out.println(this.getName() + " found " + ntracks + " tracks in " + nevents + " events which is " + ((double)ntracks/(double)nevents) + " tracks per event.");
+	}
     }
 }
\ No newline at end of file
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