Commit in lcsim-contrib/src/main/java/org/lcsim/contrib/jeremym/hps on MAIN
HPSEcalPlotsDriver.java+75-491.1 -> 1.2
working copy

lcsim-contrib/src/main/java/org/lcsim/contrib/jeremym/hps
HPSEcalPlotsDriver.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- HPSEcalPlotsDriver.java	28 Apr 2011 00:34:39 -0000	1.1
+++ HPSEcalPlotsDriver.java	28 Apr 2011 01:56:37 -0000	1.2
@@ -23,7 +23,7 @@
  * Diagnostic plots for HPS ECal.
  * 
  * @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: HPSEcalPlotsDriver.java,v 1.1 2011/04/28 00:34:39 jeremy Exp $
+ * @version $Id: HPSEcalPlotsDriver.java,v 1.2 2011/04/28 01:56:37 jeremy Exp $
  */
 // TODO Sort Ecal hits on energy and plot top 2,3,4,5
 // TODO Add plot of percentage of total FS particle E in highest hit and top 2 (?) hits
@@ -51,14 +51,15 @@
     ICloud1D idCountPlot;
     ICloud1D residualTop2Plot;
     ICloud1D residualTop3Plot;
-    ICloud1D lowEHitPlot;
     ICloud2D hitXZPlot;
     IHistogram1D acceptHitPlot;
     ICloud1D fsPlot;
     ICloud1D clusEPlot;
     ICloud1D nclusPlot;
