Commit in SlicDiagnostics on MAIN
src/org/lcsim/slic/diagnostics/CalorimeterHitPlots.java+81added 1.1
                              /HitUtil.java+54added 1.1
                              /MCParticlePlots.java+130added 1.1
                              /GenericHit.java+1-351.1 -> 1.2
                              /GenericHitPlots.java+42-381.2 -> 1.3
                              /SlicDiagnosticsDriver.java+114-291.2 -> 1.3
test/org/lcsim/slic/diagnostics/SlicDiagnosticsTest.java+4-31.2 -> 1.3
+426-105
3 added + 4 modified, total 7 files
MCParticle plots added.

SlicDiagnostics/src/org/lcsim/slic/diagnostics
CalorimeterHitPlots.java added at 1.1
diff -N CalorimeterHitPlots.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ CalorimeterHitPlots.java	27 Jul 2005 23:21:36 -0000	1.1
@@ -0,0 +1,81 @@
+/*
+ * CalorimeterHitPlots.java
+ *
+ * Created on July 27, 2005, 11:56 AM
+ */
+
+package org.lcsim.slic.diagnostics;
+
+import java.util.List;
+
+import hep.aida.ICloud1D;
+import hep.aida.ICloud2D;
+import hep.aida.ITree;
+import org.lcsim.util.aida.AIDA;
+import org.lcsim.event.EventHeader.LCMetaData;
+import org.lcsim.event.SimCalorimeterHit;
+import org.lcsim.event.MCParticle;
+import org.lcsim.util.Driver;
+import org.lcsim.event.EventHeader;
+
+/**
+ *
+ * @author jeremym
+ */
+public class CalorimeterHitPlots
+{
+    AIDA aida = org.lcsim.util.aida.AIDA.defaultInstance();
+    
+    ITree tree;
+        
+    /* plots: basic MCP */
+    ICloud1D mcpCountPerHit;
+    ICloud1D mcpPDG;
+    ICloud1D mcpSingleContribPDG;    
+    
+    String collName;    
+    
+    /** Creates a new instance of CalorimeterHitPlots */
+    public CalorimeterHitPlots(LCMetaData meta)
+    {
+        collName = meta.getName();
+        tree = aida.tree();
+        
+        definePlots();
+    }
+    
+    void definePlots()
+    {
+        tree.cd("/" + collName);
+        mcpCountPerHit = aida.cloud1D(collName + "_MCParticlesPerHit");
+        mcpPDG = aida.cloud1D(collName + "_MCParticlesPDGCode");
+        mcpSingleContribPDG = aida.cloud1D(collName + "_MCParticlesSingleContributorPDG");
+        tree.cd("..");
+    }    
+    
+    public void fill(List<SimCalorimeterHit> hits)
+    {
+        if ( hits.size() > 0 )
+        {
+            tree.cd("/" + collName);
+            for ( SimCalorimeterHit hit : hits)
+            {
+                int nmcp = hit.getMCParticleCount();
+                mcpCountPerHit.fill(nmcp);
+                
+                for ( int i=0; i < nmcp; i++)
+                {
+                    MCParticle mcp = hit.getMCParticle(i);
+                    int pdg = mcp.getPDGID();
+                    mcpPDG.fill(pdg);
+                }
+                
+                if (nmcp == 1)
+                {
+                    mcpSingleContribPDG.fill(hit.getMCParticle(0).getPDGID());
+                }
+            }
+            tree.cd("..");
+        }
+    }
+}

