Commit in hps-java/src/main/java/org/lcsim/hps/users/phansson on MAIN
TrigRateDriver.java+47-21.4 -> 1.5
Added option to use simple trigger.

hps-java/src/main/java/org/lcsim/hps/users/phansson
TrigRateDriver.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- TrigRateDriver.java	22 Aug 2012 18:42:42 -0000	1.4
+++ TrigRateDriver.java	1 Oct 2012 21:26:31 -0000	1.5
@@ -43,11 +43,13 @@
     private double targetZPosition = -674; //mm
     
     private boolean hideFrame = true;
+    private boolean simTrigger = false;
     
     private String outputPlotFileName = "trigRate.aida";
     private String trackCollectionName = "MatchedTracks";
     private String ecalClusterCollectionName = "EcalClusters";
-    
+    private String triggerClusterCollectionName = "EcalTriggerClusters";
+    private double triggerThreshold = 10.0;
     
     EcalTrackMatch trkMatchTool;
     
@@ -100,6 +102,12 @@
         plotter_hitmap_gr.style().statisticsBoxStyle().setVisible(false);
         plotterFrame.addPlotter(plotter_hitmap_gr);
 
+        IPlotter plotter_hitmap_1 = af.createPlotterFactory().create();
+        plotter_hitmap_1.createRegions(1);
+        plotter_hitmap_1.setTitle("Cluster hit map");
+        plotter_hitmap_1.style().statisticsBoxStyle().setVisible(false);
+        plotterFrame.addPlotter(plotter_hitmap_1);
+
         IPlotter plotter_hitY_gr = af.createPlotterFactory().create();
         plotter_hitY_gr.createRegions(2,nThr+1,0);
         plotter_hitY_gr.setTitle("Cluster hit Y");
@@ -120,6 +128,14 @@
         plotterFrame.addPlotter(plotter_ep_gr);
 
         
+        IHistogram hm = aida.histogram2D("Cluster hit map", 52, -25.5, 25.5, 6, -5.5, 5.5);
+        plotter_hitmap_1.region(0).plot(hm);            
+        style = plotter_hitmap_1.region(0).style();
+        style.setParameter("hist2DStyle", "colorMap");
+        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        ((PlotterRegion) plotter_hitmap_1.region(0)).getPlot().setAllowUserInteraction(true);
+        ((PlotterRegion) plotter_hitmap_1.region(0)).getPlot().setAllowPopupMenus(true);
+        
         
         for(int iside=0;iside<2;++iside) {
             String side = iside==0 ? "top" : "bottom";
@@ -128,6 +144,7 @@
             
             IHistogram h = aida.histogram2D("Hit map " + side, 26, -25.5, 0.5, 6, ymin, ymax);
             plotter_hitmap_gr.region((nThr+1)*iside).plot(h);
+
             
             IHistogram hy = aida.histogram1D("Hit Y " + side, 7, -0.5, 6.5);
             plotter_hitY_gr.region((nThr+1)*iside).plot(hy);
@@ -228,10 +245,13 @@
         this.outputPlotFileName = name;
     }
     
-   public void setHideFrame( boolean val ) {
+    public void setHideFrame( boolean val ) {
         this.hideFrame = val;
     }
     
+    public void setSimTrigger(boolean simTrigger) {
+        this.simTrigger = simTrigger;
+    }
     
     
     public void process(EventHeader event) {
@@ -244,6 +264,28 @@
             redraw();
         }
         
+        
+        if(simTrigger) {
+            boolean trigger = false;
+            if(event.hasCollection(HPSEcalCluster.class, triggerClusterCollectionName)) {
+                for(HPSEcalCluster cluster : event.get(HPSEcalCluster.class, triggerClusterCollectionName)) {
+                    if(cluster.getEnergy() > triggerThreshold) {
+                        trigger = true;
+                    }
+                }
+            }
+            if(!trigger) {
+                if(debug) {
+                    System.out.println("event " + nevents + " did NOT trigger using simTrigger");
+                }
+                return;
+            }
+            if(debug) {
+                System.out.println("event " + nevents + " triggered using simTrigger");
+            }
+        }
+        
+        
         //fastTracking(event);
         
         List<HPSEcalCluster> clusters = event.get(HPSEcalCluster.class, ecalClusterCollectionName); 
@@ -274,6 +316,8 @@
             double clusterPosY = cl.getPosition()[1];
             double clusterPosZ = cl.getPosition()[2];         
             String side = clusterPosIdx[1]>0 ? "top" : "bottom";
+            int iside = clusterPosIdx[1]>0 ? 0 : 1;
+            
             int hitY = clusterPosIdx[1]>0 ? clusterPosIdx[1] : (-1*clusterPosIdx[1]);
             double hitTheta = Math.atan(clusterPosY/(clusterPosZ-targetZPosition));
             //x-check
@@ -285,6 +329,7 @@
             }
             
             clusterEnergy[clusterPosIdx[0]+23][clusterPosIdx[1]+5].fill(cl.getEnergy());
+            aida.histogram2D("Cluster hit map").fill(clusterPosIdx[0], clusterPosIdx[1]);
             aida.histogram2D("Hit map " + side).fill(clusterPosIdx[0], clusterPosIdx[1]);
             aida.histogram1D("Hit Y " + side).fill(hitY);
             aida.histogram1D("Hit theta " + side).fill(hitTheta*1000.0); //mrad
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