Commit in lcsim/src/org/lcsim/event/base on MAIN
BaseReconstructedParticle.java+229added 1.1
BaseParticleID.java+137added 1.1
BaseTrackerHit.java+174added 1.1
BaseTrackerHitMC.java+46added 1.1
+586
4 added files
Base implementations of interface classes in event.

lcsim/src/org/lcsim/event/base
BaseReconstructedParticle.java added at 1.1
diff -N BaseReconstructedParticle.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ BaseReconstructedParticle.java	25 Mar 2006 00:37:03 -0000	1.1
@@ -0,0 +1,229 @@
+/*
+ * BaseReconstructedParticle.java
+ *
+ * Created on March 24, 2006, 9:30 AM
+ *
+ * $Id: BaseReconstructedParticle.java,v 1.1 2006/03/25 00:37:03 ngraf Exp $
+ */
+
+package org.lcsim.event.base;
+
+import hep.physics.particle.Particle;
+import hep.physics.particle.properties.ParticleType;
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.BasicHepLorentzVector;
+import hep.physics.vec.Hep3Vector;
+import hep.physics.vec.HepLorentzVector;
+import java.util.ArrayList;
+import java.util.List;
+import org.lcsim.event.*;
+import org.lcsim.mc.fast.reconstructedparticle.MCFastParticleID;
+
+import static java.lang.Math.sqrt;
+/**
+ *
+ * @author Norman Graf
+ */
+public class BaseReconstructedParticle
+{
+    protected int _type;
+    protected BasicHepLorentzVector _fourVec = new BasicHepLorentzVector();
+    protected double[] _covMatrix = new double[10];
+    protected double _mass;
+    protected double _charge;
+    protected Hep3Vector _referencePoint;
+    protected List<ParticleID> _particleIds = new ArrayList<ParticleID>();
+    protected ParticleID _particleIdUsed;
+    protected double _goodnessOfPid;
+    protected List<ReconstructedParticle> _particles = new ArrayList<ReconstructedParticle>();
+    protected List<Cluster> _clusters = new ArrayList<Cluster>();
+    protected List<Track> _tracks = new ArrayList<Track>();
+    
+    /** Creates a new instance of BaseReconstructedParticle */
+    // TODO currently adding tracks and clusters does not update four vector. Need to fix.
+    public BaseReconstructedParticle()
+    {
+    }
+    
+// ReconstructedParticle interface
+    
+    /**
+     * Type of reconstructed particle.
+     *  Check/set collection parameters ReconstructedParticleTypeNames and
+     *  ReconstructedParticleTypeValues.
+     * @return the type
+     */
+    public int getType()
+    {
+        return _type;
+    }
+    
+    /**
+     * The magnitude of the reconstructed particle's momentum
+     * @return the momentum of this particle.
+     */
+    public Hep3Vector getMomentum()
+    {
+        return _fourVec.v3();
+    }
+    
+    /**
+     * Energy of the  reconstructed particle
+     * @return the energy of this particle in GeV
+     */
+    public double getEnergy()
+    {
+        return _fourVec.t();
+    }
+    
+    /**
+     * Covariance matrix of the reconstructed particle's 4vector (10 parameters).
+     *  Stored as lower triangle matrix of the four momentum (px,py,pz,E), i.e.
+     *  cov(px,px), cov(py,px), cov( py,py ) , ....
+     * @return covariance matrix as a packed array
+     */
+    public double[] getCovMatrix()
+    {
+        return _covMatrix;
+    }
+    
+    /**
+     * Mass of the  reconstructed particle, set independently from four vector quantities
+     * @return the mass in GeV
+     */
+    public double getMass()
+    {
+        return _mass;
+    }
+    
+    /**
+     * Charge of the reconstructed particle.
+     * @return the charge in units of the electron charge
+     */
+    public double getCharge()
+    {
+        return _charge;
+    }
+    
+    /**
+     * Reference point of the reconstructedParticle parameters.
+     * @return the reference point for this particle in mm
+     */
+    public Hep3Vector getReferencePoint()
+    {
+        return _referencePoint;
+    }
+    
+    /**
+     * The particle Id's sorted by their likelihood.
+     * @see ParticleID
+     * @return a list of particle IDs for this particle, sorted by likelihood
+     */
+    public List<ParticleID> getParticleIDs()
+    {
+        return _particleIds;
+    }
+    
+    /**
+     * The particle Id used for the kinematics of this particle.
+     * @see ParticleID
+     * @return the most likely identification for this particle
+     */
+    public ParticleID getParticleIDUsed()
+    {
+        return _particleIdUsed;
+    }
+    
+    /**
+     * The overall goodness of the PID on a scale of [0;1].
+     * @return the "goodness" of this identification. not yet defined.
+     */
+    public double getGoodnessOfPID()
+    {
+        return _goodnessOfPid;
+    }
+    
+    /**
+     * The reconstructed particles that have been combined to this particle.
+     * @return a list of ReconstructedParticles if this is a compund ReconstructedParticle
+     */
+    public List<ReconstructedParticle> getParticles()
+    {
+        return _particles;
+    }
+    
+    /**
+     * The clusters that have been used for this particle.
+     * @return the list of calorimeter clusters contributing to this ReconstructedParticle
+     */
+    public List<Cluster> getClusters()
+    {
+        return _clusters;
+    }
+    
+    /**
+     * The tracks that have been used for this particle.
+     * @return the list of tracks contributing to this ReconstructedParticle
+     */
+    public List<Track> getTracks()
+    {
+        return _tracks;
+    }
+    
+    /**
+     * Add a ParticleID object.
+     * @see ParticleID
+     * @param pid
+     */
+    public void addParticleID(ParticleID pid)
+    {
+        _particleIds.add(pid);
+        _particleIdUsed = pid;
+    }
+    
+    /**
+     * Add a particle that has been used to create this particle.
+     * @param particle
+     */
+    // TODO make sure kinematics of this particle are also updated
+    public void addParticle(ReconstructedParticle particle)
+    {
+        _particles.add(particle);
+    }
+    
+    /**
+     * Add a cluster that has been used to create this particle.
+     * @param cluster
+     */
+    // TODO make sure kinematics of this particle are also updated
+    public void addCluster(Cluster cluster)
+    {
+        _clusters.add(cluster);
+    }
+    
+    /**
+     * Add a track that has been used to create this particle.
+     * @param track
+     */
+    // TODO make sure kinematics of this particle are also updated
+    public void addTrack(Track track)
+    {
+        _tracks.add(track);
+    }
+    
+    /**Returns this particle's momentum and energy as a four vector
+     */
+    public HepLorentzVector asFourVector()
+    {
+        return _fourVec;
+    }
+    
+    
+    public String toString()
+    {
+        StringBuffer sb = new StringBuffer(this.getClass().getName()+": \n");
+        sb.append("E: "+getEnergy());
+        return sb.toString();
+    }
+    
+}
\ No newline at end of file

