lcsim/src/org/lcsim/recon/cluster/util
diff -u -r1.6 -r1.7
--- FixedConeClusterPropertyCalculator.java 23 Aug 2007 21:11:00 -0000 1.6
+++ FixedConeClusterPropertyCalculator.java 3 Jun 2008 16:38:01 -0000 1.7
@@ -30,31 +30,31 @@
private boolean _isEndCap;
private boolean _isNorth;
private double _chisq = 99999.;
- private int layers;
- private double _itheta;
- private double _iphi;
-
+ private int layers;
+ private double _itheta;
+ private double _iphi;
+
/**
* Fully qualified constructor
*/
- public FixedConeClusterPropertyCalculator()
- {
- layers = 64;
- }
- public void calculateProperties(List<CalorimeterHit> hits)
- {
+ public FixedConeClusterPropertyCalculator()
+ {
+ layers = 100;
+ }
+ public void calculateProperties(List<CalorimeterHit> hits)
+ {
_vec = calculateVec(hits);
_layerEnergy = new double[layers];
_layerWidth = new double[layers];
// the array of cell (x,y,z) coordinates
double[][] points = new double[3][hits.size()];
int npoints=0;
- _highestCellEnergy = 0.;
-
+ _highestCellEnergy = 0.;
+
for(CalorimeterHit h : hits )
{
_decoder = h.getIDDecoder();
- _decoder.setID(h.getCellID());
+ _decoder.setID(h.getCellID());
double e = h.getCorrectedEnergy();
if (e>_highestCellEnergy)
{
@@ -95,27 +95,27 @@
{
_layerWidth[i]/=_clusterEnergy;
}
-
+
// fit a straight line through the cells and store the results
PrincipalAxesLineFitter lf = new PrincipalAxesLineFitter();
lf.fit(points);
_centroid = lf.centroid();
_directionCosines = lf.dircos();
- double dr = Math.sqrt( (_centroid[0]+_directionCosines[0])*(_centroid[0]+_directionCosines[0]) +
- (_centroid[1]+_directionCosines[1])*(_centroid[1]+_directionCosines[1]) +
- (_centroid[2]+_directionCosines[2])*(_centroid[2]+_directionCosines[2]) ) -
- Math.sqrt( (_centroid[0])*(_centroid[0]) +
- (_centroid[1])*(_centroid[1]) +
- (_centroid[2])*(_centroid[2]) ) ;
- double sign = 1.;
- if(dr < 0.)sign = -1.;
- _itheta = Math.acos(_directionCosines[2]);
- _iphi = Math.atan2(_directionCosines[1],_directionCosines[0]);
-
+ double dr = Math.sqrt( (_centroid[0]+_directionCosines[0])*(_centroid[0]+_directionCosines[0]) +
+ (_centroid[1]+_directionCosines[1])*(_centroid[1]+_directionCosines[1]) +
+ (_centroid[2]+_directionCosines[2])*(_centroid[2]+_directionCosines[2]) ) -
+ Math.sqrt( (_centroid[0])*(_centroid[0]) +
+ (_centroid[1])*(_centroid[1]) +
+ (_centroid[2])*(_centroid[2]) ) ;
+ double sign = 1.;
+ if(dr < 0.)sign = -1.;
+ _itheta = Math.acos(_directionCosines[2]);
+ _iphi = Math.atan2(_directionCosines[1],_directionCosines[0]);
+
// finish up the cluster (base class method)
// calculateDerivedQuantities();
}
-
+
/**
* Calculate the cluster four-momentum.
* The Lorentz four-vector is derived from the cluster cells.
@@ -124,28 +124,28 @@
public Lorentz4Vector calculateVec(List<CalorimeterHit> hits)
{
Lorentz4Vector sum = new Momentum4Vector();
- double[] sums = {0.,0.,0.};
- double wtsum = 0.;
- for(int i=0;i<hits.size();i++)
- {
- CalorimeterHit hit = hits.get(i);
- double[] pos = new double[3];
+ double[] sums = {0.,0.,0.};
+ double wtsum = 0.;
+ for(int i=0;i<hits.size();i++)
+ {
+ CalorimeterHit hit = hits.get(i);
+ double[] pos = new double[3];
_decoder = hit.getIDDecoder();
- _decoder.setID(hit.getCellID());
- pos[0] = _decoder.getX();
- pos[1] = _decoder.getY();
- pos[2] = _decoder.getZ();
- double wt = hit.getCorrectedEnergy();
- wtsum += wt;
- for(int j=0;j<3;j++)
- {
- sums[j] += wt*pos[j];
- }
- }
- sum.plusEquals(new Momentum4Vector(sums[0], sums[1], sums[2], wtsum));
+ _decoder.setID(hit.getCellID());
+ pos[0] = _decoder.getX();
+ pos[1] = _decoder.getY();
+ pos[2] = _decoder.getZ();
+ double wt = hit.getCorrectedEnergy();
+ wtsum += wt;
+ for(int j=0;j<3;j++)
+ {
+ sums[j] += wt*pos[j];
+ }
+ }
+ sum.plusEquals(new Momentum4Vector(sums[0], sums[1], sums[2], wtsum));
return sum;
}
-
+
/**
* The cluster width (energy second moment).
*
@@ -155,7 +155,7 @@
{
return _width;
}
-
+
/**
* The cluster four-momentum
*
@@ -165,7 +165,7 @@
{
return _vec;
}
-
+
/**
* The constituent cells
*
@@ -180,7 +180,7 @@
{
return _layerEnergy[layer];
}
-
+
/**
* The cluster layer energies
*
@@ -190,8 +190,8 @@
{
return _layerEnergy;
}
-
-
+
+
/**
* The cluster energy corrected for sampling fractions
*
@@ -201,7 +201,7 @@
{
return _clusterEnergy;
}
-
+
/**
* The energy of the highest energy cell in this cluster
*
@@ -211,7 +211,7 @@
{
return _highestCellEnergy;
}
-
+
/**
* The CalorimeterHit in this cluster with the highest energy
*
@@ -221,7 +221,7 @@
{
return _hottestCell;
}
-
+
/**
* The cluster width (energy second moment) deposited in a specific layer
*
@@ -231,7 +231,7 @@
{
return _layerWidth[layer];
}
-
+
/**
* The unweighted spatial centroid (x,y,z) of the cluster line fit
*
@@ -241,7 +241,7 @@
{
return _centroid;
}
-
+
/**
* The direction cosines of the cluster line fit
*
@@ -251,8 +251,8 @@
{
return _directionCosines;
}
-
-
+
+
/**
* Returns topological position of cluster.
*
@@ -262,8 +262,8 @@
{
return _isEndCap;
}
-
-
+
+
/**
* Returns topological position of cluster.
*
@@ -273,45 +273,45 @@
{
return _isNorth;
}
-
+
public void setChisq(double chisq)
{
_chisq = chisq;
}
-
+
public double chisq()
{
return _chisq;
}
- public double[] getPosition()
- {
- return _centroid;
- }
- public double[] getPositionError()
- {
- double[] positionError = {0.,0.,0.,0.,0.,0.};
- return positionError;
- }
- public double getIPhi()
- {
- return _iphi;
- }
- public double getITheta()
- {
- return _itheta;
- }
- public double[] getDirectionError()
- {
- double[] directionError = {0.,0.,0.,0.,0.,0.};
- return directionError;
- }
- public double[] getShapeParameters()
- {
- double[] shapeParameters = {0.,0.,0.,0.,0.,0.};
- shapeParameters[0] = _width;
- return shapeParameters;
- }
-
-
+ public double[] getPosition()
+ {
+ return _centroid;
+ }
+ public double[] getPositionError()
+ {
+ double[] positionError = {0.,0.,0.,0.,0.,0.};
+ return positionError;
+ }
+ public double getIPhi()
+ {
+ return _iphi;
+ }
+ public double getITheta()
+ {
+ return _itheta;
+ }
+ public double[] getDirectionError()
+ {
+ double[] directionError = {0.,0.,0.,0.,0.,0.};
+ return directionError;
+ }
+ public double[] getShapeParameters()
+ {
+ double[] shapeParameters = {0.,0.,0.,0.,0.,0.};
+ shapeParameters[0] = _width;
+ return shapeParameters;
+ }
+
+
}