Print

Print


Commit in lcsim/src/org/lcsim/recon/cluster/util on MAIN
BasicCluster.java+37-211.10 -> 1.11
Add a setEnergy method for external calculation of corrected energy

lcsim/src/org/lcsim/recon/cluster/util
BasicCluster.java 1.10 -> 1.11
diff -u -r1.10 -r1.11
--- BasicCluster.java	14 Jan 2006 00:31:44 -0000	1.10
+++ BasicCluster.java	16 Feb 2006 19:56:01 -0000	1.11
@@ -43,9 +43,9 @@
             subdetector_raw_energies[i] = 0.;
             subdetector_corrected_energies[i] = 0.;
         }
-	position = new double[3];
-	positionError = new double[6];
-	directionError = new double[6];
+        position = new double[3];
+        positionError = new double[6];
+        directionError = new double[6];
     }
 
     /**
@@ -57,11 +57,11 @@
         double hre = hit.getRawEnergy();
         raw_energy += hre;
         double hce = hit.getCorrectedEnergy();
-        corrected_energy += hce;
         IDDecoder idc = hit.getIDDecoder();
         idc.setID(hit.getCellID());
         int detector_index = idc.getValue("system");
         if((detector_index > 9 )|(detector_index < 0))detector_index = 0;
+        corrected_energy += hce;
         hit_energies.add(hce);
         subdetector_raw_energies[detector_index] += hre;
         subdetector_corrected_energies[detector_index] += hce;
@@ -69,6 +69,17 @@
     }
 
     /**
+     * Add a CalorimeterHit to the cluster from a cluster
+     */
+    public void addHitFromCluster(CalorimeterHit hit)
+    {
+        hits.add(hit);
+        double hce = hit.getCorrectedEnergy();
+        hit_energies.add(hce);
+        needsPropertyCalculation = true;
+    }
+
+    /**
      * Remove a CalorimeterHit from the cluster
      */
     public void removeHit(CalorimeterHit hit)
@@ -78,12 +89,12 @@
         double hre = hit.getRawEnergy();
         raw_energy -= hre;
         double hce = hit.getCorrectedEnergy();
-        corrected_energy -= hce;
-        hit_energies.remove(indx);
         IDDecoder idc = hit.getIDDecoder();
         idc.setID(hit.getCellID());
         int detector_index = idc.getValue("system");
-        if((detector_index > 20 )|(detector_index < 0))detector_index = 0;
+        if((detector_index > 10 )|(detector_index < 0))detector_index = 0;
+        corrected_energy -= hce;
+        hit_energies.remove(indx);
         subdetector_raw_energies[detector_index] -= hre;
         subdetector_corrected_energies[detector_index] -= hce;
         needsPropertyCalculation = true;
@@ -99,25 +110,30 @@
         {
             for(int i=0;i<chits.size();i++)
             {
-                addHit(chits.get(i));
+                addHitFromCluster(chits.get(i));
             }
             needsPropertyCalculation = true;
         }
-        else
+        corrected_energy += cluster.getEnergy();
+        if(cluster instanceof BasicCluster)
         {
-            corrected_energy += cluster.getEnergy();
-            if(cluster instanceof BasicCluster)
-            {
-                BasicCluster bcl = (BasicCluster) cluster;
-                raw_energy += bcl.getRawEnergy();
-            }
-            double[] sde = cluster.getSubdetectorEnergies();
-            for(int i=0;i<sde.length;i++)
-            {
-                subdetector_corrected_energies[i] += sde[i];
-                subdetector_raw_energies[i] += sde[i];
-            }
+            BasicCluster bcl = (BasicCluster) cluster;
+            raw_energy += bcl.getRawEnergy();
         }
+        double[] sde = cluster.getSubdetectorEnergies();
+        for(int i=0;i<sde.length;i++)
+        {
+            subdetector_corrected_energies[i] += sde[i];
+            subdetector_raw_energies[i] += sde[i];
+        }
+    }
+
+    /**
+     * Do an external calculation of Energy and set it
+     */
+    public void setEnergy(double Energy)
+    {
+        corrected_energy = Energy;
     }
 
     /**
CVSspam 0.2.8