lcsim/src/org/lcsim/event/base
BaseParticleID.java added at 1.1
diff -N BaseParticleID.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ BaseParticleID.java	25 Mar 2006 00:37:03 -0000	1.1
@@ -0,0 +1,137 @@
+/*
+ * BaseParticleID.java
+ *
+ * Created on March 24, 2006, 1:21 PM
+ *
+ * $Id: BaseParticleID.java,v 1.1 2006/03/25 00:37:03 ngraf Exp $
+ */
+
+package org.lcsim.event.base;
+
+import hep.physics.particle.properties.ParticleType;
+import org.lcsim.event.*;
+
+/**
+ *
+ * @author Norman Graf
+ */
+public class BaseParticleID implements ParticleID
+{
+    protected ParticleType _type;
+    protected double _likelihood;
+    protected int _algorithmType;
+    protected double[] _algorithmParameters;
+    
+    /** Creates a new instance of BaseParticleID */
+    public BaseParticleID()
+    {
+    }
+    
+    /**
+     * Fully qualified constructor
+     * @param type the ParticleType for this ID
+     */
+    public BaseParticleID(ParticleType type)
+    {
+        _type = type;
+    }
+    
+    // include these setters since I don't know what the final inheriting classes will
+    // look like.
+    
+    /**
+     * Set the particle type. Note that this overrides the previous type.
+     * @param type The ParticleType of this ID.
+     */
+    public void setType(ParticleType type)
+    {
+        _type = type;
+    }
+    
+    /**
+     * Set the likelihood for this type ID
+     * @param p The likelihood for this identification.
+     */
+    public void setLikelihood(double p)
+    {
+        _likelihood = p;
+    }
+    
+    /**
+     * Set the algorithm type used to make this identification.
+     * @param alg The algorithm type. Not yet defined.
+     */
+    //TODO define what this is!
+    public void setAlgorithmType(int alg)
+    {
+        _algorithmType = alg;
+    }
+    
+    /**
+     * Set the parameters used in the algorithm.
+     * @param pars an array of parameters appropriate for the algorithm typ.e Not yet defined.
+     */
+    // TODO define what these are!
+    public void setParameters(double[] pars)
+    {
+        _algorithmParameters = pars;
+    }
+    
+    
+    // ParticleID interface
+    
+    /**
+     * return the algorithm type.
+     * @return currently returns 0. not yet defined.
+     */
+    // TODO define what this is!
+    public int getType()
+    {
+        return 0;
+    }
+    
+    /**
+     * The PDG code of this id - UnknownPDG ( 999999 ) if unknown.
+     * @return the Particle Data Group id for this particle type.
+     */
+    public int getPDG()
+    {
+        if(_type==null)
+        {
+            return UnknownPDG;
+        }
+        else
+        {
+            return _type.getPDGID();
+        }
+    }
+    
+    /**
+     * The likelihood  of this hypothesis - in a user defined normalization.
+     * @return The likelihood for this particle identification
+     */
+    public double getLikelihood()
+    {
+        return _likelihood;
+    }
+    
+    /**
+     * Type of the algorithm/module that created this hypothesis.
+     * Check/set collection parameters PIDAlgorithmTypeName and PIDAlgorithmTypeID.
+     * @return the algorithm type.
+     */
+    public int getAlgorithmType()
+    {
+        return _algorithmType;
+    }
+    
+    /**
+     * Parameters associated with this hypothesis.
+     * Check/set collection parameter PIDParameterNames for decoding the indices.
+     * @return the list of parameters for the algorithm used in identifying this particle.
+     */
+    public double[] getParameters()
+    {
+        return _algorithmParameters;
+    }
+}