-    
-    double hitEnergyMin = 0;
+    ICloud1D hit50MeVPlot;
+    ICloud1D hit30MeVPlot;
+    ICloud1D hit100MeVPlot;
+    ICloud1D hitOver100MeVPlot;
     
     static class MCParticleEComparator implements Comparator<MCParticle>
     {
@@ -83,50 +84,82 @@
     
     public void startOfData()
     {
-        timePlot = aida.cloud1D(ecalCollectionName + " : Hit Time [ns]");
+        timePlot = aida.cloud1D(ecalCollectionName + " : Hit Time");
         timePlot.annotation().addItem("yAxisScale", "log");
+        timePlot.annotation().addItem("xAxisLabel", "Time [ns]");
         
-        maxTimePlot = aida.histogram1D(ecalCollectionName + " : Max Time [ns]", 200, 0, 1000);
+        maxTimePlot = aida.histogram1D(ecalCollectionName + " : Max Time", 200, 0, 1000);
         maxTimePlot.annotation().addItem("yAxisScale", "log");
+        maxTimePlot.annotation().addItem("xAxisLabel", "Time [ns]");
         
-        maxHitEPlot = aida.cloud1D(ecalCollectionName + " : Max Hit E in Event [GeV]");
+        maxHitEPlot = aida.cloud1D(ecalCollectionName + " : Max Hit E in Event");
+        maxHitEPlot.annotation().addItem("xAxisLabel", "E [GeV]");
         
-        hitEPlot = aida.histogram1D(ecalCollectionName + " : Hit Energy [MeV]", 200, 0, 3500);
+        hitEPlot = aida.histogram1D(ecalCollectionName + " : Hit Energy", 200, 0, 3500);
         hitEPlot.annotation().addItem("yAxisScale", "log");
+        hitEPlot.annotation().addItem("xAxisLabel", "E [GeV]");
         
         hitCountPlot = aida.cloud1D(ecalCollectionName + " : Hit Count");
+        hitCountPlot.annotation().addItem("xAxisLabel", "Number of Hits");
         
         idCountPlot = aida.cloud1D(ecalCollectionName + " : Uniq Hit IDs");
+        idCountPlot.annotation().addItem("xAxisLabel", "Number of Unique IDs in Event");
         
-        ecalEPlot = aida.cloud1D(ecalCollectionName + " : E Event [GeV]");
+        ecalEPlot = aida.cloud1D(ecalCollectionName + " : Total E in Event");
+        ecalEPlot.annotation().addItem("xAxisLabel", "E [GeV]");
         
-        primaryEPlot = aida.cloud1D("MCParticle: Highest Primary Energy in Event [GeV]");
+        primaryEPlot = aida.cloud1D("MCParticle: Highest Primary E in Event");
+        primaryEPlot.annotation().addItem("xAxisLabel", "E [GeV]");
         
-        eventEPlot = aida.cloud1D("MCParticle: Sum of FS Electron Energies in Event [GeV]");
+        eventEPlot = aida.cloud1D("MCParticle: Total Gen FS Electron E in Event");
+        eventEPlot.annotation().addItem("xAxisLabel", "E [GeV]");
         
-        residualPlot = aida.cloud1D(ecalCollectionName + " : Residual with Highest E Particle [GeV]");
+        residualPlot = aida.cloud1D(ecalCollectionName + " : Residual with Highest E Particle [GeV]");
+        residualPlot.annotation().addItem("xAxisLabel", "E [GeV]");
         
-        residualAllPlot = aida.cloud1D(ecalCollectionName + " : E Residual with All Final State Electrons [GeV]");
+        residualAllPlot = aida.cloud1D(ecalCollectionName + " : Resdual with All Final State Electrons [GeV]");
+        residualAllPlot.annotation().addItem("xAxisLabel", "E [GeV]");
         
         residualMaxHitPlot = aida.cloud1D(ecalCollectionName + " : Residual of Max Hit and Highest E Electron");
+        residualMaxHitPlot.annotation().addItem("xAxisLabel", "E [GeV]");
         
-        hitYZPlot = aida.cloud2D(ecalCollectionName + " : Y vs Z");
+        hitYZPlot = aida.cloud2D(ecalCollectionName + " : Y vs Z");        
+        hitYZPlot.annotation().addItem("xAxisLabel", "Y [mm]");
+        hitYZPlot.annotation().addItem("yAxisLabel", "Z [mm]");
         
         hitXZPlot = aida.cloud2D(ecalCollectionName + " : X vs Z");
+        hitXZPlot.annotation().addItem("xAxisLabel", "X [mm]");
+        hitXZPlot.annotation().addItem("yAxisLabel", "Z [mm]");
         
         residualTop2Plot = aida.cloud1D(ecalCollectionName + " : Residual with Top 2 FS Particle E");
+        residualTop2Plot.annotation().addItem("xAxisLabel", "E [GeV]");
         
         residualTop3Plot = aida.cloud1D(ecalCollectionName + " : Residual with Top 3 FS Particle E");
-        
-        lowEHitPlot = aida.cloud1D(ecalCollectionName + " : Hits with E < 100 MeV");
-        
+        residualTop3Plot.annotation().addItem("xAxisLabel", "E [GeV]");
+               
         acceptHitPlot = aida.histogram1D(ecalCollectionName + " : Hits with E >= 100 MeV", 15, 0, 15);
+        acceptHitPlot.annotation().addItem("xAxisLabel", "Number of Hits"); 
         
-        fsPlot  = aida.cloud1D("MCParticle: Number of Final State Particlesin Event");
+        fsPlot  = aida.cloud1D("MCParticle: Number of Final State Particles");
+        fsPlot.annotation().addItem("xAxisLabel", "Number of FS Particles");
         
         clusEPlot = aida.cloud1D(ecalClusterCollectionName + " : Cluster E");
+        clusEPlot.annotation().addItem("xAxisLabel", "E [GeV]");
         
         nclusPlot = aida.cloud1D(ecalClusterCollectionName + " : Number of Clusters");
+        nclusPlot.annotation().addItem("xAxisLabel", "Number of Clusters");
+        
+        hit50MeVPlot = aida.cloud1D(ecalCollectionName + " : Hits with E < 50 MeV");
+        hit50MeVPlot.annotation().addItem("xAxisLabel", "Number of Hits");
+        
+        hit30MeVPlot = aida.cloud1D(ecalCollectionName + " : Hits with E < 30 MeV");
+        hit30MeVPlot.annotation().addItem("xAxisLabel", "Number of Hits");
+        
+        hit100MeVPlot = aida.cloud1D(ecalCollectionName + " : Hits with E < 100 MeV");
+        hit100MeVPlot.annotation().addItem("xAxisLabel", "Number of Hits");
+        
+        hitOver100MeVPlot  = aida.cloud1D(ecalCollectionName + " : Hits with E >= 100 MeV");
+        hit100MeVPlot.annotation().addItem("xAxisLabel", "Number of Hits");
     }
     
     private static List<MCParticle> getFinalStateParticles(List<MCParticle> mcparticles)
@@ -177,27 +210,34 @@
         // n hits
         hitCountPlot.fill(nhits);
         
-        int nlowe = 0;
         int naccept = 0;
+                               
+        int nhits50MeV = 0;
+        int nhits30MeV = 0;
+        int nhits100MeV = 0;
+        int nhitsOver100MeV = 0;
         
         // Loop over ECal hits.
-        
-        //System.out.println("nhits="+hits.size());
-        
         for (CalorimeterHit hit : hits)
         {
             // get raw E
             double eraw = hit.getRawEnergy();
-
-            // Keep track of # hits under energy threshold.
-            if (eraw < hitEnergyMin)
+            
+            if (eraw >= 0.1)
             {
-                ++nlowe;
-                //continue;
+                nhitsOver100MeV++;
+            }            
+            else if (eraw < 0.1)
+            {
+                nhits100MeV++;
             }
-            else
+            else if (eraw < 0.05)
+            {
+                nhits50MeV++;
+            }       
+            else if (eraw < 0.03)
             {
-                ++naccept;
+                nhits30MeV++;
             }
             
             // time
@@ -227,17 +267,13 @@
                                     
             // incr E sum
             esum += eraw;
-
         }
         
-        //System.out.println("nskipped="+nlowe);
-        //System.out.println("naccept="+naccept);
-        
-        //System.out.println("tmax: " + tmax);
-        
-        // Low E hits.
-        lowEHitPlot.fill(nlowe);
-        
+        hit100MeVPlot.fill(nhits100MeV);
+        hit50MeVPlot.fill(nhits50MeV);        
+        hit30MeVPlot.fill(nhits30MeV);
+        hitOver100MeVPlot.fill(nhitsOver100MeV);
+                             
         // Hits passed E cut.
         acceptHitPlot.fill(naccept);
                  
@@ -330,15 +366,5 @@
     public void setEcalClusterCollectionName(String ecalClusterCollectionName)
     {
         this.ecalClusterCollectionName = ecalClusterCollectionName;
-    }
-    
-    /**
-     * Set minimum hit energy in GeV.
-     * @param hitEnergyMin
-     */
-    public void setHitEnergyMin(double hitEnergyMin)
-    {
-        //System.out.println("hitEnergyMin="+hitEnergyMin);
-        this.hitEnergyMin = hitEnergyMin;
-    }
+    }    
 }
CVSspam 0.2.8