Print

Print


Commit in lcsim/src/org/lcsim/contrib/onoprien/vsegment on MAIN
ExampleDriverSiD01.java+3-31.2 -> 1.3
ExampleDriverSiD02.java+3-31.1 -> 1.2
algorithm/HitMakerSmear.java+4-41.2 -> 1.3
geom/SegmentationManager.java+6-61.4 -> 1.5
process/CalibrationDriver.java+1-21.2 -> 1.3
       /ChargeCollectionDriver.java+1-21.5 -> 1.6
       /ClusteringDriver.java+1-21.4 -> 1.5
       /DigitizationDriver.java+1-21.3 -> 1.4
       /HelicalTrackHitConverter.java+4-41.1 -> 1.2
       /NoiseGenerationDriver.java+1-21.3 -> 1.4
       /ReadoutSimulationDriver.java+1-21.3 -> 1.4
mctruth/MCTruthDriverVS.java+87added 1.1
       /MCTruthVS.java+157added 1.1
       /MCTruth.java-1271.4 removed
       /MCTruthDriver.java-491.2 removed
+270-208
2 added + 2 removed + 11 modified, total 15 files
Refactoring and enhancements to MCTruth

lcsim/src/org/lcsim/contrib/onoprien/vsegment
ExampleDriverSiD01.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- ExampleDriverSiD01.java	21 Oct 2008 01:01:07 -0000	1.2
+++ ExampleDriverSiD01.java	4 Nov 2008 02:18:03 -0000	1.3
@@ -12,7 +12,7 @@
 import org.lcsim.contrib.onoprien.vsegment.geom.Segmenter;
 import org.lcsim.contrib.onoprien.vsegment.geom.Sensor;
 import org.lcsim.contrib.onoprien.vsegment.hit.ITrackerHit;
-import org.lcsim.contrib.onoprien.vsegment.mctruth.MCTruthDriver;
+import org.lcsim.contrib.onoprien.vsegment.mctruth.MCTruthDriverVS;
 import org.lcsim.contrib.onoprien.vsegment.process.CalibrationDriver;
 import org.lcsim.contrib.onoprien.vsegment.process.Calibrator;
 import org.lcsim.contrib.onoprien.vsegment.process.ChargeCollectionDriver;
@@ -31,7 +31,7 @@
  *
  *
  * @author D. Onoprienko
