3 modified files
lcsim/src/org/lcsim/event
diff -u -r1.4 -r1.5
--- MCParticle.java 15 Mar 2005 05:14:09 -0000 1.4
+++ MCParticle.java 5 Aug 2005 19:19:49 -0000 1.5
@@ -5,7 +5,7 @@
import java.util.List;
/**
- *
+ * LCSim specific MC particle class.
* @author tonyj
*/
public interface MCParticle extends Particle
@@ -13,13 +13,54 @@
public List<MCParticle> getParents();
public List<MCParticle> getDaughters();
/**
- * If this event has been simulated by Geant4 this method will return
+ * If this event has been simulated by Geant4 this method will return
* the simulation status
*/
- public int getSimulatorStatus();
+ 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 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();
+
+ }
+}
lcsim/src/org/lcsim/util/event
diff -u -r1.2 -r1.3
--- LCSimFactory.java 16 Mar 2005 02:06:39 -0000 1.2
+++ LCSimFactory.java 5 Aug 2005 19:19:49 -0000 1.3
@@ -9,10 +9,12 @@
import hep.physics.vec.Hep3Vector;
import hep.physics.vec.HepLorentzVector;
import org.lcsim.event.MCParticle;
+import org.lcsim.event.MCParticle.SimulatorStatus;
public class LCSimFactory extends GeneratorFactory
{
private String detectorName;
+ private static SimulatorStatus emptySimulatorStatus = new Status();
public LCSimFactory(String detectorName)
{
this.detectorName = detectorName;
@@ -36,9 +38,9 @@
super(origin,p,ptype,status,time);
}
- public int getSimulatorStatus()
+ public SimulatorStatus getSimulatorStatus()
{
- return 0;
+ return emptySimulatorStatus;
}
public Hep3Vector getEndPoint()
@@ -60,4 +62,46 @@
}
}
}
+ 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/util/lcio
diff -u -r1.5 -r1.6
--- SIOMCParticle.java 20 Mar 2005 18:04:28 -0000 1.5
+++ SIOMCParticle.java 5 Aug 2005 19:19:49 -0000 1.6
@@ -21,7 +21,7 @@
/**
*
* @author Tony Johnson
- * @version $Id: SIOMCParticle.java,v 1.5 2005/03/20 18:04:28 tonyj Exp $
+ * @version $Id: SIOMCParticle.java,v 1.6 2005/08/05 19:19:49 tonyj Exp $
*/
class SIOMCParticle implements MCParticle
{
@@ -36,6 +36,7 @@
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
@@ -205,9 +206,9 @@
return endPoint;
}
- public int getSimulatorStatus()
+ public SimulatorStatus getSimulatorStatus()
{
- return simulatorStatus;
+ return simStatus;
}
static void write(MCParticle particle, SIOOutputStream out, int flags) throws IOException
{
@@ -223,7 +224,7 @@
out.writeInt(particle.getType().getPDGID());
out.writeInt(particle.getGeneratorStatus());
boolean hasEndPoint = !particle.getDaughters().isEmpty();
- int simStatus = particle.getSimulatorStatus();
+ int simStatus = particle.getSimulatorStatus().getValue();
simStatus = LCIOUtil.bitSet(simStatus,31,hasEndPoint);
out.writeInt(simStatus);
@@ -252,15 +253,66 @@
out.writeDouble(endpoint[1]);
out.writeDouble(endpoint[2]);
}
- }
-
+ }
+
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<<BITLeftDetector)) != 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;
+ }
}
\ No newline at end of file
CVSspam 0.2.8