SlicDiagnostics/src/org/lcsim/slic/diagnostics
HitUtil.java added at 1.1
diff -N HitUtil.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ HitUtil.java	27 Jul 2005 23:21:36 -0000	1.1
@@ -0,0 +1,54 @@
+/*
+ * Util.java
+ *
+ * Created on July 27, 2005, 2:45 PM
+ */
+
+package org.lcsim.slic.diagnostics;
+
+import static java.lang.Math.PI;
+import static java.lang.Math.sqrt;
+import static java.lang.Math.atan2;
+import static java.lang.Math.atan;
+
+/**
+ *
+ * @author jeremym
+ */
+abstract public class HitUtil
+{
+    
+    public static double getSphericalRadius(double[] position)
+    {
+        return sqrt(position[0] * position[0] + position[1] * position[1] + position[2] * position[2]);
+    }
+    
+    public static double getCylindricalRadius(double[] position)
+    {
+        return sqrt(position[0] * position[0] + position[1] * position[1]);
+    }
+    
+    public static double getPhi(double[] position )
+    {
+        double phi = atan2(position[0], position[1]);
+        
+        if ( phi < 0 )
+        {
+            phi += 2 * PI;
+        }
+        
+        return phi;
+    }
+    
+    public static double getTheta(double[] position)
+    {
+        double theta = atan(getCylindricalRadius(position) / position[2]);
+        
+        if ( theta < 0 )
+        {
+            theta += PI;
+        }
+        
+        return theta;
+    }    
+}

SlicDiagnostics/src/org/lcsim/slic/diagnostics
MCParticlePlots.java added at 1.1
diff -N MCParticlePlots.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ MCParticlePlots.java	27 Jul 2005 23:21:36 -0000	1.1
@@ -0,0 +1,130 @@
+/*
+ * MCParticlePlots.java
+ *
+ * Created on July 27, 2005, 2:05 PM
+ */
+
+package org.lcsim.slic.diagnostics;
+
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+
+import org.lcsim.util.aida.AIDA;
+import hep.aida.ICloud1D;
+import hep.aida.ITree;
+import org.lcsim.event.MCParticle;
+import hep.physics.particle.properties.ParticlePropertyManager;
+import hep.physics.particle.properties.ParticlePropertyProvider;
+import org.lcsim.util.Driver;
+
+/**
+ *
+ * @author jeremym
+ */
+public class MCParticlePlots
+{
+    AIDA aida = org.lcsim.util.aida.AIDA.defaultInstance();
+    ITree tree = aida.tree();
+    
+    ParticlePropertyProvider McpLkp = ParticlePropertyManager.getParticlePropertyProvider();
+    
+    ICloud1D mcpCount;
+    ICloud1D mcpTotalEnergyFinalState;
+    
+    Map<String, Integer> particleCounts = new HashMap<String,Integer>();
+    
+    int nmcp = 0;
+    double totE = 0;
+    
+    /** Creates a new instance of MCParticlePlots */
+    public MCParticlePlots()
+    {
+        try
+        {
+            tree.mkdir("/MCParticles");
+        }
+        catch (Exception e)
+        {}
+        
+        definePlots();
+    }
+    
+    private void definePlots()
+    {
+        tree.cd("/MCParticles");
+        mcpCount = aida.cloud1D("MCParticle_eventCount");
+        mcpTotalEnergyFinalState = aida.cloud1D("MCParticle_eventEnergyFinalStates");
+        tree.cd("..");
+    }
+    
+    void fill(List<MCParticle> particles)
+    {        
+        if ( particles.size() > 0 )
+        {            
+            particleCounts.clear();
+            tree.cd("/MCParticles");
+            totE = 0;
+            for ( MCParticle particle : particles)
+            {
+                if ( particle.getGeneratorStatus() == MCParticle.FINAL_STATE )
+                {
+                    totE += particle.getEnergy();
+                    
+                    String particleName = McpLkp.get(particle.getPDGID()).getName();
+                    
+                    try
+                    {
+                        tree.mkdir(particleName);
+                    }
+                    catch (Exception e)
+                    {}
+                    
+                    tree.cd(particleName);
+                    
+                    if ( !particleName.equals("") && particleName != null)
+                    {
+                        /* particle energy */
+                        aida.cloud1D(particleName + "_energy").fill(particle.getEnergy());
+                        
+                        /* particle momentum -> theta, phi */
+                        aida.cloud2D(particleName + "_momentumThetaPhi").fill(
+                                HitUtil.getTheta(particle.getMomentum().v()),
+                                HitUtil.getPhi(particle.getMomentum().v())
+                                );
+                        
+                        /* keep track of particle counts */
+                        if ( particleCounts.containsKey(particleName) )
+                        {
+                            int cnt = particleCounts.get(particleName);
+                            cnt += 1;
+                            particleCounts.remove(particleName);
+                            particleCounts.put(particleName, cnt);
+                        }
+                        else
+                        {
+                            particleCounts.put(particleName, 1);
+                        }
+                    }
+                    tree.cd("..");
+                }
+            }
+            
+            /* count per event for individual particle types */
+            for ( String k : particleCounts.keySet() )
+            {
+                tree.cd(k);
+                aida.cloud1D(k + "_eventCount").fill(particleCounts.get(k));
+                tree.cd("..");
+            }
+            
+            /* count per event of all MCPs */
+            mcpCount.fill(particles.size());
+            
+            /* energy total per event */
+            mcpTotalEnergyFinalState.fill(totE);
+            
+            tree.cd("..");
+        }
+    }
+}

