22 modified files
lcsim/src/org/lcsim/event
diff -u -r1.6 -r1.7
--- MCParticle.java 28 Jun 2006 04:48:31 -0000 1.6
+++ MCParticle.java 24 Aug 2011 18:51:17 -0000 1.7
@@ -5,63 +5,106 @@
import java.util.List;
/**
- * LCSim specific MC particle class.
- * @author tonyj
- * @version $Id: MCParticle.java,v 1.6 2006/06/28 04:48:31 jstrube Exp $
+ * A simulated track.
+ *
+ * @author Tony Johnson
+ * @author Jeremy McCormick
+ * @version $Id: MCParticle.java,v 1.7 2011/08/24 18:51:17 jeremy Exp $
*/
public interface MCParticle extends Particle
{
- public List<MCParticle> getParents();
- public List<MCParticle> getDaughters();
- /**
- * If this event has been simulated by Geant4 this method will return
- * the simulation status
- */
- public SimulatorStatus getSimulatorStatus();
- /**
- * The endpoint of the simulated track. Note this may not always be available,
- * in which case this method may throw an exception.
- */
- public Hep3Vector getEndPoint();
-
- public interface SimulatorStatus
- {
- /** Get the raw undecoded simulator status
- */
- int getValue();
- /** True if the particle has been created by the simulation program (rather than the generator).
- */
- public boolean isCreatedInSimulation();
-
- /** True if the particle was created by the simulator as a result of an interaction or decay in
- * non-tracking region, e.g. a calorimeter. By convention, such particles are not saved. However,
- * if this particle creates a tracker hit, the particle is added to the MCParticle list with
- * this flag set, and the parent set to the particle that initially decayed or interacted in
- * a non-tracking region.
- */
- public boolean isBackscatter();
-
- /** True if the particle was created as a result of a continuous process where the parent
- * particle continues, i.e. hard ionization, Bremsstrahlung, elastic interactions, etc.
- */
- public boolean vertexIsNotEndpointOfParent();
-
- /** True if the particle decayed or interacted in a tracking region.
- */
- public boolean isDecayedInTracker();
-
- /** True if the particle decayed or interacted (non-continuous interaction, particle terminated)
- * in non-tracking region.
- */
- public boolean isDecayedInCalorimeter();
-
- /** True if the particle left the world volume undecayed.
- */
- public boolean hasLeftDetector();
-
- /** True if the particle lost all kinetic energy inside the world volume and did not decay
- */
- public boolean isStopped();
-
- }
-}
+ /**
+ * Get the parents of this particle.
+ * @return The particle's parents.
+ */
+ List<MCParticle> getParents();
+
+ /**
+ * Get the daughters of this particle.
+ * @return The particle daughters.
+ */
+ List<MCParticle> getDaughters();
+
+ /**
+ * If this event has been simulated by Geant4 this method will return the
+ * simulation status.
+ * @return The particle's simulator status.
+ */
+ SimulatorStatus getSimulatorStatus();
+
+ /**
+ * The endpoint of the simulated track.
+ * @throws RuntimeException
+ * if endpoint is not available.
+ * @return The particle's end point.
+ */
+ Hep3Vector getEndPoint();
+
+ /**
+ * Get the X, Y, and Z spin components of this particle.
+ * @return The particle's spin components.
+ */
+ float[] getSpin();
+
+ /**
+ * Get the color flow of particle.
+ * @return The particle's color flow.
+ */
+ int[] getColorFlow();
+
+ /**
+ * Simulation flags.
+ */
+ public interface SimulatorStatus
+ {
+ /**
+ * Get the raw undecoded simulator status
+ */
+ int getValue();
+
+ /**
+ * True if the particle has been created by the simulation program
+ * (rather than the generator).
+ */
+ boolean isCreatedInSimulation();
+
+ /**
+ * True if the particle was created by the simulator as a result of an
+ * interaction or decay in non-tracking region, e.g. a calorimeter. By
+ * convention, such particles are not saved. However, if this particle
+ * creates a tracker hit, the particle is added to the MCParticle list
+ * with this flag set, and the parent set to the particle that initially
+ * decayed or interacted in a non-tracking region.
+ */
+ boolean isBackscatter();
+
+ /**
+ * True if the particle was created as a result of a continuous process
+ * where the parent particle continues, i.e. hard ionization,
+ * Bremsstrahlung, elastic interactions, etc.
+ */
+ boolean vertexIsNotEndpointOfParent();
+
+ /**
+ * True if the particle decayed or interacted in a tracking region.
+ */
+ boolean isDecayedInTracker();
+
+ /**
+ * True if the particle decayed or interacted (non-continuous
+ * interaction, particle terminated) in non-tracking region.
+ */
+ boolean isDecayedInCalorimeter();
+
+ /**
+ * True if the particle left the world volume undecayed.
+ */
+ boolean hasLeftDetector();
+
+ /**
+ * True if the particle lost all kinetic energy inside the world volume
+ * and did not decay.
+ */
+ boolean isStopped();
+ }
+}
\ No newline at end of file
lcsim/src/org/lcsim/event
diff -u -r1.6 -r1.7
--- SimCalorimeterHit.java 23 May 2008 06:53:35 -0000 1.6
+++ SimCalorimeterHit.java 24 Aug 2011 18:51:17 -0000 1.7
@@ -1,35 +1,58 @@
package org.lcsim.event;
/**
- * Represents one simulated "hit" in a calorimeter
- * @version $Id: SimCalorimeterHit.java,v 1.6 2008/05/23 06:53:35 jeremy Exp $
+ * Represents one simulated hit in a calorimeter. It extends the
+ * {@link org.lcsim.event.CalorimeterHit} interface and adds
+ * methods for accessing MC data.
+ *
+ * @author Jeremy McCormick
+ * @author Tony Johnson
+ * @version $Id: SimCalorimeterHit.java,v 1.7 2011/08/24 18:51:17 jeremy Exp $
*/
-
-public interface SimCalorimeterHit
-extends CalorimeterHit
+public interface SimCalorimeterHit extends CalorimeterHit
{
- /**
- * Returns the number of MC contributions to the hit.
- */
- int getMCParticleCount();
+ /**
+ * Get the number of MC contributions to the hit.
+ * The name of this method is misleading if granular contributions
+ * were selected, in which case it corresponds to the total number
+ * of MC contributions to this hit. It can be used to find the
+ * maximum index number for iteration over contributions using the methods
+ * {@link #getContributedEnergy(int)}, {@link #getContributedTime(int),
+ * {@link #getMCParticle(int)}, and {@linke #getStepPosition(int)}.
+ * @return The number of MCParticle contributions.
+ */
+ int getMCParticleCount();
+
+ /**
+ * Get the MCParticle that caused the shower responsible for this
+ * contribution to the hit.
+ * @return The MCParticle of the hit contribution.
+ */
+ MCParticle getMCParticle(int index);
- /**
- * Returns the MCParticle that caused the shower responsible for this contribution to the hit.
- */
- MCParticle getMCParticle(int index);
+ /**
+ * Get the energy in GeV of the i-th contribution to the hit.
+ * @return The energy of a contribution.
+ */
+ double getContributedEnergy(int index);
- /**
- * Returns the energy in [GeV] of the i-th contribution to the hit.
- */
- double getContributedEnergy(int index);
+ /**
+ * Get the time in ns of the i-th contribution to the hit.
+ * @return The time of the contribution.
+ */
+ double getContributedTime(int index);
- /**
- * Returns the time of the i-th in [ns] contribution to the hit.
- */
- public double getContributedTime(int index);
+ /**
+ * Get the PDG code of the shower particle that caused this
+ * contribution. May be different from the MCParticle's PDG code.
+ * @return The shower contribution particle's PDG ID.
+ */
+ int getPDG(int index);
- /**
- * Returns the PDG code of the shower particle that caused this contribution.
- */
- public int getPDG(int index);
-}
+ /**
+ * Get the step position of an MCParticle contribution in Cartesian coordinates.
+ * @param index The index of the contribution.
+ * @return The step position in Cartesian coordinates as a float array of length 3.
+ */
+ float[] getStepPosition(int index);
+}
\ No newline at end of file
lcsim/src/org/lcsim/event
diff -u -r1.20 -r1.21
--- SimTrackerHit.java 17 Mar 2009 22:45:44 -0000 1.20
+++ SimTrackerHit.java 24 Aug 2011 18:51:17 -0000 1.21
@@ -1,44 +1,72 @@
package org.lcsim.event;
/**
- * @version $Id: SimTrackerHit.java,v 1.20 2009/03/17 22:45:44 jeremy Exp $
+ * The interface for a MC TrackerHit generated by the detector simulation.
+ * @author Jeremy McCormick
+ * @version $Id: SimTrackerHit.java,v 1.21 2011/08/24 18:51:17 jeremy Exp $
*/
-public interface SimTrackerHit
-extends HitWithPosition
+public interface SimTrackerHit extends HitWithPosition
{
- /** Layer containing hit */
+ /**
+ * Get the layer number of the hit.
+ * @return The layer number of the hit.
+ */
public int getLayer();
- /** x,y,z point of (center-of) hit */
+ /**
+ * Get the center of the hit in Cartesian coordinates.
+ * @return The center point of the hit.
+ */
double[] getPoint();
/** returns dE/dx energy deposition */
double getdEdx();
-
+
+ // @Deprecated
+ // @deprecated
+ // Use {@link #getCellID64()} instead.
int getCellID();
+ /**
+ * Get the full 64-bit ID of this hit.
+ * @return The ID.
+ */
+ long getCellID64();
+
+ /**
+ * Get the time of the hit [ns].
+ * @return The time of the hit [ns].
+ */
double getTime();
+ /**
+ * Get the associated MCParticle that made this hit.
+ * @return The hit's MCParticle.
+ */
MCParticle getMCParticle();
- /** Returns the 3-momentum of the particle at the hits position in [GeV] -
- * optional, only if bit LCIOConstants.THBIT_MOMENTUM is set.
+ /**
+ * Get the 3-momentum of the particle at the hit's position [GeV].
+ * Optional, only if bit LCIOConstants.THBIT_MOMENTUM is set.
+ * @return The 3-momentum of the particle at the hit's position.
*/
double[] getMomentum();
- /** The path length of the particle in the sensitive material that resulted in this hit.
- * This is only stored together with momentum, i.e. if LCIO::THBIT_MOMENTUM is set.
+ /**
+ * The path length of the particle in the sensitive material that resulted in this hit.
+ * This is only stored together with momentum, i.e. if LCIO::THBIT_MOMENTUM is set.
+ * @return The path length of the hit.
*/
double getPathLength();
/**
- * Get the start point.
+ * Get the start point of the hit.
* @return The start point.
*/
double[] getStartPoint();
/**
- * Get the end point.
+ * Get the end point of the hit.
* @return The end point.
*/
double[] getEndPoint();
lcsim/src/org/lcsim/event
diff -u -r1.7 -r1.8
--- TrackerHit.java 9 Nov 2010 22:26:00 -0000 1.7
+++ TrackerHit.java 24 Aug 2011 18:51:17 -0000 1.8
@@ -2,56 +2,60 @@
import java.util.List;
-/** A generic tracker hit to be used by pattern recognition.
+/**
+ * A generic tracker hit to be used by pattern recognition.
*
- * @author gaede
- * @version $Id: TrackerHit.java,v 1.7 2010/11/09 22:26:00 jeremy Exp $
+ * @author Tony Johnson
+ * @author Jeremy McCormick
+ * @version $Id: TrackerHit.java,v 1.8 2011/08/24 18:51:17 jeremy Exp $
*/
public interface TrackerHit
{
/**
- * The hit position in [mm].
+ * The hit position [mm].
*/
- public double[] getPosition();
+ double[] getPosition();
/**
* Covariance of the position (x,y,z)
*/
- public double[] getCovMatrix();
+ double[] getCovMatrix();
- /** The dE/dx of the hit in [GeV].
+ /** The dE/dx of the hit [GeV].
*/
- public double getdEdx();
+ double getdEdx();
/**
* The measured edep error [GeV].
*/
- public double getEdepError();
+ double getEdepError();
/**
* The quality of the hit.
*/
- public int getQuality();
+ int getQuality();
/**
- * The time of the hit in [ns].
+ * The time of the hit [ns].
*/
- public double getTime();
+ double getTime();
/**
* Type of hit. Mapping of integer types to type names
* through collection parameters "TrackerHitTypeNames"
* and "TrackerHitTypeValues".
*/
- public int getType();
+ int getType();
/** The raw data hits.
* Check getType() to get actual data type.
*/
- public List getRawHits();
-
- // FixMe: We could add a method to get a CellID from the RawHits.
- // FixMe: See Dima's comments from 2/13/2007 LCD meeting
-
-} // class or interface
+ List getRawHits();
+
+ /**
+ * Get the cell ID.
+ * @return The cell ID.
+ */
+ long getCellID();
+}
\ No newline at end of file
lcsim/src/org/lcsim/event/base
diff -u -r1.5 -r1.6
--- BaseMCParticle.java 30 Apr 2011 04:43:50 -0000 1.5
+++ BaseMCParticle.java 24 Aug 2011 18:51:17 -0000 1.6
@@ -3,7 +3,7 @@
*
* Created on March 30, 2006, 8:58 AM
*
- * $Id: BaseMCParticle.java,v 1.5 2011/04/30 04:43:50 grefe Exp $
+ * $Id: BaseMCParticle.java,v 1.6 2011/08/24 18:51:17 jeremy Exp $
*/
package org.lcsim.event.base;
@@ -26,6 +26,8 @@
protected Hep3Vector _endPoint = new BasicHep3Vector(0., 0., 0.);
protected SimulatorStatus _status;
protected double charge;
+ protected float[] spin = new float[3];
+ protected int[] colorFlow = new int[2];
/**
* Creates a new instance of BaseMCParticle
@@ -107,6 +109,16 @@
return _endPoint;
}
+ public float[] getSpin()
+ {
+ return spin;
+ }
+
+ public int[] getColorFlow()
+ {
+ return colorFlow;
+ }
+
protected class Status implements SimulatorStatus {
int simulatorStatus;
public Status(int v) {
@@ -161,6 +173,4 @@
private final static int BITLeftDetector = 25;
private final static int BITStopped = 24;
}
-
-
}
lcsim/src/org/lcsim/event/base
diff -u -r1.6 -r1.7
--- BaseSimCalorimeterHit.java 15 Feb 2011 23:23:13 -0000 1.6
+++ BaseSimCalorimeterHit.java 24 Aug 2011 18:51:17 -0000 1.7
@@ -2,6 +2,9 @@
import hep.io.sio.SIORef;
+import java.util.List;
+import java.util.ArrayList;
+
import org.lcsim.event.MCParticle;
import org.lcsim.event.SimCalorimeterHit;
@@ -12,6 +15,7 @@
protected float[] energyContrib;
protected float[] times;
protected int[] pdg;
+ protected List<float[]> steps;
protected BaseSimCalorimeterHit()
{}
@@ -25,17 +29,47 @@
float[] times,
int[] pdgs)
{
+ // Base class fields.
+ super.id = id;
+ super.rawEnergy = rawEnergy;
+ super.time = time;
+ super.position = null;
+
+ // MCParticle contributions.
this.nContributions = mcparts.length;
this.particle = mcparts;
this.energyContrib = energies;
this.times = times;
this.pdg = pdgs;
-
+ this.steps = new ArrayList(nContributions);
+ }
+
+ /**
+ * New ctor with step positions.
+ */
+ public BaseSimCalorimeterHit(
+ long id,
+ double rawEnergy,
+ double time,
+ Object[] mcparts,
+ float[] energies,
+ float[] times,
+ int[] pdgs,
+ List<float[]> steps)
+ {
// Base class fields.
super.id = id;
super.rawEnergy = rawEnergy;
super.time = time;
- super.position = null;
+ super.position = null;
+
+ // MCParticle contributions.
+ this.nContributions = mcparts.length;
+ this.particle = mcparts;
+ this.energyContrib = energies;
+ this.times = times;
+ this.pdg = pdgs;
+ this.steps = steps;
}
public void shiftTime(double time)
@@ -44,8 +78,7 @@
for (int i=0; i<times.length; i++)
{
times[i] += time;
- }
-
+ }
}
public double getTime()
@@ -90,9 +123,14 @@
{
return times[index];
}
+
+ public float[] getStepPosition(int index)
+ {
+ return steps.get(index);
+ }
public int getMCParticleCount()
{
return particle.length;
- }
+ }
}
lcsim/src/org/lcsim/event/base
diff -u -r1.14 -r1.15
--- BaseSimTrackerHit.java 29 Apr 2011 16:22:33 -0000 1.14
+++ BaseSimTrackerHit.java 24 Aug 2011 18:51:17 -0000 1.15
@@ -5,16 +5,16 @@
import hep.physics.vec.VecOp;
import org.lcsim.detector.IDetectorElement;
-import org.lcsim.detector.IDetectorElementContainer;
import org.lcsim.detector.identifier.IIdentifier;
import org.lcsim.detector.identifier.Identifier;
+import org.lcsim.event.EventHeader.LCMetaData;
import org.lcsim.event.MCParticle;
import org.lcsim.event.SimTrackerHit;
-import org.lcsim.event.EventHeader.LCMetaData;
/**
- * An concrete implementation of SimTrackerHit.
- * @author jeremym
+ * A concrete implementation of SimTrackerHit.
+ * @author Jeremy McCormick
+ * @version $Id: BaseSimTrackerHit.java,v 1.15 2011/08/24 18:51:17 jeremy Exp $
*/
public class BaseSimTrackerHit extends BaseHitWithPosition implements SimTrackerHit
{
@@ -24,6 +24,7 @@
protected double time;
protected double dEdx;
protected int cellID;
+ protected long id;
protected double pathLength;
private Hep3Vector startPoint, endPoint;
@@ -118,11 +119,18 @@
return mcparticle;
}
+ // @Deprecated
+ // Use {@link #getCellID64()} instead.
public int getCellID()
{
- return cellID;
+ return cellID;
}
-
+
+ public long getCellID64()
+ {
+ return id;
+ }
+
public double getPathLength()
{
return pathLength;
@@ -160,7 +168,7 @@
public IIdentifier getIdentifier()
{
if (compactId == null)
- compactId = new Identifier(cellID);
+ compactId = new Identifier(id);
return compactId;
- }
+ }
}
\ No newline at end of file
lcsim/src/org/lcsim/event/base
diff -u -r1.6 -r1.7
--- BaseTrackerHit.java 9 Nov 2010 22:26:00 -0000 1.6
+++ BaseTrackerHit.java 24 Aug 2011 18:51:17 -0000 1.7
@@ -3,7 +3,7 @@
*
* Created on March 24, 2006, 9:22 AM
*
- * $Id: BaseTrackerHit.java,v 1.6 2010/11/09 22:26:00 jeremy Exp $
+ * $Id: BaseTrackerHit.java,v 1.7 2011/08/24 18:51:17 jeremy Exp $
*/
package org.lcsim.event.base;
@@ -29,13 +29,11 @@
//TODO decide what this is a list of
//TODO decide whether this should be a Set
protected List _rawHits = new ArrayList();
+ protected long id;
/** Creates a new instance of BaseTrackerHit */
public BaseTrackerHit()
- {
-
- }
-
+ {}
/**
* fully qualified constructor
@@ -207,5 +205,9 @@
{
return _rawHits;
}
-
+
+ public long getCellID()
+ {
+ return id;
+ }
}
\ No newline at end of file
lcsim/src/org/lcsim/event/util
diff -u -r1.1 -r1.2
--- LCSimFactory.java 23 May 2008 03:12:09 -0000 1.1
+++ LCSimFactory.java 24 Aug 2011 18:51:17 -0000 1.2
@@ -14,95 +14,107 @@
public class LCSimFactory extends GeneratorFactory
{
- private String detectorName;
- private static SimulatorStatus emptySimulatorStatus = new Status();
- public LCSimFactory(String detectorName)
- {
- this.detectorName = detectorName;
- }
-
- public MCEvent createEvent(int run, int event)
- {
- return new BaseLCSimEvent(run,event,detectorName);
- }
-
- public BasicParticle createParticle(Hep3Vector origin, HepLorentzVector p, ParticleType ptype, int status, double time)
- {
- return new GeneratorParticle(origin,p,ptype,status,time);
- }
-
- private static class GeneratorParticle extends BasicParticle implements MCParticle
- {
-
- GeneratorParticle(Hep3Vector origin,HepLorentzVector p,ParticleType ptype,int status, double time)
- {
- super(origin,p,ptype,status,time);
- }
-
- public SimulatorStatus getSimulatorStatus()
- {
- return emptySimulatorStatus;
- }
-
- public Hep3Vector getEndPoint()
- {
- if (getDaughters().isEmpty()) throw new RuntimeException("MCParticle end point not available");
- return ((Particle) getDaughters().get(0)).getOrigin();
- }
- // FixMe: Ugly workaround for particle 92 (pythia string) problem
- public double getCharge()
- {
- try
- {
- return super.getCharge();
- }
- catch (UnknownParticleIDException x)
- {
- if (x.getPDGID() == 92) return 0;
- else throw x;
- }
- }
- }
- private static class Status implements SimulatorStatus
- {
- public boolean vertexIsNotEndpointOfParent()
- {
- return false;
- }
-
- public boolean isStopped()
- {
- return false;
- }
-
- public boolean isDecayedInTracker()
- {
- return false;
- }
-
- public boolean isDecayedInCalorimeter()
- {
- return false;
- }
-
- public boolean isCreatedInSimulation()
- {
- return false;
- }
-
- public boolean isBackscatter()
- {
- return false;
- }
-
- public boolean hasLeftDetector()
- {
- return false;
- }
-
- public int getValue()
- {
- return 0;
- }
- }
+ private String detectorName;
+ private static SimulatorStatus emptySimulatorStatus = new Status();
+ public LCSimFactory(String detectorName)
+ {
+ this.detectorName = detectorName;
+ }
+
+ public MCEvent createEvent(int run, int event)
+ {
+ return new BaseLCSimEvent(run,event,detectorName);
+ }
+
+ public BasicParticle createParticle(Hep3Vector origin, HepLorentzVector p, ParticleType ptype, int status, double time)
+ {
+ return new GeneratorParticle(origin,p,ptype,status,time);
+ }
+
+ private static class GeneratorParticle extends BasicParticle implements MCParticle
+ {
+ float[] spin = new float[3];
+ int[] colorFlow = new int[2];
+
+ GeneratorParticle(Hep3Vector origin,HepLorentzVector p,ParticleType ptype,int status, double time)
+ {
+ super(origin,p,ptype,status,time);
+ }
+
+ public SimulatorStatus getSimulatorStatus()
+ {
+ return emptySimulatorStatus;
+ }
+
+ public Hep3Vector getEndPoint()
+ {
+ if (getDaughters().isEmpty()) throw new RuntimeException("MCParticle end point not available");
+ return ((Particle) getDaughters().get(0)).getOrigin();
+ }
+ // FixMe: Ugly workaround for particle 92 (pythia string) problem
+ public double getCharge()
+ {
+ try
+ {
+ return super.getCharge();
+ }
+ catch (UnknownParticleIDException x)
+ {
+ if (x.getPDGID() == 92) return 0;
+ else throw x;
+ }
+ }
+
+ public float[] getSpin()
+ {
+ return spin;
+ }
+
+ public int[] getColorFlow()
+ {
+ return colorFlow;
+ }
+ }
+ private static class Status implements SimulatorStatus
+ {
+ public boolean vertexIsNotEndpointOfParent()
+ {
+ return false;
+ }
+
+ public boolean isStopped()
+ {
+ return false;
+ }
+
+ public boolean isDecayedInTracker()
+ {
+ return false;
+ }
+
+ public boolean isDecayedInCalorimeter()
+ {
+ return false;
+ }
+
+ public boolean isCreatedInSimulation()
+ {
+ return false;
+ }
+
+ public boolean isBackscatter()
+ {
+ return false;
+ }
+
+ public boolean hasLeftDetector()
+ {
+ return false;
+ }
+
+ public int getValue()
+ {
+ return 0;
+ }
+ }
}
\ No newline at end of file
lcsim/src/org/lcsim/event/util
diff -u -r1.2 -r1.3
--- ParticleTypeClassifier.java 29 Nov 2007 22:12:37 -0000 1.2
+++ ParticleTypeClassifier.java 24 Aug 2011 18:51:17 -0000 1.3
@@ -4,9 +4,8 @@
/**
*
- * This class provides static utility methods for determining the type of a particle based on the PDGID. It based on the primary
- * document on PDGIDs issued by the Particle Data Group and also on some
- * code from the ATLAS LXR.
+ * This class provides static utility methods for determining the type of a particle based on the PDGID. It based
+ * on the primary document on PDGIDs issued by the Particle Data Group and also on some code from the ATLAS LXR.
*
* <h2>References</h2>
* <ul>
@@ -16,7 +15,7 @@
* </ul>
*
* @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: ParticleTypeClassifier.java,v 1.2 2007/11/29 22:12:37 jeremy Exp $
+ * @version $Id: ParticleTypeClassifier.java,v 1.3 2011/08/24 18:51:17 jeremy Exp $
*
*/
public final class ParticleTypeClassifier
lcsim/src/org/lcsim/fit/helicaltrack
diff -u -r1.19 -r1.20
--- HelicalTrackHit.java 12 Feb 2011 05:20:15 -0000 1.19
+++ HelicalTrackHit.java 24 Aug 2011 18:51:17 -0000 1.20
@@ -51,6 +51,7 @@
private double _dr;
private double _chisq;
protected static final double _eps = 1e-6;
+ protected long id; // FIXME: Dummy value that needs to be set from RawTrackerHit data.
public HelicalTrackHit(Hep3Vector pos, SymmetricMatrix cov, double dEdx, double time, int type,
List rawhits, String detname, int layer, BarrelEndcapFlag beflag) {
@@ -356,4 +357,9 @@
return;
}
+
+ public long getCellID()
+ {
+ return id;
+ }
}
\ No newline at end of file
lcsim/src/org/lcsim/recon/cat
diff -u -r1.3 -r1.4
--- GarfieldHit.java 9 Nov 2010 22:26:00 -0000 1.3
+++ GarfieldHit.java 24 Aug 2011 18:51:17 -0000 1.4
@@ -18,7 +18,7 @@
*
* @author E. von Toerne
* @author D. Onoprienko
- * @version $Id: GarfieldHit.java,v 1.3 2010/11/09 22:26:00 jeremy Exp $
+ * @version $Id: GarfieldHit.java,v 1.4 2011/08/24 18:51:17 jeremy Exp $
*/
final public class GarfieldHit implements TrackerHit {
@@ -280,8 +280,10 @@
* Returns dE/dx energy deposition (forwarded from the first simulated hit in the list).
*/
public double getdEdx() {return rawHitList.isEmpty() ? 0. : rawHitList.get(0).getdEdx();}
-
+
+ public long getCellID()
+ {
+ if (true) throw new UnsupportedOperationException("This method is not implemented in this class.");
+ return 0;
+ }
}
-
-
-
lcsim/src/org/lcsim/recon/tracking/digitization/sisim
diff -u -r1.2 -r1.3
--- BaseTrackerHit.java 9 Nov 2010 22:26:00 -0000 1.2
+++ BaseTrackerHit.java 24 Aug 2011 18:51:17 -0000 1.3
@@ -38,6 +38,7 @@
private double _time;
private List<RawTrackerHit> _raw_hits;
private int _type;
+ private long id; // FIXME: This ID needs to be set from RawTrackerHit data.
// Cached derived quantities
private IIdentifierHelper _identifier_helper;
@@ -172,5 +173,8 @@
return _identifier_helper;
}
-}
-
+ public long getCellID()
+ {
+ return id;
+ }
+}
\ No newline at end of file
lcsim/src/org/lcsim/recon/tracking/digitization/sisim/config
diff -u -r1.2 -r1.3
--- SimTrackerHitReadoutDriver.java 25 Aug 2009 00:01:59 -0000 1.2
+++ SimTrackerHitReadoutDriver.java 24 Aug 2011 18:51:18 -0000 1.3
@@ -13,8 +13,8 @@
*/
public class SimTrackerHitReadoutDriver extends CollectionHandler
{
- boolean needCleanupDriver=true;
- boolean debug=false;
+ boolean needCleanupDriver = true;
+ static boolean debug = false;
public SimTrackerHitReadoutDriver()
{}
@@ -36,7 +36,7 @@
public void setDebug(boolean debug)
{
- this.debug = debug;
+ SimTrackerHitReadoutDriver.debug = debug;
}
public void startOfData()
@@ -51,6 +51,17 @@
protected void process(EventHeader header)
{
super.process(header);
+
+ if (debug)
+ {
+ System.out.println(this.getClass().getSimpleName() + " - handling collections");
+
+ for (String cname : this.collections)
+ {
+ System.out.println(" " + cname);
+ }
+ }
+
List<List<SimTrackerHit>> collections = header.get(SimTrackerHit.class);
for (List<SimTrackerHit> collection : collections)
{
lcsim/src/org/lcsim/recon/tracking/vsegment/hitmaking
diff -u -r1.2 -r1.3
--- OldTrackerHit.java 9 Nov 2010 22:26:00 -0000 1.2
+++ OldTrackerHit.java 24 Aug 2011 18:51:18 -0000 1.3
@@ -12,7 +12,7 @@
* this package into old <tt>TrackerHits</tt>.
*
* @author D. Onoprienko
- * @version $Id: OldTrackerHit.java,v 1.2 2010/11/09 22:26:00 jeremy Exp $
+ * @version $Id: OldTrackerHit.java,v 1.3 2011/08/24 18:51:18 jeremy Exp $
*/
public class OldTrackerHit implements org.lcsim.event.TrackerHit {
@@ -116,4 +116,10 @@
{
return 0;
}
+
+ public long getCellID()
+ {
+ if (true) throw new UnsupportedOperationException("This method is not implemented in this class.");
+ return 0;
+ }
}
\ No newline at end of file
lcsim/src/org/lcsim/recon/vertexing/pixsim
diff -u -r1.2 -r1.3
--- SimPixelHit.java 17 Mar 2009 22:45:44 -0000 1.2
+++ SimPixelHit.java 24 Aug 2011 18:51:18 -0000 1.3
@@ -11,7 +11,7 @@
import org.lcsim.geometry.Subdetector;
/**
- * @version $Id: SimPixelHit.java,v 1.2 2009/03/17 22:45:44 jeremy Exp $
+ * @version $Id: SimPixelHit.java,v 1.3 2011/08/24 18:51:18 jeremy Exp $
*/
public class SimPixelHit extends BaseHitWithPosition implements SimTrackerHit
@@ -170,5 +170,11 @@
public double[] getPosition()
{
return getPoint();
+ }
+
+ public long getCellID64()
+ {
+ if (true) throw new UnsupportedOperationException("This method is not implemented in this class.");
+ return 0;
}
}
\ No newline at end of file
lcsim/src/org/lcsim/util/heprep
diff -u -r1.11 -r1.12
--- MCParticleConverter.java 19 Aug 2008 23:34:33 -0000 1.11
+++ MCParticleConverter.java 24 Aug 2011 18:51:18 -0000 1.12
@@ -1,24 +1,24 @@
package org.lcsim.util.heprep;
+import static java.lang.Math.abs;
import hep.graphics.heprep.HepRepFactory;
import hep.graphics.heprep.HepRepInstance;
+import hep.graphics.heprep.HepRepInstanceTree;
import hep.graphics.heprep.HepRepType;
import hep.graphics.heprep.HepRepTypeTree;
-import hep.graphics.heprep.HepRepInstanceTree;
import hep.physics.particle.properties.UnknownParticleIDException;
import hep.physics.vec.BasicHep3Vector;
import hep.physics.vec.Hep3Vector;
import hep.physics.vec.VecOp;
+
import java.awt.Color;
-import java.io.IOException;
import java.util.List;
+
import org.lcsim.event.EventHeader;
import org.lcsim.event.EventHeader.LCMetaData;
import org.lcsim.event.MCParticle;
import org.lcsim.geometry.Detector;
import org.lcsim.util.swim.HelixSwimmer;
-
-import static java.lang.Math.abs;
/**
*
* -Changed to allow no detector. By default, now uses a B field of (0,0,0).
@@ -26,7 +26,7 @@
* -Removed unused flags variable. FIXME: Should be using collection flags?
*
* @author tonyj
- * @version $Id: MCParticleConverter.java,v 1.11 2008/08/19 23:34:33 jeremy Exp $
+ * @version $Id: MCParticleConverter.java,v 1.12 2011/08/24 18:51:18 jeremy Exp $
*/
class MCParticleConverter implements HepRepCollectionConverter
{
@@ -39,6 +39,7 @@
}
public void convert(EventHeader event, List collection, HepRepFactory factory, HepRepTypeTree typeTree, HepRepInstanceTree instanceTree)
{
+ System.out.println("hello MCParticleConverter");
LCMetaData meta = event.getMetaData(collection);
String name = meta.getName();
//int flags = meta.getFlags();
lcsim/src/org/lcsim/util/lcio
diff -u -r1.14 -r1.15
--- LCIOConstants.java 3 Feb 2011 20:11:45 -0000 1.14
+++ LCIOConstants.java 24 Aug 2011 18:51:18 -0000 1.15
@@ -7,7 +7,7 @@
public interface LCIOConstants
{
int MAJORVERSION = 1;
- int MINORVERSION = 51;
+ int MINORVERSION = 60;
// bits in flag words
// SimCalorimeterHit (CH)
@@ -20,7 +20,9 @@
int CHBIT_ID1 = 29;
// cellid1 stored
- int CHBIT_PDG = 28;
+ int CHBIT_PDG = 28; // deprecated
+
+ int CHBIT_STEP = 28;
int RCHBIT_LONG = 31;
@@ -43,9 +45,11 @@
// SimTrackerHit
int THBIT_BARREL = 31;
- // barrel(1) - endcap(0)
-
+ // barrel(1) - endcap(0)
int THBIT_MOMENTUM = 30 ;
+
+ // CellID1 stored for SimTrackerHit and TrackerHit.
+ int THBIT_ID1 = 29;
// momentum of particle stored(1) - not stored(0)
// Tracks
lcsim/src/org/lcsim/util/lcio
diff -u -r1.12 -r1.13
--- SIOMCParticle.java 12 Mar 2011 12:11:39 -0000 1.12
+++ SIOMCParticle.java 24 Aug 2011 18:51:18 -0000 1.13
@@ -18,327 +18,376 @@
import org.lcsim.event.MCParticle;
/**
- *
+ * SIO implementation of {@link org.lcsim.event.MCParticle}.
* @author Tony Johnson
- * @version $Id: SIOMCParticle.java,v 1.12 2011/03/12 12:11:39 grefe Exp $
+ * @author Jeremy McCormick
+ * @version $Id: SIOMCParticle.java,v 1.13 2011/08/24 18:51:18 jeremy Exp $
*/
public class SIOMCParticle implements MCParticle
{
- private int pdg;
- private int generatorStatus;
- private int simulatorStatus;
- private Hep3Vector vertex;
- private Hep3Vector endPoint;
- private HepLorentzVector p;
- private float mass;
- private float charge;
- private float time;
- private List<MCParticle> daughters;
- private List<MCParticle> parents;
- private SimulatorStatus simStatus = new Status();
-
- private List temp = new ArrayList();
- SIOMCParticle(SIOInputStream in, int flags, int version) throws IOException
- {
- boolean hasEndPoint = false;
- in.readPTag(this);
-
- if (version == 8)
- {
- in.readPntr();
- in.readPntr();
-
- int nDaughters = in.readInt();
- for (int i = 0; i < nDaughters; i++)
- temp.add(in.readPntr());
-
- hasEndPoint = (nDaughters == 0);
- }
- else
- {
- int nParents = in.readInt();
- for (int i=0; i<nParents; i++)
- {
- temp.add(in.readPntr());
- }
- }
- pdg = in.readInt();
- generatorStatus = in.readInt();
- if (version != 8)
- {
- simulatorStatus = in.readInt();
- hasEndPoint = LCIOUtil.bitTest(simulatorStatus,Status.BITEndpoint);
- simulatorStatus = LCIOUtil.bitSet(simulatorStatus,Status.BITEndpoint,false);
- }
- vertex = new BasicHep3Vector(in.readDouble(),in.readDouble(),in.readDouble());
-
- if( version > 1002 ) time = in.readFloat();
-
- Hep3Vector momentum = new BasicHep3Vector(in.readFloat(),in.readFloat(),in.readFloat());
- mass = in.readFloat();
- double e = Math.sqrt(mass*mass + momentum.magnitudeSquared());
- p = new BasicHepLorentzVector(e,momentum);
- charge = in.readFloat();
- if (hasEndPoint)
- {
- endPoint = new BasicHep3Vector(in.readDouble(),in.readDouble(),in.readDouble());
- }
- }
- void resolve(int version)
- {
- if (version == 8)
- {
- for (int i=0; i<temp.size(); i++)
- {
- SIOMCParticle daughter = (SIOMCParticle) ((SIORef) temp.get(i)).getObject();
- this.addDaughter(daughter);
- }
- }
- else
- {
- for (int i=0; i<temp.size(); i++)
- {
- SIOMCParticle parent = (SIOMCParticle) ((SIORef) temp.get(i)).getObject();
- parent.addDaughter(this);
- }
- }
- temp = null;
- }
- private void addDaughter(SIOMCParticle child)
- {
- if (daughters == null) daughters = new ArrayList<MCParticle>();
- daughters.add(child);
- child.addParent(this);
- }
- private void addParent(SIOMCParticle parent)
- {
- if (parents == null) parents = new ArrayList<MCParticle>();
- parents.add(parent);
- }
- public void setTime(double newTime) {
- time = (float) newTime;
- }
- public ParticleType getType()
- {
- return ParticlePropertyManager.getParticlePropertyProvider().get(pdg);
- }
-
- public double getProductionTime()
- {
- return time;
- }
-
- public List<MCParticle> getParents()
- {
- return parents == null ? Collections.EMPTY_LIST : parents;
- }
-
- public double getCharge()
- {
- return charge;
- }
-
- public List<MCParticle> getDaughters()
- {
- return daughters == null ? Collections.EMPTY_LIST : daughters;
- }
-
- public double getEnergy()
- {
- return p.t();
- }
-
- public int getGeneratorStatus()
- {
- return generatorStatus;
- }
-
- public double getMass()
- {
- return mass;
- }
-
- public Hep3Vector getMomentum()
- {
- return p.v3();
- }
-
- public Hep3Vector getOrigin()
- {
- return vertex;
- }
-
- public double getOriginX()
- {
- return vertex.x();
- }
-
- public double getOriginY()
- {
- return vertex.y();
- }
-
- public double getOriginZ()
- {
- return vertex.z();
- }
-
- public double getPX()
- {
- return p.v3().x();
- }
-
- public double getPY()
- {
- return p.v3().y();
- }
-
- public double getPZ()
- {
- return p.v3().z();
- }
-
- public Hep3Vector getEndPoint()
- {
- if (endPoint == null)
- {
- for (MCParticle daughter : getDaughters())
- {
- if(!daughter.getSimulatorStatus().vertexIsNotEndpointOfParent())
+ private int pdg;
+ private int generatorStatus;
+ private int simulatorStatus;
+ private Hep3Vector vertex;
+ private Hep3Vector endPoint;
+ private HepLorentzVector p;
+ private float mass;
+ private float charge;
+ private float time;
+ private List<MCParticle> daughters;
+ private List<MCParticle> parents;
+ private SimulatorStatus simStatus = new Status();
+ protected float[] spin = new float[3];
+ protected int[] colorFlow = new int[2];
+
+ private List temp = new ArrayList();
+
+ SIOMCParticle(SIOInputStream in, int flags, int version) throws IOException
+ {
+ boolean hasEndPoint = false;
+ in.readPTag(this);
+
+ if (version == 8)
+ {
+ in.readPntr();
+ in.readPntr();
+
+ int nDaughters = in.readInt();
+ for (int i = 0; i < nDaughters; i++)
+ temp.add(in.readPntr());
+
+ hasEndPoint = (nDaughters == 0);
+ }
+ else
+ {
+ int nParents = in.readInt();
+ for (int i = 0; i < nParents; i++)
{
- return daughter.getOrigin();
+ temp.add(in.readPntr());
}
- }
- throw new RuntimeException("MCParticle end point not available");
- }
- else return endPoint;
- }
-
- public SimulatorStatus getSimulatorStatus()
- {
- return simStatus;
- }
- static void write(MCParticle particle, SIOOutputStream out, int flags) throws IOException
- {
- out.writePTag(particle);
- List<MCParticle> parents = particle.getParents();
- out.writeInt(parents.size());
-
- for (MCParticle parent : parents )
- {
- out.writePntr(parent);
- }
-
- out.writeInt(particle.getType().getPDGID());
- out.writeInt(particle.getGeneratorStatus());
- boolean shouldExplicityWriteOutEndPoint = true;
- for (MCParticle daughter : particle.getDaughters())
- {
- if(!daughter.getSimulatorStatus().vertexIsNotEndpointOfParent())
- {
- shouldExplicityWriteOutEndPoint = false;
- }
- }
- Hep3Vector endPoint = null;
- if (shouldExplicityWriteOutEndPoint)
- {
- try
- {
- endPoint = particle.getEndPoint();
- }
- catch (Exception x)
- {
- shouldExplicityWriteOutEndPoint = false;
- }
- }
- int simStatus = particle.getSimulatorStatus().getValue();
- simStatus = LCIOUtil.bitSet(simStatus,Status.BITEndpoint,shouldExplicityWriteOutEndPoint);
- out.writeInt(simStatus);
-
- out.writeDouble(particle.getOriginX());
- out.writeDouble(particle.getOriginY());
- out.writeDouble(particle.getOriginZ());
-
- out.writeFloat((float) particle.getProductionTime()) ;
-
- out.writeFloat((float) particle.getPX());
- out.writeFloat((float) particle.getPY());
- out.writeFloat((float) particle.getPZ());
- out.writeFloat((float) particle.getMass());
- try
- {
- out.writeFloat((float) particle.getCharge());
- }
- catch (UnknownParticleIDException x)
- {
- out.writeFloat(0);
- }
- if (shouldExplicityWriteOutEndPoint)
- {
- out.writeDouble(endPoint.x());
- out.writeDouble(endPoint.y());
- out.writeDouble(endPoint.z());
- }
- }
-
- public int getPDGID()
- {
- return pdg;
- }
-
- public HepLorentzVector asFourVector()
- {
- return p;
- }
- private class Status implements SimulatorStatus
- {
- public boolean vertexIsNotEndpointOfParent()
- {
- return (simulatorStatus & (1<<BITVertexIsNotEndpointOfParent)) != 0;
- }
-
- public boolean isStopped()
- {
- return (simulatorStatus & (1<<BITStopped)) != 0;
- }
-
- public boolean isDecayedInTracker()
- {
- return (simulatorStatus & (1<<BITDecayedInTracker)) != 0;
- }
-
- public boolean isDecayedInCalorimeter()
- {
- return (simulatorStatus & (1<<BITDecayedInCalorimeter)) != 0;
- }
-
- public boolean isCreatedInSimulation()
- {
- return (simulatorStatus & (1<<BITCreatedInSimulation)) != 0;
- }
-
- public boolean isBackscatter()
- {
- return (simulatorStatus & (1<<BITBackscatter)) != 0;
- }
-
- public boolean hasLeftDetector()
- {
- return (simulatorStatus & (1<<BITLeftDetector)) != 0;
- }
-
- public int getValue()
- {
- return simulatorStatus;
- }
- // define the bit positions for the simulation flag
- private final static int BITEndpoint = 31;
- private final static int BITCreatedInSimulation = 30;
- private final static int BITBackscatter = 29;
- private final static int BITVertexIsNotEndpointOfParent = 28;
- private final static int BITDecayedInTracker = 27;
- private final static int BITDecayedInCalorimeter = 26;
- private final static int BITLeftDetector = 25;
- private final static int BITStopped = 24;
- }
+ }
+ pdg = in.readInt();
+ generatorStatus = in.readInt();
+ if (version != 8)
+ {
+ simulatorStatus = in.readInt();
+ hasEndPoint = LCIOUtil.bitTest(simulatorStatus, Status.BITEndpoint);
+ simulatorStatus = LCIOUtil.bitSet(simulatorStatus, Status.BITEndpoint, false);
+ }
+ vertex = new BasicHep3Vector(in.readDouble(), in.readDouble(), in.readDouble());
+
+ if (version > 1002)
+ time = in.readFloat();
+
+ Hep3Vector momentum = new BasicHep3Vector(in.readFloat(), in.readFloat(), in.readFloat());
+ mass = in.readFloat();
+ double e = Math.sqrt(mass * mass + momentum.magnitudeSquared());
+ p = new BasicHepLorentzVector(e, momentum);
+ charge = in.readFloat();
+ if (hasEndPoint)
+ {
+ endPoint = new BasicHep3Vector(in.readDouble(), in.readDouble(), in.readDouble());
+ }
+
+ // Spin and colorflow for versions 1.60 and greater.
+ if (version >= 1060)
+ {
+ spin[0] = in.readFloat();
+ spin[1] = in.readFloat();
+ spin[2] = in.readFloat();
+
+ colorFlow[0] = in.readInt();
+ colorFlow[1] = in.readInt();
+ }
+ }
+
+ void resolve(int version)
+ {
+ if (version == 8)
+ {
+ for (int i = 0; i < temp.size(); i++)
+ {
+ SIOMCParticle daughter = (SIOMCParticle) ((SIORef) temp.get(i)).getObject();
+ this.addDaughter(daughter);
+ }
+ }
+ else
+ {
+ for (int i = 0; i < temp.size(); i++)
+ {
+ SIOMCParticle parent = (SIOMCParticle) ((SIORef) temp.get(i)).getObject();
+ parent.addDaughter(this);
+ }
+ }
+ temp = null;
+ }
+
+ private void addDaughter(SIOMCParticle child)
+ {
+ if (daughters == null)
+ daughters = new ArrayList<MCParticle>();
+ daughters.add(child);
+ child.addParent(this);
+ }
+
+ private void addParent(SIOMCParticle parent)
+ {
+ if (parents == null)
+ parents = new ArrayList<MCParticle>();
+ parents.add(parent);
+ }
+
+ public void setTime(double newTime)
+ {
+ time = (float) newTime;
+ }
+
+ public ParticleType getType()
+ {
+ return ParticlePropertyManager.getParticlePropertyProvider().get(pdg);
+ }
+
+ public double getProductionTime()
+ {
+ return time;
+ }
+
+ public List<MCParticle> getParents()
+ {
+ return parents == null ? Collections.EMPTY_LIST : parents;
+ }
+
+ public double getCharge()
+ {
+ return charge;
+ }
+
+ public List<MCParticle> getDaughters()
+ {
+ return daughters == null ? Collections.EMPTY_LIST : daughters;
+ }
+
+ public double getEnergy()
+ {
+ return p.t();
+ }
+
+ public int getGeneratorStatus()
+ {
+ return generatorStatus;
+ }
+
+ public double getMass()
+ {
+ return mass;
+ }
+
+ public Hep3Vector getMomentum()
+ {
+ return p.v3();
+ }
+
+ public Hep3Vector getOrigin()
+ {
+ return vertex;
+ }
+
+ public double getOriginX()
+ {
+ return vertex.x();
+ }
+
+ public double getOriginY()
+ {
+ return vertex.y();
+ }
+
+ public double getOriginZ()
+ {
+ return vertex.z();
+ }
+
+ public double getPX()
+ {
+ return p.v3().x();
+ }
+
+ public double getPY()
+ {
+ return p.v3().y();
+ }
+
+ public double getPZ()
+ {
+ return p.v3().z();
+ }
+
+ public Hep3Vector getEndPoint()
+ {
+ if (endPoint == null)
+ {
+ for (MCParticle daughter : getDaughters())
+ {
+ if (!daughter.getSimulatorStatus().vertexIsNotEndpointOfParent())
+ {
+ return daughter.getOrigin();
+ }
+ }
+ throw new RuntimeException("MCParticle end point not available");
+ }
+ else
+ return endPoint;
+ }
+
+ public SimulatorStatus getSimulatorStatus()
+ {
+ return simStatus;
+ }
+
+ static void write(MCParticle particle, SIOOutputStream out, int flags) throws IOException
+ {
+ out.writePTag(particle);
+ List<MCParticle> parents = particle.getParents();
+ out.writeInt(parents.size());
+
+ for (MCParticle parent : parents)
+ {
+ out.writePntr(parent);
+ }
+
+ out.writeInt(particle.getType().getPDGID());
+ out.writeInt(particle.getGeneratorStatus());
+ boolean shouldExplicityWriteOutEndPoint = true;
+ for (MCParticle daughter : particle.getDaughters())
+ {
+ if (!daughter.getSimulatorStatus().vertexIsNotEndpointOfParent())
+ {
+ shouldExplicityWriteOutEndPoint = false;
+ }
+ }
+ Hep3Vector endPoint = null;
+ if (shouldExplicityWriteOutEndPoint)
+ {
+ try
+ {
+ endPoint = particle.getEndPoint();
+ }
+ catch (Exception x)
+ {
+ shouldExplicityWriteOutEndPoint = false;
+ }
+ }
+ int simStatus = particle.getSimulatorStatus().getValue();
+ simStatus = LCIOUtil.bitSet(simStatus, Status.BITEndpoint, shouldExplicityWriteOutEndPoint);
+ out.writeInt(simStatus);
+
+ out.writeDouble(particle.getOriginX());
+ out.writeDouble(particle.getOriginY());
+ out.writeDouble(particle.getOriginZ());
+
+ out.writeFloat((float) particle.getProductionTime());
+
+ out.writeFloat((float) particle.getPX());
+ out.writeFloat((float) particle.getPY());
+ out.writeFloat((float) particle.getPZ());
+ out.writeFloat((float) particle.getMass());
+ try
+ {
+ out.writeFloat((float) particle.getCharge());
+ }
+ catch (UnknownParticleIDException x)
+ {
+ out.writeFloat(0);
+ }
+ if (shouldExplicityWriteOutEndPoint)
+ {
+ out.writeDouble(endPoint.x());
+ out.writeDouble(endPoint.y());
+ out.writeDouble(endPoint.z());
+ }
+
+ // Spin.
+ float[] spin = particle.getSpin();
+ out.writeFloat((float) spin[0]);
+ out.writeFloat((float) spin[1]);
+ out.writeFloat((float) spin[2]);
+
+ // Color flow.
+ int[] colorFlow = particle.getColorFlow();
+ out.writeInt(colorFlow[0]);
+ out.writeInt(colorFlow[1]);
+ }
+
+ public int getPDGID()
+ {
+ return pdg;
+ }
+
+ public HepLorentzVector asFourVector()
+ {
+ return p;
+ }
+
+ public float[] getSpin()
+ {
+ return spin;
+ }
+
+ public int[] getColorFlow()
+ {
+ return colorFlow;
+ }
+
+ private class Status implements SimulatorStatus
+ {
+ public boolean vertexIsNotEndpointOfParent()
+ {
+ return (simulatorStatus & (1 << BITVertexIsNotEndpointOfParent)) != 0;
+ }
+
+ public boolean isStopped()
+ {
+ return (simulatorStatus & (1 << BITStopped)) != 0;
+ }
+
+ public boolean isDecayedInTracker()
+ {
+ return (simulatorStatus & (1 << BITDecayedInTracker)) != 0;
+ }
+
+ public boolean isDecayedInCalorimeter()
+ {
+ return (simulatorStatus & (1 << BITDecayedInCalorimeter)) != 0;
+ }
+
+ public boolean isCreatedInSimulation()
+ {
+ return (simulatorStatus & (1 << BITCreatedInSimulation)) != 0;
+ }
+
+ public boolean isBackscatter()
+ {
+ return (simulatorStatus & (1 << BITBackscatter)) != 0;
+ }
+
+ public boolean hasLeftDetector()
+ {
+ return (simulatorStatus & (1 << BITLeftDetector)) != 0;
+ }
+
+ public int getValue()
+ {
+ return simulatorStatus;
+ }
+
+ // define the bit positions for the simulation flag
+ private final static int BITEndpoint = 31;
+ private final static int BITCreatedInSimulation = 30;
+ private final static int BITBackscatter = 29;
+ private final static int BITVertexIsNotEndpointOfParent = 28;
+ private final static int BITDecayedInTracker = 27;
+ private final static int BITDecayedInCalorimeter = 26;
+ private final static int BITLeftDetector = 25;
+ private final static int BITStopped = 24;
+ }
}
lcsim/src/org/lcsim/util/lcio
diff -u -r1.10 -r1.11
--- SIOSimCalorimeterHit.java 23 May 2008 22:36:33 -0000 1.10
+++ SIOSimCalorimeterHit.java 24 Aug 2011 18:51:18 -0000 1.11
@@ -2,25 +2,24 @@
import hep.io.sio.SIOInputStream;
import hep.io.sio.SIOOutputStream;
-import hep.io.sio.SIORef;
import java.io.IOException;
+import java.util.ArrayList;
-import org.lcsim.event.MCParticle;
-import org.lcsim.event.SimCalorimeterHit;
import org.lcsim.event.EventHeader.LCMetaData;
+import org.lcsim.event.SimCalorimeterHit;
import org.lcsim.event.base.BaseSimCalorimeterHit;
/**
- *
* @author Tony Johnson
- * @version $Id: SIOSimCalorimeterHit.java,v 1.10 2008/05/23 22:36:33 jeremy Exp $
+ * @author Jeremy McCormick
+ * @version $Id: SIOSimCalorimeterHit.java,v 1.11 2011/08/24 18:51:18 jeremy Exp $
*/
public class SIOSimCalorimeterHit extends BaseSimCalorimeterHit
{
// constructor from LCIO data file
SIOSimCalorimeterHit(SIOInputStream in, int flags, int version, LCMetaData meta) throws IOException
- {
+ {
this.meta = meta;
int cellid0 = in.readInt();
int cellid1 = 0;
@@ -42,6 +41,7 @@
particle = new Object[nContributions];
energyContrib = new float[nContributions];
times = new float[nContributions];
+ steps = new ArrayList();
boolean hasPDG = LCIOUtil.bitTest(flags,LCIOConstants.CHBIT_PDG);
if (hasPDG) pdg = new int[nContributions];
@@ -50,11 +50,25 @@
particle[i] = in.readPntr();
energyContrib[i] = in.readFloat();
times[i] = in.readFloat();
- if (hasPDG) pdg[i] = in.readInt();
+ if (hasPDG)
+ {
+ pdg[i] = in.readInt();
+ if(version > 1051)
+ {
+ float[] st = new float[3];
+ st[0] = in.readFloat();
+ st[1] = in.readFloat();
+ st[2] = in.readFloat();
+ steps.add(st);
+ }
+
+ }
}
if ( version > 1000 ) in.readPTag(this);
}
+ static private float emptyPos[] = new float[3];
+
static void write(SimCalorimeterHit hit, SIOOutputStream out, int flags) throws IOException
{
long cellID = hit.getCellID();
@@ -78,7 +92,15 @@
out.writePntr(hit.getMCParticle(i));
out.writeFloat((float) hit.getContributedEnergy(i));
out.writeFloat((float) hit.getContributedTime(i));
- if (hasPDG) out.writeInt(hit.getPDG(i));
+ if (hasPDG)
+ {
+ out.writeInt(hit.getPDG(i));
+ float[] st = hit.getStepPosition(i);
+ if (st == null) st = emptyPos;
+ out.writeFloat(st[0]);
+ out.writeFloat(st[1]);
+ out.writeFloat(st[2]);
+ }
}
out.writePTag(hit);
}
lcsim/src/org/lcsim/util/lcio
diff -u -r1.15 -r1.16
--- SIOSimTrackerHit.java 19 Jan 2011 20:44:05 -0000 1.15
+++ SIOSimTrackerHit.java 24 Aug 2011 18:51:18 -0000 1.16
@@ -12,8 +12,10 @@
import org.lcsim.event.EventHeader.LCMetaData;
/**
+ * The SIO implementation of {@link org.lcsim.event.SimTrackerHit}.
* @author Tony Johnson
- * @version $Id: SIOSimTrackerHit.java,v 1.15 2011/01/19 20:44:05 mgraham Exp $
+ * @author Jeremy McCormick
+ * @version $Id: SIOSimTrackerHit.java,v 1.16 2011/08/24 18:51:18 jeremy Exp $
*/
class SIOSimTrackerHit extends BaseSimTrackerHit
{
@@ -22,7 +24,19 @@
SIOSimTrackerHit(SIOInputStream in, int flags, int version, LCMetaData meta) throws IOException
{
this.meta = meta;
- cellID = in.readInt();
+
+ // Cell ID.
+ int cellID0 = in.readInt();
+ int cellID1 = 0;
+ if(version >= 1060)
+ {
+ if(LCIOUtil.bitTest(flags, LCIOConstants.THBIT_ID1))
+ {
+ cellID1 = in.readInt();
+ }
+ }
+ this.id = ((long) cellID1) << 32 | cellID0;
+
position[0] = in.readDouble();
position[1] = in.readDouble();
position[2] = in.readDouble();
@@ -64,7 +78,13 @@
static void write(SimTrackerHit hit, SIOOutputStream out, int flags) throws IOException
{
- out.writeInt(hit.getCellID());
+ // Cell ID.
+ long cellID = hit.getCellID64();
+ out.writeInt((int) cellID);
+ if (LCIOUtil.bitTest(flags, LCIOConstants.THBIT_ID1))
+ {
+ out.writeInt((int) (cellID >> 32));
+ }
double[] pos = hit.getPoint();
out.writeDouble(pos[0]);
lcsim/src/org/lcsim/util/lcio
diff -u -r1.3 -r1.4
--- SIOTrackerHit.java 9 Nov 2010 22:26:00 -0000 1.3
+++ SIOTrackerHit.java 24 Aug 2011 18:51:18 -0000 1.4
@@ -12,7 +12,8 @@
/**
*
* @author Tony Johnson
- * @version $Id: SIOTrackerHit.java,v 1.3 2010/11/09 22:26:00 jeremy Exp $
+ * @author Jeremy McCormick
+ * @version $Id: SIOTrackerHit.java,v 1.4 2011/08/24 18:51:18 jeremy Exp $
*/
class SIOTrackerHit implements TrackerHit
{
@@ -25,12 +26,26 @@
private float time;
private float edepError;
private int quality;
+ private long id;
SIOTrackerHit(SIOInputStream in, int flags, int version) throws IOException
{
+ // Cell ID.
+ if(version >= 1060)
+ {
+ int cellID0 = in.readInt();
+ int cellID1 = 0;
+ if( (flags & (1 << LCIOConstants.THBIT_ID1)) != 0 )
+ {
+ cellID1 = in.readInt();
+ }
+ id = ((long) cellID1) << 32 | cellID0;
+ }
+
type = in.readInt();
for (int i = 0; i < 3; i++)
position[i] = in.readDouble();
+
for (int i = 0; i < 6; i++)
covMatrix[i] = in.readFloat();
@@ -63,6 +78,42 @@
in.readPTag(this);
}
+
+ static void write(TrackerHit hit, SIOOutputStream out, int flags) throws IOException
+ {
+ // Cell ID.
+ long cellID = hit.getCellID();
+ out.writeInt((int) cellID);
+ if (LCIOUtil.bitTest(flags, LCIOConstants.THBIT_ID1))
+ {
+ out.writeInt((int) (cellID >> 32));
+ }
+
+ out.writeInt(hit.getType());
+
+ double[] pos = hit.getPosition();
+ for (int i = 0; i < 3; i++)
+ out.writeDouble(pos[i]);
+
+ double[] matrix = hit.getCovMatrix();
+ for (int i = 0; i < 6; i++)
+ out.writeFloat((float) matrix[i]);
+
+ out.writeFloat((float) hit.getdEdx());
+ out.writeFloat((float) hit.getEdepError());
+ out.writeFloat((float) hit.getTime());
+ out.writeInt((int) hit.getQuality());
+
+ List rawHits = hit.getRawHits() ;
+ out.writeInt( rawHits.size()) ;
+ for (int i = 0; i < rawHits.size() ; i++)
+ {
+ out.writePntr( rawHits.get(i) );
+ }
+
+ out.writePTag(hit);
+ }
+
public List getRawHits()
{
if (rawHits == null && tempHits != null)
@@ -76,6 +127,11 @@
}
return rawHits;
}
+
+ public long getCellID()
+ {
+ return id;
+ }
public double getdEdx()
{
@@ -110,30 +166,5 @@
public int getQuality()
{
return quality;
- }
-
- static void write(TrackerHit hit, SIOOutputStream out, int flags) throws IOException
- {
- out.writeInt(hit.getType());
- double[] pos = hit.getPosition();
- for (int i = 0; i < 3; i++)
- out.writeDouble(pos[i]);
-
- double[] matrix = hit.getCovMatrix();
- for (int i = 0; i < 6; i++)
- out.writeFloat((float) matrix[i]);
- out.writeFloat((float) hit.getdEdx());
- out.writeFloat((float) hit.getEdepError());
- out.writeFloat((float) hit.getTime());
- out.writeInt((int) hit.getQuality());
-
- List rawHits = hit.getRawHits() ;
- out.writeInt( rawHits.size()) ;
- for (int i = 0; i < rawHits.size() ; i++)
- {
- out.writePntr( rawHits.get(i) );
- }
-
- out.writePTag(hit);
- }
-}
+ }
+ }
CVSspam 0.2.8