lcsim/src/org/lcsim/contrib/onoprien/tracking/mctruth
diff -u -r1.1 -r1.2
--- MCTruth.java 9 Oct 2007 18:08:47 -0000 1.1
+++ MCTruth.java 9 Oct 2007 22:56:15 -0000 1.2
@@ -11,10 +11,12 @@
import org.lcsim.contrib.onoprien.tracking.hitmaking.OldTrackerHit;
/**
- *
+ * 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.1 2007/10/09 18:08:47 onoprien Exp $
+ * @version $Id: MCTruth.java,v 1.2 2007/10/09 22:56:15 onoprien Exp $
*/
public class MCTruth {
@@ -28,6 +30,10 @@
// -- Getting SimTrackerHits from which the object was produced : -------------
+ /**
+ * Returns a list of <tt>SimGroup</tt> objects containing <tt>SimTrackerHits</tt>
+ * that contributed to the given <tt>DigiTrackerHit</tt>.
+ */
public List<SimGroup> getSimGroups(DigiTrackerHit hit) {
ArrayList<SimGroup> out = new ArrayList<SimGroup>(1);
List<DigiTrackerHit> elHits= hit.getElementalHits();
@@ -38,6 +44,10 @@
return out;
}
+ /**
+ * Returns a list of <tt>SimGroup</tt> objects containing <tt>SimTrackerHits</tt>
+ * that contributed to the given <tt>TrackerCluster</tt>.
+ */
public List<SimGroup> getSimGroups(TrackerCluster cluster) {
List<SimGroup> out = null;
for (DigiTrackerHit hit : cluster.getDigiHits()) {
@@ -50,10 +60,18 @@
return out;
}
+ /**
+ * Returns a list of <tt>SimGroup</tt> objects containing <tt>SimTrackerHits</tt>
+ * that contributed to the given <tt>TrackerHit</tt>.
+ */
public List<SimGroup> getSimGroups(TrackerHit hit) {
return getSimGroups(hit.getCluster());
}
+ /**
+ * Returns a list of <tt>SimGroup</tt> objects containing <tt>SimTrackerHits</tt>
+ * that contributed to the given hit.
+ */
public List<SimGroup> getSimGroups(org.lcsim.event.TrackerHit oldHit) {
if (oldHit instanceof OldTrackerHit) {
List<SimGroup> out = null;
@@ -70,20 +88,30 @@
}
}
+ /**
+ * Returns a collection of all <tt>SimGroup</tt> objects containing <tt>SimTrackerHits</tt>
+ * that contributed to any <tt>DigiTrackerHits</tt>.
+ */
public Collection<SimGroup> getSimGroups() {
return _digiToSimGroup.values();
}
+ /**
+ * Returns a collection of all <tt>SimGroup</tt> objects containing <tt>SimTrackerHits</tt>
+ * that did not contribute to any <tt>DigiTrackerHits</tt>.
+ */
public List<SimGroup> getMissedSimGroups() {
return _missedSimGroups;
}
// -- Getting MCParticles : ---------------------------------------------------
+ /** Returns <tt>MCParticle</tt> that produced <tt>SimTrackerHits</tt> in the given <tt>SimGroup</tt>. */
public MCParticle getMCParticle(SimGroup simGroup) {
return simGroup.getMCParticle();
}
+ /** Returns a list of <tt>MCParticles</tt> that contributed to the given <tt>DigiTrackerHit</tt>. */
public List<MCParticle> getMCParticles(DigiTrackerHit hit) {
ArrayList<MCParticle> out = new ArrayList<MCParticle>();
for (DigiTrackerHit elementalHit : hit.getElementalHits()) {
@@ -94,6 +122,7 @@
return out;
}
+ /** Returns a list of <tt>MCParticles</tt> that contributed to the given <tt>TrackerCluster</tt>. */
public List<MCParticle> getMCParticles(TrackerCluster cluster) {
List<MCParticle> out = null;
for (DigiTrackerHit hit : cluster.getDigiHits()) {
@@ -108,10 +137,12 @@
return out;
}
+ /** Returns a list of <tt>MCParticles</tt> that contributed to the given <tt>TrackerHit</tt>. */
public List<MCParticle> getMCParticles(TrackerHit hit) {
return getMCParticles(hit.getCluster());
}
+ /** Returns a list of <tt>MCParticles</tt> that contributed to the given hit. */
public List<MCParticle> getMCParticles(org.lcsim.event.TrackerHit oldHit) {
if (oldHit instanceof OldTrackerHit) {
List<MCParticle> out = null;
@@ -132,6 +163,10 @@
// -- Modifiers : -------------------------------------------------------------
+ /**
+ * This method is called by <tt>DigitizationDriver</tt> to create a new <tt>SimGroup</tt>
+ * and store it in this <tt>MCTruth</tt> object.
+ */
public void addSimGroup(Collection<SimTrackerHit> simTrackerHits, Collection<DigiTrackerHit> digiTrackerHits) {
SimGroup simGroup = new SimGroup(simTrackerHits, digiTrackerHits);
if (digiTrackerHits.isEmpty()) {
lcsim/src/org/lcsim/contrib/onoprien/tracking/mctruth
diff -u -r1.1 -r1.2
--- MCTruthDriver.java 9 Oct 2007 18:08:47 -0000 1.1
+++ MCTruthDriver.java 9 Oct 2007 22:56:15 -0000 1.2
@@ -9,10 +9,16 @@
import org.lcsim.contrib.onoprien.tracking.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.1 2007/10/09 18:08:47 onoprien Exp $
+ * @version $Id: MCTruthDriver.java,v 1.2 2007/10/09 22:56:15 onoprien Exp $
*/
public class MCTruthDriver extends Driver {
lcsim/src/org/lcsim/contrib/onoprien/tracking/mctruth
diff -u -r1.1 -r1.2
--- SimGroup.java 9 Oct 2007 18:08:47 -0000 1.1
+++ SimGroup.java 9 Oct 2007 22:56:15 -0000 1.2
@@ -13,7 +13,7 @@
* Group of {@link SimTrackerHit} objects created in a single sensor-particle crossing.
*
* @author D. Onoprienko
- * @version $Id: SimGroup.java,v 1.1 2007/10/09 18:08:47 onoprien Exp $
+ * @version $Id: SimGroup.java,v 1.2 2007/10/09 22:56:15 onoprien Exp $
*/
public class SimGroup {
@@ -28,10 +28,13 @@
// -- Getters : ---------------------------------------------------------------
+ /** Returns <tt>true</tt> if this group contains the given <tt>SimTrackerHit</tt>. */
public boolean contains(SimTrackerHit hit) {return _simList.contains(hit);}
+ /** Returns <tt>true</tt> if the diven elemental <tt>DigiTrackerHit</tt> was produced from this group. */
public boolean contains(DigiTrackerHit hit) {return _digiList.contains(hit);}
+ /** Returns an average energy deposition weighted position of <tt>SimTrackerHits</tt> in this group. */
public Hep3Vector getPosition() {
double[] pos = {0.,0.,0.};
double sig = 0.;
@@ -44,6 +47,7 @@
return new BasicHep3Vector(pos[0]/sig, pos[1]/sig, pos[2]/sig);
}
+ /** Returns combined energy deposition of all <tt>SimTrackerHits</tt> in this group. */
public double getSignal() {
double sig = 0.;
for (SimTrackerHit hit : _simList) {
@@ -52,12 +56,15 @@
return sig;
}
+ /** Returns <tt>MCParticle</tt> that produced <tt>SimTrackerHits</tt> in this group. */
public MCParticle getMCParticle() {
return _simList.get(0).getMCParticle();
}
+ /** Returns a list of <tt>SimTrackerHits</tt> in this group. */
public List<SimTrackerHit> getSimTrackerHits() {return _simList;}
+ /** Returns a list of elemental <tt>DigiTrackerHit</tt> produced from <tt>SimTrackerHits</tt> in this group. */
public List<DigiTrackerHit> getDigiTrackerHits() {return _digiList;}
// -- Private parts : ---------------------------------------------------------