Print

Print


Commit in hps-java/src/main/java/org/lcsim/hps/users/omoreno on MAIN
SvtPerformance.java+91-181.2 -> 1.3
Added hit efficiency plots

hps-java/src/main/java/org/lcsim/hps/users/omoreno
SvtPerformance.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- SvtPerformance.java	25 Jul 2012 02:02:41 -0000	1.2
+++ SvtPerformance.java	26 Jul 2012 12:29:14 -0000	1.3
@@ -3,6 +3,7 @@
 import hep.aida.IHistogram1D;
 import hep.aida.IHistogram2D;
 import hep.aida.IPlotter;
+import hep.physics.vec.Hep3Vector;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -11,10 +12,12 @@
 import org.lcsim.event.EventHeader;
 import org.lcsim.event.RawTrackerHit;
 import org.lcsim.event.Track;
+import org.lcsim.event.TrackerHit;
 import org.lcsim.fit.helicaltrack.HelicalTrackHit;
 import org.lcsim.geometry.Detector;
 import org.lcsim.hps.monitoring.AIDAFrame;
 import org.lcsim.hps.recon.ecal.HPSEcalCluster;
+import org.lcsim.hps.recon.tracking.SvtTrackExtrapolator;
 import org.lcsim.hps.recon.tracking.SvtUtils;
 import org.lcsim.hps.recon.tracking.TrackUtils;
 import org.lcsim.recon.tracking.seedtracker.SeedTrack;
@@ -25,7 +28,7 @@
  * Svt Performance Plots
  * 
  * @author Omar Moreno <[log in to unmask]>
- * @version $Id: SvtPerformance.java,v 1.2 2012/07/25 02:02:41 omoreno Exp $
+ * @version $Id: SvtPerformance.java,v 1.3 2012/07/26 12:29:14 omoreno Exp $
  */
 public class SvtPerformance extends Driver {
 	
@@ -35,6 +38,7 @@
 	private List<IHistogram2D> histos2D = new ArrayList<IHistogram2D>();
 	private List<IPlotter>     plotters = new ArrayList<IPlotter>();
 	TrackUtils trkUtil = new TrackUtils();
+	SvtTrackExtrapolator extrapolator = new SvtTrackExtrapolator();
 	
 	double totalTracksFound  = 0;
 	double totalTopTracksFound = 0;
@@ -43,12 +47,16 @@
 	double possibleTracks = 0;
 	double possibleTopTracks = 0;
 	double possibleBottomTracks = 0;
+	double totalFourHitTracks = 0;
+	double totalTracksWith5LayersHit = 0;
+	int plotterIndex = 0;
 	
 	double[] topLayers;    
 	double[] bottomLayers;
 	
 	boolean debug = true;
-	boolean topHit = false;
+	boolean enableHitPositionPlots = false;
+	
 	
 	// Plot flags
 	
@@ -69,6 +77,10 @@
 	    this.debug = debug;
 	}
 	
