Print

Print


Commit in hps-java/src/main/java/org/lcsim/hps/users/omoreno on MAIN
PlotUtils.java+55-21.1 -> 1.2
Changes to Support IClouds

hps-java/src/main/java/org/lcsim/hps/users/omoreno
PlotUtils.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- PlotUtils.java	23 Jul 2012 18:05:04 -0000	1.1
+++ PlotUtils.java	5 Oct 2012 19:48:18 -0000	1.2
@@ -5,15 +5,19 @@
 import java.util.List;
 import java.util.Map;
 
+import org.lcsim.detector.tracker.silicon.SiSensor;
 import org.lcsim.hps.monitoring.AIDAFrame;
+import org.lcsim.hps.recon.tracking.SvtUtils;
 import org.lcsim.util.aida.AIDA;
 
 import hep.aida.IHistogram2D;
 
+import hep.aida.ICloud2D;
 //--- hep ---//
 import hep.aida.IHistogram1D;
 import hep.aida.IHistogram2D;
 import hep.aida.IPlotter;
+import hep.aida.IPlotterStyle;
 import hep.physics.vec.Hep3Vector;
 
 public class PlotUtils {
@@ -30,8 +34,8 @@
 	    
 	    plotter.style().statisticsBoxStyle().setVisible(false);
 	    plotter.style().dataStyle().errorBarStyle().setVisible(false);
-	    plotter.setParameter("plotterWidth", "1000");
-	    plotter.setParameter("plotterHeight", "700");
+	    plotter.setParameter("plotterWidth", "800");
+	    plotter.setParameter("plotterHeight", "800");
 	    
 	    return plotter;
 	    
@@ -44,7 +48,13 @@
     		throw new RuntimeException("Region is invalid! " + title + " contains " + plotter.numberOfRegions() + " regions");
     	
 		plotter.region(region).style().xAxisStyle().setLabel(xTitle);
+		plotter.region(region).style().xAxisStyle().labelStyle().setFontSize(14);
+		String[] pars = plotter.region(region).style().xAxisStyle().availableParameters();
+		for(String par : pars){
+			System.out.println("Parameter: " + par);
+		}
 		plotter.region(region).style().yAxisStyle().setLabel(yTitle);
+		plotter.region(region).style().yAxisStyle().labelStyle().setFontSize(14);
 		plotter.region(region).style().xAxisStyle().setVisible(true);
 		plotter.region(region).style().yAxisStyle().setVisible(true);
 		plotter.region(region).style().setParameter("hist2DStyle", "colorMap");
@@ -53,12 +63,55 @@
     	if(histo != null) plotter.region(region).plot(histo);
     }
    
+    public static void setup2DRegion(IPlotter plotter, String title, int region, String xTitle, String yTitle, ICloud2D cloud, IPlotterStyle style){
+    	
+    	// Check if the specified region is valid
+    	if(region > plotter.numberOfRegions()) 
+    		throw new RuntimeException("Region is invalid! " + title + " contains " + plotter.numberOfRegions() + " regions");
+    	
+		plotter.region(region).style().xAxisStyle().setLabel(xTitle);
+		plotter.region(region).style().xAxisStyle().labelStyle().setFontSize(14);
+		String[] pars = plotter.region(region).style().xAxisStyle().availableParameters();
+		for(String par : pars){
+			System.out.println("Parameter: " + par);
+		}
+		plotter.region(region).style().yAxisStyle().setLabel(yTitle);
+		plotter.region(region).style().yAxisStyle().labelStyle().setFontSize(14);
+		plotter.region(region).style().xAxisStyle().setVisible(true);
+		plotter.region(region).style().yAxisStyle().setVisible(true);
+		plotter.region(region).style().setParameter("showAsScatterPlot", "true");
+    	
+    	if(cloud != null) plotter.region(region).plot(cloud, style);
+    }
+    
     
     public static void setup1DRegion(IPlotter plotter, String title, int region, String xTitle, IHistogram1D histo){
     	
 		plotter.region(region).style().xAxisStyle().setLabel(xTitle);
+		plotter.region(region).style().xAxisStyle().labelStyle().setFontSize(14);
 		plotter.region(region).style().xAxisStyle().setVisible(true);
 		
 		if(histo != null) plotter.region(region).plot(histo);
     }
+    
+    /**
+     * 
+     */
+    public static int getPlotterRegion(SiSensor sensor) {
+
+        int layer = SvtUtils.getInstance().getLayerNumber(sensor);
+
+        // Compute the sensor's x and y grid coordinates and then translate to region number.
+        int ix = (layer - 1) / 2;
+        int iy = 0;
+        if (!SvtUtils.getInstance().isTopLayer(sensor)) {
+            iy += 2;
+        }
+        if (layer % 2 == 0) {
+            iy += 1;
+        }
+        int region = ix * 4 + iy;
+        return region;
+    }
+    
 }
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