1 removed + 8 modified, total 9 files
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/algorithms
diff -u -r1.1.1.1 -r1.2
--- ValidationDriver.java 10 Dec 2008 22:03:06 -0000 1.1.1.1
+++ ValidationDriver.java 9 Feb 2009 03:57:38 -0000 1.2
@@ -10,7 +10,6 @@
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 assigns parameters (energy, momentum, particle type) to reconstructed
@@ -37,7 +36,7 @@
* is called for a vertex after its daughter particles have been validated.
*
* @author D. Onoprienko
- * @version $Id: ValidationDriver.java,v 1.1.1.1 2008/12/10 22:03:06 jeremy Exp $
+ * @version $Id: ValidationDriver.java,v 1.2 2009/02/09 03:57:38 onoprien Exp $
*/
public class ValidationDriver extends Driver {
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/cheat
diff -u -r1.1 -r1.2
--- CheatRecoParticleCreator.java 22 Jan 2009 21:12:42 -0000 1.1
+++ CheatRecoParticleCreator.java 9 Feb 2009 03:57:38 -0000 1.2
@@ -3,7 +3,6 @@
import java.util.*;
import static java.util.logging.Level.*;
-import hep.physics.particle.properties.ParticleType;
import hep.physics.particle.properties.UnknownParticleIDException;
import org.lcsim.event.EventHeader;
import org.lcsim.event.MCParticle;
@@ -11,7 +10,6 @@
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 creates a tree of reconstructed particles and vertices based on
@@ -19,7 +17,7 @@
* puts it into the event record.
*
* @author D. Onoprienko
- * @version $Id: CheatRecoParticleCreator.java,v 1.1 2009/01/22 21:12:42 onoprien Exp $
+ * @version $Id: CheatRecoParticleCreator.java,v 1.2 2009/02/09 03:57:38 onoprien Exp $
*/
public class CheatRecoParticleCreator extends Driver {
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/cheat
diff -u -r1.2 -r1.3
--- CheatVertexFinderDriver.java 27 Jan 2009 20:48:51 -0000 1.2
+++ CheatVertexFinderDriver.java 9 Feb 2009 03:57:38 -0000 1.3
@@ -22,7 +22,7 @@
* or flies by it.
*
* @author D. Onoprienko
- * @version $Id: CheatVertexFinderDriver.java,v 1.2 2009/01/27 20:48:51 onoprien Exp $
+ * @version $Id: CheatVertexFinderDriver.java,v 1.3 2009/02/09 03:57:38 onoprien Exp $
*/
public class CheatVertexFinderDriver extends Driver {
@@ -171,7 +171,7 @@
boolean bornInFlight = mcParticle.getSimulatorStatus().vertexIsNotEndpointOfParent();
List<MCParticle> pList = mcParticle.getParents();
for (MCParticle mc : pList) {
- CruxTrack track = _mcTruth.getTrack(mc);
+ CruxTrack track = (CruxTrack) _mcTruth.get(MCTruthCrux.Rec.TRACK, mc).get(0);
if (bornInFlight && track != null) {
return track;
} else if (VecOp.sub(mc.getOrigin(), mc.getEndPoint()).magnitudeSquared() < _mergeDist2) {
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/diagnostics
diff -u -r1.2 -r1.3
--- ClusteringTest.java 22 Jan 2009 21:01:56 -0000 1.2
+++ ClusteringTest.java 9 Feb 2009 03:57:38 -0000 1.3
@@ -7,11 +7,13 @@
import org.lcsim.contrib.onoprien.crux.geom.CalGeometry;
import org.lcsim.event.CalorimeterHit;
+import org.lcsim.event.Cluster;
import org.lcsim.event.EventHeader;
import org.lcsim.event.MCParticle;
import org.lcsim.event.SimCalorimeterHit;
import org.lcsim.util.aida.AIDA;
+import org.lcsim.contrib.onoprien.util.WeightedTable;
import org.lcsim.contrib.onoprien.util.job.Driver;
import org.lcsim.contrib.onoprien.util.job.JobEvent;
import org.lcsim.contrib.onoprien.util.job.JobEventListener;
@@ -24,7 +26,7 @@
*
*
* @author D. Onoprienko
- * @version $Id: ClusteringTest.java,v 1.2 2009/01/22 21:01:56 onoprien Exp $
+ * @version $Id: ClusteringTest.java,v 1.3 2009/02/09 03:57:38 onoprien Exp $
*/
public class ClusteringTest extends Driver implements JobEventListener {
@@ -164,9 +166,11 @@
}
// Cluster purity:
+
+ MCTruthCrux mcTruth = (MCTruthCrux) _event.get(MCTruthCrux.KEY);
for (CruxCluster cluster : _inClusterList) {
- List<MCParticle> mcList = MCTruthCrux.getMCParticles(cluster);
+ List<MCParticle> mcList = mcTruth.getMCParticles(cluster);
CalModule module = cluster.getModule();
String name = (module == null) ? "Multiple modules" : module.getName();
_aida.cloud1D("MCParticles per cluster").fill(mcList.size());
@@ -175,10 +179,11 @@
// Cluster multiplicity:
- Map<MCParticle, ArrayList<CruxCluster>> mcToClusterMap = MCTruthCrux.getMCParticleToClusterMap(_inClusterList);
- for (Map.Entry<MCParticle, ArrayList<CruxCluster>> entry : mcToClusterMap.entrySet()) {
- _aida.cloud1D("Clusters per MCParticle").fill(entry.getValue().size());
- _aida.cloud1D("Clusters per MCParticle: "+entry.getKey().getType().getName()).fill(entry.getValue().size());
+ WeightedTable<MCParticle, Cluster> mcToClusterMap = mcTruth.<Cluster>getMCParticleMap(MCTruthCrux.Rec.CLUSTER, _inClusterList);
+ for (MCParticle mc : mcToClusterMap.fromSet()) {
+ int nClusters = mcToClusterMap.allFrom(mc).size();
+ _aida.cloud1D("Clusters per MCParticle").fill(nClusters);
+ _aida.cloud1D("Clusters per MCParticle: "+mc.getType().getName()).fill(nClusters);
}
}
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/diagnostics
diff -u -r1.1.1.1 -r1.2
--- TrackingTest.java 10 Dec 2008 22:03:06 -0000 1.1.1.1
+++ TrackingTest.java 9 Feb 2009 03:57:38 -0000 1.2
@@ -8,15 +8,13 @@
import org.lcsim.contrib.onoprien.util.job.Driver;
import org.lcsim.contrib.onoprien.crux.infrastructure.*;
-import org.lcsim.contrib.onoprien.crux.mctruth.MCTruthCrux;
-import org.lcsim.contrib.onoprien.crux.mctruth.MCTruthDriverCrux;
/**
* Driver that runs tests on the collection of reconstructed tracks after
* fetching it from the event record.
*
* @author D. Onoprienko
- * @version $Id: TrackingTest.java,v 1.1.1.1 2008/12/10 22:03:06 jeremy Exp $
+ * @version $Id: TrackingTest.java,v 1.2 2009/02/09 03:57:38 onoprien Exp $
*/
public class TrackingTest extends Driver {
@@ -63,12 +61,10 @@
super.process(event);
_event = event;
- _mcTruth = (MCTruthCrux) event.get("CruxMCTruth");
printTree();
_event = null;
- _mcTruth = null;
}
// -- Tests : -----------------------------------------------------------------
@@ -117,7 +113,6 @@
// -- Private parts : ---------------------------------------------------------
private EventHeader _event;
- private MCTruthCrux _mcTruth;
String _trackListName;
}
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/infrastructure
diff -u -r1.2 -r1.3
--- CATSeed.java 1 Feb 2009 19:40:38 -0000 1.2
+++ CATSeed.java 9 Feb 2009 03:57:38 -0000 1.3
@@ -2,19 +2,24 @@
import java.util.*;
+import org.lcsim.event.CalorimeterHit;
import org.lcsim.event.MCParticle;
/**
* Stub to prevent build from failing.
*
* @author D. Onoprienko
- * @version $Id: CATSeed.java,v 1.2 2009/02/01 19:40:38 onoprien Exp $
+ * @version $Id: CATSeed.java,v 1.3 2009/02/09 03:57:38 onoprien Exp $
*/
-public class CATSeed {
+public class CatSeed {
+
+// -- Private parts : ---------------------------------------------------------
+
+ ArrayList<MCParticle> _mcList = new ArrayList<MCParticle>(1);
// -- Constructors : ----------------------------------------------------------
- public CATSeed() {
+ public CatSeed() {
}
// -- Getters : ---------------------------------------------------------------
@@ -26,8 +31,8 @@
return _mcList;
}
-// -- Private parts : ---------------------------------------------------------
-
- ArrayList<MCParticle> _mcList = new ArrayList<MCParticle>(1);
+ public List<CalorimeterHit> getCalorimeterHits() {
+ return null;
+ }
}
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/mctruth
diff -u -r1.1.1.1 -r1.2
--- MCTruthCrux.java 10 Dec 2008 22:03:06 -0000 1.1.1.1
+++ MCTruthCrux.java 9 Feb 2009 03:57:38 -0000 1.2
@@ -3,127 +3,215 @@
import java.util.*;
import org.lcsim.event.CalorimeterHit;
+import org.lcsim.event.Cluster;
import org.lcsim.event.EventHeader;
import org.lcsim.event.MCParticle;
import org.lcsim.event.SimCalorimeterHit;
-import org.lcsim.event.SimTrackerHit;
-import org.lcsim.contrib.onoprien.crux.infrastructure.*;
+import org.lcsim.contrib.onoprien.util.WeightedTable;
+import org.lcsim.contrib.onoprien.util.WeightedList;
+
+import org.lcsim.contrib.onoprien.vsegment.hit.ITrackerHit;
+import org.lcsim.contrib.onoprien.vsegment.mctruth.MCTruthVS;
+
+import org.lcsim.contrib.onoprien.crux.infrastructure.CatSeed;
+import org.lcsim.contrib.onoprien.crux.infrastructure.ITrack;
/**
- *
- *
- *
+ * Provides access to Monte Carlo truth information for reconstructed
+ * objects created with crux package.
+ *
* @author D. Onoprienko
- * @version $Id: MCTruthCrux.java,v 1.1.1.1 2008/12/10 22:03:06 jeremy Exp $
+ * @version $Id: MCTruthCrux.java,v 1.2 2009/02/09 03:57:38 onoprien Exp $
*/
public class MCTruthCrux {
/** Name under which this object is saved in the event record: "MCTruthCrux". */
static public final String KEY = "MCTruthCrux";
+
+ public enum Rec {
+ TRACK(ITrack.class),
+ CAL_HIT(CalorimeterHit.class),
+ CLUSTER(Cluster.class),
+ CAT_SEED(CatSeed.class);
+ Class _type;
+ Rec(Class type) {_type = type;}
+ public Class type() {return _type;}
+ }
+
+// -- Private parts : ---------------------------------------------------------
+
+ private MCTruthDriverCrux _driver;
+ private EventHeader _event;
+
+ private MCTruthVS _mcTruthVS;
+
+ private EnumMap<Rec, WeightedTable> _defMaps;
+
// -- Constructors : ----------------------------------------------------------
- public MCTruthCrux(EventHeader event) {
+ public MCTruthCrux(MCTruthDriverCrux driver, EventHeader event) {
+ _driver = driver;
_event = event;
+ try {
+ _mcTruthVS = (MCTruthVS) event.get(MCTruthVS.KEY);
+ } catch (IllegalArgumentException x) {}
}
-
-// -- Getters : ---------------------------------------------------------------
-
- /**
- * Returns time-ordered list of <tt>SimTrackerHits</tt> produced by the given <tt>MCParticle</tt>.
- */
- public List<SimTrackerHit> getSimTrackerHits(MCParticle mcParticle) {
- if (_mcToSimHitsMap == null) {
- _mcToSimHitsMap = new HashMap<MCParticle, ArrayList<SimTrackerHit>>();
- List<List<SimTrackerHit>> all = _event.get(SimTrackerHit.class);
- for (List<SimTrackerHit> hitList : all) {
- for (SimTrackerHit hit : hitList) {
- MCParticle mc = hit.getMCParticle();
- ArrayList<SimTrackerHit> mcHits = _mcToSimHitsMap.get(mc);
- if (mcHits == null) {
- mcHits = new ArrayList<SimTrackerHit>();
- _mcToSimHitsMap.put(mc, mcHits);
- }
- mcHits.add(hit);
+
+
+// -- Set default maps : ------------------------------------------------------
+
+ public <T> void setMCParticleMap(Rec type, WeightedTable<MCParticle,T> map) {
+ _defMaps.put(type, map);
+ }
+
+
+// -- Names of collections of reco objects to RelationalTable methods : -------
+
+ public <T> WeightedTable<MCParticle,T> getMCParticleMap(Rec type, String... collectionNames) {
+ List<Collection<T>> colList;
+ if (collectionNames.length == 0) {
+ colList = _event.get(type.type());
+ } else {
+ colList = new ArrayList<Collection<T>>();
+ for (String name : collectionNames) {
+ try {
+ colList.add((Collection<T>) (_event.get(name)));
+ } catch (IllegalArgumentException x) {
}
}
- for (ArrayList<SimTrackerHit> hitList : _mcToSimHitsMap.values()) {
- Collections.sort(hitList, new Comparator<SimTrackerHit>() {
- public int compare(SimTrackerHit hit1, SimTrackerHit hit2) {
- return (int) Math.signum(hit1.getTime()-hit2.getTime());
- }
- });
- hitList.trimToSize();
+ }
+ if (colList.size() == 1) {
+ return getMCParticleMap(type, colList.get(0));
+ } else {
+ ArrayList<T> lst = new ArrayList<T>(100);
+ for (Collection<T> col : colList) {
+ lst.addAll(col);
}
+ return getMCParticleMap(type, lst);
}
- List<SimTrackerHit> out = _mcToSimHitsMap.get(mcParticle);
- if (out == null) out = Collections.emptyList();
- return out;
}
-
- /** Returns time-ordered list of digitized ECAL hits to which the given <tt>MCParticle</tt> has contributed. */
- public List<SimCalorimeterHit> getDigitizedEcalHits(MCParticle mcParticle) {
- throw new UnsupportedOperationException("FIXME: NOT IMPLEMENTED");
+
+
+// -- Collection of reco objects to RelationalTable methods : -----------------
+
+ public <T> WeightedTable<MCParticle,T> getMCParticleMap(Rec type, Collection<? extends T> collection) {
+ WeightedTable<MCParticle,T> table = new WeightedTable<MCParticle,T>();
+ LinkedHashSet<T> set = new LinkedHashSet<T>(collection);
+ for (T e : set) {
+ WeightedList<MCParticle> mcList = findMCParticles(e);
+ for (int i=0; i<mcList.size(); i++) {
+ table.add(mcList.get(i), e, mcList.getWeight(i));
+ }
+ }
+ return table;
}
-
- /** Returns time-ordered list of digitized ECAL hits to which the given <tt>MCParticle</tt> has contributed. */
- public List<SimCalorimeterHit> getDigitizedHcalHits(MCParticle mcParticle) {
- throw new UnsupportedOperationException("FIXME: NOT IMPLEMENTED");
+
+
+// -- MCParticle to Reco Objects methods : ------------------------------------
+
+ public <T> WeightedList<T> get(Rec type, MCParticle mcParticle) {
+ WeightedTable<MCParticle,T> map = _defMaps.get(type);
+ if (map == null) {
+ String[] names = _driver._defaultNames.get(type);
+ if (names == null) {
+ List<List<T>> colList = _event.get(type.type());
+ ArrayList<T> col = new ArrayList<T>(100);
+ for (List<T> lst : colList) col.addAll(lst);
+ map = getMCParticleMap(type, col);
+ } else {
+ map = getMCParticleMap(type, names);
+ }
+ _defMaps.put(type, map);
+ }
+ return map.listFrom(mcParticle);
}
-
- /** Returns a track associated with the given <tt>MCParticle</tt>. */
- public CruxTrack getTrack(MCParticle mcParticle) {
- return (_mcToTrackMap == null) ? null : _mcToTrackMap.get(mcParticle);
+
+
+// -- Reco object to MCParticles methods (lookup in tables) : -----------------
+
+ public WeightedList<MCParticle> getMCParticles(Object reconstructedObject) {
+ Rec type;
+ if (reconstructedObject instanceof ITrack) {
+ type = Rec.TRACK;
+ } else if (reconstructedObject instanceof CalorimeterHit) {
+ type = Rec.CAL_HIT;
+ } else if (reconstructedObject instanceof Cluster) {
+ type = Rec.CLUSTER;
+ } else if (reconstructedObject instanceof CatSeed) {
+ type = Rec.CAT_SEED;
+ } else {
+ throw new IllegalArgumentException("No idea how to find MCParticles for "+ reconstructedObject.getClass());
+ }
+ return getMCParticles(type, reconstructedObject);
}
-
-// -- Modifiers : -------------------------------------------------------------
-
- /** Builds a mapping of <tt>MCParticles</tt> to <tt>CruxTracks</tt>. */
- public void addTracks(List<CruxTrack> trackList) {
- _mcToTrackMap = new HashMap<MCParticle,CruxTrack>(((int)(trackList.size()/0.75f))+1, 0.75f);
- for (CruxTrack track : trackList) {
- MCParticle mc = track.getMCParticle();
- if (mc != null) _mcToTrackMap.put(mc, track);
+
+ public WeightedList<MCParticle> getMCParticles(Rec type, Object reconstructedObject) {
+ WeightedTable map = _defMaps.get(type);
+ if (map == null) {
+ map = getMCParticleMap(type);
+ setMCParticleMap(type, map);
}
+ return map.listTo(reconstructedObject);
}
-
-// -- Static utility methods : ------------------------------------------------
-
- static public List<MCParticle> getMCParticles(CruxCluster cluster) {
- HashSet<MCParticle> mcSet = new HashSet<MCParticle>();
- List<CalorimeterHit> hitList = cluster.getCalorimeterHits();
- for (CalorimeterHit cHit : hitList) {
- SimCalorimeterHit hit = (SimCalorimeterHit) cHit;
- int nPart = hit.getMCParticleCount();
- for (int i=0; i<nPart; i++) {
- mcSet.add(hit.getMCParticle(i));
+
+
+// -- Reco object to MCParticles methods : ------------------------------------
+
+ private WeightedList<MCParticle> findMCParticles(Object reconstructedObject) {
+ if (reconstructedObject instanceof ITrack) {
+ return findMCParticles((ITrack)reconstructedObject);
+ } else if (reconstructedObject instanceof CalorimeterHit) {
+ return findMCParticles((CalorimeterHit)reconstructedObject);
+ } else if (reconstructedObject instanceof Cluster) {
+ return findMCParticles((Cluster)reconstructedObject);
+ } else if (reconstructedObject instanceof CatSeed) {
+ return findMCParticles((CatSeed)reconstructedObject);
+ } else {
+ throw new IllegalArgumentException("No idea how to find MCParticles for "+ reconstructedObject.getClass());
+ }
+ }
+
+ public WeightedList<MCParticle> findMCParticles(ITrack track) {
+ List<? extends ITrackerHit> hits = track.getAnchorHits();
+ WeightedList<MCParticle> out = new WeightedList<MCParticle>(1);
+ for (ITrackerHit hit : hits) {
+ List<MCParticle> mcList = _mcTruthVS.getMCParticles(hit);
+ for (MCParticle mc : mcList) {
+ out.addWeight(mc, 1.);
}
}
- return new ArrayList<MCParticle>(mcSet);
+ out.sort();
+ return out;
}
-
- static public HashMap<MCParticle, ArrayList<CruxCluster>> getMCParticleToClusterMap(Collection<CruxCluster> clusterList) {
- HashMap<MCParticle, ArrayList<CruxCluster>> map = new HashMap<MCParticle, ArrayList<CruxCluster>>();
- for (CruxCluster cluster : clusterList) {
- for (MCParticle mc : getMCParticles(cluster)) {
- ArrayList<CruxCluster> clusters = map.get(mc);
- if (clusters == null) {
- clusters = new ArrayList<CruxCluster>();
- map.put(mc, clusters);
- }
- clusters.add(cluster);
+
+ public WeightedList<MCParticle> findMCParticles(CalorimeterHit hit) {
+ SimCalorimeterHit sHit = (SimCalorimeterHit) hit;
+ int n = sHit.getMCParticleCount();
+ WeightedList<MCParticle> out = new WeightedList<MCParticle>(n);
+ for (int i=0; i<n; i++) {
+ out.add(sHit.getMCParticle(i), sHit.getContributedEnergy(i));
+ }
+ out.sort();
+ return out;
+ }
+
+ public WeightedList<MCParticle> findMCParticles(Cluster cluster) {
+ WeightedList<MCParticle> out = new WeightedList<MCParticle>();
+ List<CalorimeterHit> hitList = cluster.getCalorimeterHits();
+ for (CalorimeterHit hit : hitList) {
+ WeightedList<MCParticle> mcList = findMCParticles(hit);
+ for (int i=0; i<mcList.size(); i++) {
+ out.addWeight(mcList.get(i), mcList.getWeight(i));
}
}
- for (ArrayList<CruxCluster> cList : map.values()) cList.trimToSize();
- return map;
+ out.sort();
+ return out;
+ }
+
+ public WeightedList<MCParticle> findMCParticles(CatSeed seed) {
+ throw new UnsupportedOperationException(); //FIXME
}
-
-// -- Private parts : ---------------------------------------------------------
-
- private EventHeader _event;
-
- private HashMap<MCParticle, ArrayList<SimTrackerHit>> _mcToSimHitsMap;
- private HashMap<MCParticle,CruxTrack> _mcToTrackMap;
}
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/mctruth
diff -u -r1.1.1.1 -r1.2
--- MCTruthDriverCrux.java 10 Dec 2008 22:03:06 -0000 1.1.1.1
+++ MCTruthDriverCrux.java 9 Feb 2009 03:57:38 -0000 1.2
@@ -1,5 +1,7 @@
package org.lcsim.contrib.onoprien.crux.mctruth;
+import java.util.*;
+
import org.lcsim.event.EventHeader;
import org.lcsim.contrib.onoprien.util.job.Driver;
@@ -9,24 +11,105 @@
*
*
* @author D. Onoprienko
- * @version $Id: MCTruthDriverCrux.java,v 1.1.1.1 2008/12/10 22:03:06 jeremy Exp $
+ * @version $Id: MCTruthDriverCrux.java,v 1.2 2009/02/09 03:57:38 onoprien Exp $
*/
public class MCTruthDriverCrux extends Driver {
+
+// -- Private parts : ---------------------------------------------------------
+
+ EnumMap<MCTruthCrux.Rec, String[]> _defaultNames = new EnumMap<MCTruthCrux.Rec, String[]>(MCTruthCrux.Rec.class);
// -- Constructors : ----------------------------------------------------------
public MCTruthDriverCrux() {
}
+
+
+// -- Setters : ---------------------------------------------------------------
+
+ /**
+ *
+ * Set any parameter.
+ * The following parameters can be set with this method:
+ * <p><dl>
+ * <dt>"TRACKS"</dt> <dd>One or more names of default {@link ITrack} collections in the event record.
+ * Tracks from these collections will be associated with <tt>MCParticles</tt> by
+ * {@link MCTruthCrux} methods unless the collection is explicitly specified.<br>
+ * Default: <tt>null</tt> (no default collection of tracks).</dd>
+ * <dt>"CALORIMETER_HITS"</dt> <dd>One or more names of default {@link CalorimeterHit} collections in the event record.
+ * Hits from these collections will be associated with <tt>MCParticles</tt> by
+ * {@link MCTruthCrux} methods unless the collection is explicitly specified.<br>
+ * Default: <tt>null</tt> (no default collection of hits).</dd>
+ * <dt>"CLUSTERS"</dt> <dd>One or more names of default {@link Cluster} collections in the event record.
+ * Clusters from these collections will be associated with <tt>MCParticles</tt> by
+ * {@link MCTruthCrux} methods unless the collection is explicitly specified.<br>
+ * Default: <tt>null</tt> (no default collection of clusters).</dd>
+ * <dt>"CAT_SEEDS"</dt> <dd>One or more names of default {@link CatSeed} collections in the event record.
+ * CAT seeds from these collections will be associated with <tt>MCParticles</tt> by
+ * {@link MCTruthCrux} methods unless the collection is explicitly specified.<br>
+ * Default: <tt>null</tt> (no default collection of CAT seeds).</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 number of values, or a value
+ * of incorrect type is supplied.
+ */
+ public void set(String name, Object... values) {
+ try {
+ if (name.equalsIgnoreCase("TRACKS")) {
+ String[] names;
+ if (values.length == 0) {
+ names = null;
+ } else {
+ names = new String[values.length];
+ for (int i=0; i<values.length; i++) names[i] = (String) values[i];
+ }
+ _defaultNames.put(MCTruthCrux.Rec.TRACK, names);
+ } else if (name.equalsIgnoreCase("CALORIMETER_HITS")) {
+ String[] names;
+ if (values.length == 0) {
+ names = null;
+ } else {
+ names = new String[values.length];
+ for (int i=0; i<values.length; i++) names[i] = (String) values[i];
+ }
+ _defaultNames.put(MCTruthCrux.Rec.CAL_HIT, names);
+ } else if (name.equalsIgnoreCase("CLUSTERS")) {
+ String[] names;
+ if (values.length == 0) {
+ names = null;
+ } else {
+ names = new String[values.length];
+ for (int i=0; i<values.length; i++) names[i] = (String) values[i];
+ }
+ _defaultNames.put(MCTruthCrux.Rec.CLUSTER, names);
+ } else if (name.equalsIgnoreCase("CAT_SEEDS")) {
+ String[] names;
+ if (values.length == 0) {
+ names = null;
+ } else {
+ names = new String[values.length];
+ for (int i=0; i<values.length; i++) names[i] = (String) values[i];
+ }
+ _defaultNames.put(MCTruthCrux.Rec.CAT_SEED, names);
+ } else {
+ super.set(name, values);
+ }
+ } catch (ClassCastException x) {
+ throw new IllegalArgumentException(ERR_VIT, x);
+ }
+ }
// -- Processing event : ------------------------------------------------------
public void process(EventHeader event) {
- MCTruthCrux mcTruth = new MCTruthCrux(event);
+ MCTruthCrux mcTruth = new MCTruthCrux(this, event);
event.put(MCTruthCrux.KEY, mcTruth);
}
-// -- Private parts : ---------------------------------------------------------
-
}
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/tests
diff -N TestDriverMCTruth.java
--- TestDriverMCTruth.java 10 Dec 2008 22:03:06 -0000 1.1.1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,74 +0,0 @@
-package org.lcsim.contrib.onoprien.crux.tests;
-
-import java.util.*;
-import static java.util.logging.Level.*;
-
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.MCParticle;
-import org.lcsim.event.SimTrackerHit;
-
-import org.lcsim.contrib.onoprien.util.job.Driver;
-
-import org.lcsim.contrib.onoprien.crux.mctruth.MCTruthCrux;
-import org.lcsim.contrib.onoprien.crux.mctruth.MCTruthDriverCrux;
-
-/**
- *
- *
- * @author D. Onoprienko
- * @version $Id: TestDriverMCTruth.java,v 1.1.1.1 2008/12/10 22:03:06 jeremy Exp $
- */
-public class TestDriverMCTruth extends Driver {
-
-// -- Constructors : ----------------------------------------------------------
-
- public TestDriverMCTruth() {
-
- set("LOG_DEFAULT_LEVEL", INFO);
-
- add(new MCTruthDriverCrux());
-
- }
-
-// -- Event processing : ------------------------------------------------------
-
- public void process(EventHeader event) {
-
- super.process(event);
-
- _event = event;
- _mcTruth = (MCTruthCrux) event.get(MCTruthCrux.KEY);
-
- testMCParticleToSimHitMap();
-
- _event = null;
- _mcTruth = null;
- }
-
-// -- Tests : -----------------------------------------------------------------
-
- public void testMCParticleToSimHitMap() {
-
- List<MCParticle> mcList = _event.getMCParticles();
- log("MCParticle in event: " + mcList.size());
-
- for (MCParticle mc : mcList) {
- log("");
- List<SimTrackerHit> hitList = _mcTruth.getSimTrackerHits(mc);
- if (hitList.size() > 0) {
- log("MCParticle: " + mc.getType().getName());
- for (SimTrackerHit hit : hitList) {
- if (hit.getMCParticle() != mc) log("testMCParticleToSimHitMap: ERROR 1");
- log(" Hit: time "+hit.getTime()+" sd "+hit.getSubdetector().getName()+" layer "+hit.getLayer());
- }
- }
- }
-
- }
-
-// -- Private parts : ---------------------------------------------------------
-
- private EventHeader _event;
- private MCTruthCrux _mcTruth;
-
-}
CVSspam 0.2.8