lcsim/src/org/lcsim/event/base
BaseTrackerHit.java added at 1.1
diff -N BaseTrackerHit.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ BaseTrackerHit.java	25 Mar 2006 00:37:04 -0000	1.1
@@ -0,0 +1,174 @@
+/*
+ * BaseTrackerHit.java
+ *
+ * Created on March 24, 2006, 9:22 AM
+ *
+ * $Id: BaseTrackerHit.java,v 1.1 2006/03/25 00:37:04 ngraf Exp $
+ */
+
+package org.lcsim.event.base;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.lcsim.event.*;
+
+/**
+ *
+ * @author Norman Graf
+ */
+public class BaseTrackerHit implements TrackerHit
+{
+    protected double[] _pos = new double[3];
+    protected double[] _covMatrix = new double[6];
+    protected double _time;
+    protected double _dedx;
+    //TODO set up an enumeration to replace the integer type
+    protected int _type;
+    //TODO decide what this is a list of
+    protected List _rawHits = new ArrayList();
+    
+    /** Creates a new instance of BaseTrackerHit */
+    public BaseTrackerHit()
+    {
+        
+    }
+    
+   
+    /**
+     * fully qualified constructor
+     * @param pos the position of this hit (x,y,z) in mm
+     * @param cov the covariance matrix for the position measurement, packed as 6 elements.
+     * @param t the time for this measurement in ns
+     * @param e the energy deposit associated with this measurement, in GeV
+     * @param type the type of this measurement. not yet defined.
+     */
+    public BaseTrackerHit(double[] pos, double[] cov, double t, double e, int type)
+    {
+        _pos = pos;
+        _covMatrix = cov;
+        _time = t;
+        _dedx = e;
+        _type = type;
+    }
+    
+    // include these setters since I don't know what the final inheriting classes will
+    // look like.
+    /**
+     * The (x,y,z) position of this measurement.
+     * @param pos the position of this hit (x,y,z) in mm 
+     */
+    public void setPosition(double[] pos)
+    {
+        _pos = pos;
+    }
+    
+    /**
+     * The covariance matrix for the position measurement.
+     * @param cov Packed array representing the symmetric covariance matrix (6 elements).
+     */
+    public void setCovarianceMatrix( double[] cov)
+    {
+        _covMatrix = cov;
+    }
+    
+    /**
+     * The time at which this measurement was made.
+     * @param t the time in ns.
+     */
+    public void setTime(double t)
+    {
+        _time = t;
+    }
+    
+    /**
+     * The energy deposit associated with this measurement.
+     * @param e The energy in GeV.
+     */
+    public void setEnergy(double e)
+    {
+        _dedx = e;
+    }
+    
+    /**
+     * The type of this measurement.
+     * @param type Not yet defined.
+     */
+    public void setType(int type)
+    {
+        _type = type;
+    }
+    
+
+    public String toString()
+    {
+        String className = getClass().getName();
+        int lastDot = className.lastIndexOf('.');
+        if(lastDot!=-1)className = className.substring(lastDot+1);
+        StringBuffer sb = new StringBuffer(className+": \n");
+        return sb.toString();
+    }
+    
+    // TODO add convenience methods which extend the base interface.
+    // TODO return position as SpacePoint
+    // TODO return covariance matrix as Matrix
+    
+//TrackerHit interface
+    /**
+     * The hit position in [mm].
+     * @return 
+     */
+    public double[] getPosition()
+    {
+        return _pos;
+    }
+    
+    /**
+     * Covariance of the position (x,y,z)
+     * @return 
+     */
+    public double[] getCovMatrix()
+    {
+        return _covMatrix;
+    }
+    
+    /**
+     * The dE/dx of the hit in [GeV].
+     * @return 
+     */
+    public double getdEdx()
+    {
+        return _dedx;
+    }
+    
+    /**
+     * The  time of the hit in [ns].
+     * @return 
+     */
+    public double getTime()
+    {
+        return _time;
+    }
+    
+    /**
+     * Type of hit. Mapping of integer types to type names
+     * through collection parameters "TrackerHitTypeNames"
+     * and "TrackerHitTypeValues".
+     * @return 
+     */
+    public int getType()
+    {
+        return _type;
+    }
+    
+    // TODO fix the covariant return type.
+    /**
+     * The raw data hits.
+     * Check getType() to get actual data type.
+     * @return 
+     */
+    public List getRawHits()
+    {
+        return _rawHits;
+    }
+      
+}
\ No newline at end of file

