8 modified files
lcsim/src/org/lcsim/event
diff -u -r1.5 -r1.6
--- Cluster.java 25 Aug 2005 23:10:05 -0000 1.5
+++ Cluster.java 9 Nov 2011 22:50:28 -0000 1.6
@@ -4,7 +4,7 @@
/** The LCIO cluster.
*
* @author gaede
- * @version $Id: Cluster.java,v 1.5 2005/08/25 23:10:05 lima Exp $
+ * @version $Id: Cluster.java,v 1.6 2011/11/09 22:50:28 jeremy Exp $
*/
public interface Cluster
@@ -18,6 +18,11 @@
/** Energy of the cluster.
*/
public double getEnergy();
+
+ /**
+ * Energy error of the cluster.
+ */
+ public double getEnergyError();
/** Position of the cluster.
*/
lcsim/src/org/lcsim/mc/fast/cluster/ronan
diff -u -r1.9 -r1.10
--- ReconCluster.java 17 Dec 2008 18:25:21 -0000 1.9
+++ ReconCluster.java 9 Nov 2011 22:50:28 -0000 1.10
@@ -16,6 +16,7 @@
protected double c = 0;
protected double d = 0;
protected double energy;
+ protected double energyError;
protected double neg_energy;
protected double sigma;
protected double phi;
@@ -34,6 +35,16 @@
{
return energy;
}
+
+ public double getEnergyError()
+ {
+ return energyError;
+ }
+
+ public void setEnergyError(double energyError)
+ {
+ this.energyError = energyError;
+ }
public double getNegEnergy()
{
lcsim/src/org/lcsim/recon/cat
diff -u -r1.1 -r1.2
--- MipStub.java 6 Apr 2007 21:48:14 -0000 1.1
+++ MipStub.java 9 Nov 2011 22:50:28 -0000 1.2
@@ -1,7 +1,11 @@
package org.lcsim.recon.cat;
-import java.util.*;
-import org.lcsim.event.*;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.lcsim.event.CalorimeterHit;
+import org.lcsim.event.Cluster;
+import org.lcsim.event.MCParticle;
/**
* Simple data format for Minimum ionizing particles in the ECAL.
@@ -12,7 +16,7 @@
* @see GarfieldTrackFinder
*
* @author E. von Toerne
- * @version $Id: MipStub.java,v 1.1 2007/04/06 21:48:14 onoprien Exp $
+ * @version $Id: MipStub.java,v 1.2 2011/11/09 22:50:28 jeremy Exp $
*/
final public class MipStub implements Cluster {
@@ -27,6 +31,7 @@
private double kappaError;
private boolean isEndcap = false;
public double energy; // energy estimate
+ private double energyError;
public double angleBaseDir; // angle FROM BASE to DIR in xy
//static double maxKappaValue = 1./50.; // maximum allowed curvature estimate
static final double k_cm = 10.;
@@ -124,6 +129,16 @@
public int charge() { return (kappa<0.) ? -1 : 1 ;}
public MCParticle[] getMCParticles() {return mcParticles;}
+ public double getEnergyError()
+ {
+ return energyError;
+ }
+
+ public void setEnergyError(double energyError)
+ {
+ this.energyError = energyError;
+ }
+
// -- Public setters : ------------------------------------------------------
public void setMCParticles(MCParticle[] mcParticles) {this.mcParticles = mcParticles;}
lcsim/src/org/lcsim/recon/cluster/cheat
diff -u -r1.6 -r1.7
--- CheatCluster.java 1 Jul 2006 21:52:21 -0000 1.6
+++ CheatCluster.java 9 Nov 2011 22:50:28 -0000 1.7
@@ -19,5 +19,5 @@
public MCParticle getMCParticle()
{
return particle;
- }
+ }
}
\ No newline at end of file
lcsim/src/org/lcsim/recon/cluster/util
diff -u -r1.18 -r1.19
--- BasicCluster.java 3 Nov 2010 06:06:59 -0000 1.18
+++ BasicCluster.java 9 Nov 2011 22:50:28 -0000 1.19
@@ -25,6 +25,7 @@
protected List<Subdetector> detectors = new ArrayList<Subdetector>();
protected double raw_energy;
protected double corrected_energy;
+ protected double energyError;
protected double[] subdetector_raw_energies = new double[10];
protected double[] subdetector_corrected_energies = new double[10];
protected List<Double> hit_energies = new ArrayList<Double>();
@@ -163,6 +164,16 @@
{
return corrected_energy;
}
+
+ public double getEnergyError()
+ {
+ return energyError;
+ }
+
+ public void setEnergyError(double energyError)
+ {
+ this.energyError = energyError;
+ }
/**
* Return the corrected energy contribution of each hit
lcsim/src/org/lcsim/recon/cluster/util
diff -u -r1.5 -r1.6
--- HitsCluster.java 21 Jun 2006 17:19:25 -0000 1.5
+++ HitsCluster.java 9 Nov 2011 22:50:28 -0000 1.6
@@ -14,6 +14,7 @@
{
protected List<CalorimeterHit> hits = new ArrayList<CalorimeterHit>();
public double energy;
+ protected double energyError;
public double raw_energy;
public void addHit(CalorimeterHit hit)
@@ -41,6 +42,16 @@
{
return energy;
}
+
+ public double getEnergyError()
+ {
+ return energyError;
+ }
+
+ public void setEnergyError(double energyError)
+ {
+ this.energyError = energyError;
+ }
/**
* Return the sum of the raw energies from the hits in the cluster
lcsim/src/org/lcsim/recon/cluster/util
diff -u -r1.3 -r1.4
--- RefinedCluster.java 21 Jun 2006 17:19:25 -0000 1.3
+++ RefinedCluster.java 9 Nov 2011 22:50:28 -0000 1.4
@@ -14,6 +14,7 @@
{
private List<Cluster> clusters = new ArrayList<Cluster>();
public double energy;
+ public double energyError;
public double raw_energy;
public List<CalorimeterHit> getCalorimeterHits()
@@ -36,6 +37,16 @@
{
return energy;
}
+
+ public double getEnergyError()
+ {
+ return energyError;
+ }
+
+ public void setEnergyError(double energyError)
+ {
+ this.energyError = energyError;
+ }
/**
* Return the sum of the raw energies from the hits in the cluster
lcsim/src/org/lcsim/util/lcio
diff -u -r1.8 -r1.9
--- SIOCluster.java 9 Nov 2011 21:28:48 -0000 1.8
+++ SIOCluster.java 9 Nov 2011 22:50:28 -0000 1.9
@@ -13,275 +13,297 @@
import org.lcsim.event.Cluster;
/**
- *
+ *
* @author tonyj
*/
public class SIOCluster implements Cluster
{
- private final static double[] dummy = new double[6];
- private int type;
- private float energy;
- private float energyError;
- private double raw_energy;
- private double[] position;
- private double[] positionError;
- private float theta;
- private float phi;
- private double[] directionError;
- private double[] shape;
- private List<Cluster> clusters;
- private List<CalorimeterHit> calorimeterHits;
- private double[] hitContributions;
- private double[] subdetectorEnergies;
- private List<SIORef> tempHits;
- private List<SIORef> tempClusters;
-
- SIOCluster(SIOInputStream in, int flag, int version) throws IOException
- {
- type = in.readInt();
- energy = in.readFloat();
- if (version>1051) {
- energyError = in.readFloat();
- }
- position = new double[3];
- for (int i=0; i<3; i++) position[i] = in.readFloat();
- positionError = new double[6];
- for (int i=0; i<6; i++) positionError[i] = in.readFloat();
-
- theta = in.readFloat();
- phi = in.readFloat();
- directionError = new double[3];
- for (int i=0; i<3; i++) directionError[i] = in.readFloat();
-
- int nShape;
- if( version > 1002)
- {
- nShape = in.readInt();
- }
- else
- {
- nShape = 6;
- }
- shape = new double[nShape];
- for (int i = 0; i < nShape; i++)
- {
- shape[i] = in.readFloat();
- }
-
- if( version > 1002)
- {
- int nPid = in.readInt() ;
- // this.particleIDs = new ArrayList(nPid);
- // for (int i=0; i<nPid; i++)
- // {
- // ParticleID id = new SIOParticleID(in,owner,flag,major,minor);
- // particleIDs.add(id);
- // }
- }
- else
- {
- // read 3 dummy floats
- float[] particleType = new float[3] ;
- particleType[0] = in.readFloat();
- particleType[1] = in.readFloat();
- particleType[2] = in.readFloat();
- }
-
- int nClust = in.readInt();
- tempClusters = new ArrayList<SIORef>(nClust);
- clusters = null;
- for (int i =0 ; i<nClust ; i++ )
- {
- tempClusters.add(in.readPntr());
- }
- if ((flag & (1<<LCIOConstants.CLBIT_HITS)) != 0)
- {
- int n = in.readInt();
- tempHits = new ArrayList<SIORef>(n);
- calorimeterHits = null;
- this.hitContributions = new double[n];
- for (int i=0; i<n; i++)
- {
- tempHits.add(in.readPntr());
- hitContributions[i] = in.readFloat();
- }
- }
- int nEnergies = in.readInt();
- subdetectorEnergies = new double[nEnergies];
- for (int i = 0; i < nEnergies; i++)
- {
- subdetectorEnergies[i] = in.readFloat();
- }
- in.readPTag(this);
- }
-
- public List<CalorimeterHit> getCalorimeterHits()
- {
- if (calorimeterHits == null && tempHits != null)
- {
- calorimeterHits = new ArrayList(tempHits.size());
- for (SIORef ref : tempHits)
- {
- calorimeterHits.add((CalorimeterHit) ref.getObject());
- }
- tempHits.clear();
- tempHits = null;
- }
- if(calorimeterHits==null) return Collections.EMPTY_LIST;
- else return calorimeterHits;
- }
-
- public List<Cluster> getClusters()
- {
- if (clusters == null && tempClusters != null)
- {
- clusters = new ArrayList(tempClusters.size());
- for (SIORef ref : tempClusters)
- {
- clusters.add((Cluster) ref.getObject());
- }
- tempClusters.clear();
- tempClusters = null;
- }
- return clusters;
- }
-
- public double[] getDirectionError()
- {
- return directionError;
- }
+ private final static double[] dummy = new double[6];
+ private int type;
+ private float energy;
+ private float energyError;
+ private double raw_energy;
+ private double[] position;
+ private double[] positionError;
+ private float theta;
+ private float phi;
+ private double[] directionError;
+ private double[] shape;
+ private List<Cluster> clusters;
+ private List<CalorimeterHit> calorimeterHits;
+ private double[] hitContributions;
+ private double[] subdetectorEnergies;
+ private List<SIORef> tempHits;
+ private List<SIORef> tempClusters;
+
+ SIOCluster(SIOInputStream in, int flag, int version) throws IOException
+ {
+ type = in.readInt();
+ energy = in.readFloat();
+ if (version > 1051)
+ {
+ energyError = in.readFloat();
+ }
+ position = new double[3];
+ for (int i = 0; i < 3; i++)
+ position[i] = in.readFloat();
+ positionError = new double[6];
+ for (int i = 0; i < 6; i++)
+ positionError[i] = in.readFloat();
+
+ theta = in.readFloat();
+ phi = in.readFloat();
+ directionError = new double[3];
+ for (int i = 0; i < 3; i++)
+ directionError[i] = in.readFloat();
+
+ int nShape;
+ if (version > 1002)
+ {
+ nShape = in.readInt();
+ }
+ else
+ {
+ nShape = 6;
+ }
+ shape = new double[nShape];
+ for (int i = 0; i < nShape; i++)
+ {
+ shape[i] = in.readFloat();
+ }
+
+ if (version > 1002)
+ {
+ int nPid = in.readInt();
+ // this.particleIDs = new ArrayList(nPid);
+ // for (int i=0; i<nPid; i++)
+ // {
+ // ParticleID id = new SIOParticleID(in,owner,flag,major,minor);
+ // particleIDs.add(id);
+ // }
+ }
+ else
+ {
+ // read 3 dummy floats
+ float[] particleType = new float[3];
+ particleType[0] = in.readFloat();
+ particleType[1] = in.readFloat();
+ particleType[2] = in.readFloat();
+ }
+
+ int nClust = in.readInt();
+ tempClusters = new ArrayList<SIORef>(nClust);
+ clusters = null;
+ for (int i = 0; i < nClust; i++)
+ {
+ tempClusters.add(in.readPntr());
+ }
+ if ((flag & (1 << LCIOConstants.CLBIT_HITS)) != 0)
+ {
+ int n = in.readInt();
+ tempHits = new ArrayList<SIORef>(n);
+ calorimeterHits = null;
+ this.hitContributions = new double[n];
+ for (int i = 0; i < n; i++)
+ {
+ tempHits.add(in.readPntr());
+ hitContributions[i] = in.readFloat();
+ }
+ }
+ int nEnergies = in.readInt();
+ subdetectorEnergies = new double[nEnergies];
+ for (int i = 0; i < nEnergies; i++)
+ {
+ subdetectorEnergies[i] = in.readFloat();
+ }
+ in.readPTag(this);
+ }
+
+ public List<CalorimeterHit> getCalorimeterHits()
+ {
+ if (calorimeterHits == null && tempHits != null)
+ {
+ calorimeterHits = new ArrayList(tempHits.size());
+ for (SIORef ref : tempHits)
+ {
+ calorimeterHits.add((CalorimeterHit) ref.getObject());
+ }
+ tempHits.clear();
+ tempHits = null;
+ }
+ if (calorimeterHits == null)
+ return Collections.EMPTY_LIST;
+ else
+ return calorimeterHits;
+ }
+
+ public List<Cluster> getClusters()
+ {
+ if (clusters == null && tempClusters != null)
+ {
+ clusters = new ArrayList(tempClusters.size());
+ for (SIORef ref : tempClusters)
+ {
+ clusters.add((Cluster) ref.getObject());
+ }
+ tempClusters.clear();
+ tempClusters = null;
+ }
+ return clusters;
+ }
+
+ public double[] getDirectionError()
+ {
+ return directionError;
+ }
/** Return corrected cluster energy */
- public double getEnergy()
- {
- return energy;
- }
-
- public double[] getHitContributions()
- {
- return hitContributions;
- }
-
- public double getIPhi()
- {
- return phi;
- }
-
- public double getITheta()
- {
- return theta;
- }
-
- public double[] getPosition()
- {
- return position;
- }
-
- public double[] getPositionError()
- {
- return positionError;
- }
-
- public double[] getShape()
- {
- return shape;
- }
-
- public double[] getSubdetectorEnergies()
- {
- return subdetectorEnergies;
- }
-
- public int getType()
- {
- return type;
- }
- static void write(Cluster cluster, SIOOutputStream out, int flag) throws IOException
- {
- out.writeInt(cluster.getType());
- out.writeFloat((float) cluster.getEnergy());
- out.writeFloat(0); // FIXME: Should be energy error
- double[] p = cluster.getPosition();
- if (p == null) p = dummy;
- for (int i=0; i<3; i++) out.writeFloat((float) p[i]);
- p = cluster.getPositionError();
- if (p == null) p = dummy;
- for (int i=0; i<6; i++) out.writeFloat((float) p[i]);
- out.writeFloat((float) cluster.getITheta());
- out.writeFloat((float) cluster.getIPhi());
- p = cluster.getDirectionError();
- if (p == null) p = dummy;
- for (int i=0; i<3; i++) out.writeFloat((float) p[i]);
-
- p = cluster.getShape();
- if (p == null) {
- out.writeInt(0);
- }
- else
- {
- out.writeInt(p.length);
- for (int i=0; i<p.length; i++) {
- out.writeFloat((float) p[i]);
- }
- }
-
- out.writeInt(0);
- //List pids = cluster.getParticleIDs() ;
- //out.writeInt( pids.size());
- //for (Iterator iter = pids.iterator(); iter.hasNext();)
- //{
- // ParticleID pid = (ParticleID) iter.next();
- // SIOParticleID.write(pid,out);
- //}
-
- List<Cluster> clusters = cluster.getClusters();
- out.writeInt(clusters.size());
- for (Cluster c : clusters)
- {
- out.writePntr(c);
- }
-
- if ((flag & (1<<LCIOConstants.CLBIT_HITS)) != 0)
- {
- List<CalorimeterHit> calorimeterHits = cluster.getCalorimeterHits();
- double[] hitContributions = cluster.getHitContributions();
- out.writeInt(calorimeterHits.size());
- int ii = 0;
- for (CalorimeterHit hit : calorimeterHits)
- {
- out.writePntr(hit);
- out.writeFloat((float) hitContributions[ii++]);
- }
- }
- p = cluster.getSubdetectorEnergies();
- if (p == null) {
- out.writeInt(0);
- }
- else
- {
- out.writeInt(p.length);
- for (int i=0; i<p.length; i++) {
- out.writeFloat((float) p[i]);
- }
- }
- out.writePTag(cluster);
- }
-
- /** Return the number of hits comprising the cluster, including
- * hits in subclusters, as per interface. Hits belonging to more
- * than one cluster/subcluster should be counted only once.
+ public double getEnergy()
+ {
+ return energy;
+ }
+
+ public double getEnergyError()
+ {
+ return energyError;
+ }
+
+ public double[] getHitContributions()
+ {
+ return hitContributions;
+ }
+
+ public double getIPhi()
+ {
+ return phi;
+ }
+
+ public double getITheta()
+ {
+ return theta;
+ }
+
+ public double[] getPosition()
+ {
+ return position;
+ }
+
+ public double[] getPositionError()
+ {
+ return positionError;
+ }
+
+ public double[] getShape()
+ {
+ return shape;
+ }
+
+ public double[] getSubdetectorEnergies()
+ {
+ return subdetectorEnergies;
+ }
+
+ public int getType()
+ {
+ return type;
+ }
+
+ static void write(Cluster cluster, SIOOutputStream out, int flag) throws IOException
+ {
+ out.writeInt(cluster.getType());
+ out.writeFloat((float) cluster.getEnergy());
+ out.writeFloat((float) cluster.getEnergyError());
+ double[] p = cluster.getPosition();
+ if (p == null)
+ p = dummy;
+ for (int i = 0; i < 3; i++)
+ out.writeFloat((float) p[i]);
+ p = cluster.getPositionError();
+ if (p == null)
+ p = dummy;
+ for (int i = 0; i < 6; i++)
+ out.writeFloat((float) p[i]);
+ out.writeFloat((float) cluster.getITheta());
+ out.writeFloat((float) cluster.getIPhi());
+ p = cluster.getDirectionError();
+ if (p == null)
+ p = dummy;
+ for (int i = 0; i < 3; i++)
+ out.writeFloat((float) p[i]);
+
+ p = cluster.getShape();
+ if (p == null)
+ {
+ out.writeInt(0);
+ }
+ else
+ {
+ out.writeInt(p.length);
+ for (int i = 0; i < p.length; i++)
+ {
+ out.writeFloat((float) p[i]);
+ }
+ }
+
+ out.writeInt(0);
+ // List pids = cluster.getParticleIDs() ;
+ // out.writeInt( pids.size());
+ // for (Iterator iter = pids.iterator(); iter.hasNext();)
+ // {
+ // ParticleID pid = (ParticleID) iter.next();
+ // SIOParticleID.write(pid,out);
+ // }
+
+ List<Cluster> clusters = cluster.getClusters();
+ out.writeInt(clusters.size());
+ for (Cluster c : clusters)
+ {
+ out.writePntr(c);
+ }
+
+ if ((flag & (1 << LCIOConstants.CLBIT_HITS)) != 0)
+ {
+ List<CalorimeterHit> calorimeterHits = cluster.getCalorimeterHits();
+ double[] hitContributions = cluster.getHitContributions();
+ out.writeInt(calorimeterHits.size());
+ int ii = 0;
+ for (CalorimeterHit hit : calorimeterHits)
+ {
+ out.writePntr(hit);
+ out.writeFloat((float) hitContributions[ii++]);
+ }
+ }
+ p = cluster.getSubdetectorEnergies();
+ if (p == null)
+ {
+ out.writeInt(0);
+ }
+ else
+ {
+ out.writeInt(p.length);
+ for (int i = 0; i < p.length; i++)
+ {
+ out.writeFloat((float) p[i]);
+ }
+ }
+ out.writePTag(cluster);
+ }
+
+ /**
+ * Return the number of hits comprising the cluster, including hits in subclusters, as per
+ * interface. Hits belonging to more than one cluster/subcluster should be counted only once.
*/
public int getSize()
{
Set<CalorimeterHit> hitSet = new HashSet<CalorimeterHit>(this.getCalorimeterHits());
- for( Cluster clus : this.getClusters() )
+ for (Cluster clus : this.getClusters())
{
- hitSet.addAll( clus.getCalorimeterHits() );
+ hitSet.addAll(clus.getCalorimeterHits());
}
- // cleanup and return
- int size = hitSet.size();
- hitSet.clear();
+ // cleanup and return
+ int size = hitSet.size();
+ hitSet.clear();
return size;
}
@@ -290,17 +312,19 @@
*/
public double getRawEnergy()
{
- if(raw_energy>0) return raw_energy;
+ if (raw_energy > 0)
+ return raw_energy;
Set<CalorimeterHit> hitSet = new HashSet<CalorimeterHit>(this.getCalorimeterHits());
- for( Cluster clus : this.getClusters() )
+ for (Cluster clus : this.getClusters())
{
- hitSet.addAll( clus.getCalorimeterHits() );
+ hitSet.addAll(clus.getCalorimeterHits());
}
- for( CalorimeterHit hit : hitSet ) {
- raw_energy += hit.getRawEnergy();
- }
- return raw_energy;
+ for (CalorimeterHit hit : hitSet)
+ {
+ raw_energy += hit.getRawEnergy();
+ }
+ return raw_energy;
}
}
CVSspam 0.2.8