SlicDiagnostics/src/org/lcsim/slic/diagnostics
GenericHit.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- GenericHit.java	27 Jul 2005 00:43:59 -0000	1.1
+++ GenericHit.java	27 Jul 2005 23:21:36 -0000	1.2
@@ -79,39 +79,5 @@
     String getCollectionName()
     {
         return collName;
-    }
-    
-    double getSphericalRadius()
-    {
-        return sqrt(getX() * getX() + getY() * getY() + getZ() * getZ());
-    }
-    
-    double getCylindricalRadius()
-    {
-        return sqrt(getX() * getX() + getY() * getY());
-    }
-    
-    public double getPhi()
-    {
-        double phi = atan2(getX(), getY() );
-        
-        if ( phi < 0 )
-        {
-            phi += 2 * PI;
-        }
-        
-        return phi;
-    }
-    
-    public double getTheta()
-    {
-        double theta = atan(getCylindricalRadius() / getZ());
-        
-        if ( theta < 0 )
-        {
-            theta += PI;
-        }
-        
-        return theta;
-    }
+    }    
 }
\ No newline at end of file

SlicDiagnostics/src/org/lcsim/slic/diagnostics
GenericHitPlots.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- GenericHitPlots.java	27 Jul 2005 00:57:15 -0000	1.2
+++ GenericHitPlots.java	27 Jul 2005 23:21:36 -0000	1.3
@@ -9,12 +9,14 @@
 import java.util.List;
 
 import org.lcsim.util.aida.AIDA;
+import hep.aida.IHistogram1D;
 import hep.aida.ICloud1D;
 import hep.aida.ICloud2D;
 import hep.aida.ITree;
 import org.lcsim.event.EventHeader.LCMetaData;
 import org.lcsim.geometry.Subdetector;
 import org.lcsim.geometry.subdetector.SubdetectorIDDecoder;
+import org.lcsim.util.Driver;
 
 /**
  *
@@ -34,14 +36,14 @@
     ICloud2D thetaPhi;
     ICloud2D xy;
     ICloud2D rz;
-    ICloud1D layer;
+    IHistogram1D layer;
     ICloud1D hitCount;
     ICloud1D hitAvgEnergy;
     ICloud1D layerEnergy;
     ICloud1D layerHitCount;
     
-    double[] layerE;
-    int[] layerHits;
+//    double[] layerE;
+//    int[] layerHits;
     
     int nlayers = 0;
     double eventTotEnergy = 0;
@@ -61,10 +63,10 @@
         nlayers = ((SubdetectorIDDecoder)meta.getIDDecoder()).getSubdetector().getLayering().getLayerCount();
         
         /* define energy per layer array */
-        layerE = new double[nlayers];
+//        layerE = new double[nlayers];
         
         /* define # hits per layer array */
-        layerHits = new int[nlayers];
+//        layerHits = new int[nlayers];
         
         /* set ref to AIDA tree */
         tree = aida.tree();
