Commit in lcsim/src/org/lcsim/recon/cluster/analysis on MAIN
ClusterMCPInfo.java+252-2311.1 -> 1.2
CreateClusterAnalysisLists.java+1-11.1 -> 1.2
+253-232
2 modified files
debugging

lcsim/src/org/lcsim/recon/cluster/analysis
ClusterMCPInfo.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- ClusterMCPInfo.java	5 Oct 2005 17:29:11 -0000	1.1
+++ ClusterMCPInfo.java	12 Oct 2005 17:01:04 -0000	1.2
@@ -11,250 +11,271 @@
 
 /**
  * Class to hold MCParticle information about a Cluster
- * @author Ron Cassell 
+ * @author Ron Cassell
  */
 public class ClusterMCPInfo
 {
-   private int NMCP;
-   private Map<MCParticle,Contributions> contributers;
-   private MCParticle maxMCP;
-   private int maxNhits;
-   private double maxErawContribution;
-   private double maxEcorrectedContribution;
-   private BasicCluster thisCluster;
-   private MCParticle[] mcparts;
-   private int nPrimary;
-   private int nFragment;
-   private MCParticle[] primaries;
-   private MCParticle[] fragments;
-
-   /**
-    */
-   public ClusterMCPInfo(BasicCluster c, Map<MCParticle,MCParticle> fsmap)
-   {
-      thisCluster = c;
-      contributers = new HashMap();
-      for(CalorimeterHit h:c.getCalorimeterHits())
-      {
-         SimCalorimeterHit simhit = (SimCalorimeterHit) h;
-         Contributions cc = null;
-         double totecorr = simhit.getCorrectedEnergy();
-         double toteraw = simhit.getRawEnergy();
-         Map<MCParticle,Double> pemap = new HashMap<MCParticle,Double>();
-         for(int i=0;i<simhit.getMCParticleCount();i++)
-         {
-            MCParticle p = fsmap.get(simhit.getMCParticle(i));
-            if(p == null)p = simhit.getMCParticle(i);
-            Double ce;
-            if(pemap.containsKey(p))
+    private int NMCP;
+    private Map<MCParticle,Contributions> contributers;
+    private MCParticle maxMCP;
+    private int maxNhits;
+    private double maxErawContribution;
+    private double maxEcorrectedContribution;
+    private BasicCluster thisCluster;
+    private MCParticle[] mcparts;
+    private int nPrimary;
+    private int nFragment;
+    private MCParticle[] primaries;
+    private MCParticle[] fragments;
+    private MCPClusterInfo maxMCPC;
+    
+    /**
+     */
+    public ClusterMCPInfo(BasicCluster c, Map<MCParticle,MCParticle> fsmap)
+    {
+        thisCluster = c;
+        contributers = new HashMap();
+        for(CalorimeterHit h:c.getCalorimeterHits())
+        {
+            SimCalorimeterHit simhit = (SimCalorimeterHit) h;
+            Contributions cc = null;
+            double totecorr = simhit.getCorrectedEnergy();
+            double toteraw = simhit.getRawEnergy();
+            Map<MCParticle,Double> pemap = new HashMap<MCParticle,Double>();
+            for(int i=0;i<simhit.getMCParticleCount();i++)
             {
-               ce = new Double(simhit.getContributedEnergy(i) + pemap.get(p).doubleValue());
-               pemap.remove(p);
+                MCParticle p = fsmap.get(simhit.getMCParticle(i));
+                if(p == null)p = simhit.getMCParticle(i);
+                Double ce;
+                if(pemap.containsKey(p))
+                {
+                    ce = new Double(simhit.getContributedEnergy(i) + pemap.get(p).doubleValue());
+                    pemap.remove(p);
+                }
+                else
+                {
+                    ce = new Double(simhit.getContributedEnergy(i));
+                }
+                pemap.put(p,ce);
             }
-            else
+            for(MCParticle p:pemap.keySet())
             {
-               ce = new Double(simhit.getContributedEnergy(i));
+                if(contributers.containsKey(p))
+                {
+                    cc = contributers.get(p);
+                }
+                else
+                {
+                    contributers.put(p,cc = new Contributions());
+                }
+                cc.addContribution(pemap.get(p).doubleValue());
+                cc.addEcorrected(totecorr*pemap.get(p).doubleValue()/toteraw);
             }
-            pemap.put(p,ce);
-         }
-         for(MCParticle p:pemap.keySet())
-         {
-            if(contributers.containsKey(p))
+        }
+        NMCP = contributers.size();
+        mcparts = new MCParticle[NMCP];
+        int ipart = 0;
+        for(MCParticle p:contributers.keySet())
+        {
+            mcparts[ipart] = p;
+            ipart++;
+        }
+    }
+    /**
+     */
+    public void FillInfo(Map<MCParticle,MCPClusterInfo> m)
+    {
+        maxNhits = 0;
+        maxErawContribution = 0.;
+        nPrimary = 0;
+        nFragment = 0;
+        for(MCParticle p:contributers.keySet())
+        {
+            MCPClusterInfo ci = m.get(p);
+            Contributions co = contributers.get(p);
+            if(ci.isFinalState())co.setFS();
+            if(thisCluster == ci.getMaxCluster())
             {
-               cc = contributers.get(p);
+                co.setPrimary();
+                nPrimary++;
             }
             else
             {
-               contributers.put(p,cc = new Contributions());
+                co.setFragment();
+                nFragment++;
+            }
+            int nh = co.getNhits();
+            if(nh > maxNhits)
+            {
+                maxNhits = nh;
+                maxErawContribution = co.getEraw();
+                maxEcorrectedContribution = co.getEcorrected();
+                maxMCP = p;
+                maxMCPC = ci;
+            }
+            else if(nh == maxNhits)
+            {
+                if(co.getEraw() > maxErawContribution)
+                {
+                    maxNhits = nh;
+                    maxErawContribution = co.getEraw();
+                    maxEcorrectedContribution = co.getEcorrected();
+                    maxMCP = p;
+                    maxMCPC = ci;
+                }
             }
-            cc.addContribution(pemap.get(p).doubleValue());
-            cc.addEcorrected(totecorr*pemap.get(p).doubleValue()/toteraw);
-         }
-      }
-      NMCP = contributers.size();
-      mcparts = new MCParticle[NMCP];
-      int ipart = 0;
-      for(MCParticle p:contributers.keySet())
-      {
-         mcparts[ipart] = p;
-         ipart++;
-      }
-   }
-   /**
-    */
-   public void FillInfo(Map<MCParticle,MCPClusterInfo> m)
-   {
-      maxNhits = 0;
-      maxErawContribution = 0.;
-      nPrimary = 0;
-      nFragment = 0;
-      for(MCParticle p:contributers.keySet())
-      {
-         MCPClusterInfo ci = m.get(p);
-         Contributions co = contributers.get(p);
-         if(ci.isFinalState())co.setFS();
-         if(thisCluster == ci.getMaxCluster())
-         {
-            co.setPrimary();
-            nPrimary++;
-         }
-         else
-         {
-            co.setFragment();
-            nFragment++;
-         }
-         int nh = co.getNhits();
-         if(nh > maxNhits)
-         {
-            maxNhits = nh;
-            maxErawContribution = co.getEraw();
-            maxEcorrectedContribution = co.getEcorrected();
-            maxMCP = p;
-         }
-         else if(nh == maxNhits)
-         {
-            if(co.getEraw() > maxErawContribution)
-            {
-               maxNhits = nh;
-               maxErawContribution = co.getEraw();
-               maxEcorrectedContribution = co.getEcorrected();
-               maxMCP = p;
-            }
-         }
-      }
-      primaries = new MCParticle[nPrimary];
-      fragments = new MCParticle[nFragment];
-      int iprim = 0;
-      int ifrag = 0;
-      for(MCParticle p:contributers.keySet())
-      {
-         Contributions co = contributers.get(p);
-         if(co.isPrimary())
-         {
-            primaries[iprim] = p;
-            iprim++;
-         }
-         if(co.isFragment())
-         {
-            fragments[ifrag] = p;
-            ifrag++;
-         }
-      }		
-   }
-   /**
-    * Return the number of MCParticles contributing to this cluster
-    */
-   public int getNContributers()
-   {
-      return NMCP;
-   }
-   /**
-    * Return an array of MCParticles contributing to this cluster
-    */
-   public MCParticle[] getContributers()
-   {
-      return mcparts;
-   }
-   /**
-    * Return the number of MCParticles having this cluster as their maximum cluster
-    */
-   public int getNPrimary()
-   {
-      return nPrimary;
-   }
-   /**
-    * Return the number of MCParticles contributing to this cluster having a different 
-    * maximum cluster
-    */
-   public int getNFragment()
-   {
-      return nFragment;
-   }
-   /**
-    * Return an array of MCParticles having this cluster as their maximum cluster
-    */
-   public MCParticle[] getPrimaries()
-   {
-      return primaries;
-   }
-   /**
-    * Return an array of MCParticles contributing to this cluster having a different 
-    * maximum cluster
-    */
-   public MCParticle[] getFragments()
-   {
-      return fragments;
-   }
-   /**
-    * Return the MCParticle with the maximum contribution to this cluster
-    */
-   public MCParticle getMaxContributer()
-   {
-      return maxMCP;
-   }
-   /**
-    * Return the number of hits from the MCParticle with the maximum
-    * contribution to this cluster
-    */
-   public int getMaxNHits()
-   {
-      return maxNhits;
-   }
-   /**
-    * Return the raw energy from the MCParticle with the maximum
-    * contribution to this cluster
-    */
-   public double getMaxRawEnergy()
-   {
-      return maxErawContribution;
-   }
-   /**
-    * Return the corrected energy from the MCParticle with the maximum
-    * contribution to this cluster
-    */
-   public double getMaxCorrectedEnergy()
-   {
-      return maxEcorrectedContribution;
-   }
-   public BasicCluster getCluster(){return thisCluster;}
-
+        }
+        primaries = new MCParticle[nPrimary];
+        fragments = new MCParticle[nFragment];
+        int iprim = 0;
+        int ifrag = 0;
+        for(MCParticle p:contributers.keySet())
+        {
+            Contributions co = contributers.get(p);
+            if(co.isPrimary())
+            {
+                primaries[iprim] = p;
+                iprim++;
+                m.get(p).setMaxCMCP(this);
+            }
+            if(co.isFragment())
+            {
+                fragments[ifrag] = p;
+                ifrag++;
+            }
+        }
+    }
+    /**
+     * Return the number of MCParticles contributing to this cluster
+     */
+    public int getNContributers()
+    {
+        return NMCP;
+    }
+    /**
+     * Return an array of MCParticles contributing to this cluster
+     */
+    public MCParticle[] getContributers()
+    {
+        return mcparts;
+    }
+    /**
+     * Return the number of MCParticles having this cluster as their maximum cluster
+     */
+    public int getNPrimary()
+    {
+        return nPrimary;
+    }
+    /**
+     * Return the number of MCParticles contributing to this cluster having a different
+     * maximum cluster
+     */
+    public int getNFragment()
+    {
+        return nFragment;
+    }
+    /**
+     * Return an array of MCParticles having this cluster as their maximum cluster
+     */
+    public MCParticle[] getPrimaries()
+    {
+        return primaries;
+    }
+    /**
+     * Return an array of MCParticles contributing to this cluster having a different
+     * maximum cluster
+     */
+    public MCParticle[] getFragments()
+    {
+        return fragments;
+    }
+    /**
+     * Return the MCParticle with the maximum contribution to this cluster
+     */
+    public MCParticle getMaxContributer()
+    {
+        return maxMCP;
+    }
+    /**
+     * Return the MCPClusterInfo block for the maximum contributer
+     */
+    public MCPClusterInfo getMaxMCPC()
+    {
+        return maxMCPC;
+    }
+    /**
+     * Return the number of hits from the MCParticle with the maximum
+     * contribution to this cluster
+     */
+    public int getMaxNHits()
+    {
+        return maxNhits;
+    }
+    /**
+     * Return the raw energy from the MCParticle with the maximum
+     * contribution to this cluster
+     */
+    public double getMaxRawEnergy()
+    {
+        return maxErawContribution;
+    }
+    /**
+     * Return the corrected energy from the MCParticle with the maximum
+     * contribution to this cluster
+     */
+    public double getMaxCorrectedEnergy()
+    {
+        return maxEcorrectedContribution;
+    }
+    public BasicCluster getCluster()
+    {return thisCluster;}
+    
 }
