2 removed + 8 modified, total 10 files
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux
diff -u -r1.1.1.1 -r1.2
--- CruxConfig.java 10 Dec 2008 22:03:06 -0000 1.1.1.1
+++ CruxConfig.java 22 Jan 2009 21:01:55 -0000 1.2
@@ -45,7 +45,7 @@
* </ul>
*
* @author D. Onoprienko
- * @version $Id: CruxConfig.java,v 1.1.1.1 2008/12/10 22:03:06 jeremy Exp $
+ * @version $Id: CruxConfig.java,v 1.2 2009/01/22 21:01:55 onoprien Exp $
*/
public class CruxConfig implements JobEventListener, CalGeometryConfig {
@@ -198,7 +198,7 @@
public List<CalLayer> findNeighbors(CalLayer layer, Trajectory trajectory) {
Surface surface = layer.getReferenceSurface();
Hep3Vector dir = trajectory.getDirection();
- Hep3Vector pos = trajectory.getPoint();
+ Hep3Vector pos = trajectory.getPosition();
double dirSign;
if (surface instanceof ZDisk) {
dirSign = dir.z()*pos.z();
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/algorithms/rosary
diff -u -r1.1.1.1 -r1.2
--- RosaryClusterer.java 10 Dec 2008 22:03:06 -0000 1.1.1.1
+++ RosaryClusterer.java 22 Jan 2009 21:01:56 -0000 1.2
@@ -29,7 +29,7 @@
*
*
* @author D. Onoprienko
- * @version $Id: RosaryClusterer.java,v 1.1.1.1 2008/12/10 22:03:06 jeremy Exp $
+ * @version $Id: RosaryClusterer.java,v 1.2 2009/01/22 21:01:56 onoprien Exp $
*/
public class RosaryClusterer extends Driver implements Clusterer, JobEventListener {
@@ -223,7 +223,7 @@
* <tt>Dots</tt> that contain at least one of the nearest neighbours.</i>
*/
protected List<Dot> searchForDots(Rosary rosary, Trajectory trajectory, LayerStore store) {
- Hep3Vector pos = trajectory.getPoint();
+ Hep3Vector pos = trajectory.getPosition();
long cell = store.decoder.findCellContainingXYZ(pos);
Dot dot = store.dotMap.get(cell);
ArrayList<Dot> out;
@@ -251,7 +251,7 @@
*/
protected Bead searchForBead(Rosary rosary, Trajectory trajectory, LayerStore store) {
if (store.beads.isEmpty()) return null;
- Hep3Vector pos = trajectory.getPoint();
+ Hep3Vector pos = trajectory.getPosition();
return store.beadMap.get(store.decoder.findCellContainingXYZ(pos));
}
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/diagnostics
diff -u -r1.1.1.1 -r1.2
--- ClusteringTest.java 10 Dec 2008 22:03:06 -0000 1.1.1.1
+++ ClusteringTest.java 22 Jan 2009 21:01:56 -0000 1.2
@@ -10,7 +10,6 @@
import org.lcsim.event.EventHeader;
import org.lcsim.event.MCParticle;
import org.lcsim.event.SimCalorimeterHit;
-import org.lcsim.geometry.IDDecoder;
import org.lcsim.util.aida.AIDA;
import org.lcsim.contrib.onoprien.util.job.Driver;
@@ -25,7 +24,7 @@
*
*
* @author D. Onoprienko
- * @version $Id: ClusteringTest.java,v 1.1.1.1 2008/12/10 22:03:06 jeremy Exp $
+ * @version $Id: ClusteringTest.java,v 1.2 2009/01/22 21:01:56 onoprien Exp $
*/
public class ClusteringTest extends Driver implements JobEventListener {
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/infrastructure
diff -u -r1.1.1.1 -r1.2
--- CruxHitMap.java 10 Dec 2008 22:03:06 -0000 1.1.1.1
+++ CruxHitMap.java 22 Jan 2009 21:01:56 -0000 1.2
@@ -3,7 +3,6 @@
import java.util.*;
import org.lcsim.event.CalorimeterHit;
-import org.lcsim.util.hitmap.HitMap;
import org.lcsim.contrib.onoprien.util.job.JobManager;
@@ -25,7 +24,7 @@
* copy of each hit is held, no matter how many times it is added to this collection.
*
* @author D. Onoprienko
- * @version $Id: CruxHitMap.java,v 1.1.1.1 2008/12/10 22:03:06 jeremy Exp $
+ * @version $Id: CruxHitMap.java,v 1.2 2009/01/22 21:01:56 onoprien Exp $
*/
final public class CruxHitMap implements List<CalorimeterHit> {
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/infrastructure
diff -u -r1.1.1.1 -r1.2
--- CruxTrack.java 10 Dec 2008 22:03:06 -0000 1.1.1.1
+++ CruxTrack.java 22 Jan 2009 21:01:56 -0000 1.2
@@ -15,12 +15,32 @@
import org.lcsim.contrib.onoprien.vsegment.hit.ITrackerHit;
/**
- * Helper class that provides access to various parameters of a fitted track.
+ * Implementation of {@link ITrack} interface.
*
* @author D. Onoprienko
- * @version $Id: CruxTrack.java,v 1.1.1.1 2008/12/10 22:03:06 jeremy Exp $
+ * @version $Id: CruxTrack.java,v 1.2 2009/01/22 21:01:56 onoprien Exp $
*/
public class CruxTrack implements ITrack, Track {
+
+// -- Private parts : ---------------------------------------------------------
+
+ private CruxTrackVertex _startVertex;
+ private CruxTrackVertex _endVertex;
+ private ArrayList<CruxTrackVertex> _interVertexes = new ArrayList<CruxTrackVertex>(0);
+
+ private MCParticle _mcParticle;
+
+ private ArrayList<ITrackAnchor> _anchors;
+
+ private ArrayList<ITrackNode> _nodes;
+ private int _charge;
+
+ private EnumMap<Point, FNode> _fNodes;
+
+ private double _chi2;
+ private int _ndf;
+ private boolean _fitSuccess;
+
// -- Constructors : ----------------------------------------------------------
@@ -153,7 +173,7 @@
public Hep3Vector getPosition(Point where) {
FNode fNode = _fNodes.get(where);
if (fNode == null) return null;
- return fNode.node.getTrajectory().getPoint(fNode.path);
+ return fNode.node.getTrajectory().getPosition(fNode.path);
}
/**
@@ -257,25 +277,6 @@
public void setFunctionalPoint(Point point, ITrackNode node, double path) {
_fNodes.put(point, new FNode(node,path));
}
-
-// -- Private parts : ---------------------------------------------------------
-
- private CruxTrackVertex _startVertex;
- private CruxTrackVertex _endVertex;
- private ArrayList<CruxTrackVertex> _interVertexes = new ArrayList<CruxTrackVertex>(0);
-
- private MCParticle _mcParticle;
-
- private ArrayList<ITrackAnchor> _anchors;
-
- private ArrayList<ITrackNode> _nodes;
- private int _charge;
-
- private EnumMap<Point, FNode> _fNodes;
-
- private double _chi2;
- private int _ndf;
- private boolean _fitSuccess;
// -- Helper class encapsulating info on how to compute parameters at a functional point : --
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/infrastructure
diff -u -r1.1.1.1 -r1.2
--- ITrack.java 10 Dec 2008 22:03:06 -0000 1.1.1.1
+++ ITrack.java 22 Jan 2009 21:01:56 -0000 1.2
@@ -12,7 +12,7 @@
* Generic interface to be implemented by classes that represent found tracks.
*
* @author D. Onoprienko
- * @version $Id: ITrack.java,v 1.1.1.1 2008/12/10 22:03:06 jeremy Exp $
+ * @version $Id: ITrack.java,v 1.2 2009/01/22 21:01:56 onoprien Exp $
*/
public interface ITrack {
@@ -60,7 +60,7 @@
// -- Nodes and hits : --------------------------------------------------------
- /** Returns a list of track nodes, ordered along the trajectory. */
+ /** Returns a list of track nodes (pivot points), ordered along the trajectory. */
List<? extends ITrackNode> getNodes();
/** Returns a list of achors for this track, ordered along the trajectory. */
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/tests
diff -u -r1.1.1.1 -r1.2
--- TestDriver.java 10 Dec 2008 22:03:06 -0000 1.1.1.1
+++ TestDriver.java 22 Jan 2009 21:01:56 -0000 1.2
@@ -16,14 +16,14 @@
import org.lcsim.contrib.onoprien.crux.diagnostics.TrackingTest;
import org.lcsim.contrib.onoprien.crux.infrastructure.*;
import org.lcsim.contrib.onoprien.crux.mctruth.MCTruthDriverCrux;
-import org.lcsim.contrib.onoprien.crux.tracking.CheatTrackFinderDriver;
-import org.lcsim.contrib.onoprien.crux.tracking.CheatVertexFinderDriver;
+import org.lcsim.contrib.onoprien.crux.cheat.CheatTrackFinderDriver;
+import org.lcsim.contrib.onoprien.crux.cheat.CheatVertexFinderDriver;
/**
* Main driver for testing PFA code.
*
* @author D. Onoprienko
- * @version $Id: TestDriver.java,v 1.1.1.1 2008/12/10 22:03:06 jeremy Exp $
+ * @version $Id: TestDriver.java,v 1.2 2009/01/22 21:01:56 onoprien Exp $
*/
public class TestDriver extends Driver {
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/tests
diff -u -r1.1.1.1 -r1.2
--- TestDriverRosary.java 10 Dec 2008 22:03:06 -0000 1.1.1.1
+++ TestDriverRosary.java 22 Jan 2009 21:01:56 -0000 1.2
@@ -24,14 +24,14 @@
import org.lcsim.contrib.onoprien.crux.auxdrivers.HitMapFilterDriver;
import org.lcsim.contrib.onoprien.crux.infrastructure.*;
import org.lcsim.contrib.onoprien.crux.mctruth.MCTruthDriverCrux;
-import org.lcsim.contrib.onoprien.crux.tracking.CheatTrackFinderDriver;
-import org.lcsim.contrib.onoprien.crux.tracking.CheatVertexFinderDriver;
+import org.lcsim.contrib.onoprien.crux.cheat.CheatTrackFinderDriver;
+import org.lcsim.contrib.onoprien.crux.cheat.CheatVertexFinderDriver;
/**
*
*
* @author D. Onoprienko
- * @version $Id: TestDriverRosary.java,v 1.1.1.1 2008/12/10 22:03:06 jeremy Exp $
+ * @version $Id: TestDriverRosary.java,v 1.2 2009/01/22 21:01:56 onoprien Exp $
*/
public class TestDriverRosary extends Driver {
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/tracking
diff -N CheatTrackFinderDriver.java
--- CheatTrackFinderDriver.java 10 Dec 2008 22:03:06 -0000 1.1.1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,286 +0,0 @@
-package org.lcsim.contrib.onoprien.crux.tracking;
-
-import java.util.*;
-
-import hep.physics.vec.Hep3Vector;
-import org.lcsim.detector.identifier.Identifiable;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.MCParticle;
-import org.lcsim.event.SimTrackerHit;
-
-import org.lcsim.contrib.onoprien.util.ConstHep3Vector;
-import org.lcsim.contrib.onoprien.util.job.Driver;
-import org.lcsim.contrib.onoprien.util.ListMap;
-import org.lcsim.contrib.onoprien.util.NoSuchParameterException;
-import org.lcsim.contrib.onoprien.util.swim.BField;
-import org.lcsim.contrib.onoprien.util.swim.Helix;
-
-import org.lcsim.contrib.onoprien.vsegment.hit.ITrackerHit;
-import org.lcsim.contrib.onoprien.vsegment.mctruth.MCTruthVS;
-
-import org.lcsim.contrib.onoprien.crux.infrastructure.*;
-
-/**
- * Driver that uses MC truth info to produce a list of reconstructable tracks in the event.
- * <p>
- * The list of tracks created by this driver is saved into the event record under
- * the name set through a call to <tt>set("TRACK_LIST", name)</tt>.
- * <p>
- * Subclasses can override {@link #isTracked(MCParticle)} and {@link #makeTrack(MCParticle)}
- * methods to change the definition of "reconstructable" particle and to control
- * creation of the {@link CruxTrack} object for the given {@link MCParticle}.
- *
- * @author D. Onoprienko
- * @version $Id: CheatTrackFinderDriver.java,v 1.1.1.1 2008/12/10 22:03:06 jeremy Exp $
- */
-public class CheatTrackFinderDriver extends Driver {
-
-// -- Constructors : ----------------------------------------------------------
-
- public CheatTrackFinderDriver() {
- _bField = BField.defaultInstance();
- }
-
-// -- Setters : ---------------------------------------------------------------
-
- /**
- * Set any parameter.
- * The following parameters can be set with this method:
- * <p><dl>
- * <dt>"HIT_MAP_NAMES"</dt> <dd>One or more names of input <tt>TrackerHitMaps</tt>.
- * <tt>ITrackerHits</tt> from these maps will be attached to created tracks.
- * <br>No default, must be set explicitly if this class is to be used as a driver.</dd>
- * <dt>"TRACK_LIST_NAME"</dt> <dd>Name of output list of <tt>Tracks</tt>.
- * If the list with this name already exists in the event record, newly created
- * tracks will be appended to it.
- * <br>No default, must be set explicitly if this class is to be used as a driver.</dd>
- * <dt>"CUT_MinLayers"</dt> <dd>Minimal effective number of layers with hits for the track to be reconstructed.
- * Hits in two layers that constitute a stereo pair add 1 to the effective number of layers.
- * <br>Default: 3.</dd>
- * <dt>"CUT_Pt"</dt> <dd>Minimal transverse momentum for the track to be reconstructed.
- * <br>Default: 0.</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("HIT_MAP_NAMES")) {
- _hitMapNames = new ArrayList<String>(values.length);
- for (Object o : values) _hitMapNames.add((String)o);
- } else if (name.equalsIgnoreCase("TRACK_LIST_NAME")) {
- _trackListName = (String) value;
- } else if (name.equalsIgnoreCase("CUT_MinLayers")) {
- _cutMinLayers = (Integer) value;
- } else if (name.equalsIgnoreCase("CUT_Pt")) {
- _cutPt2 = (Double) value;
- _cutPt2 *= _cutPt2;
- } else {
- super.set(name, values);
- }
- } catch (ClassCastException x) {
- throw new IllegalArgumentException(ERR_VIT, x);
- }
- }
-
-// -- Event processing : ------------------------------------------------------
-
- /** Called by the framework to process an event. */
- public void process(EventHeader event) {
-
- super.process(event);
-
- // Fetch MCTruth and list of MCParticles
-
- _mcTruth = (MCTruthVS) event.get(MCTruthVS.KEY);
-
- // Fetch or create list of tracks
-
- List<CruxTrack> trackList;
- try {
- trackList = (ArrayList<CruxTrack>) event.get(CruxTrack.class, _trackListName);
- } catch (IllegalArgumentException x) {
- trackList = new ArrayList<CruxTrack>(100);
- event.put(_trackListName, trackList, CruxTrack.class, 0);
- }
-
- // Compile set of hits
-
- HashSet<ITrackerHit> hitSet = new HashSet<ITrackerHit>();
- for (String name : _hitMapNames) {
- try {
- ListMap<Identifiable, ITrackerHit> hitMap = (ListMap<Identifiable, ITrackerHit>) event.get(name);
- hitSet.addAll(hitMap);
- } catch (IllegalArgumentException x) {
- continue;
- }
- }
-
- // Associate hits to MCParticles :
-
- HashMap<MCParticle,List<ITrackerHit>> mc2hit = new HashMap<MCParticle,List<ITrackerHit>>();
- for (ITrackerHit hit : hitSet) {
- List<MCParticle> mcList = _mcTruth.getMCParticles(hit);
- for (MCParticle mc : mcList) {
- List<ITrackerHit> hits = mc2hit.get(mc);
- if (hits == null) {
- hits = new ArrayList<ITrackerHit>();
- mc2hit.put(mc, hits);
- }
- hits.add(hit);
- }
- }
-
- // Loop over MCParticle, creating Tracks for those deemed reconstructable
-
- for (Map.Entry<MCParticle, List<ITrackerHit>> entry : mc2hit.entrySet()) {
- MCParticle mc = entry.getKey();
- List<ITrackerHit> hits = entry.getValue();
- if (isTracked(mc,hits)) {
- CruxTrack track = makeTrack(mc,hits);
- trackList.add(track);
- }
- }
-
- // Cleanup
-
- try {
- ((ArrayList<CruxTrack>)trackList).trimToSize();
- } catch (ClassCastException x) {}
- _mcTruth = null;
- }
-
- /**
- * Returns <tt>true</tt> if a track should be created for the given particle.
- * Default: returns <tt>true</tt> for charged particles that pass number of layers
- * with hits and Pt cuts (see {@link #set}).
- * Subclasses can override and implement their own definitions of "reconstructable" track.
- */
- protected boolean isTracked(MCParticle mcParticle, List<ITrackerHit> hits) {
-
- // Charged particles only
-
- if (Math.abs(mcParticle.getCharge()) < 0.9) return false;
-
- // Cut on effective number of layers with hits
-
- if (hits.size() < _cutMinLayers) return false;
- HashSet<Integer> layers = new HashSet<Integer>();
- int nEffLayers = 0;
- for (ITrackerHit hit : hits) {
- boolean newLayer = ! layers.add(hit.getSubdetector().getSystemID() * 1000 + hit.getLayer());
- if (newLayer) {
- if (hit.getType().nUnmeasured() == 0) {
- nEffLayers += 2;
- } else {
- if (hit.getBarrelEndcapFlag().isBarrel()) {
- nEffLayers += 2;
- } else {
- nEffLayers += 1;
- }
- }
- }
- }
- if (nEffLayers < _cutMinLayers * 2) return false;
-
- // Cut on Pt
-
- if (_cutPt2 > 0.) {
- double px = mcParticle.getPX();
- double py = mcParticle.getPY();
- if (px*px+py*py < _cutPt2) return false;
- }
-
- return true;
- }
-
- /**
- * Create <tt>CruxTrack</tt> object for the given <tt>MCParticle</tt>, and set its parameters.
- * Default implementation only sets <tt>MCParticle</tt> associated with the track -
- * subclasses can override.
- */
- protected CruxTrack makeTrack(MCParticle mcParticle, List<ITrackerHit> hits) {
-
- // Sort hits by time :
-
- _mc = mcParticle;
- Collections.sort(hits, _hitTimeComparator);
- _mc = null;
-
- // Wrap hits into anchors :
-
- ArrayList<ITrackAnchor> anchors = new ArrayList<ITrackAnchor>(hits.size());
- for (ITrackerHit hit : hits) {
- anchors.add(new CruxTrackAnchorHit(hit));
- }
-
- // Create track node at the particle origin :
-
- Hep3Vector pos = mcParticle.getOrigin();
- Hep3Vector momentum = mcParticle.getMomentum();
- int charge = (int) mcParticle.getCharge();
- Helix helix = _bField.makeHelix(pos, momentum, charge);
- CruxTrackNode startNode = new CruxTrackNode(helix);
-
- ArrayList<ITrackNode> nodes = new ArrayList<ITrackNode>(2);
- nodes.add(startNode);
-
- // Create node at last hit position :
-
- SimTrackerHit simHit = _mcTruth.getSimTrackerHits(hits.get(hits.size()-1)).get(0);
- pos = new ConstHep3Vector(simHit.getPoint());
- momentum = new ConstHep3Vector(simHit.getMomentum());
- helix = _bField.makeHelix(pos, momentum, charge);
- CruxTrackNode lastHitNode = new CruxTrackNode(helix);
-
- nodes.add(lastHitNode);
-
- // Create track
-
- CruxTrack track = new CruxTrack(anchors, nodes, charge);
- track.setMCParticle(mcParticle);
- track.setFunctionalPoint(ITrack.Point.START, startNode, 0.);
- track.setFunctionalPoint(ITrack.Point.LAST_HIT, lastHitNode, 0.);
-
- return track;
- }
-
-// -- Private parts : ---------------------------------------------------------
-
- protected ArrayList<String> _hitMapNames;
- protected String _trackListName;
-
- protected MCTruthVS _mcTruth;
- protected BField _bField;
-
- protected int _cutMinLayers = 3;
- protected double _cutPt2 = 0.;
-
- protected Comparator<ITrackerHit> _hitTimeComparator = new Comparator<ITrackerHit>() {
- public int compare(ITrackerHit hit1, ITrackerHit hit2) {
- SimTrackerHit sHit1 = null;
- SimTrackerHit sHit2 = null;
- List<SimTrackerHit> simList = _mcTruth.getSimTrackerHits(hit1);
- for (SimTrackerHit sHit : simList) {
- if (sHit.getMCParticle() == _mc) {
- sHit1 = sHit;
- break;
- }
- }
- simList = _mcTruth.getSimTrackerHits(hit2);
- for (SimTrackerHit sHit : simList) {
- if (sHit.getMCParticle() == _mc) {
- sHit2 = sHit;
- break;
- }
- }
- return (int) Math.signum(sHit1.getTime() - sHit2.getTime());
- }
- };
- private MCParticle _mc;
-
-}
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/tracking
diff -N CheatVertexFinderDriver.java
--- CheatVertexFinderDriver.java 10 Dec 2008 22:03:06 -0000 1.1.1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,192 +0,0 @@
-package org.lcsim.contrib.onoprien.crux.tracking;
-
-import java.util.*;
-
-import hep.physics.vec.Hep3Vector;
-import hep.physics.vec.VecOp;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.MCParticle;
-import org.lcsim.units.clhep.SystemOfUnits;
-
-import org.lcsim.contrib.onoprien.util.NoSuchParameterException;
-import org.lcsim.contrib.onoprien.util.job.Driver;
-
-import org.lcsim.contrib.onoprien.crux.infrastructure.*;
-import org.lcsim.contrib.onoprien.crux.mctruth.MCTruthCrux;
-
-/**
- * Driver that uses MC truth info to produce a list of reconstructable vertices in the
- * event, and to associate them with previously reconstructed tracks.
- * <p>
- * A vertex is created if more than one track from the given list originates, terminates,
- * or flies by it.
- *
- * @author D. Onoprienko
- * @version $Id: CheatVertexFinderDriver.java,v 1.1.1.1 2008/12/10 22:03:06 jeremy Exp $
- */
-public class CheatVertexFinderDriver extends Driver {
-
-// -- Constructors : ----------------------------------------------------------
-
- public CheatVertexFinderDriver() {
- }
-
-// -- Setters : ---------------------------------------------------------------
-
- /**
- * Set any parameter.
- * The following parameters can be set with this method:
- * <p><dl>
- * <dt>"TRACK_LIST"</dt> <dd>Name of input list of <tt>Tracks</tt>
- * <br>No default, must be set explicitly if this class is to be used as a driver.</dd>
- * <dt>"VERTEX_LIST"</dt> <dd>Name of output list of found <tt>Vertexes</tt>
- * <br>Default: <tt>null</tt> (vertices will be associated with tracks but the list will not
- * be explicitly saved into the event record.</dd>
- * <dt>"MERGE_DISTANCE"</dt> <dd>Double value defining the minimal distance between vertices -
- * closer vertices will be merged.
- * <br>Default: 1 micrometer.</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("TRACK_LIST")) {
- _trackListName = (String) value;
- } else if (name.equalsIgnoreCase("VERTEX_LIST")) {
- _vertexListName = (String) value;
- } else if (name.equalsIgnoreCase("MERGE_DISTANCE")) {
- _mergeDist2 = (Double) value;
- _mergeDist2 *= _mergeDist2;
- } else {
- super.set(name, values);
- }
- } catch (ClassCastException x) {
- throw new IllegalArgumentException("Value of incompatible type", x);
- }
- }
-
-// -- Event processing : ------------------------------------------------------
-
- /** Called by the framework to process an event. */
- public void process(EventHeader event) {
-
- super.process(event);
-
- _mcTruth = (MCTruthCrux) event.get("CruxMCTruth");
- List<MCParticle> mcList = event.getMCParticles();
- List<CruxTrack> trackList = event.get(CruxTrack.class, _trackListName);
-
- ArrayList<CruxTrackVertex> vertexList = new ArrayList<CruxTrackVertex>();
-
- // Create vertexes for start and end points of each track, merging those less than _mergeDist apart
-
- for (CruxTrack track : trackList) {
- MCParticle mc = track.getMCParticle();
- Hep3Vector endPoint = mc.getEndPoint();
- Hep3Vector startPoint = mc.getOrigin();
- boolean start = true;
- boolean end = true;
- for (CruxTrackVertex vertex : vertexList) {
- Hep3Vector pos = vertex.getPosition();
- if ( start && (VecOp.sub(pos, startPoint).magnitudeSquared() < _mergeDist2) ) {
- vertex.getDaughterTracks().add(track);
- start = false;
- } else if ( end && (VecOp.sub(pos, endPoint).magnitudeSquared() < _mergeDist2) ) {
- vertex.setParentTrack(track);
- end = false;
- }
- }
- if (start) {
- CruxTrackVertex vertex = new CruxTrackVertex();
- vertex.setPosition(startPoint);
- vertex.getDaughterTracks().add(track);
- vertexList.add(vertex);
- }
- if (end) {
- CruxTrackVertex vertex = new CruxTrackVertex();
- vertex.setPosition(endPoint);
- vertex.setParentTrack(track);
- vertexList.add(vertex);
- }
- }
-
- // Save vertexes with more than one track
-
- ArrayList<CruxTrackVertex> finalList = new ArrayList<CruxTrackVertex>();
- for (CruxTrackVertex vertex : vertexList) {
- boolean isIntermediate = false;
- List<CruxTrack> daughters = vertex.getDaughterTracks();
- int nTracks = daughters.size();
- if (vertex.getParentTrack() == null) {
- for (CruxTrack track : daughters) {
- MCParticle mc = track.getMCParticle();
- CruxTrack parentTrack = getFlyByParent(mc);
- if (parentTrack != null) {
- vertex.setParentTrack(parentTrack);
- isIntermediate = true;
- nTracks++;
- break;
- }
- }
- } else {
- nTracks++;
- }
- if (nTracks > 1) {
- finalList.add(vertex);
- for (CruxTrack track : daughters) {
- track.setStartVertex(vertex);
- }
- CruxTrack parent = vertex.getParentTrack();
- if (parent != null) {
- if (isIntermediate) {
- parent.getIntermediateVertexes().add(vertex);
- } else {
- parent.setEndVertex(vertex);
- }
- }
- }
- }
-
- // Put list of vertexes into event record
-
- if (_vertexListName != null) {
- finalList.trimToSize();
- event.put(_vertexListName, finalList, CruxTrackVertex.class, 0);
- }
-
- // Clean up
-
- _mcTruth = null;
- }
-
- /**
- * Try to find a track whose intermediate vertex the given MCParticle was produced at.
- */
- private CruxTrack getFlyByParent(MCParticle mcParticle) {
- boolean bornInFlight = mcParticle.getSimulatorStatus().vertexIsNotEndpointOfParent();
- List<MCParticle> pList = mcParticle.getParents();
- for (MCParticle mc : pList) {
- CruxTrack track = _mcTruth.getTrack(mc);
- if (bornInFlight && track != null) {
- return track;
- } else if (VecOp.sub(mc.getOrigin(), mc.getEndPoint()).magnitudeSquared() < _mergeDist2) {
- track = getFlyByParent(mc);
- if (track != null) return track;
- }
- }
- return null;
- }
-
-// -- Private parts : ---------------------------------------------------------
-
- protected String _trackListName;
- protected String _vertexListName;
- protected double _mergeDist2 = (1.*SystemOfUnits.micrometer) * (1.*SystemOfUnits.micrometer);
-
- protected MCTruthCrux _mcTruth;
-}
CVSspam 0.2.8