@@ -92,17 +94,17 @@
     private void definePlots()
     {
         tree.cd("/" + collName);
-        energy = aida.cloud1D("hitEnergy_cloud1D");
-        hitAvgEnergy = aida.cloud1D("hitAvgEnergy_cloud1D");
-        time = aida.cloud1D("hitTime_cloud1D");
-        thetaPhi = aida.cloud2D("hitThetaPhi_cloud2D");
-        xy = aida.cloud2D("hitXY_cloud2D");
-        rz = aida.cloud2D("hitRZ_cloud2D");
-        layer = aida.cloud1D("hitLayer_cloud1D");
-        energyEvent = aida.cloud1D("eventEnergy_cloud1D");
-        hitCount = aida.cloud1D("eventNumHits_cloud1D");
-        layerEnergy = aida.cloud1D("layersAvgEnergyEvent_cloud1D");
-        layerHitCount = aida.cloud1D("layersAvgHitCountEvent_cloud1D");
+        energy = aida.cloud1D(collName + "_hitEnergy");
+        hitAvgEnergy = aida.cloud1D(collName + "_hitAvgEnergy");
+        time = aida.cloud1D(collName + "_hitTime");
+        thetaPhi = aida.cloud2D(collName + "_hitThetaPhi");
+        xy = aida.cloud2D(collName + "_hitXY");
+        rz = aida.cloud2D(collName + "_hitRZ");        
+        layer = aida.histogram1D(collName + "_hitLayer", nlayers, 0, nlayers);
+        energyEvent = aida.cloud1D(collName + "_eventEnergy");
+        hitCount = aida.cloud1D(collName + "_eventNumHits");
+        //layerEnergy = aida.cloud1D("layersAvgEnergyEvent");
+        //layerHitCount = aida.cloud1D("layersAvgHitCountEvent");
         tree.cd("..");
     }
     
@@ -117,6 +119,8 @@
             
             for ( GenericHit hit : hits )
             {
+                double[] position = hit.getPosition();
+                
                 /* hit energy */
                 energy.fill(hit.getEnergy() );
                 
@@ -124,22 +128,22 @@
                 time.fill(hit.getTime() );
                 
                 /* hit theta vs. phi */
-                thetaPhi.fill(hit.getTheta(), hit.getPhi() );
+                thetaPhi.fill(HitUtil.getTheta(position), HitUtil.getPhi(position) );
                 
                 /* hit X vs. Y */
                 xy.fill(hit.getX(), hit.getY() );
                 
-                /* hit cyl radius vs. Z */
-                rz.fill(hit.getCylindricalRadius(), hit.getZ() );
+                /* hit Z vs. cylindrical radius */
+                rz.fill(hit.getZ(), HitUtil.getCylindricalRadius(position) );
                 
                 /* hit layer */
                 layer.fill(hit.getLayer());
                 
-                /* layer energy */
-                layerE[hit.getLayer()] += hit.getEnergy();
-                
-                /* layer # hits */
-                layerHits[hit.getLayer()] += 1;
+//                /* layer energy */
+//                layerE[hit.getLayer()] += hit.getEnergy();
+//                
+//                /* layer # hits */
+//                layerHits[hit.getLayer()] += 1;
                 
                 /* incr tot E */
                 eventTotEnergy += hit.getEnergy();
@@ -158,20 +162,20 @@
             double hitAvgE = eventTotEnergy / nhits;
             hitAvgEnergy.fill(hitAvgE);
             
-            /* fill layer plots from arrays */
-            for ( int i=0; i < this.nlayers; i++)
-            {
-                /* energy by layer */
-                layerEnergy.fill(i, layerE[i]);
-                
-                /* hit count by layer*/
-                layerHitCount.fill(i, (double)layerHits[i]);
-            }
-            
-            /* reset layer arrays */
-            layerEnergy.fill(0);
-            layerHitCount.fill(0);
-            
+//            /* fill layer plots from arrays */
+//            for ( int i=0; i < this.nlayers; i++)
+//            {
+//                /* energy by layer */
+//                layerEnergy.fill(i, layerE[i]);
+//                
+//                /* hit count by layer*/
+//                layerHitCount.fill(i, (double)layerHits[i]);
+//            }
+//            
+//            /* reset layer arrays */
+//            layerEnergy.fill(0);
+//            layerHitCount.fill(0);
+//            
             tree.cd("..");
         }
     }

