Print

Print


Commit in lcsim/src/org/lcsim on MAIN
conditions/ConditionsManagerImplementation.java+41.4 -> 1.5
util/lcio/SIOParticleID.java+70added 1.1
         /SIOReconstructedParticle.java+222added 1.1
         /SIOReconstructedParticleBlockHandler.java+26added 1.1
         /HandlerManager.java+11.3 -> 1.4
event/ParticleID.java+40added 1.1
     /ReconstructedParticle.java+92added 1.1
+455
5 added + 2 modified, total 7 files
Initial support for ReconstructedParticle

lcsim/src/org/lcsim/conditions
ConditionsManagerImplementation.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- ConditionsManagerImplementation.java	7 Mar 2005 07:48:01 -0000	1.4
+++ ConditionsManagerImplementation.java	30 Jun 2005 23:21:09 -0000	1.5
@@ -32,6 +32,10 @@
     */
    ConditionsManagerImplementation()
    {
+//      logger.setLevel(Level.ALL);
+//      ConsoleHandler handler = new ConsoleHandler();
+//      handler.setLevel(Level.ALL);
+//      logger.addHandler(handler);
    }
    public void setDetector(String name, int run) throws ConditionsNotFoundException
    {

lcsim/src/org/lcsim/util/lcio
SIOParticleID.java added at 1.1
diff -N SIOParticleID.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ SIOParticleID.java	30 Jun 2005 23:21:09 -0000	1.1
@@ -0,0 +1,70 @@
+package org.lcsim.util.lcio;
+
+import hep.lcd.io.sio.SIOInputStream;
+import hep.lcd.io.sio.SIOOutputStream;
+
+import java.io.IOException;
+import org.lcsim.event.ParticleID;
+
+/**
+ *
+ * @author Tony Johnson
+ * @version $Id: SIOParticleID.java,v 1.1 2005/06/30 23:21:09 tonyj Exp $
+ */
+class SIOParticleID implements ParticleID
+{
+   SIOParticleID(SIOInputStream in, int flags, int versionr) throws IOException
+   {
+      likelihood = in.readFloat();
+      type = in.readInt();
+      pdg = in.readInt();
+      algorithmType =in.readInt() ;
+      int n = in.readInt();
+      parameters = new double[n];
+      for (int i=0; i<n; i++) parameters[i] = in.readInt();
+   }
+
+   static void write(ParticleID id, SIOOutputStream out, int flags) throws IOException
+   {
+         out.writeFloat((float) id.getLikelihood());
+         out.writeInt(id.getType());
+         out.writeInt(id.getPDG());
+         out.writeInt(id.getAlgorithmType());
+         double[] pars = id.getParameters();
+         int n = pars == null ? 0 : pars.length;
+         out.writeInt(n);
+         for (int i=0; i<n; i++) out.writeFloat((float)pars[i]);
+
+   }
+
+   public int getAlgorithmType()
+   {
+      return algorithmType;
+   }
+
+   public double getLikelihood()
+   {
+      return likelihood;
+   }
+
+   public int getPDG()
+   {
+      return pdg;
+   }
+
+   public double[] getParameters()
+   {
+      return parameters;
+   }
+
+   public int getType()
+   {
+      return type;
+   }
+   private int algorithmType;
+   private double likelihood;
+   private int pdg;
+   private double[] parameters;
+   private int type;
+
+}
\ No newline at end of file

lcsim/src/org/lcsim/util/lcio
SIOReconstructedParticle.java added at 1.1
diff -N SIOReconstructedParticle.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ SIOReconstructedParticle.java	30 Jun 2005 23:21:10 -0000	1.1
@@ -0,0 +1,222 @@
+package org.lcsim.util.lcio;
+
+import hep.lcd.io.sio.SIOInputStream;
+import hep.lcd.io.sio.SIOOutputStream;
+import hep.lcd.io.sio.SIORef;
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.BasicHepLorentzVector;
+import hep.physics.vec.Hep3Vector;
+import hep.physics.vec.HepLorentzVector;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import org.lcsim.event.Cluster;
+import org.lcsim.event.ParticleID;
+import org.lcsim.event.ReconstructedParticle;
+import org.lcsim.event.Track;
+
+/**
+ *
+ * @author Tony Johnson
+ * @version $Id: SIOReconstructedParticle.java,v 1.1 2005/06/30 23:21:10 tonyj Exp $
+ */
+class SIOReconstructedParticle implements ReconstructedParticle
+{
+   
+   SIOReconstructedParticle(SIOInputStream in, int flags, int version) throws IOException
+   {
+      type = in.readInt();
+      Hep3Vector momentum = new BasicHep3Vector(in.readFloat(),in.readFloat(),in.readFloat());
+      double energy = in.readFloat();
+      fourVector = new BasicHepLorentzVector(energy,momentum);
+      covMatrix = new double[10];
+      for (int i=0; i<10; i++) covMatrix[i] = in.readFloat();
+      mass = in.readFloat();
+      charge = in.readFloat();
+      referencePoint = new BasicHep3Vector(in.readFloat(),in.readFloat(),in.readFloat());
+      int nPid = in.readInt();
+      this.particleIDs = new ArrayList(nPid);
+      for (int i=0; i<nPid; i++)
+      {
+         ParticleID id = new SIOParticleID(in,flags,version);
+         particleIDs.add(id);
+         in.readPTag(id);
+      }
+      particleIDUsed = (ParticleID) in.readPntr().getObject();
+      goodnessOfPID = in.readFloat();
+      int nReco = in.readInt();
+      tempParticles = new ArrayList(nReco);
+      for (int i=0; i<nReco; i++)
+      {
+         tempParticles.add(in.readPntr());
+      }
+      int nTracks = in.readInt();
+      tempTracks = new ArrayList(nTracks);
+      for (int i=0; i<nTracks; i++)
+      {
+         tempTracks.add(in.readPntr());
+      }
+      int nClust = in.readInt();
+      tempClusters = new ArrayList(nClust);
+      for (int i=0; i<nClust; i++)
+      {
+         tempClusters.add(in.readPntr());
+      }
+      in.readPTag(this);      
+   }
+   
+   static void write(ReconstructedParticle particle, SIOOutputStream out, int flags) throws IOException
+   {
+      out.writeInt(particle.getType());
+      double[] mom = particle.getMomentum().v();
+      for (int i=0; i<3; i++) out.writeFloat((float) mom[i]);
+      out.writeFloat((float) particle.getEnergy());
+      double[] matrix = particle.getCovMatrix();
+      for (int i=0; i<10; i++) out.writeFloat((float)matrix[i]);
+      out.writeFloat((float) particle.getMass());
+      out.writeFloat((float)particle.getCharge());
+      double[] ref = particle.getReferencePoint().v();
+      for (int i=0; i<3; i++) out.writeFloat((float)ref[i]);
+      List<ParticleID> ids = particle.getParticleIDs();
+      out.writeInt(ids.size());
+      for (ParticleID pid : ids )
+      {
+         SIOParticleID.write(pid,out,flags);
+         out.writePTag(pid);
+      }
+      out.writePntr(particle.getParticleIDUsed());
+      out.writeFloat((float)particle.getGoodnessOfPID());
+      List<ReconstructedParticle> particles = particle.getParticles();
+      out.writeInt(particles.size());
+      for (ReconstructedParticle child : particles) out.writePntr(child);
+      List<Track> tracks = particle.getTracks();
+      out.writeInt(tracks.size());
+      for (Track track : tracks) out.writePntr(tracks);
+      List<Cluster> clusters = particle.getClusters();
+      out.writeInt(clusters.size());
+      for (Cluster cluster : clusters) out.writePntr(cluster);
+      out.writePTag(particle);
+   }
+
+   public void addCluster(Cluster cluster)
+   {
+   }
+
+   public void addParticle(ReconstructedParticle particle)
+   {
+   }
+
+   public void addParticleID(ParticleID pid)
+   {
+   }
+
+   public void addTrack(Track track)
+   {
+
+   }
+
+   public HepLorentzVector asFourVector()
+   {
+      return fourVector;
+   }
+
+   public double getCharge()
+   {
+      return charge;
+   }
+
+   public List<Cluster> getClusters()
+   {
+      if (tempClusters != null)
+      {
+         clusters = new ArrayList<Cluster>(tempClusters.size());
+         for (SIORef ref : tempClusters) clusters.add((Cluster) ref.getObject());
+         tempClusters = null;
+      }
+      return clusters;
+   }
+
+   public double[] getCovMatrix()
+   {
+      return covMatrix;
+   }
+
+   public double getEnergy()
+   {
+      return fourVector.t();
+   }
+
+   public double getGoodnessOfPID()
+   {
+      return goodnessOfPID;
+   }
+
+   public double getMass()
+   {
+      return mass;
+   }
+
+   public Hep3Vector getMomentum()
+   {
+      return fourVector.v3();
+   }
+
+   public ParticleID getParticleIDUsed()
+   {
+      return particleIDUsed;
+   }
+
+   public List<ParticleID> getParticleIDs()
+   {
+      return particleIDs;
+   }
+
+   public List<ReconstructedParticle> getParticles()
+   {
+      if (tempParticles != null)
+      {
+         particles = new ArrayList<ReconstructedParticle>(tempParticles.size());
+         for (SIORef ref : tempParticles) particles.add((ReconstructedParticle) ref.getObject());
+         tempParticles = null;
+      }
+      return particles;
+   }
+
+   public Hep3Vector getReferencePoint()
+   {
+      return referencePoint;
+   }
+
+   public List<Track> getTracks()
+   {
+      if (tempTracks != null)
+      {
+         tracks = new ArrayList<Track>(tempTracks.size());
+         for (SIORef ref : tempTracks) tracks.add((Track) ref.getObject());
+         tempTracks = null;
+      }
+      return tracks;
+   }
+
+   public int getType()
+   {
+      return type;
+   }
+
+   private List<SIORef> tempParticles;
+   private List<SIORef> tempTracks;
+   private List<SIORef> tempClusters;
+   private int type;
+   private List<Track> tracks;
+   private Hep3Vector referencePoint;
+   private List<ReconstructedParticle> particles;
+   private List<ParticleID> particleIDs;
+   private ParticleID particleIDUsed;
+   private double[] covMatrix;
+   private List<Cluster> clusters;
+   private double charge;
+   private HepLorentzVector fourVector;
+   private double mass;
+   private double goodnessOfPID;
+}

lcsim/src/org/lcsim/util/lcio
SIOReconstructedParticleBlockHandler.java added at 1.1
diff -N SIOReconstructedParticleBlockHandler.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ SIOReconstructedParticleBlockHandler.java	30 Jun 2005 23:21:10 -0000	1.1
@@ -0,0 +1,26 @@
+package org.lcsim.util.lcio;
+
+import hep.lcd.io.sio.SIOInputStream;
+import hep.lcd.io.sio.SIOOutputStream;
+import java.io.IOException;
+import org.lcsim.event.ReconstructedParticle;
+
+/**
+ *
+ * @author tonyj
+ */
+class SIOReconstructedParticleBlockHandler extends AbstractBlockHandler
+{
+   public String getType() { return "ReconstructedParticle"; }
+   public Class getClassForType() { return ReconstructedParticle.class; }
+   void addCollectionElements(LCIOCollection collection, SIOInputStream in, int n, int version) throws IOException
+   {
+      for (int i = 0; i < n; i++)
+         collection.add(new SIOReconstructedParticle(in, collection.getFlags(), version));
+   }
+   
+   void writeCollectionElement(Object element, SIOOutputStream out, int flags) throws IOException
+   {
+      SIOReconstructedParticle.write((ReconstructedParticle) element, out, flags);
+   }
+}

lcsim/src/org/lcsim/util/lcio
HandlerManager.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- HandlerManager.java	26 Apr 2005 18:53:40 -0000	1.3
+++ HandlerManager.java	30 Jun 2005 23:21:09 -0000	1.4
@@ -29,6 +29,7 @@
       register(new SIOTrackBlockHandler());
       register(new SIORawCalorimeterHitBlockHandler());
       register(new SIOLCRelationBlockHandler());
+      register(new SIOReconstructedParticleBlockHandler());
    }
    static HandlerManager instance()
    {

lcsim/src/org/lcsim/event
ParticleID.java added at 1.1
diff -N ParticleID.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ParticleID.java	30 Jun 2005 23:21:10 -0000	1.1
@@ -0,0 +1,40 @@
+package org.lcsim.event;
+
+/**
+ *  Used by ReconstructedParticle and Cluster
+ *  for different hypotheses on the particle type.
+ *
+ * @author gaede
+ * @version $Id: ParticleID.java,v 1.1 2005/06/30 23:21:10 tonyj Exp $
+ * @see ReconstructedParticle.getParticleIDs()
+ * @see Cluster.getParticleIDs()
+ */
+public interface ParticleID
+{
+   /** Type - userdefined.
+    */
+   public int getType();
+   
+   /** The PDG code of this id - UnknownPDG ( 999999 ) if unknown.
+    */
+   public int getPDG();
+   
+   /**The likelihood  of this hypothesis - in a user defined normalization.
+    */
+   public double getLikelihood();
+   
+   /** Type of the algorithm/module that created this hypothesis.
+    * Check/set collection parameters PIDAlgorithmTypeName and PIDAlgorithmTypeID.
+    */
+   public int getAlgorithmType();
+   
+   /** Parameters associated with this hypothesis.
+    * Check/set collection paramter PIDParameterNames for decoding the indices.
+    */
+   public double[] getParameters();
+   
+   /** Constant to be used if the PDG code is not known or undefined.
+    */
+   public final static int UnknownPDG = 999999;
+}
+

lcsim/src/org/lcsim/event
ReconstructedParticle.java added at 1.1
diff -N ReconstructedParticle.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ReconstructedParticle.java	30 Jun 2005 23:21:10 -0000	1.1
@@ -0,0 +1,92 @@
+package org.lcsim.event;
+
+import hep.physics.vec.Hep3Vector;
+import hep.physics.vec.HepLorentzVector;
+import java.util.List;
+
+/**
+ * Represents a fully reconstructed particle.
+ * @author tonyj
+ */
+public interface ReconstructedParticle
+{
+   /** Type of reconstructed particle.
+    *  Check/set collection parameters ReconstructedParticleTypeNames and
+    *  ReconstructedParticleTypeValues.
+    */
+   public int getType();
+   
+   /** The magnitude of the reconstructed particle's momentum
+    */
+   public Hep3Vector getMomentum();
+   
+   /** Energy of the  reconstructed particle
+    */
+   public double getEnergy();
+   
+   /** 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 ) , ....
+    */
+   public double[] getCovMatrix();
+   
+   /** Mass of the  reconstructed particle, set independently from four vector quantities
+    */
+   public double getMass();
+   
+   /** Charge of the reconstructed particle.
+    */
+   public double getCharge();
+   
+   /** Reference point of the reconstructedParticle parameters.
+    */
+   public Hep3Vector getReferencePoint();
+   
+   /** The particle Id's sorted by their likelihood.
+    * @see ParticleID
+    */
+   public List<ParticleID> getParticleIDs();
+   
+   /** The particle Id used for the kinematics of this particle.
+    * @see ParticleID
+    */
+   public ParticleID getParticleIDUsed();
+   
+   /** The overall goodness of the PID on a scale of [0;1].
+    */
+   public double getGoodnessOfPID();
+   
+   /** The reconstructed particles that have been combined to this particle.
+    */
+   public List<ReconstructedParticle> getParticles();
+   
+   /** The clusters that have been used for this particle.
+    */
+   public List<Cluster> getClusters();
+   
+   /** The tracks that have been used for this particle.
+    */
+   public List<Track> getTracks();
+   
+   /**Add a ParticleID object.
+    * @see ParticleID
+    */
+   public void addParticleID(ParticleID pid);
+   
+   /**Add a particle that has been used to create this particle.
+    */
+   public void addParticle(ReconstructedParticle particle);
+   
+   /**Add a cluster that has been used to create this particle.
+    */
+   public void addCluster(Cluster cluster);
+   
+   /**Add a track that has been used to create this particle.
+    */
+   public void addTrack(Track track);
+   
+   /**Returns this particles momentum and energy as a four vector
+    */
+   HepLorentzVector asFourVector();
+}
+
CVSspam 0.2.8