Commit in lcsim/src/org/lcsim/recon/cluster/analysis on MAIN
MCPClusterInfo.java+221-1991.1 -> 1.2
Debugging

lcsim/src/org/lcsim/recon/cluster/analysis
MCPClusterInfo.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- MCPClusterInfo.java	5 Oct 2005 17:28:29 -0000	1.1
+++ MCPClusterInfo.java	12 Oct 2005 17:00:33 -0000	1.2
@@ -10,215 +10,237 @@
 
 /**
  * Class to hold Cluster information about a MCParticle
- * @author Ron Cassell 
+ * @author Ron Cassell
  */
 public class MCPClusterInfo
 {
-   private int NClusters;
-   private BasicCluster MaxCluster;
-   private double MaxEraw;
-   private double MaxEcorrected;
-   private int MaxNHits;
-   private List<BasicCluster> Clusters;
-   private List<Double> ErawContribution;
-   private List<Double> EcorrectedContribution;
-   private List<Integer> NhitContribution;
-   private List<SimCalorimeterHit> UnclusteredHits;
-   private int TotalHits;
-   private double TotalEraw;
-   private double TotalEcorrected;
-   private MCParticle part;
-   private boolean isFS;
-   private Map<MCParticle,MCParticle> fsmap;
-
-   /**
-    */
-   public MCPClusterInfo(MCParticle p,Map<MCParticle,MCParticle> FSmap)
-   {
-      part = p;
-      fsmap = FSmap;
-      isFS = (FSmap.get(p) == p);
-      NClusters = 0;
-      MaxCluster = null;
-      MaxEraw = 0.;
-      MaxEcorrected = 0.;
-      MaxNHits = 0;
-      TotalHits = 0;
-      TotalEraw = 0.;
-      TotalEcorrected = 0.;
-      Clusters = new ArrayList<BasicCluster>();
-      ErawContribution = new ArrayList<Double>();
-      EcorrectedContribution = new ArrayList<Double>();
-      NhitContribution = new ArrayList<Integer>();
-      UnclusteredHits = new ArrayList<SimCalorimeterHit>();
-   }
-   /**
-    * Add a cluster this particle contributes to
-    */
-   public void AddCluster(BasicCluster c)
-   {
-      Clusters.add(c);
-      NClusters++;
-      int nhits = 0;
-      double eraw = 0.;
-      double ecorr = 0.;
-      for(CalorimeterHit hit:c.getCalorimeterHits())
-      {
-         double thiseraw = 0.;
-         SimCalorimeterHit shit = (SimCalorimeterHit) hit;
-         boolean hashit = false;
-         for(int i=0;i<shit.getMCParticleCount();i++)
-         {
-            MCParticle thisp = fsmap.get(shit.getMCParticle(i));
-            if(thisp == null)thisp = shit.getMCParticle(i);
-            if(thisp == part)
+    private int NClusters;
+    private BasicCluster MaxCluster;
+    private double MaxEraw;
+    private double MaxEcorrected;
+    private int MaxNHits;
+    private List<BasicCluster> Clusters;
+    private List<Double> ErawContribution;
+    private List<Double> EcorrectedContribution;
+    private List<Integer> NhitContribution;
+    private List<SimCalorimeterHit> UnclusteredHits;
+    private int TotalHits;
+    private double TotalEraw;
+    private double TotalEcorrected;
+    private MCParticle part;
+    private boolean isFS;
+    private Map<MCParticle,MCParticle> fsmap;
+    private ClusterMCPInfo MaxCMCP;
+    
+    /**
+     */
+    public MCPClusterInfo(MCParticle p,Map<MCParticle,MCParticle> FSmap)
+    {
+        part = p;
+        fsmap = FSmap;
+        isFS = (FSmap.get(p) == p);
+        NClusters = 0;
+        MaxCluster = null;
+        MaxCMCP = null;
+        MaxEraw = 0.;
+        MaxEcorrected = 0.;
+        MaxNHits = 0;
+        TotalHits = 0;
+        TotalEraw = 0.;
+        TotalEcorrected = 0.;
+        Clusters = new ArrayList<BasicCluster>();
+        ErawContribution = new ArrayList<Double>();
+        EcorrectedContribution = new ArrayList<Double>();
+        NhitContribution = new ArrayList<Integer>();
+        UnclusteredHits = new ArrayList<SimCalorimeterHit>();
+    }
+    /**
+     * Add a cluster this particle contributes to
+     */
+    public void AddCluster(BasicCluster c)
+    {
+        Clusters.add(c);
+        NClusters++;
+        int nhits = 0;
+        double eraw = 0.;
+        double ecorr = 0.;
+        for(CalorimeterHit hit:c.getCalorimeterHits())
+        {
+            double thiseraw = 0.;
+            SimCalorimeterHit shit = (SimCalorimeterHit) hit;
+            boolean hashit = false;
+            for(int i=0;i<shit.getMCParticleCount();i++)
             {
-               hashit = true;
-               thiseraw += shit.getContributedEnergy(i);
+                MCParticle thisp = fsmap.get(shit.getMCParticle(i));
+                if(thisp == null)thisp = shit.getMCParticle(i);
+                if(thisp == part)
+                {
+                    hashit = true;
+                    thiseraw += shit.getContributedEnergy(i);
+                }
             }
-         }
-         if(hashit)nhits++;
-         ecorr += shit.getCorrectedEnergy()*thiseraw/shit.getRawEnergy();
-         eraw += thiseraw;
-      }
-      Integer nh = new Integer(nhits);
-      Double er = new Double(eraw);
-      Double ec = new Double(ecorr);
-      ErawContribution.add(er);
-      EcorrectedContribution.add(ec);
-      NhitContribution.add(nh);
-      TotalHits += nhits;
-      TotalEraw += eraw;
-      TotalEcorrected += ecorr;
+            if(hashit)nhits++;
+            ecorr += shit.getCorrectedEnergy()*thiseraw/shit.getRawEnergy();
+            eraw += thiseraw;
+        }
+        Integer nh = new Integer(nhits);
+        Double er = new Double(eraw);
+        Double ec = new Double(ecorr);
+        ErawContribution.add(er);
+        EcorrectedContribution.add(ec);
+        NhitContribution.add(nh);
+        TotalHits += nhits;
+        TotalEraw += eraw;
+        TotalEcorrected += ecorr;
 //
 // See if this is the maximum cluster contributing to this particle
 //
-      if(nhits > MaxNHits)
-      {
-         MaxNHits = nhits;
-         MaxCluster = c;
-         MaxEraw = eraw;
-         MaxEcorrected = ecorr;
-      }
-      else if(nhits == MaxNHits)
-      {
-         if(ecorr > MaxEcorrected)
-         {
+        if(nhits > MaxNHits)
+        {
             MaxNHits = nhits;
             MaxCluster = c;
             MaxEraw = eraw;
             MaxEcorrected = ecorr;
-         }
-      }
-   }
-   /**
-    * Add an unclustered hit this particle contributes to
-    */
-   public void AddUnclusteredHit(SimCalorimeterHit h)
-   {
-      TotalHits++;
-      UnclusteredHits.add(h);
-      double rawE = 0.;
-      for(int i=0;i<h.getMCParticleCount();i++)
-      {
-         if(fsmap.get(h.getMCParticle(i)) == part)
-         {
-            rawE += h.getContributedEnergy(i);
-         }
-      }
-      TotalEraw += rawE;
-      TotalEcorrected += h.getCorrectedEnergy()*rawE/h.getRawEnergy();
-   }
-   /**
-    * Return the MCParticle for which the cluster information is stored
-    */
-   public MCParticle getMCParticle(){return part;}
-   /**
-    * Return true if the MCParticle for which the cluster information is stored is a 
-    * final state particle
-    */
-   public boolean isFinalState(){return isFS;}
-   /**
-    * Return the number of clusters to which this MCParticle contributes
-    */
-   public int getNClusters(){return NClusters;}
-   /**
-    * Return the cluster with the maximum number of hits contributed by this particle 
-    */
-   public BasicCluster getMaxCluster(){return MaxCluster;}
-   /**
-    * Return the raw energy contributed by this particle to the cluster with the 
-    * maximum number of hits contributed by this particle 
-    */
-   public double getMaxEraw(){return MaxEraw;}
-   /**
-    * Return the corrected energy contributed by this particle to the cluster with the 
-    * maximum number of hits contributed by this particle 
-    */
-   public double getMaxEcorrected(){return MaxEcorrected;}
-   /**
-    * Return the number of hits contributed by this particle to the cluster with the 
-    * maximum number of hits contributed by this particle 
-    */
-   public int getMaxNHits(){return MaxNHits;}
-   /**
-    * Return the total number of hits in the CalorimeterHit collections contributed 
-    * by this particle 
-    */
-   public int getTotalHits(){return TotalHits;}
-   /**
-    * Return the total raw energy in the CalorimeterHit collections contributed 
-    * by this particle 
-    */
-   public double getTotalEraw(){return TotalEraw;}
-   /**
-    * Return the total corrected energy in the CalorimeterHit collections contributed 
-    * by this particle 
-    */
-   public double getTotalEcorrected(){return TotalEcorrected;}
-   /**
-    * Return a list of clusters to which this particle contributes
-    */
-   public List<BasicCluster> getClusters(){return Clusters;}
-   /**
-    * Return an array of raw energy contributions of this particle to the list of clusters
-    */
-   public double[] getErawContribution()
-   {
-      double[] ret = new double[ErawContribution.size()];
-      for(int i=0;i<ErawContribution.size();i++)
-      {
-         ret[i] = ErawContribution.get(i).doubleValue();
-      }
-      return ret;
-   }
-   /**
-    * Return an array of corrected energy contributions of this particle to the list of clusters
-    */
-   public double[] getEcorrectedContribution()
-   {
-      double[] ret = new double[EcorrectedContribution.size()];
-      for(int i=0;i<EcorrectedContribution.size();i++)
-      {
-         ret[i] = EcorrectedContribution.get(i).doubleValue();
-      }
-      return ret;
-   }
-   /**
-    * Return an array of number of hits contributed by this particle to the list of clusters
-    */
-   public int[] getNhitContribution()
-   {
-      int[] ret = new int[NhitContribution.size()];
-      for(int i=0;i<NhitContribution.size();i++)
-      {
-         ret[i] = NhitContribution.get(i).intValue();
-      }
-      return ret;
-   }
-   /**
-    * Return a list of unclustered hits contributed to by this particle
-    */
-   public List<SimCalorimeterHit> getUnclusteredHits(){return UnclusteredHits;}
-
+        }
+        else if(nhits == MaxNHits)
+        {
+            if(ecorr > MaxEcorrected)
+            {
+                MaxNHits = nhits;
+                MaxCluster = c;
+                MaxEraw = eraw;
+                MaxEcorrected = ecorr;
+            }
+        }
+    }
+    /**
+     * Add an unclustered hit this particle contributes to
+     */
+    public void AddUnclusteredHit(SimCalorimeterHit h)
+    {
+        TotalHits++;
+        UnclusteredHits.add(h);
+        double rawE = 0.;
+        for(int i=0;i<h.getMCParticleCount();i++)
+        {
+            if(fsmap.get(h.getMCParticle(i)) == part)
+            {
+                rawE += h.getContributedEnergy(i);
+            }
+        }
+        TotalEraw += rawE;
+        TotalEcorrected += h.getCorrectedEnergy()*rawE/h.getRawEnergy();
+    }
+    public void setMaxCMCP(ClusterMCPInfo ci)
+    {
+        MaxCMCP = ci;
+    }
+    public ClusterMCPInfo getMaxCMCP()
+    {
+        return MaxCMCP;
+    }
+    /**
+     * Return the MCParticle for which the cluster information is stored
+     */
+    public MCParticle getMCParticle()
+    {return part;}
+    /**
+     * Return true if the MCParticle for which the cluster information is stored is a
+     * final state particle
+     */
+    public boolean isFinalState()
+    {return isFS;}
+    /**
+     * Return the number of clusters to which this MCParticle contributes
+     */
+    public int getNClusters()
+    {return NClusters;}
+    /**
+     * Return the cluster with the maximum number of hits contributed by this particle
+     */
+    public BasicCluster getMaxCluster()
+    {return MaxCluster;}
+    /**
+     * Return the raw energy contributed by this particle to the cluster with the
+     * maximum number of hits contributed by this particle
+     */
+    public double getMaxEraw()
+    {return MaxEraw;}
+    /**
+     * Return the corrected energy contributed by this particle to the cluster with the
+     * maximum number of hits contributed by this particle
+     */
+    public double getMaxEcorrected()
+    {return MaxEcorrected;}
+    /**
+     * Return the number of hits contributed by this particle to the cluster with the
+     * maximum number of hits contributed by this particle
+     */
+    public int getMaxNHits()
+    {return MaxNHits;}
+    /**
+     * Return the total number of hits in the CalorimeterHit collections contributed
+     * by this particle
+     */
+    public int getTotalHits()
+    {return TotalHits;}
+    /**
+     * Return the total raw energy in the CalorimeterHit collections contributed
+     * by this particle
+     */
+    public double getTotalEraw()
+    {return TotalEraw;}
+    /**
+     * Return the total corrected energy in the CalorimeterHit collections contributed
+     * by this particle
+     */
+    public double getTotalEcorrected()
+    {return TotalEcorrected;}
+    /**
+     * Return a list of clusters to which this particle contributes
+     */
+    public List<BasicCluster> getClusters()
+    {return Clusters;}
+    /**
+     * Return an array of raw energy contributions of this particle to the list of clusters
+     */
+    public double[] getErawContribution()
+    {
+        double[] ret = new double[ErawContribution.size()];
+        for(int i=0;i<ErawContribution.size();i++)
+        {
+            ret[i] = ErawContribution.get(i).doubleValue();
+        }
+        return ret;
+    }
+    /**
+     * Return an array of corrected energy contributions of this particle to the list of clusters
+     */
+    public double[] getEcorrectedContribution()
+    {
+        double[] ret = new double[EcorrectedContribution.size()];
+        for(int i=0;i<EcorrectedContribution.size();i++)
+        {
+            ret[i] = EcorrectedContribution.get(i).doubleValue();
+        }
+        return ret;
+    }
+    /**
+     * Return an array of number of hits contributed by this particle to the list of clusters
+     */
+    public int[] getNhitContribution()
+    {
+        int[] ret = new int[NhitContribution.size()];
+        for(int i=0;i<NhitContribution.size();i++)
+        {
+            ret[i] = NhitContribution.get(i).intValue();
+        }
+        return ret;
+    }
+    /**
+     * Return a list of unclustered hits contributed to by this particle
+     */
+    public List<SimCalorimeterHit> getUnclusteredHits()
+    {return UnclusteredHits;}
+    
 }
\ No newline at end of file
CVSspam 0.2.8