SlicDiagnostics/src/org/lcsim/slic/diagnostics
SlicDiagnosticsDriver.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- SlicDiagnosticsDriver.java	27 Jul 2005 00:44:00 -0000	1.2
+++ SlicDiagnosticsDriver.java	27 Jul 2005 23:21:36 -0000	1.3
@@ -10,6 +10,7 @@
 import java.util.ArrayList;
 import java.util.Map;
 import java.util.HashMap;
+import java.io.File;
 
 import org.freehep.application.Application;
 import org.freehep.application.studio.Studio;
@@ -23,6 +24,7 @@
 import org.lcsim.event.EventHeader.LCMetaData;
 import org.lcsim.event.SimTrackerHit;
 import org.lcsim.event.SimCalorimeterHit;
+import org.lcsim.event.MCParticle;
 import org.lcsim.geometry.IDDecoder;
 import org.lcsim.event.EventHeader.LCMetaData;
 
@@ -33,78 +35,146 @@
 public class SlicDiagnosticsDriver extends Driver
 {
     private AIDA aida = AIDA.defaultInstance();
-    String fileName = "slicDiagnostics.aida";    
+    String fileName = null;
+    String defaultFileName = "slicDiagnostics.aida";
     
-    Map<String, GenericHitPlots> singleCollPlots = new HashMap<String,GenericHitPlots>();
+    Map<String, GenericHitPlots> genericHitPlots = new HashMap<String,GenericHitPlots>();
+    Map<String, CalorimeterHitPlots> calorimeterHitPlots = new HashMap<String,CalorimeterHitPlots>();
+    MCParticlePlots mcpPlots = new MCParticlePlots();
     
     int nEvents = 0;
     
     ICloud1D eventTotalEnergy;
+    ICloud1D eventHits;
+    ICloud1D eventTrackerHits;
+    ICloud1D eventCalorimeterHits;
+    ICloud1D eventTrackerEnergy;
+    ICloud1D eventCalorimeterEnergy;
     
     double eventEnergy = 0;
     
+    double trackerTotalEnergy = 0;
+    double calorimeterTotalEnergy = 0;
+    
+    double trackerHitCount = 0;
+    double calorimeterHitCount = 0;
+    
     /** Creates a new instance of SlicDiagnosticsDriver */
     public SlicDiagnosticsDriver()
     {
-        eventTotalEnergy = aida.cloud1D("eventEnergy_cloud1D");
+        eventTotalEnergy = aida.cloud1D("eventEnergy");
+        eventHits = aida.cloud1D("eventHits");
+        eventTrackerHits = aida.cloud1D("eventTrackerHits");
+        eventCalorimeterHits = aida.cloud1D("eventCalorimeterHits");
+        eventTrackerEnergy = aida.cloud1D("eventTrackerEnergy");
+        eventCalorimeterEnergy = aida.cloud1D("eventCalorimeterEnergy");
     }
     
     protected void process(EventHeader event)
-    {        
+    {
+        /* reset hit counters */
+        trackerHitCount = calorimeterHitCount = 0;
+        
         /* proc tracker colls */
         processTrackerCollections(event);
         
         /* proc cal colls */
-        processCalorimeterCollections(event);        
+        processCalorimeterCollections(event);
+        
+        /* proc MCParticles coll */
+        processMCParticleCollection(event);
         
         /* event total energy */
         eventEnergy = 0;
-        for ( GenericHitPlots plots : singleCollPlots.values() )
+        for ( GenericHitPlots plots : genericHitPlots.values() )
         {
             eventEnergy += plots.getEventEnergy();
         }
         
+        /* fill event plots */
         eventTotalEnergy.fill(eventEnergy);
+        eventTrackerHits.fill(trackerHitCount);
+        eventCalorimeterHits.fill(calorimeterHitCount);
+        eventHits.fill(trackerHitCount + calorimeterHitCount);
+        eventTrackerEnergy.fill(trackerTotalEnergy);
+        eventCalorimeterEnergy.fill(calorimeterTotalEnergy);
         
         /* incr tot n events */
-        ++nEvents;                   
+        ++nEvents;
     }
     
-    private GenericHitPlots getSingleHitCollectionPlots(LCMetaData meta)
+    private void processMCParticleCollection(EventHeader event )
     {
-        if ( singleCollPlots.get(meta.getName()) == null )
+        List<List<MCParticle>> mcpCollections = event.get(MCParticle.class);
+        
+        for ( List<MCParticle> mcp : mcpCollections )
         {
-            singleCollPlots.put(meta.getName(), new GenericHitPlots(meta) );
+            mcpPlots.fill(mcp);
+        }
+    }
+    
+    private GenericHitPlots getGenericHitPlots(LCMetaData meta)
+    {
+        if ( genericHitPlots.get(meta.getName()) == null )
+        {
+            genericHitPlots.put(meta.getName(), new GenericHitPlots(meta) );
         }
         
-        return singleCollPlots.get(meta.getName());
+        return genericHitPlots.get(meta.getName());
+    }
+    
+    private CalorimeterHitPlots getCalorimeterHitPlots(LCMetaData meta)
+    {
+        if ( calorimeterHitPlots.get(meta.getName()) == null )
+        {
+            calorimeterHitPlots.put(meta.getName(), new CalorimeterHitPlots(meta) );
+        }
+        
+        return calorimeterHitPlots.get(meta.getName());
     }
     
     private void processTrackerCollections(EventHeader event)
     {
-        List<List<SimTrackerHit>> simTrackerHitCollections = event.get(SimTrackerHit.class);        
+        trackerTotalEnergy = 0;
+        List<List<SimTrackerHit>> simTrackerHitCollections = event.get(SimTrackerHit.class);
         for ( List<SimTrackerHit> simTrackerHits : simTrackerHitCollections )
         {
+            /* generic plots */
             LCMetaData meta = event.getMetaData(simTrackerHits);
-            GenericHitPlots plots = getSingleHitCollectionPlots(meta);
+            GenericHitPlots plots = getGenericHitPlots(meta);
             List<GenericHit> hits = makeTrackerHits(simTrackerHits, meta);
             plots.fill(hits);
+            
+            trackerHitCount += simTrackerHits.size();
+            trackerTotalEnergy += plots.getEventEnergy();
         }
     }
     
     private void processCalorimeterCollections(EventHeader event)
     {
-        List<List<SimCalorimeterHit>> simCalorimeterHitCollections = event.get(SimCalorimeterHit.class);                
+        calorimeterTotalEnergy = 0;
+        List<List<SimCalorimeterHit>> simCalorimeterHitCollections = event.get(SimCalorimeterHit.class);
         for ( List<SimCalorimeterHit> simCalorimeterHits : simCalorimeterHitCollections)
         {
+            /* generic plots*/
             LCMetaData meta = event.getMetaData(simCalorimeterHits);
-            GenericHitPlots plots = getSingleHitCollectionPlots(meta);
+            GenericHitPlots plots = getGenericHitPlots(meta);
             List<GenericHit> hits = makeCalorimeterHits(simCalorimeterHits, meta);
             plots.fill(hits);
+            
+            /* cal plots */
+            CalorimeterHitPlots calPlots = getCalorimeterHitPlots(meta);
+            calPlots.fill(simCalorimeterHits);
+            
+            /* incr hit count */
+            calorimeterHitCount += simCalorimeterHits.size();
+            
+            /* add to total cal E */
+            calorimeterTotalEnergy += plots.getEventEnergy();
         }
     }
     
-    private List<GenericHit> makeTrackerHits(List<SimTrackerHit> trackerHits, LCMetaData meta)
+    private static List<GenericHit> makeTrackerHits(List<SimTrackerHit> trackerHits, LCMetaData meta)
     {
         List<GenericHit> genericHits = new ArrayList<GenericHit>();
         for (SimTrackerHit trackerHit : trackerHits)
@@ -115,7 +185,7 @@
         return genericHits;
     }
     
-    private List<GenericHit> makeCalorimeterHits(List<SimCalorimeterHit> calHits, LCMetaData meta)
+    private static List<GenericHit> makeCalorimeterHits(List<SimCalorimeterHit> calHits, LCMetaData meta)
     {
         List<GenericHit> genericHits = new ArrayList<GenericHit>();
         for (SimCalorimeterHit calHit : calHits)
@@ -126,7 +196,7 @@
         return genericHits;
     }
     
-    private GenericHit makeCalorimeterHit(SimCalorimeterHit calorimeterHit, LCMetaData meta)
+    private static GenericHit makeCalorimeterHit(SimCalorimeterHit calorimeterHit, LCMetaData meta)
     {
         IDDecoder decoder = meta.getIDDecoder();
         decoder.setID(calorimeterHit.getCellID() );
@@ -138,11 +208,11 @@
                 calorimeterHit.getEnergy(),
                 calorimeterHit.getPosition(),
                 layer,
-                calorimeterHit.getContributedTime(0) // smallest time???
+                calorimeterHit.getTime()
                 );
     }
     
-    private GenericHit makeTrackerHit(SimTrackerHit trackerHit, LCMetaData meta)
+    private static GenericHit makeTrackerHit(SimTrackerHit trackerHit, LCMetaData meta)
     {
         IDDecoder decoder = meta.getIDDecoder();
         decoder.setID(trackerHit.getCellID() );
@@ -160,24 +230,33 @@
     
     protected void startOfData()
     {
-        if ( Application.getApplication() != null)
+        if ( fileName == null )
         {
-            SequentialRecordLoop loop = (SequentialRecordLoop) ((Studio) Application.getApplication()).getLookup().lookup(SequentialRecordLoop.class);
-            
-            if ( loop != null )
+            /* try setting output filename from JAS app*/
+            if ( Application.getApplication() != null)
             {
-                SequentialRecordSource source = loop.getRecordSource();
-                if ( source != null )
+                SequentialRecordLoop loop = (SequentialRecordLoop) ((Studio) Application.getApplication()).getLookup().lookup(SequentialRecordLoop.class);
+                
+                if ( loop != null )
                 {
-                    fileName = source.getSourceName();
+                    SequentialRecordSource source = loop.getRecordSource();
+                    if ( source != null )
+                    {
+                        fileName = source.getSourceName();
+                    }
                 }
             }
-        }
+            
+            /* set filename to default */
+            if ( fileName == null ) 
+            {
+                fileName = defaultFileName;
+            }
+        }        
     }
     
     protected void endOfData()
     {
-        //System.out.println("endOfData");
         try
         {
             aida.saveAs(fileName);
@@ -187,4 +266,10 @@
             throw new RuntimeException("Problem committing tree.", e);
         }
     }
+    
+    /** set filename to basename with ".slcio" replaced by ".aida" */
+    public void setFileName(String path)
+    {
+        fileName = (new File(path)).getName().replace(".slcio",".aida");
+    }
 }