+	public void setEnableHitPositionPlots(boolean enableHitPositionPlots){
+		this.enableHitPositionPlots = enableHitPositionPlots;
+	}
+	
 	
 	protected void detectorChanged(Detector detector){
 		
@@ -80,8 +92,31 @@
 		for(int index = 0; index < 2; index++) frames.add(new AIDAFrame());
 		
 		// Set frame titles
-		
+		frames.get(0).setTitle("Stereo Hit Positions");
 	
+		String title = null;
+		IHistogram2D histo2D = null;
+		
+		//--- Hit Positions ---//
+		//---------------------//
+		if(enableHitPositionPlots){
+			plotters.add(PlotUtils.setupPlotter("Hit Positions", 1, 2));
+//			for(int layer = 0; layer < 5; layer++){
+//				title = "Hit Positions - Layer " + String.valueOf(layer+1);
+			title = "Hit Positions - XZ";
+			histo2D = aida.histogram2D(title, 5, 1, 6, 200, -100, 100);
+			histos2D.add(histo2D);
+			PlotUtils.setup2DRegion(plotters.get(plotterIndex), title, 0, "Layer #", "x [mm]", histo2D);
+			title = "Hit Positions - YZ";
+			histo2D = aida.histogram2D(title, 5, 1, 6, 200, -100, 100);
+			PlotUtils.setup2DRegion(plotters.get(plotterIndex), title, 1, "Layer #", "y [mm]", histo2D);
+			
+//			}
+			frames.get(0).addPlotter(plotters.get(plotterIndex));
+			plotterIndex++;
+		}
+		
+		
 		for(AIDAFrame frame : frames){
 			frame.pack();
 			frame.setVisible(true);
@@ -185,6 +220,7 @@
     	
     	for(SeedTrack track : tracks){
     		trkUtil.setTrack(track);
+    		extrapolator.setTrack(track);
     		
     		// Check which volume the track corresponds to
     		if(trkUtil.getZ0() > 0){
@@ -197,6 +233,50 @@
     			if(debug)
     			    System.out.println(this.getClass().getSimpleName() + " : Found Bottom Track!");
     		}
+    		
+    		// Check if the track has four hits associated with it. This should be the case when 
+    		// only four hits are used to fit the track
+    		if(track.getTrackerHits().size() == 4 && !ecalClusters.isEmpty()){
+    			
+    			// Get the position of the track at the last Layer
+    			Hep3Vector trkPositionAtLayer5 = extrapolator.extrapolateTrack(707.5 /* mm */);
+    			
+    			if(debug)
+    				System.out.println(this.getClass().getSimpleName() + ": Track Position at Layer 5: " + trkPositionAtLayer5.toString());
+    			
+    			if(trkPositionAtLayer5.y() < 80 && trkPositionAtLayer5.y() > -10 && trkPositionAtLayer5.z() > 32 && trkPositionAtLayer5.z() < 72){
+    			
+    				if(trkUtil.getZ0() > 0) totalFourHitTracks++;
+    				if(trkUtil.getZ0() > 0 && topLayers[4] > 0){
+    					for(HPSEcalCluster ecalCluster : ecalClusters){
+    						if(ecalCluster.getPosition()[1] > 0){
+    							totalTracksWith5LayersHit++;
+    							break;
+    						}
+    					}
+    				}
+    				else if(trkUtil.getZ0() > 0 && topLayers[4] == 0){
+    					for(TrackerHit hit : track.getTrackerHits()){
+    						HelicalTrackHit hth = (HelicalTrackHit) hit;
+    				        int arrayPosition = (hth.Layer() - 1)/2;
+//    				        String title = "Hit Positions - Layer " + String.valueOf(arrayPosition+1);
+    				        String title = "Hit Positions - XZ";
+    				        System.out.println(title);
+    				        aida.histogram2D(title).fill(arrayPosition + 1,  hth.getCorrectedPosition().y());
+    				        title = "Hit Positions - YZ";
+    				        aida.histogram2D(title).fill(arrayPosition + 1, hth.getCorrectedPosition().z());
+    					}
+    				}
+    				else if(trkUtil.getZ0() < 0 && bottomLayers[4] > 0 ){
+    					for(HPSEcalCluster ecalCluster : ecalClusters){
+    						if(ecalCluster.getPosition()[1] < 0){
+//    							totalTracksWith5LayersHit++;
+    							break;
+    						}
+    					}
+    				}
+    			}
+    		}
     	}
     	
     	if(debug){
@@ -205,18 +285,6 @@
     	    System.out.println("Total Top Track Reconstruction Efficiency " + (totalTopTracksFound/possibleTopTracks));
     	    System.out.println("Total Bottom Track Reconstruction Efficiency" + (totalBottomTracksFound/possibleBottomTracks));
     	}
-    	
-    	/*
-		if(this.hasConsecutiveHits(topLayers) && ecalClusters.get(0).getPosition()[1] > 0 ){
-			possibleTracks++;
-			possibleTopTracks++;
-		}
-		
-		if(this.hasConsecutiveHits(bottomLayers) && ecalClusters.get(0).getPosition()[1] < 0){
-			possibleTracks++;
-			possibleBottomTracks++;
-			System.out.println(this.getClass().getSimpleName() + " : Found Possible Bottom Track!");
-		}*/
 	}
 	
 	private boolean hasConsecutiveHits(double[] layers){
@@ -231,9 +299,14 @@
 	
 	@Override
 	public void endOfData(){
+		System.out.println("%===================================================================% \n");
 		System.out.println("Number of tracks per event: " + (totalTracksFound/totalNumberEvents) );
-		System.out.println("Total Track Reconstruction Efficiency: " + (totalTracksFound/possibleTracks));
-		System.out.println("Total Top Track Reconstruction Efficiency " + (totalTopTracksFound/possibleTopTracks));
-		System.out.println("Total Bottom Track Reconstruction Efficiency" + (totalBottomTracksFound/possibleBottomTracks));
+		System.out.println("Total Track Reconstruction Efficiency: " + (totalTracksFound/possibleTracks)*100 + "%");
+		System.out.println("Total Top Track Reconstruction Efficiency: " + (totalTopTracksFound/possibleTopTracks)*100 + "%");
+		System.out.println("Total Bottom Track Reconstruction Efficiency: " + (totalBottomTracksFound/possibleBottomTracks)*100 + "%");
+		System.out.println("Percentage of 4 hit tracks: " + (totalFourHitTracks/totalTracksFound)*100 + "%" );
+		System.out.println("Hit Efficiency: " + (totalTracksWith5LayersHit/totalFourHitTracks)*100 + "%");
+		System.out.println("%===================================================================% \n");
+
 	}
 }
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