-   /**
-    * Class to store contribution information while ClusterMCPInfo being filled
-    */
+/**
+ * Class to store contribution information while ClusterMCPInfo being filled
+ */
 class Contributions
 {
-   int nhits;
-   double eraw;
-   double ecorr;
-   boolean isfs;
-   boolean isprimary;
-   boolean isfragment;
-   public Contributions()
-   {
-      nhits = 0;
-      eraw = 0.;
-      ecorr = 0.;
-      isfs = false;
-      isprimary = false;
-      isfragment = false;
-   }
-   public void addContribution(double er)
-   {
-      nhits++;
-      eraw += er;
-   }
-   public void addEcorrected(double ec)
-   {
-      ecorr += ec;
-   }
-   public void setFS(){isfs = true;}
-   public void setPrimary(){isprimary = true;}
-   public void setFragment(){isfragment = true;}
-   public boolean isFS(){return isfs;}
-   public boolean isPrimary(){return isprimary;}
-   public boolean isFragment(){return isfragment;}
-   public int getNhits(){return nhits;}
-   public double getEraw(){return eraw;}
-   public double getEcorrected(){return ecorr;}
+    int nhits;
+    double eraw;
+    double ecorr;
+    boolean isfs;
+    boolean isprimary;
+    boolean isfragment;
+    public Contributions()
+    {
+        nhits = 0;
+        eraw = 0.;
+        ecorr = 0.;
+        isfs = false;
+        isprimary = false;
+        isfragment = false;
+    }
+    public void addContribution(double er)
+    {
+        nhits++;
+        eraw += er;
+    }
+    public void addEcorrected(double ec)
+    {
+        ecorr += ec;
+    }
+    public void setFS()
+    {isfs = true;}
+    public void setPrimary()
+    {isprimary = true;}
+    public void setFragment()
+    {isfragment = true;}
+    public boolean isFS()
+    {return isfs;}
+    public boolean isPrimary()
+    {return isprimary;}
+    public boolean isFragment()
+    {return isfragment;}
+    public int getNhits()
+    {return nhits;}
+    public double getEraw()
+    {return eraw;}
+    public double getEcorrected()
+    {return ecorr;}
 }
\ No newline at end of file

lcsim/src/org/lcsim/recon/cluster/analysis
CreateClusterAnalysisLists.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- CreateClusterAnalysisLists.java	5 Oct 2005 17:30:38 -0000	1.1
+++ CreateClusterAnalysisLists.java	12 Oct 2005 17:01:04 -0000	1.2
@@ -171,9 +171,9 @@
 // Through with all the clustered, so unclustered hit list should be
 //  correct. So add the unclustered hits to the MCPClusterInfo block
 //
-       List<MCParticle> contmc = new ArrayList<MCParticle>();
        for(CalorimeterHit h:unclustered)
        {
+          List<MCParticle> contmc = new ArrayList<MCParticle>();
           SimCalorimeterHit simhit = (SimCalorimeterHit) h;
           for(int i=0;i<simhit.getMCParticleCount();i++)
           {
CVSspam 0.2.8