SlicDiagnostics/test/org/lcsim/slic/diagnostics
SlicDiagnosticsTest.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- SlicDiagnosticsTest.java	27 Jul 2005 00:44:00 -0000	1.2
+++ SlicDiagnosticsTest.java	27 Jul 2005 23:21:37 -0000	1.3
@@ -29,7 +29,9 @@
         recordCount = 0;
         LCSimLoop loop = new LCSimLoop();
         loop.setLCIORecordSource(file);
-        loop.add(new SlicDiagnosticsDriver());
+        SlicDiagnosticsDriver slicDiag = new SlicDiagnosticsDriver();
+        slicDiag.setFileName(s);
+        loop.add(slicDiag);
         loop.loop(-1);
 //        loop.loop(5);
         loop.dispose();
@@ -37,9 +39,8 @@
     
     public void testSlicDiagnostics() throws Exception
     {
+        runTestFile("http://www.lcsim.org/test/lcio/ZPoleUDS_50evt_SLIC_v1r9p1_sidmay05.slcio");
         //runTestFile("http://www.lcsim.org/test/lcio/muons_SLIC_v1r9p1_sidmay05.slcio");
-        //runTestFile("http://www.lcsim.org/test/lcio/muons_SLIC_v1r9p1_sidmay05_np.slcio");
-        runTestFile("file:/nfs/slac/g/lcd/mc/prj/data/public_data/ILC/singleParticle/sidaug05/slcio/slic/muon_Theta1-179_1-50GeV_SLIC_v1r9p3_sidaug05.slcio");
     }
         
     public SlicDiagnosticsTest(String testName)
CVSspam 0.2.8