lcsim/src/org/lcsim/event/base
BaseTrackerHitMC.java added at 1.1
diff -N BaseTrackerHitMC.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ BaseTrackerHitMC.java	25 Mar 2006 00:37:04 -0000	1.1
@@ -0,0 +1,46 @@
+/*
+ * BaseTrackerHitMC.java
+ *
+ * Created on March 24, 2006, 9:46 AM
+ *
+ * $Id: BaseTrackerHitMC.java,v 1.1 2006/03/25 00:37:04 ngraf Exp $
+ */
+
+package org.lcsim.event.base;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.lcsim.event.MCParticle;
+
+/**
+ * A BaseTrackerHit which includes information about the Monte carlo particles contributing to it.
+ * @author Norman Graf
+ */
+public class BaseTrackerHitMC extends BaseTrackerHit
+{
+    protected List<MCParticle> _mcparticles = new ArrayList<MCParticle>();
+    /**
+     * fully qualified constructor
+     * @param pos the position of this hit (x,y,z) in mm
+     * @param cov the covariance matrix for the position measurement, packed as 6 elements.
+     * @param t the time for this measurement in ns
+     * @param e the energy deposit associated with this measurement, in GeV
+     * @param type the type of this measurement. not yet defined.
+     * @param mcparticles The list of monte carlo particles contributing to this measurement.
+     */
+    public BaseTrackerHitMC(double[] pos, double[] cov, double t, double e, int type, List<MCParticle> mcparticles)
+    {
+        super(pos, cov, t, e, type);
+        _mcparticles = mcparticles;
+    }
+    
+    /**
+     * The list of monte carlo particles contributing to this measurement.
+     * @return The list of monte carlo particles contributing to this measurement.
+     */
+    public List<MCParticle> mcParticles()
+    {
+        return _mcparticles;
+    }
+    
+}
CVSspam 0.2.8