1 added + 2 removed + 17 modified, total 20 files
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux
diff -u -r1.2 -r1.3
--- CruxConfig.java 22 Jan 2009 21:01:55 -0000 1.2
+++ CruxConfig.java 18 Feb 2009 03:29:06 -0000 1.3
@@ -45,7 +45,7 @@
* </ul>
*
* @author D. Onoprienko
- * @version $Id: CruxConfig.java,v 1.2 2009/01/22 21:01:55 onoprien Exp $
+ * @version $Id: CruxConfig.java,v 1.3 2009/02/18 03:29:06 onoprien Exp $
*/
public class CruxConfig implements JobEventListener, CalGeometryConfig {
@@ -89,12 +89,12 @@
// create modules
- CalModule eBar = new CalModule("ECAL_BARREL", EnumSet.of(ECAL, BARREL), "EMBarrel");
- CalModule hBar = new CalModule("HCAL_BARREL", EnumSet.of(HCAL, BARREL), "HADBarrel");
- CalModule eSouthEnd = new CalModule("ECAL_ENDCAP_SOUTH", EnumSet.of(ECAL, ENDCAP, SOUTH), "EMEndcap");
- CalModule eNorthEnd = new CalModule("ECAL_ENDCAP_NORTH", EnumSet.of(ECAL, ENDCAP, NORTH), "EMEndcap");
- CalModule hSouthEnd = new CalModule("HCAL_ENDCAP_SOUTH", EnumSet.of(HCAL, ENDCAP, SOUTH), "HADEndcap");
- CalModule hNorthEnd = new CalModule("HCAL_ENDCAP_NORTH", EnumSet.of(HCAL, ENDCAP, NORTH), "HADEndcap");
+ CalModule eBar = new CalModule("ECAL_BARREL", EnumSet.of(ECAL, BARREL, ENTRY), "EMBarrel");
+ CalModule hBar = new CalModule("HCAL_BARREL", EnumSet.of(HCAL, BARREL, EXIT), "HADBarrel");
+ CalModule eSouthEnd = new CalModule("ECAL_ENDCAP_SOUTH", EnumSet.of(ECAL, ENDCAP, SOUTH, ENTRY), "EMEndcap");
+ CalModule eNorthEnd = new CalModule("ECAL_ENDCAP_NORTH", EnumSet.of(ECAL, ENDCAP, NORTH, ENTRY), "EMEndcap");
+ CalModule hSouthEnd = new CalModule("HCAL_ENDCAP_SOUTH", EnumSet.of(HCAL, ENDCAP, SOUTH, EXIT), "HADEndcap");
+ CalModule hNorthEnd = new CalModule("HCAL_ENDCAP_NORTH", EnumSet.of(HCAL, ENDCAP, NORTH, EXIT), "HADEndcap");
_modules = new ArrayList<CalModule>(6);
Collections.addAll(_modules, eBar, hBar, eSouthEnd, eNorthEnd, hSouthEnd, hNorthEnd);
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux
diff -u -r1.1.1.1 -r1.2
--- CruxManager.java 10 Dec 2008 22:03:06 -0000 1.1.1.1
+++ CruxManager.java 18 Feb 2009 03:29:06 -0000 1.2
@@ -1,16 +1,6 @@
package org.lcsim.contrib.onoprien.crux;
-import java.lang.ref.WeakReference;
-import java.util.*;
-
-import org.lcsim.conditions.ConditionsListener;
-import org.lcsim.conditions.ConditionsEvent;
-import org.lcsim.conditions.ConditionsManager;
-import org.lcsim.conditions.ConditionsManager.ConditionsSetNotFoundException;
-import org.lcsim.event.CalorimeterHit;
-import org.lcsim.event.EventHeader;
-import org.lcsim.geometry.Detector;
-import org.lcsim.util.aida.AIDA;
+import java.util.logging.Level;
import org.lcsim.contrib.onoprien.util.job.Driver;
import org.lcsim.contrib.onoprien.util.job.JobManager;
@@ -30,7 +20,7 @@
*
*
* @author D. Onoprienko
- * @version $Id: CruxManager.java,v 1.1.1.1 2008/12/10 22:03:06 jeremy Exp $
+ * @version $Id: CruxManager.java,v 1.2 2009/02/18 03:29:06 onoprien Exp $
*/
public class CruxManager extends Driver {
@@ -38,8 +28,8 @@
private CruxManager() {
_config = new CruxConfig();
- _geom = new CalGeometry(_config);
JobManager.defaultInstance().put(this, CruxManager.class);
+ log("Created CruxManager", Level.SEVERE);
}
@@ -51,13 +41,6 @@
return _defInstance;
}
- /**
- * Returns <tt>CalGeometry</tt> object associated with this <tt>CruxManager</tt>.
- */
- public CalGeometry getGeometry() {
- return _geom;
- }
-
/** Returns <tt>CruxConfig</tt> object associated with this <tt>CruxManager</tt>. */
public CruxConfig getConfig() {
return _config;
@@ -81,7 +64,6 @@
static private CruxManager _defInstance;
- private CalGeometry _geom;
private CruxConfig _config;
private CruxClusterValidator _defaultClusterValidator;
}
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/algorithms
diff -u -r1.2 -r1.3
--- ClusteringDriver.java 12 Feb 2009 01:32:08 -0000 1.2
+++ ClusteringDriver.java 18 Feb 2009 03:29:06 -0000 1.3
@@ -2,15 +2,16 @@
import java.util.*;
import java.util.logging.Level;
-import org.lcsim.contrib.onoprien.crux.CruxManager;
-import org.lcsim.contrib.onoprien.crux.geom.CalModule;
import org.lcsim.event.Cluster;
import org.lcsim.event.EventHeader;
import org.lcsim.recon.cluster.util.Clusterer;
import org.lcsim.contrib.onoprien.util.job.Driver;
+import org.lcsim.contrib.onoprien.util.job.JobManager;
+import org.lcsim.contrib.onoprien.crux.geom.CalGeometry;
+import org.lcsim.contrib.onoprien.crux.geom.CalModule;
import org.lcsim.contrib.onoprien.crux.infrastructure.*;
/**
@@ -21,7 +22,7 @@
* input hit map from the event,
*
* @author D. Onoprienko
- * @version $Id: ClusteringDriver.java,v 1.2 2009/02/12 01:32:08 onoprien Exp $
+ * @version $Id: ClusteringDriver.java,v 1.3 2009/02/18 03:29:06 onoprien Exp $
*/
public class ClusteringDriver extends Driver {
@@ -86,6 +87,7 @@
super.process(event);
CruxHitMap inMap = (CruxHitMap) event.get(_inMapName);
+ CalGeometry geom = JobManager.defaultInstance().get(CalGeometry.class);
for (int out=0; out<_filters.size(); out++) {
@@ -96,8 +98,7 @@
clusterList = new ArrayList<Cluster>(0);
} else if (_splitModules) {
clusterList = new ArrayList<Cluster>();
- CruxManager cruxMan = CruxManager.defaultInstance();
- List<CalModule> modules = cruxMan.getGeometry().getModules();
+ List<CalModule> modules = geom.getModules();
for (CalModule module : modules) {
CruxHitMap moduleMap = filteredMap.toMap(module);
if (! moduleMap.isEmpty()) clusterList.addAll(_clusterers.get(out).createClusters(moduleMap));
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/algorithms/rosary
diff -u -r1.1.1.1 -r1.2
--- DotAndBeadFinder.java 10 Dec 2008 22:03:06 -0000 1.1.1.1
+++ DotAndBeadFinder.java 18 Feb 2009 03:29:06 -0000 1.2
@@ -1,21 +1,22 @@
package org.lcsim.contrib.onoprien.crux.algorithms.rosary;
import java.util.*;
-import org.lcsim.contrib.onoprien.crux.CruxManager;
-import org.lcsim.contrib.onoprien.crux.geom.CalLayer;
-import org.lcsim.contrib.onoprien.crux.geom.CalGeometry;
import org.lcsim.event.Cluster;
import org.lcsim.recon.cluster.nn.NearestNeighborClusterer;
import org.lcsim.recon.cluster.util.Clusterer;
+import org.lcsim.contrib.onoprien.util.job.JobManager;
+
+import org.lcsim.contrib.onoprien.crux.geom.CalLayer;
+import org.lcsim.contrib.onoprien.crux.geom.CalGeometry;
import org.lcsim.contrib.onoprien.crux.infrastructure.*;
/**
* Clusterer that creates {@link Dot}s and {@link Beads} on a layer.
*
* @author D. Onoprienko
- * @version $Id: DotAndBeadFinder.java,v 1.1.1.1 2008/12/10 22:03:06 jeremy Exp $
+ * @version $Id: DotAndBeadFinder.java,v 1.2 2009/02/18 03:29:06 onoprien Exp $
*/
public class DotAndBeadFinder {
@@ -23,7 +24,7 @@
public DotAndBeadFinder() {
_clusterer = new NearestNeighborClusterer(1, 1, 0, 0, 0.);
- _geom = CruxManager.defaultInstance().getGeometry();
+ _geom = JobManager.defaultInstance().get(CalGeometry.class);
}
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/algorithms/rosary
diff -u -r1.2 -r1.3
--- RosaryClusterer.java 22 Jan 2009 21:01:56 -0000 1.2
+++ RosaryClusterer.java 18 Feb 2009 03:29:06 -0000 1.3
@@ -3,16 +3,10 @@
import java.util.*;
import java.util.logging.Level;
-import hep.physics.vec.BasicHep3Vector;
import hep.physics.vec.Hep3Vector;
-import org.lcsim.contrib.onoprien.crux.CruxManager;
-import org.lcsim.contrib.onoprien.crux.geom.CalLayer;
-import org.lcsim.contrib.onoprien.crux.geom.CalGeometry;
-import org.lcsim.detector.IDetectorElement;
import org.lcsim.event.CalorimeterHit;
import org.lcsim.event.Cluster;
import org.lcsim.event.EventHeader;
-import org.lcsim.geometry.IDDecoder;
import org.lcsim.recon.cluster.util.Clusterer;
import org.lcsim.contrib.onoprien.util.job.Driver;
@@ -21,6 +15,8 @@
import org.lcsim.contrib.onoprien.util.job.JobManager;
import org.lcsim.contrib.onoprien.util.swim.Trajectory;
+import org.lcsim.contrib.onoprien.crux.geom.CalLayer;
+import org.lcsim.contrib.onoprien.crux.geom.CalGeometry;
import org.lcsim.contrib.onoprien.crux.infrastructure.*;
import static org.lcsim.contrib.onoprien.crux.algorithms.rosary.RosaryNode.Type.*;
@@ -29,7 +25,7 @@
*
*
* @author D. Onoprienko
- * @version $Id: RosaryClusterer.java,v 1.2 2009/01/22 21:01:56 onoprien Exp $
+ * @version $Id: RosaryClusterer.java,v 1.3 2009/02/18 03:29:06 onoprien Exp $
*/
public class RosaryClusterer extends Driver implements Clusterer, JobEventListener {
@@ -37,9 +33,9 @@
public RosaryClusterer() {
set("LOG_DEFAULT_LEVEL", Level.FINEST);
- _cruxMan = CruxManager.defaultInstance();
- _geom = _cruxMan.getGeometry();
- JobManager.defaultInstance().addListener(this, _geom);
+ JobManager jobMan = JobManager.defaultInstance();
+ _geom = jobMan.get(CalGeometry.class);
+ jobMan.addListener(this, _geom);
}
public void detectorChanged(JobEvent jEvent) {
@@ -334,7 +330,6 @@
// -- Private parts : ---------------------------------------------------------
- protected CruxManager _cruxMan;
protected CalGeometry _geom;
protected String _inMapName;
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/cheat
diff -u -r1.1 -r1.2
--- CheatClusteringDriver.java 22 Jan 2009 21:12:42 -0000 1.1
+++ CheatClusteringDriver.java 18 Feb 2009 03:29:06 -0000 1.2
@@ -1,8 +1,6 @@
package org.lcsim.contrib.onoprien.crux.cheat;
import java.util.*;
-import org.lcsim.contrib.onoprien.crux.CruxManager;
-import org.lcsim.contrib.onoprien.crux.geom.CalGeometry;
import org.lcsim.event.CalorimeterHit;
import org.lcsim.event.EventHeader;
@@ -11,21 +9,23 @@
import org.lcsim.recon.cluster.util.BasicCluster;
import org.lcsim.contrib.onoprien.util.job.Driver;
+import org.lcsim.contrib.onoprien.util.job.JobManager;
+import org.lcsim.contrib.onoprien.crux.geom.CalGeometry;
import org.lcsim.contrib.onoprien.crux.infrastructure.*;
/**
* Cheater that attaches hits and tracks to reconstructed particles.
*
* @author D. Onoprienko
- * @version $Id: CheatClusteringDriver.java,v 1.1 2009/01/22 21:12:42 onoprien Exp $
+ * @version $Id: CheatClusteringDriver.java,v 1.2 2009/02/18 03:29:06 onoprien Exp $
*/
public class CheatClusteringDriver extends Driver {
// -- Constructors : ----------------------------------------------------------
public CheatClusteringDriver() {
- _geom = CruxManager.defaultInstance().getGeometry();
+ _geom = JobManager.defaultInstance().get(CalGeometry.class);
}
// -- Setters : ---------------------------------------------------------------
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/cheat
diff -u -r1.3 -r1.4
--- RecoDefinition.java 13 Feb 2009 20:02:18 -0000 1.3
+++ RecoDefinition.java 18 Feb 2009 03:29:06 -0000 1.4
@@ -25,12 +25,14 @@
* the methods.
*
* @author D. Onoprienko
- * @version $Id: RecoDefinition.java,v 1.3 2009/02/13 20:02:18 onoprien Exp $
+ * @version $Id: RecoDefinition.java,v 1.4 2009/02/18 03:29:06 onoprien Exp $
*/
public class RecoDefinition implements IRecoDefinition {
// -- Private parts : ---------------------------------------------------------
+ protected static String ERR_CNH = "Cannot handle this type of object: ";
+
private String _name;
protected EnumMap<RecType, CutSet> _cuts;
@@ -142,7 +144,7 @@
public boolean isFindable(RecType type, MCParticle mcParticle) {
CutSet cutSet = _cuts.get(type);
- if (cutSet == null) throw new IllegalArgumentException();
+ if (cutSet == null) throw new IllegalArgumentException(ERR_CNH + type);
// Charge cut
@@ -174,12 +176,12 @@
}
public boolean isReconstructed(RecType type, MCParticle mcParticle) {
- if (!_cuts.containsKey(type)) throw new IllegalArgumentException();
+ if (!_cuts.containsKey(type)) throw new IllegalArgumentException(ERR_CNH + type);
return true;
}
public boolean isFake(RecType type, Object recObject) {
- if (!_cuts.containsKey(type)) throw new IllegalArgumentException();
+ if (!_cuts.containsKey(type)) throw new IllegalArgumentException(ERR_CNH + type);
return true;
}
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/cheat
diff -u -r1.1 -r1.2
--- RecoDefinitionCrux.java 13 Feb 2009 20:02:18 -0000 1.1
+++ RecoDefinitionCrux.java 18 Feb 2009 03:29:06 -0000 1.2
@@ -30,7 +30,7 @@
* <tt>endEvent()</tt> to clean it up once the event is processed.
*
* @author D. Onoprienko
- * @version $Id: RecoDefinitionCrux.java,v 1.1 2009/02/13 20:02:18 onoprien Exp $
+ * @version $Id: RecoDefinitionCrux.java,v 1.2 2009/02/18 03:29:06 onoprien Exp $
*/
public class RecoDefinitionCrux extends RecoDefinition {
@@ -84,7 +84,7 @@
public void setCut(RecType type, String name, Object... values) {
try {
super.setCut(type, name, values);
- } catch (IllegalArgumentException x) {
+ } catch (NoSuchParameterException x) {
CutSetCrux cutSet = _cutsCrux.get(type);
if (cutSet == null) _cutsCrux.put(type, cutSet = new CutSetCrux());
try {
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/diagnostics
diff -u -r1.5 -r1.6
--- ClusteringTest.java 13 Feb 2009 20:02:19 -0000 1.5
+++ ClusteringTest.java 18 Feb 2009 03:29:06 -0000 1.6
@@ -26,14 +26,16 @@
*
*
* @author D. Onoprienko
- * @version $Id: ClusteringTest.java,v 1.5 2009/02/13 20:02:19 onoprien Exp $
+ * @version $Id: ClusteringTest.java,v 1.6 2009/02/18 03:29:06 onoprien Exp $
*/
public class ClusteringTest extends Driver implements JobEventListener {
// -- Constructors and initialization : ---------------------------------------
public ClusteringTest() {
- JobManager.defaultInstance().addListener(this, CruxManager.defaultInstance().getGeometry());
+ JobManager jobMan = JobManager.defaultInstance();
+ _geom = jobMan.get(CalGeometry.class);
+ JobManager.defaultInstance().addListener(this, _geom);
}
/**
@@ -41,10 +43,7 @@
* Called by {@link CruxManager} before processing events, and whenever detector changes.
*/
public void detectorChanged(JobEvent jEvent) {
-
_aida = JobManager.defaultInstance().getAIDA();
-
- _geom = CruxManager.defaultInstance().getGeometry();
_modules = _geom.getModules();
}
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/geom
diff -u -r1.1.1.1 -r1.2
--- CalGeometry.java 10 Dec 2008 22:03:06 -0000 1.1.1.1
+++ CalGeometry.java 18 Feb 2009 03:29:06 -0000 1.2
@@ -5,7 +5,6 @@
import hep.physics.vec.Hep3Vector;
import org.lcsim.event.CalorimeterHit;
import org.lcsim.geometry.Detector;
-import org.lcsim.geometry.Subdetector;
import org.lcsim.contrib.onoprien.util.job.JobEvent;
import org.lcsim.contrib.onoprien.util.job.JobEventListener;
@@ -13,24 +12,34 @@
import org.lcsim.contrib.onoprien.util.swim.Trajectory;
/**
- * Singleton of this class is created by {@link CruxManager}, and provides various
- * detector geometry related services to other classes.
+ * Provides various calorimeter geometry related services to other classes.
+ * Singleton of this class is available at run time through {@link JobManager} by
+ * calling <tt>JobManager.defaultInstance().get(CalGeometry.class)</tt>.
*
* @author D. Onoprienko
- * @version $Id: CalGeometry.java,v 1.1.1.1 2008/12/10 22:03:06 jeremy Exp $
+ * @version $Id: CalGeometry.java,v 1.2 2009/02/18 03:29:06 onoprien Exp $
*/
public class CalGeometry implements JobEventListener {
+
+ static public CalGeometry defaultInstance() {
+ return new CalGeometry();
+ }
// -- Constructors and initialization : ---------------------------------------
- public CalGeometry(CalGeometryConfig config) {
+ private CalGeometry() {
+ JobManager.defaultInstance().addListener(this);
+ }
+
+ public void setConfig(CalGeometryConfig config) {
+ if (_config != null) throw new IllegalStateException("Geometry config has already been set.");
_config = config;
JobManager jobManager = JobManager.defaultInstance();
jobManager.addListener(this, config);
- jobManager.put(this, CalGeometry.class);
}
public void detectorChanged(JobEvent jEvent) {
+ if (_config == null) throw new IllegalStateException("Geometry config has not been set.");
_detector = jEvent.getDetector();
_modules = new ArrayList(_config.getModules());
}
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/geom
diff -u -r1.1.1.1 -r1.2
--- CalModule.java 10 Dec 2008 22:03:06 -0000 1.1.1.1
+++ CalModule.java 18 Feb 2009 03:29:06 -0000 1.2
@@ -1,7 +1,6 @@
package org.lcsim.contrib.onoprien.crux.geom;
import java.util.*;
-import org.lcsim.contrib.onoprien.crux.infrastructure.*;
import org.lcsim.geometry.Subdetector;
@@ -9,11 +8,11 @@
* Class to represent a part of the calorimeter.
*
* @author D. Onoprienko
- * @version $Id: CalModule.java,v 1.1.1.1 2008/12/10 22:03:06 jeremy Exp $
+ * @version $Id: CalModule.java,v 1.2 2009/02/18 03:29:06 onoprien Exp $
*/
public class CalModule {
- public enum Attribute {ECAL, HCAL, BARREL, ENDCAP, SOUTH, NORTH}
+ public enum Attribute {ECAL, HCAL, BARREL, ENDCAP, SOUTH, NORTH, ENTRY, EXIT}
// -- Constructors and initialization : ---------------------------------------
@@ -69,6 +68,14 @@
public boolean isNorth() {
return _attributes.contains(Attribute.NORTH);
}
+
+ public boolean isEntry() {
+ return _attributes.contains(Attribute.ENTRY);
+ }
+
+ public boolean isExit() {
+ return _attributes.contains(Attribute.EXIT);
+ }
public Subdetector getSubdetector() {
return _sd;
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/infrastructure
diff -N CruxMipStub.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ CruxMipStub.java 18 Feb 2009 03:29:07 -0000 1.1
@@ -0,0 +1,127 @@
+package org.lcsim.contrib.onoprien.crux.infrastructure;
+
+import java.util.*;
+
+import org.lcsim.event.CalorimeterHit;
+import org.lcsim.event.Cluster;
+
+import org.lcsim.contrib.onoprien.crux.geom.CalModule;
+
+/**
+ * MIP stub.
+ * Currently supports MIP stubs contained within a single calorimeter module.
+ *
+ * @author D. Onoprienko
+ * @version $Id: CruxMipStub.java,v 1.1 2009/02/18 03:29:07 onoprien Exp $
+ */
+public class CruxMipStub implements ICluster {
+
+// -- Private parts : ---------------------------------------------------------
+
+ private final static double[] _zero3 = new double[3];
+ private final static double[] _zero6 = new double[6];
+
+ private ArrayList<CalorimeterHit> _hits;
+ private int[] _layerStartIndex;
+ private int _firstLayer, _nextLayer;
+
+ private CalModule _module;
+
+// -- Constructors : ----------------------------------------------------------
+
+ public CruxMipStub(CalModule module, int firstLayer) {
+ _module = module;
+ _hits = new ArrayList<CalorimeterHit>();
+ _firstLayer = firstLayer;
+ _nextLayer = firstLayer;
+ _layerStartIndex = new int[module.getLayers().size()];
+ }
+
+// -- Implement ICluster : ----------------------------------------------------
+
+ public int getType() {return 0;}
+
+ public double getEnergy() {return 0.;}
+
+ public double[] getPosition() {return _zero3;}
+
+ public double[] getPositionError() {return _zero3;}
+
+ public double getITheta() {return 0.;}
+
+ public double getIPhi() {return 0.;}
+
+ public int getSize() {return _hits.size();}
+
+ public double[] getDirectionError() {return _zero3;}
+
+ public double[] getShape() {return _zero6;}
+
+ public List<Cluster> getClusters() {return Collections.emptyList();}
+
+ public List<CalorimeterHit> getCalorimeterHits() {return Collections.unmodifiableList(_hits);}
+
+ public double[] getHitContributions() {throw new UnsupportedOperationException();}
+
+ public double[] getSubdetectorEnergies() {throw new UnsupportedOperationException();}
+
+
+// -- Additional getters : ----------------------------------------------------
+
+ /**
+ * Returns list of calorimeter hits in the specified layer.
+ * @param layer Ordinal layer number (layers in a {@link CalModule} are numbered from zero.
+ */
+ public List<CalorimeterHit> getHits(int layer) {
+ if (layer < _firstLayer || layer >= _nextLayer) return Collections.emptyList();
+ int fromIndex = _layerStartIndex[layer];
+ int toIndex = (layer < _nextLayer-1) ? _layerStartIndex[layer+1] : _hits.size();
+ return Collections.unmodifiableList(_hits.subList(fromIndex, toIndex));
+ }
+
+ public CalModule getModule() {
+ return _module;
+ }
+
+ public int getFirstLayer() {
+ return _firstLayer;
+ }
+
+ public int getNextLayer() {
+ return _nextLayer;
+ }
+
+ /**
+ * Returns the highest ordinal number among layers with hits. Returns -1 if this MIP stub is empty.
+ */
+ public int getLastLayer() {
+ int layer = _nextLayer;
+ while (layer-- > _firstLayer) {
+ if (!getHits(layer).isEmpty()) return layer;
+ }
+ return -1;
+ }
+
+ public List<CalorimeterHit> getLastHits() {
+ int layer = _nextLayer;
+ while (layer-- > _firstLayer) {
+ List<CalorimeterHit> out = getHits(layer);
+ if (!out.isEmpty()) return out;
+ }
+ return Collections.emptyList();
+ }
+
+
+// -- Modifiers: --------------------------------------------------------------
+
+ public void add(List<? extends CalorimeterHit> hits) {
+ _layerStartIndex[_nextLayer++] = _hits.size();
+ _hits.addAll(hits);
+ }
+
+ public void add(CalorimeterHit hit) {
+ _layerStartIndex[_nextLayer++] = _hits.size();
+ _hits.add(hit);
+ }
+
+}
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/infrastructure
diff -u -r1.2 -r1.3
--- CatSeed.java 11 Feb 2009 23:31:40 -0000 1.2
+++ CatSeed.java 18 Feb 2009 03:29:06 -0000 1.3
@@ -5,6 +5,7 @@
import hep.physics.vec.Hep3Vector;
import org.lcsim.event.CalorimeterHit;
import org.lcsim.event.Cluster;
+import org.lcsim.event.MCParticle;
import org.lcsim.contrib.onoprien.util.job.JobManager;
import org.lcsim.contrib.onoprien.util.swim.BField;
@@ -15,16 +16,18 @@
* Stub to prevent build from failing.
*
* @author D. Onoprienko
- * @version $Id: CatSeed.java,v 1.2 2009/02/11 23:31:40 onoprien Exp $
+ * @version $Id: CatSeed.java,v 1.3 2009/02/18 03:29:06 onoprien Exp $
*/
public class CatSeed implements ICluster {
// -- Private parts : ---------------------------------------------------------
private Helix _helix;
- private ICluster _mipStub;
+ private CruxMipStub _mipStub;
private ArrayList<ICluster> _clusters;
+ private MCParticle _mc;
+
private BField _bField;
// -- Constructors : ----------------------------------------------------------
@@ -33,7 +36,7 @@
_bField = JobManager.defaultInstance().get(BField.class);
}
- public CatSeed(Helix helix, ICluster mipStub, List<? extends ICluster> clusters) {
+ public CatSeed(Helix helix, CruxMipStub mipStub, List<? extends ICluster> clusters) {
this();
_helix = helix;
_mipStub = mipStub;
@@ -115,8 +118,26 @@
* Returns cluster of calorimeter hits that belong to the MIP-like portion of this <tt>CatSeed</tt>.
* Hits are ordered in increasing layer number.
*/
- public ICluster getMipStup() {
+ public CruxMipStub getMipStub() {
return _mipStub;
}
+
+ /**
+ * Returns <tt>MCParticle</tt> that has been associated with this CAT seed through a
+ * call to <tt>setMCParticle</tt> method. Returns <tt>null</tt> if no <tt>MCParticle</tt>
+ * has been associated.
+ */
+ public MCParticle getMCParticle() {
+ return _mc;
+ }
+
+// -- Setters : ---------------------------------------------------------------
+
+ /**
+ * Associates <tt>MCParticle</tt> with this CAT seed.
+ */
+ public void setMCParticle(MCParticle mcParticle) {
+ _mc = mcParticle;
+ }
}
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/infrastructure
diff -u -r1.2 -r1.3
--- CruxCluster.java 11 Feb 2009 23:31:40 -0000 1.2
+++ CruxCluster.java 18 Feb 2009 03:29:07 -0000 1.3
@@ -4,18 +4,22 @@
import hep.physics.matrix.SymmetricMatrix;
import hep.physics.vec.BasicHep3Vector;
-import org.lcsim.contrib.onoprien.crux.CruxManager;
-import org.lcsim.contrib.onoprien.crux.geom.CalModule;
-import org.lcsim.contrib.onoprien.crux.geom.CalGeometry;
import org.lcsim.event.CalorimeterHit;
import org.lcsim.event.Cluster;
import org.lcsim.geometry.Subdetector;
+import org.lcsim.contrib.onoprien.util.job.JobManager;
+
+import org.lcsim.contrib.onoprien.crux.CruxManager;
+import org.lcsim.contrib.onoprien.crux.geom.CalModule;
+import org.lcsim.contrib.onoprien.crux.geom.CalGeometry;
+
+
/**
* Crux package specific implementation of {@link ICluster}.
*
* @author D. Onoprienko
- * @version $Id: CruxCluster.java,v 1.2 2009/02/11 23:31:40 onoprien Exp $
+ * @version $Id: CruxCluster.java,v 1.3 2009/02/18 03:29:07 onoprien Exp $
*/
public class CruxCluster implements ICluster {
@@ -221,7 +225,7 @@
* if you are planning to use this method extensively.</i>
*/
public double[] getSubdetectorEnergies() {
- Collection<? extends Subdetector> sdCol = CruxManager.defaultInstance().getGeometry().getDetector().getSubdetectors().values();
+ Collection<? extends Subdetector> sdCol = JobManager.defaultInstance().get(CalGeometry.class).getDetector().getSubdetectors().values();
ArrayList<Subdetector> sdList = new ArrayList<Subdetector>(4);
for (Subdetector sd : sdCol) {
if (sd.isCalorimeter()) sdList.add(sd);
@@ -262,7 +266,7 @@
* Returns a list of calorimeter modules that contain hits from this cluster.
*/
public List<CalModule> getModules() {
- CalGeometry geom = CruxManager.defaultInstance().getGeometry();
+ CalGeometry geom = JobManager.defaultInstance().get(CalGeometry.class);
if (_modules == null) {
HashSet<CalModule> moduleSet = new HashSet<CalModule>();
if (_hits != null) {
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/infrastructure
diff -u -r1.1 -r1.2
--- RecType.java 13 Feb 2009 20:02:19 -0000 1.1
+++ RecType.java 18 Feb 2009 03:29:07 -0000 1.2
@@ -31,10 +31,16 @@
CLUSTER(Cluster.class),
/**
+ * Reconstructed particle. Unweighted.
+ */
+ PARTICLE(CruxParticle.class),
+
+ /**
* Calorimeter assisted tracking seed. The <tt>MCParticle</tt> weight is equal to the
* energy contributed by the <tt>MCParticle</tt> to the MIP stub portion of the seed cluster.
*/
CAT_SEED(CatSeed.class);
+
Class _type;
RecType(Class type) {
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/infrastructure
diff -N CruxEvent.java
--- CruxEvent.java 10 Dec 2008 22:03:06 -0000 1.1.1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,40 +0,0 @@
-package org.lcsim.contrib.onoprien.crux.infrastructure;
-
-import org.lcsim.contrib.onoprien.crux.CruxManager;
-import org.lcsim.contrib.onoprien.crux.geom.CalGeometry;
-import org.lcsim.geometry.Detector;
-import org.lcsim.event.EventHeader;
-
-/**
- * Class that represents an event dispatched by {@link CruxManager}.
- *
- * @author D. Onoprienko
- * @version $Id: CruxEvent.java,v 1.1.1.1 2008/12/10 22:03:06 jeremy Exp $
- */
-public class CruxEvent {
-
-// -- Constructors : ----------------------------------------------------------
-
- public CruxEvent(CruxManager cruxMan, EventHeader event) {
- _cruxMan = cruxMan;
- _det = event.getDetector();
- }
-
-// -- Getters : ---------------------------------------------------------------
-
- /** Returns <tt>CruxManager</tt> object that fired this event. */
- public CruxManager getCruxManager() {return _cruxMan;}
-
- /**
- * Returns <tt>CalGeometry</tt> object describing the current geometry.
- */
- public CalGeometry getGeometry() {return _cruxMan.getGeometry();}
-
- /** Returns <tt>Detector</tt> object describing the current geometry. */
- public Detector getDetector() {return _det;}
-
-// -- Private parts : ---------------------------------------------------------
-
- private CruxManager _cruxMan;
- private Detector _det;
-}
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/infrastructure
diff -N CruxEventListener.java
--- CruxEventListener.java 10 Dec 2008 22:03:06 -0000 1.1.1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,13 +0,0 @@
-package org.lcsim.contrib.onoprien.crux.infrastructure;
-
-/**
- * Interface to be implemented by classes listening to events dispatched by {@link CruxManager}.
- *
- * @author D. Onoprienko
- * @version $Id: CruxEventListener.java,v 1.1.1.1 2008/12/10 22:03:06 jeremy Exp $
- */
-public interface CruxEventListener {
-
- public void detectorChanged(CruxEvent cruxEvent);
-
-}
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/mctruth
diff -u -r1.4 -r1.5
--- MCTruthCrux.java 13 Feb 2009 20:02:19 -0000 1.4
+++ MCTruthCrux.java 18 Feb 2009 03:29:07 -0000 1.5
@@ -26,7 +26,7 @@
* weights are calculated for each type of reconstructed object.
*
* @author D. Onoprienko
- * @version $Id: MCTruthCrux.java,v 1.4 2009/02/13 20:02:19 onoprien Exp $
+ * @version $Id: MCTruthCrux.java,v 1.5 2009/02/18 03:29:07 onoprien Exp $
*/
public class MCTruthCrux {
@@ -48,6 +48,7 @@
MCTruthCrux(MCTruthDriverCrux driver, EventHeader event) {
_driver = driver;
_event = event;
+ _defMaps = new EnumMap<RecType, WeightedTable>(RecType.class);
}
@@ -273,7 +274,15 @@
* portion of the seed cluster. The returned list is in decreasing weight order.
*/
public WeightedList<MCParticle> findMCParticles(CatSeed seed) {
- return findMCParticles(seed.getMipStup());
+ Cluster mipStub = seed.getMipStub();
+ MCParticle mc = seed.getMCParticle();
+ if (mc != null) {
+ WeightedList<MCParticle> out = new WeightedList<MCParticle>();
+ out.add(mc, mipStub.getSize());
+ return out;
+ } else {
+ return findMCParticles(seed.getMipStub()); // use findMCParticles(Cluster)
+ }
}
}
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/recon
diff -u -r1.1 -r1.2
--- CalorimeterDriver.java 12 Feb 2009 01:32:08 -0000 1.1
+++ CalorimeterDriver.java 18 Feb 2009 03:29:07 -0000 1.2
@@ -9,7 +9,6 @@
import org.lcsim.contrib.onoprien.util.job.JobEventListener;
import org.lcsim.contrib.onoprien.util.job.JobManager;
-import org.lcsim.contrib.onoprien.crux.recon.HitMapFilterDriver;
import org.lcsim.contrib.onoprien.crux.geom.CalGeometry;
import org.lcsim.contrib.onoprien.crux.geom.CalGeometryConfig;
@@ -20,19 +19,26 @@
* to the event record.
*
* @author D. Onoprienko
- * @version $Id: CalorimeterDriver.java,v 1.1 2009/02/12 01:32:08 onoprien Exp $
+ * @version $Id: CalorimeterDriver.java,v 1.2 2009/02/18 03:29:07 onoprien Exp $
*/
public class CalorimeterDriver extends Driver implements JobEventListener {
+
+// -- Private parts : ---------------------------------------------------------
+
+ private String _outMapName;
+
// -- Constructors and initialization : ---------------------------------------
public CalorimeterDriver() {
- JobManager.defaultInstance().addListener(this);
+ JobManager jobMan = JobManager.defaultInstance();
+ CalGeometry geom = jobMan.get(CalGeometry.class);
+ jobMan.addListener(this, geom);
}
public void detectorChanged(JobEvent jEvent) {
- if ((_outMapName == null) || (_geomConfig == null)) throw new IllegalStateException(ERR_NS);
+ if (_outMapName == null) throw new IllegalStateException(ERR_NS);
// Output of DigiSim is hit collections: "EcalBarrDigiHits", "EcalEndcapDigiHits",
// "HcalBarrDigiHits", "HcalEndcapDigiHits" (added to the event).
@@ -43,13 +49,8 @@
add(new DigiSimDriver());
add(new SimCalorimeterHitsDriver());
- // Initialize geometry
-
- CalGeometry geom = new CalGeometry(_geomConfig);
- JobManager.defaultInstance().put(geom, CalGeometry.class);
-
// Put hits into map
-
+
HitMapFilterDriver mapMaker = new HitMapFilterDriver();
mapMaker.set("INPUT", "EcalBarrDigiHits","EcalEndcapDigiHits","HcalBarrDigiHits","HcalEndcapDigiHits");
mapMaker.set("OUTPUT", _outMapName);
@@ -82,8 +83,8 @@
if (name.equalsIgnoreCase("OUTPUT_MAP_NAME")) {
_outMapName = (String) value;
} else if (name.equalsIgnoreCase("GEOMETRY_CONFIG")) {
- _geomConfig = (CalGeometryConfig) value;
- JobManager.defaultInstance().addListener(this, _geomConfig);
+ CalGeometryConfig geomConfig = (CalGeometryConfig) value;
+ JobManager.defaultInstance().get(CalGeometry.class).setConfig(geomConfig);
} else {
super.set(name, values);
}
@@ -91,10 +92,5 @@
throw new IllegalArgumentException(ERR_VIT, x);
}
}
-
-
-// -- Private parts : ---------------------------------------------------------
-
- private String _outMapName;
- private CalGeometryConfig _geomConfig;
+
}
lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/crux/tests
diff -u -r1.3 -r1.4
--- TestDriverRosary.java 12 Feb 2009 01:32:08 -0000 1.3
+++ TestDriverRosary.java 18 Feb 2009 03:29:07 -0000 1.4
@@ -1,6 +1,7 @@
package org.lcsim.contrib.onoprien.crux.tests;
import java.util.*;
+
import java.util.logging.Level;
import org.lcsim.contrib.onoprien.crux.CruxManager;
import org.lcsim.contrib.onoprien.crux.geom.CalGeometry;
@@ -8,30 +9,26 @@
import org.lcsim.digisim.DigiSimDriver;
import org.lcsim.digisim.SimCalorimeterHitsDriver;
import org.lcsim.detector.identifier.*;
-import org.lcsim.detector.solids.Tube;
-import org.lcsim.geometry.Detector;
import org.lcsim.detector.IDetectorElement;
-import org.lcsim.event.CalorimeterHit;
import org.lcsim.event.EventHeader;
import org.lcsim.recon.cluster.util.CalHitMapDriver;
import org.lcsim.contrib.onoprien.util.job.Driver;
+import org.lcsim.contrib.onoprien.util.job.JobManager;
import org.lcsim.contrib.onoprien.crux.algorithms.TrackedParticleFinderDriver;
-import org.lcsim.contrib.onoprien.crux.algorithms.ValidationDriver;
-import org.lcsim.contrib.onoprien.crux.algorithms.Validator;
import org.lcsim.contrib.onoprien.crux.algorithms.rosary.RosaryClusterer;
-import org.lcsim.contrib.onoprien.crux.recon.HitMapFilterDriver;
import org.lcsim.contrib.onoprien.crux.infrastructure.*;
import org.lcsim.contrib.onoprien.crux.mctruth.MCTruthDriverCrux;
import org.lcsim.contrib.onoprien.crux.cheat.CheatTrackFinderDriver;
import org.lcsim.contrib.onoprien.crux.cheat.CheatVertexFinderDriver;
+import org.lcsim.contrib.onoprien.crux.recon.HitMapFilterDriver;
/**
*
*
* @author D. Onoprienko
- * @version $Id: TestDriverRosary.java,v 1.3 2009/02/12 01:32:08 onoprien Exp $
+ * @version $Id: TestDriverRosary.java,v 1.4 2009/02/18 03:29:07 onoprien Exp $
*/
public class TestDriverRosary extends Driver {
@@ -102,7 +99,7 @@
public void process(EventHeader event) {
super.process(event);
- CalGeometry geom = CruxManager.defaultInstance().getGeometry();
+ CalGeometry geom = JobManager.defaultInstance().get(CalGeometry.class);
// CruxHitMap hitMap = (CruxHitMap) event.get("CalHitMap_All");
// Collection<CalorimeterHit> hitList = hitMap.values();
CVSspam 0.2.8