- * @version $Id: ExampleDriverSiD01.java,v 1.2 2008/10/21 01:01:07 onoprien Exp $
+ * @version $Id: ExampleDriverSiD01.java,v 1.3 2008/11/04 02:18:03 onoprien Exp $
  */
 public class ExampleDriverSiD01 extends VSDriver {
 
@@ -45,7 +45,7 @@
     String nameTrackerPulses =   "VSTrackerPulses";    // ITrackerPulse
     String nameTrackerClusters = "VSTrackerClusters";  // ITrackerHit
 
-    add(new MCTruthDriver());
+    add(new MCTruthDriverVS());
     
     // -- Segmentation description :  ------------------------------------------
     

lcsim/src/org/lcsim/contrib/onoprien/vsegment
ExampleDriverSiD02.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- ExampleDriverSiD02.java	21 Oct 2008 19:51:50 -0000	1.1
+++ ExampleDriverSiD02.java	4 Nov 2008 02:18:03 -0000	1.2
@@ -12,7 +12,7 @@
 import org.lcsim.contrib.onoprien.vsegment.geom.Segmenter;
 import org.lcsim.contrib.onoprien.vsegment.geom.Sensor;
 import org.lcsim.contrib.onoprien.vsegment.hit.ITrackerHit;
-import org.lcsim.contrib.onoprien.vsegment.mctruth.MCTruthDriver;
+import org.lcsim.contrib.onoprien.vsegment.mctruth.MCTruthDriverVS;
 import org.lcsim.contrib.onoprien.vsegment.process.CalibrationDriver;
 import org.lcsim.contrib.onoprien.vsegment.process.Calibrator;
 import org.lcsim.contrib.onoprien.vsegment.process.ChargeCollectionDriver;
@@ -31,7 +31,7 @@
  *
  *
  * @author D. Onoprienko
- * @version $Id: ExampleDriverSiD02.java,v 1.1 2008/10/21 19:51:50 onoprien Exp $
+ * @version $Id: ExampleDriverSiD02.java,v 1.2 2008/11/04 02:18:03 onoprien Exp $
  */
 public class ExampleDriverSiD02 extends VSDriver {
 
@@ -45,7 +45,7 @@
     String nameTrackerPulses =   "VSTrackerPulses";    // ITrackerPulse
     String nameTrackerClusters = "VSTrackerClusters";  // ITrackerHit
 
-    add(new MCTruthDriver());
+    add(new MCTruthDriverVS());
     
     // -- Segmentation description :  ------------------------------------------
     

lcsim/src/org/lcsim/contrib/onoprien/vsegment/algorithm
HitMakerSmear.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- HitMakerSmear.java	21 Oct 2008 00:53:47 -0000	1.2
+++ HitMakerSmear.java	4 Nov 2008 02:18:03 -0000	1.3
@@ -12,8 +12,8 @@
 import org.lcsim.contrib.onoprien.vsegment.hit.VSTrackerHit;
 import org.lcsim.contrib.onoprien.vsegment.hit.VSTrackerHitGeneric;
 import org.lcsim.contrib.onoprien.vsegment.hit.VSTrackerPulse;
-import org.lcsim.contrib.onoprien.vsegment.mctruth.MCTruth;
-import org.lcsim.contrib.onoprien.vsegment.mctruth.MCTruthDriver;
+import org.lcsim.contrib.onoprien.vsegment.mctruth.MCTruthVS;
+import org.lcsim.contrib.onoprien.vsegment.mctruth.MCTruthDriverVS;
 import org.lcsim.contrib.onoprien.vsegment.process.VSEvent;
 import org.lcsim.contrib.onoprien.vsegment.process.VSEventListener;
 import org.lcsim.contrib.onoprien.vsegment.transform.ConstHep3Vector;
@@ -34,7 +34,7 @@
  * fixed direction is always zero.
  *
  * @author D. Onoprienko
- * @version $Id: HitMakerSmear.java,v 1.2 2008/10/21 00:53:47 onoprien Exp $
+ * @version $Id: HitMakerSmear.java,v 1.3 2008/11/04 02:18:03 onoprien Exp $
  */
 public class HitMakerSmear extends HitMakerAbstract implements VSEventListener {
   
@@ -79,7 +79,7 @@
     
     // Compute channel average position, and compile a set of SimTrackerHits that contributed :
     
-    MCTruth mcTruth = _segMan.getMCTruth();
+    MCTruthVS mcTruth = _segMan.getMCTruth();
     Set<SimTrackerHit> simHits = new HashSet<SimTrackerHit>();
     double[] posP = new double[3];
     double sP = 0.;

lcsim/src/org/lcsim/contrib/onoprien/vsegment/geom
SegmentationManager.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- SegmentationManager.java	21 Oct 2008 00:53:47 -0000	1.4
+++ SegmentationManager.java	4 Nov 2008 02:18:03 -0000	1.5
@@ -20,7 +20,7 @@
 import org.lcsim.recon.cat.util.NoSuchParameterException;
 import org.lcsim.util.Driver;
 
-import org.lcsim.contrib.onoprien.vsegment.mctruth.MCTruth;
+import org.lcsim.contrib.onoprien.vsegment.mctruth.MCTruthVS;
 import org.lcsim.contrib.onoprien.vsegment.process.VSEvent;
 import org.lcsim.contrib.onoprien.vsegment.process.VSEventListener;
 
@@ -45,7 +45,7 @@
  * method in the future.
  *
  * @author D.Onoprienko
- * @version $Id: SegmentationManager.java,v 1.4 2008/10/21 00:53:47 onoprien Exp $
+ * @version $Id: SegmentationManager.java,v 1.5 2008/11/04 02:18:03 onoprien Exp $
  */
 public class SegmentationManager extends Driver implements ConditionsListener {
   
@@ -196,9 +196,9 @@
   }
   
   /**
-   * Returns <tt>MCTruth</tt> for the current event.
+   * Returns <tt>MCTruthVS</tt> for the current event.
    */
-  public MCTruth getMCTruth() {
+  public MCTruthVS getMCTruth() {
     return _mcTruth;
   }
   
@@ -226,7 +226,7 @@
     }
     
     try {
-      _mcTruth = (MCTruth) event.get("MCTruth");
+      _mcTruth = (MCTruthVS) event.get(MCTruthVS.KEY);
     } catch (IllegalArgumentException x) {
       _mcTruth = null;
     }
@@ -357,7 +357,7 @@
   
   private Segmenter _segmenter;
   private Navigator _navigator;
-  private MCTruth _mcTruth;
+  private MCTruthVS _mcTruth;
   private Random _random;
   
   private boolean _createSensorsOnDetectorChange;

lcsim/src/org/lcsim/contrib/onoprien/vsegment/process
CalibrationDriver.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- CalibrationDriver.java	21 Oct 2008 00:53:47 -0000	1.2
+++ CalibrationDriver.java	4 Nov 2008 02:18:03 -0000	1.3
@@ -12,13 +12,12 @@
 import org.lcsim.contrib.onoprien.vsegment.hit.TrackerHitMap;
 import org.lcsim.contrib.onoprien.vsegment.hit.VSRawTrackerHit;
 import org.lcsim.contrib.onoprien.vsegment.hit.VSTrackerPulse;
-import org.lcsim.contrib.onoprien.vsegment.mctruth.MCTruth;
 
 /**
  *
  *
  * @author D. Onoprienko
- * @version $Id: CalibrationDriver.java,v 1.2 2008/10/21 00:53:47 onoprien Exp $
+ * @version $Id: CalibrationDriver.java,v 1.3 2008/11/04 02:18:03 onoprien Exp $
  */
 public class CalibrationDriver extends VSDriver implements VSEventListener {
 

lcsim/src/org/lcsim/contrib/onoprien/vsegment/process
ChargeCollectionDriver.java 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- ChargeCollectionDriver.java	21 Oct 2008 00:53:47 -0000	1.5
+++ ChargeCollectionDriver.java	4 Nov 2008 02:18:03 -0000	1.6
@@ -15,7 +15,6 @@
 import org.lcsim.contrib.onoprien.vsegment.geom.Sensor;
 import org.lcsim.contrib.onoprien.vsegment.hit.TrackerHitMap;
 import org.lcsim.contrib.onoprien.vsegment.hit.VSRawTrackerData;
-import org.lcsim.contrib.onoprien.vsegment.mctruth.MCTruth;
 
 /**
  * Driver that handles conversion of {@link SimTrackerHit} objects into a collection of 
@@ -30,7 +29,7 @@
  * 
  * 
  * @author D.Onoprienko
- * @version $Id: ChargeCollectionDriver.java,v 1.5 2008/10/21 00:53:47 onoprien Exp $
+ * @version $Id: ChargeCollectionDriver.java,v 1.6 2008/11/04 02:18:03 onoprien Exp $
  */
 public class ChargeCollectionDriver extends VSDriver implements VSEventListener {
   

lcsim/src/org/lcsim/contrib/onoprien/vsegment/process
ClusteringDriver.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- ClusteringDriver.java	24 Oct 2008 04:09:13 -0000	1.4
+++ ClusteringDriver.java	4 Nov 2008 02:18:03 -0000	1.5
@@ -12,13 +12,12 @@
 import org.lcsim.contrib.onoprien.vsegment.hit.VSTrackerHit;
 import org.lcsim.contrib.onoprien.vsegment.hit.TrackerHitMap;
 import org.lcsim.contrib.onoprien.vsegment.hit.VSTrackerPulse;
-import org.lcsim.contrib.onoprien.vsegment.mctruth.MCTruth;
 
 /**
  * Driver that handles clustering of tracker pulses.
  *
  * @author D. Onoprienko
- * @version $Id: ClusteringDriver.java,v 1.4 2008/10/24 04:09:13 onoprien Exp $
+ * @version $Id: ClusteringDriver.java,v 1.5 2008/11/04 02:18:03 onoprien Exp $
  */
 public class ClusteringDriver extends VSDriver implements VSEventListener {
 

lcsim/src/org/lcsim/contrib/onoprien/vsegment/process
DigitizationDriver.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- DigitizationDriver.java	21 Oct 2008 00:53:47 -0000	1.3
+++ DigitizationDriver.java	4 Nov 2008 02:18:03 -0000	1.4
@@ -12,13 +12,12 @@
 import org.lcsim.contrib.onoprien.vsegment.hit.TrackerHitMap;
 import org.lcsim.contrib.onoprien.vsegment.hit.VSRawTrackerHit;
 import org.lcsim.contrib.onoprien.vsegment.hit.VSRawTrackerData;
-import org.lcsim.contrib.onoprien.vsegment.mctruth.MCTruth;
 
 /**
  *
  *
  * @author D. Onoprienko
- * @version $Id: DigitizationDriver.java,v 1.3 2008/10/21 00:53:47 onoprien Exp $
+ * @version $Id: DigitizationDriver.java,v 1.4 2008/11/04 02:18:03 onoprien Exp $
  */
 public class DigitizationDriver extends VSDriver implements VSEventListener {
 

lcsim/src/org/lcsim/contrib/onoprien/vsegment/process
HelicalTrackHitConverter.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- HelicalTrackHitConverter.java	24 Oct 2008 04:09:13 -0000	1.1
+++ HelicalTrackHitConverter.java	4 Nov 2008 02:18:03 -0000	1.2
@@ -35,7 +35,7 @@
 import org.lcsim.contrib.onoprien.vsegment.hit.ITrackerHit;
 import org.lcsim.contrib.onoprien.vsegment.hit.TrackerHitMap;
 import org.lcsim.contrib.onoprien.vsegment.hit.VSTrackerHit;
-import org.lcsim.contrib.onoprien.vsegment.mctruth.MCTruth;
+import org.lcsim.contrib.onoprien.vsegment.mctruth.MCTruthVS;
 import org.lcsim.contrib.onoprien.vsegment.transform.ConstHep3Vector;
 import org.lcsim.contrib.onoprien.vsegment.transform.IRefFrame;
 
@@ -44,7 +44,7 @@
  * required by <tt>seedtracker</tt> package.
  *
  * @author D. Onoprienko
- * @version $Id: HelicalTrackHitConverter.java,v 1.1 2008/10/24 04:09:13 onoprien Exp $
+ * @version $Id: HelicalTrackHitConverter.java,v 1.2 2008/11/04 02:18:03 onoprien Exp $
  */
 public class HelicalTrackHitConverter extends VSDriver {
   
@@ -112,7 +112,7 @@
         super.process(event);
         
         if (_segman == null) _segman = (SegmentationManager) event.get("SegmentationManager");
-        _mcTruth = (MCTruth) event.get("MCTruth");
+        _mcTruth = (MCTruthVS) event.get(MCTruthVS.KEY);
 
         //  Initialize the list of HelicalTrackHits and vector with local z direction
         List<HelicalTrackHit> helhits = new ArrayList<HelicalTrackHit>();
@@ -269,5 +269,5 @@
   protected String _hitRelName;
   protected String _mcRelName;
   
-  private MCTruth _mcTruth;
+  private MCTruthVS _mcTruth;
 }

lcsim/src/org/lcsim/contrib/onoprien/vsegment/process
NoiseGenerationDriver.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- NoiseGenerationDriver.java	21 Oct 2008 00:53:47 -0000	1.3
+++ NoiseGenerationDriver.java	4 Nov 2008 02:18:03 -0000	1.4
@@ -12,13 +12,12 @@
 import org.lcsim.contrib.onoprien.vsegment.geom.SensorType;
 import org.lcsim.contrib.onoprien.vsegment.hit.TrackerHitMap;
 import org.lcsim.contrib.onoprien.vsegment.hit.VSRawTrackerData;
-import org.lcsim.contrib.onoprien.vsegment.mctruth.MCTruth;
 
 /**
  *
  *
  * @author D. Onoprienko
- * @version $Id: NoiseGenerationDriver.java,v 1.3 2008/10/21 00:53:47 onoprien Exp $
+ * @version $Id: NoiseGenerationDriver.java,v 1.4 2008/11/04 02:18:03 onoprien Exp $
  */
 public class NoiseGenerationDriver extends VSDriver implements VSEventListener {
   

lcsim/src/org/lcsim/contrib/onoprien/vsegment/process
ReadoutSimulationDriver.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ReadoutSimulationDriver.java	21 Oct 2008 00:53:47 -0000	1.3
+++ ReadoutSimulationDriver.java	4 Nov 2008 02:18:03 -0000	1.4
@@ -13,7 +13,6 @@
 import org.lcsim.contrib.onoprien.vsegment.hit.VSRawTrackerHit;
 import org.lcsim.contrib.onoprien.vsegment.hit.TrackerHitMap;
 import org.lcsim.contrib.onoprien.vsegment.hit.VSRawTrackerData;
-import org.lcsim.contrib.onoprien.vsegment.mctruth.MCTruth;
 
 /**
  * "Shortcut" Driver that handles conversion of {@link VSRawTrackerData} into {@link VSTrackerPulse},
@@ -21,7 +20,7 @@
  * 
  * 
  * @author D.Onoprienko
- * @version $Id: ReadoutSimulationDriver.java,v 1.3 2008/10/21 00:53:47 onoprien Exp $
+ * @version $Id: ReadoutSimulationDriver.java,v 1.4 2008/11/04 02:18:03 onoprien Exp $
  */
 public class ReadoutSimulationDriver extends VSDriver {
   

lcsim/src/org/lcsim/contrib/onoprien/vsegment/mctruth
MCTruthDriverVS.java added at 1.1
diff -N MCTruthDriverVS.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ MCTruthDriverVS.java	4 Nov 2008 02:18:03 -0000	1.1
@@ -0,0 +1,87 @@
+package org.lcsim.contrib.onoprien.vsegment.mctruth;
+
+import java.util.*;
+
+import org.lcsim.event.EventHeader;
+import org.lcsim.recon.cat.util.NoSuchParameterException;
+import org.lcsim.util.Driver;
+
+import org.lcsim.contrib.onoprien.vsegment.geom.Sensor;
+import org.lcsim.contrib.onoprien.vsegment.process.VSDriver;
+
+/**
+ * If this driver is added to the processing chain, an {@link MCTruthVS} object will
+ * be created and put into the event. This object can later be retrieved by other
+ * drivers through a call to <tt>event.get("MCTruthVS")</tt>, and used to access Monte
+ * Carlo truth information. Some drivers, like <tt>DigitizationDriver</tt>, will 
+ * automatically check for the presence of an <tt>MCTruthVS</tt> object in the event,
+ * and if present, they will use it to store relations between objects they create
+ * and objects created by the simulator, like <tt>MCParticles</tt> and <tt>SimTrackerHits</tt>.
+ * 
+ * 
+ * 
+ * @author D. Onoprienko
+ * @version $Id: MCTruthDriverVS.java,v 1.1 2008/11/04 02:18:03 onoprien Exp $
+ */
+public class MCTruthDriverVS extends VSDriver {
+  
+// -- Constructors :  ----------------------------------------------------------
+  
+  public MCTruthDriverVS() {
+  }
+
+  
+// -- Setters :  ---------------------------------------------------------------
+  
+  /**
+   * 
+   * Set any parameter. 
+   * The following parameters can be set with this method:
+   * <p><dl>
+   * <dt>"TRACKER_CLUSTER_MAP_NAMES"</dt> <dd>One or more names of <tt>TrackerHitMap&lt;Sensor,VSTrackerHit&gt;</tt>
+   *             in the event record that contain tracker clusters. {@link MCTruthVS} methods that look up
+   *             tracker clusters by {@link MCParticle} or {@link SimTrackerHit} will only return clusters 
+   *             contained in the specified maps.<br>
+   *             Default: <tt>null</tt> (must be specified before this driver can be used).</dd></dl>
+   * 
+   * 
+   * @param name   Name of parameter to be set. Case is ignored.
+   * @param values  List of values to be used for setting the parameter.
+   * @throws NoSuchParameterException Thrown if the supplied parameter name is unknown.
+   * @throws IllegalArgumentException Thrown if incorrect nunber of values, or a value
+   *                                  of incorrect type is supplied.
+   */
+  public void set(String name, Object... values) {
+    Object value = values.length == 0 ? null : values[0];
+    try {
+      if (name.equalsIgnoreCase("TRACKER_CLUSTER_MAP_NAMES")) {
+        _trackerClusterNames = new ArrayList<String>(values.length);
+        for (Object v : values) _trackerClusterNames.add((String)v);
+      } else {
+        super.set(name, values);
+      }
+    } catch (ClassCastException x) {
+      throw new IllegalArgumentException(ERR_VIT, x);
+    }
+  }
+
+
+// -- Event processing :  ------------------------------------------------------
+  
+  /** Process event. */
+  public void process(EventHeader event) {
+    
+    // Process children if any
+    
+    super.process(event);
+    
+    // Create MCTruthVS object and attach it to the event
+    
+    MCTruthVS mcTruth = new MCTruthVS(this, event);
+    event.put(MCTruthVS.KEY, mcTruth);
+  }
+  
+// -- Private parts :  ---------------------------------------------------------
+  
+  ArrayList<String> _trackerClusterNames;
+}

lcsim/src/org/lcsim/contrib/onoprien/vsegment/mctruth
MCTruthVS.java added at 1.1
diff -N MCTruthVS.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ MCTruthVS.java	4 Nov 2008 02:18:03 -0000	1.1
@@ -0,0 +1,157 @@
+package org.lcsim.contrib.onoprien.vsegment.mctruth;
+
+import java.util.*;
+
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.MCParticle;
+import org.lcsim.event.RelationalTable;
+import org.lcsim.event.SimTrackerHit;
+import org.lcsim.event.base.BaseRelationalTable;
+
+import org.lcsim.contrib.onoprien.vsegment.geom.Sensor;
+import org.lcsim.contrib.onoprien.vsegment.hit.TrackerHitMap;
+import org.lcsim.contrib.onoprien.vsegment.hit.VSRawTrackerData;
+import org.lcsim.contrib.onoprien.vsegment.hit.VSRawTrackerHit;
+import org.lcsim.contrib.onoprien.vsegment.hit.VSTrackerPulse;
+import org.lcsim.contrib.onoprien.vsegment.hit.VSTrackerHit;
+
+/**
+ * An object of this class provides convenient access to Monte Carlo truth information.
+ * In order for this object to be created, an instance of {@link MCTruthDriverVS} should
+ * be added to the processing chain (usually as the first driver).
+ * 
+ * 
+ * 
+ * @author D. Onoprienko
+ * @version $Id: MCTruthVS.java,v 1.1 2008/11/04 02:18:03 onoprien Exp $
+ */
+public class MCTruthVS {
+  
+  /** Name of {@link MCTruthVS} object in the event record: "MCTruthVS". */
+  static public final String KEY = "MCTruthVS";
+  
+// -- Constructors and initialization :  ---------------------------------------
+  
+  MCTruthVS(MCTruthDriverVS mcTruthDriver, EventHeader event) {
+    _mcDriver = mcTruthDriver;
+    _event = event;
+  }
+  
+// -- Getting SimTrackerHits from which the object was produced :  -------------
+  
+  /**
+   * Returns a list of <tt>SimTrackerHits</tt> that contributed to the specified <tt>VSRawTrackerHit</tt>. 
+   */
+  public List<SimTrackerHit> getSimTrackerHits(VSRawTrackerHit hit) {
+    if (_rth2sth == null) {
+      VSRawTrackerData rawData = hit.getRawData();
+      if (rawData == null) {
+        return Collections.emptyList();
+      } else {
+        return rawData.getSimTrackerHits();
+      }
+    } else {
+      return new ArrayList<SimTrackerHit>(_rth2sth.allFrom(hit));
+    }
+  }
+
+  /**
+   * Returns a list of <tt>SimTrackerHits</tt> that contributed to the specified <tt>VSTrackerPulse</tt>. 
+   */
+  public List<SimTrackerHit> getSimTrackerHits(VSTrackerPulse pulse) {
+    if (_tp2sth == null) {
+      VSRawTrackerHit hit = pulse.getRawTrackerHit();
+      if (hit == null) {
+        return Collections.emptyList();
+      } else {
+        return getSimTrackerHits(hit);
+      }
+    } else {
+      return new ArrayList<SimTrackerHit>(_tp2sth.allFrom(pulse));
+    }
+  }
+  
+  /**
+   * Returns a list of <tt>SimTrackerHits</tt> that contributed to the specified <tt>VSTrackerHit</tt>. 
+   */
+  public List<SimTrackerHit> getSimTrackerHits(VSTrackerHit hit) {
+    if (_th2sth == null) {
+      List<VSTrackerPulse> pulses = hit.getPulses();
+      if (pulses == null || pulses.isEmpty()) {
+        return Collections.emptyList();
+      } else {
+        Set<SimTrackerHit> simHits = new HashSet<SimTrackerHit>();
+        for (VSTrackerPulse pulse : pulses) {
+          simHits.addAll(getSimTrackerHits(pulse));
+        }
+        return new ArrayList<SimTrackerHit>(simHits);
+      }
+    } else {
+      return new ArrayList<SimTrackerHit>(_th2sth.allFrom(hit));
+    }
+  }
+
+  
+// -- Getting MCParticles :  ---------------------------------------------------
+  
+  public List<MCParticle> getMCParticles(VSTrackerHit hit) {
+    List<SimTrackerHit> simHits = getSimTrackerHits(hit);
+    HashSet<MCParticle> mcSet = new HashSet<MCParticle>();
+    for (SimTrackerHit simHit : simHits) mcSet.add(simHit.getMCParticle());
+    return new ArrayList<MCParticle> (mcSet);
+  }
+
+
+// -- Looking up tracking objects by MCParticle :  -----------------------------
+  
+  public List<VSTrackerHit> getTrackerClusters(MCParticle mcParticle) {
+    if (_mc2th == null) {
+      _mc2th = new BaseRelationalTable<MCParticle, VSTrackerHit>(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
+      Object o;
+      for (String mapName : _mcDriver._trackerClusterNames) {
+        try {
+          o = _event.get(mapName);
+        } catch (RuntimeException x) {
+          continue;
+        }
+        TrackerHitMap<Sensor,VSTrackerHit> map = (TrackerHitMap<Sensor,VSTrackerHit>) o;
+        for (VSTrackerHit cluster : map.hitList()) {
+          List<MCParticle> mcList = getMCParticles(cluster);
+          for (MCParticle mc : mcList) {
+            _mc2th.add(mc, cluster);
+          }
+        }
+      }
+    }
+    return new ArrayList(_mc2th.allFrom(mcParticle));
+  }
+
+  
+// -- Stereo :  ----------------------------------------------------------------
+  
+//  /**
+//   * Returns <tt>true</tt> if the hit supplied as an argument is a cross between hits
+//   * in stereo layer, and no MCParticle contributed to both of its parent clusters.
+//   */
+//  public boolean isGhost(OldTrackerHit hit) {
+//    if (! hit.isStereo()) return false;
+//    List<TrackerCluster> clusters = hit.getClusters();
+//    List<MCParticle> mcList1 = getMCParticles(clusters.get(0));
+//    List<MCParticle> mcList2 = getMCParticles(clusters.get(1));
+//    for (MCParticle mc : mcList1) {
+//      if (mcList2.contains(mc)) return false;
+//    }
+//    return true;
+//  }
+  
+// -- Private parts :  ---------------------------------------------------------
+  
+  private MCTruthDriverVS _mcDriver;
+  private EventHeader _event;
+  
+  private RelationalTable<VSRawTrackerHit, SimTrackerHit> _rth2sth;
+  private RelationalTable<VSTrackerPulse, SimTrackerHit> _tp2sth;
+  private RelationalTable<VSTrackerHit, SimTrackerHit> _th2sth;
+  
+  private RelationalTable<MCParticle, VSTrackerHit> _mc2th;
+}

lcsim/src/org/lcsim/contrib/onoprien/vsegment/mctruth
MCTruth.java removed after 1.4
diff -N MCTruth.java
--- MCTruth.java	24 Oct 2008 04:09:13 -0000	1.4
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,127 +0,0 @@
-package org.lcsim.contrib.onoprien.vsegment.mctruth;
-
-import java.util.*;
-
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.MCParticle;
-import org.lcsim.event.RelationalTable;
-import org.lcsim.event.SimTrackerHit;
-import org.lcsim.event.base.BaseRelationalTable;
-
-import org.lcsim.contrib.onoprien.vsegment.geom.Sensor;
-import org.lcsim.contrib.onoprien.vsegment.hit.VSRawTrackerData;
-import org.lcsim.contrib.onoprien.vsegment.hit.VSRawTrackerHit;
-import org.lcsim.contrib.onoprien.vsegment.hit.VSTrackerPulse;
-import org.lcsim.contrib.onoprien.vsegment.hit.VSTrackerHit;
-
-/**
- * An object of this class provides convenient access to Monte Carlo truth information.
- * In order for this object to be created, an instance of {@link MCTruthDriver} should
- * be added to the processing chain (usually as the first driver).
- *
- * @author D. Onoprienko
- * @version $Id: MCTruth.java,v 1.4 2008/10/24 04:09:13 onoprien Exp $
- */
-public class MCTruth {
-  
-// -- Constructors and initialization :  ---------------------------------------
-  
-  MCTruth(MCTruthDriver mcTruthDriver, EventHeader event) {
-    _mcDriver = mcTruthDriver;
-    _event = event;
-  }
-  
-// -- Getting SimTrackerHits from which the object was produced :  -------------
-  
-  /**
-   * Returns a list of <tt>SimTrackerHits</tt> that contributed to the specified <tt>VSRawTrackerHit</tt>. 
-   */
-  public List<SimTrackerHit> getSimTrackerHits(VSRawTrackerHit hit) {
-    if (_rth2sth == null) {
-      VSRawTrackerData rawData = hit.getRawData();
-      if (rawData == null) {
-        return Collections.emptyList();
-      } else {
-        return rawData.getSimTrackerHits();
-      }
-    } else {
-      return new ArrayList<SimTrackerHit>(_rth2sth.allFrom(hit));
-    }
-  }
-
-  /**
-   * Returns a list of <tt>SimTrackerHits</tt> that contributed to the specified <tt>VSTrackerPulse</tt>. 
-   */
-  public List<SimTrackerHit> getSimTrackerHits(VSTrackerPulse pulse) {
-    if (_tp2sth == null) {
-      VSRawTrackerHit hit = pulse.getRawTrackerHit();
-      if (hit == null) {
-        return Collections.emptyList();
-      } else {
-        return getSimTrackerHits(hit);
-      }
-    } else {
-      return new ArrayList<SimTrackerHit>(_tp2sth.allFrom(pulse));
-    }
-  }
-  
-  /**
-   * Returns a list of <tt>SimTrackerHits</tt> that contributed to the specified <tt>VSTrackerHit</tt>. 
-   */
-  public List<SimTrackerHit> getSimTrackerHits(VSTrackerHit hit) {
-    if (_th2sth == null) {
-      List<VSTrackerPulse> pulses = hit.getPulses();
-      if (pulses == null || pulses.isEmpty()) {
-        return Collections.emptyList();
-      } else {
-        Set<SimTrackerHit> simHits = new HashSet<SimTrackerHit>();
-        for (VSTrackerPulse pulse : pulses) {
-          simHits.addAll(getSimTrackerHits(pulse));
-        }
-        return new ArrayList<SimTrackerHit>(simHits);
-      }
-    } else {
-      return new ArrayList<SimTrackerHit>(_th2sth.allFrom(hit));
-    }
-  }
-
-  
-// -- Getting MCParticles :  ---------------------------------------------------
-  
-  public List<MCParticle> getMCParticles(VSTrackerHit hit) {
-    List<SimTrackerHit> simHits = getSimTrackerHits(hit);
-    HashSet<MCParticle> mcSet = new HashSet<MCParticle>();
-    for (SimTrackerHit simHit : simHits) mcSet.add(simHit.getMCParticle());
-    return new ArrayList<MCParticle> (mcSet);
-  }
-
-
-// -- Looking up tracking objects by MCParticle :  -----------------------------
-
-  
-// -- Stereo :  ----------------------------------------------------------------
-  
-//  /**
-//   * Returns <tt>true</tt> if the hit supplied as an argument is a cross between hits
-//   * in stereo layer, and no MCParticle contributed to both of its parent clusters.
-//   */
-//  public boolean isGhost(OldTrackerHit hit) {
-//    if (! hit.isStereo()) return false;
-//    List<TrackerCluster> clusters = hit.getClusters();
-//    List<MCParticle> mcList1 = getMCParticles(clusters.get(0));
-//    List<MCParticle> mcList2 = getMCParticles(clusters.get(1));
-//    for (MCParticle mc : mcList1) {
-//      if (mcList2.contains(mc)) return false;
-//    }
-//    return true;
-//  }
-  
-// -- Private parts :  ---------------------------------------------------------
-  
-  private MCTruthDriver _mcDriver;
-  private EventHeader _event;
-  
-  private RelationalTable<VSRawTrackerHit, SimTrackerHit> _rth2sth;
-  private RelationalTable<VSTrackerPulse, SimTrackerHit> _tp2sth;
-  private RelationalTable<VSTrackerHit, SimTrackerHit> _th2sth;
-}

lcsim/src/org/lcsim/contrib/onoprien/vsegment/mctruth
MCTruthDriver.java removed after 1.2
diff -N MCTruthDriver.java
--- MCTruthDriver.java	15 Sep 2008 15:44:03 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,49 +0,0 @@
-package org.lcsim.contrib.onoprien.vsegment.mctruth;
-
-import java.util.*;
-
-import org.lcsim.event.EventHeader;
-import org.lcsim.recon.cat.util.NoSuchParameterException;
-import org.lcsim.util.Driver;
-
-import org.lcsim.contrib.onoprien.vsegment.geom.Sensor;
-
-/**
- * If this driver is added to the processing chain, an {@link MCTruth} object will
- * be created and put into the event. This object can later be retrieved by other
- * drivers through a call to <tt>event.get("MCTruth")</tt>, and used to access Monte
- * Carlo truth information. Some drivers, like <tt>DigitizationDriver</tt>, will 
- * automatically check for the presence of an <tt>MCTruth</tt> object in the event,
- * and if present, they will use it to store relations between objects they create
- * and objects created by the simulator, like <tt>MCParticles</tt> and <tt>SimTrackerHits</tt>.
- *
- * @author D. Onoprienko
- * @version $Id: MCTruthDriver.java,v 1.2 2008/09/15 15:44:03 onoprien Exp $
- */
-public class MCTruthDriver extends Driver {
-  
-// -- Constructors :  ----------------------------------------------------------
-  
-  public MCTruthDriver() {
-  }
-// -- Event processing :  ------------------------------------------------------
-  
-  /**
-   * Process event.
-   */
-  public void process(EventHeader event) {
-    
-    // Process children if any
-    
-    super.process(event);
-    
-    // Create MCTruth object and attach it to the event
-    
-    MCTruth mcTruth = new MCTruth(this, event);
-    event.put("MCTruth", mcTruth);
-    
-  }
-  
-// -- Private parts :  ---------------------------------------------------------
-  
-}
CVSspam 0.2.8