lcsim/src/org/lcsim/recon/cluster/util
diff -u -r1.8 -r1.9
--- BasicCluster.java 26 Sep 2005 21:52:54 -0000 1.8
+++ BasicCluster.java 7 Dec 2005 16:58:52 -0000 1.9
@@ -43,8 +43,11 @@
subdetector_raw_energies[i] = 0.;
subdetector_corrected_energies[i] = 0.;
}
+ position = new double[3];
+ positionError = new double[6];
+ directionError = new double[6];
}
-
+
/**
* Add a CalorimeterHit to the cluster
*/
@@ -64,7 +67,7 @@
subdetector_corrected_energies[detector_index] += hce;
needsPropertyCalculation = true;
}
-
+
/**
* Remove a CalorimeterHit from the cluster
*/
@@ -116,7 +119,7 @@
}
}
}
-
+
/**
* Return the hits comprising the cluster as per interface
*/
@@ -124,7 +127,7 @@
{
return hits;
}
-
+
/**
* Return the clusters comprising the cluster as per interface
*/
@@ -132,7 +135,7 @@
{
return clusters;
}
-
+
/**
* Return the corrected Energy of the cluster as per interface
*/
@@ -140,7 +143,7 @@
{
return corrected_energy;
}
-
+
/**
* Return the corrected energy contribution of each hit
* comprising the cluster as per interface
@@ -154,7 +157,7 @@
}
return earray;
}
-
+
/**
* Return the phi direction of the cluster as per interface
*/
@@ -166,7 +169,7 @@
}
return iphi;
}
-
+
/**
* Return the theta direction of the cluster as per interface
*/
@@ -178,7 +181,7 @@
}
return itheta;
}
-
+
/**
* Return the direction error of the cluster as per interface
*/
@@ -190,7 +193,7 @@
}
return directionError;
}
-
+
/**
* Return the position of the cluster as per interface
*/
@@ -202,7 +205,7 @@
}
return position;
}
-
+
/**
* Return the position error of the cluster as per interface
*/
@@ -214,7 +217,7 @@
}
return positionError;
}
-
+
/**
* Return the shape parameters of the cluster as per interface
*/
@@ -226,7 +229,7 @@
}
return shapeParameters;
}
-
+
/**
* Return the subdetector energy contributions
* of the cluster as per interface
@@ -235,7 +238,7 @@
{
return subdetector_corrected_energies;
}
-
+
/**
* Return a bit mask defining the type of cluster as per interface
*/
@@ -243,7 +246,7 @@
{
return 0;
}
-
+
/**
* Return the sum of the raw energies from the hits in the cluster
*/
@@ -251,7 +254,7 @@
{
return raw_energy;
}
-
+
/**
* Allow for recalculation of cluster properties, or
* prevent recalculation after adding to cluster
@@ -260,30 +263,46 @@
{
needsPropertyCalculation = tf;
}
-
+
/**
* Override the default ClusterPropertyCalculator
*/
public void setPropertyCalculator(ClusterPropertyCalculator cpc)
{
cluster_property_calculator = cpc;
+ needsPropertyCalculation = true;
}
-
+
/**
* Calculate the cluster properties from the hits
*/
public void calculateProperties()
{
cluster_property_calculator.calculateProperties(hits);
- position = cluster_property_calculator.getPosition();
- positionError = cluster_property_calculator.getPositionError();
iphi = cluster_property_calculator.getIPhi();
itheta = cluster_property_calculator.getITheta();
- directionError = cluster_property_calculator.getDirectionError();
- shapeParameters = cluster_property_calculator.getShapeParameters();
+
+ // important: store info locally, not a reference to info in calculator
+ double[] tmp = cluster_property_calculator.getPosition();
+ for(int i=0; i<3; ++i) position[i] = tmp[i];
+
+ double[] posErr = cluster_property_calculator.getPositionError();
+ double[] dirErr = cluster_property_calculator.getDirectionError();
+ for(int i=0; i<6; ++i) {
+ positionError[i] = posErr[i];
+ directionError[i] = dirErr[i];
+ }
+
+ // In general, assume any number of parameters needed
+ double[] shapePar = cluster_property_calculator.getShapeParameters();
+ shapeParameters = new double[ shapePar.length ];
+ for(int i=0; i<shapePar.length; ++i) {
+ shapeParameters[i] = shapePar[i];
+ }
+
needsPropertyCalculation = false;
}
-
+
/** Return the hits comprising the cluster, including hits in
* subclusters, as per interface. Hits belonging to more than one
* cluster/subcluster should be counted only once.