lcsim/src/org/lcsim/recon/tracking/seedtracker
diff -u -r1.2 -r1.3
--- MaterialManagerNew.java 9 Feb 2011 18:11:51 -0000 1.2
+++ MaterialManagerNew.java 10 Feb 2011 01:10:23 -0000 1.3
@@ -25,9 +25,11 @@
import org.lcsim.detector.solids.Polycone.ZPlane;
import org.lcsim.geometry.Detector;
import org.lcsim.geometry.Subdetector;
+import org.lcsim.geometry.subdetector.DiskTracker;
import org.lcsim.geometry.subdetector.MultiLayerTracker;
import org.lcsim.geometry.subdetector.PolyconeSupport;
import org.lcsim.geometry.subdetector.SiTrackerBarrel;
+import org.lcsim.geometry.subdetector.SiTrackerEndcap;
import org.lcsim.geometry.subdetector.SiTrackerEndcap2;
/**
@@ -35,12 +37,12 @@
* This class should now group together SiTrackerEndcap2 layers correctly.
*
* @author Jeremy McCormick
- * @version $Id: MaterialManagerNew.java,v 1.2 2011/02/09 18:11:51 jeremy Exp $
+ * @version $Id: MaterialManagerNew.java,v 1.3 2011/02/10 01:10:23 jeremy Exp $
*/
public class MaterialManagerNew
{
// Variables from original MaterialManager class.
- private static final boolean DEBUG = true; // enable debug output
+ private static final boolean DEBUG = false; // enable debug output
private static final boolean TUBE_ONLY = false; // only use Tube elements
// for calculating volume.
private List<MaterialPolyconeSegment> _matpc = new ArrayList<MaterialPolyconeSegment>();
@@ -135,24 +137,52 @@
}
/**
+ * Default VolumeGroup for endcaps with physical layers.
+ */
+ static private class EndcapVolumeGrouper implements SubdetectorVolumeGrouper
+ {
+ public List<List<String>> getPathGroups(Subdetector subdet, IPhysicalVolume topVol)
+ {
+ List<List<String>> pathGroups = new ArrayList<List<String>>();
+ // Positive and negative endcap loop.
+ for (IDetectorElement endcaps : subdet.getDetectorElement().getChildren())
+ {
+ // Layer loop.
+ for (IDetectorElement layer : endcaps.getChildren())
+ {
+ List<String> layerPaths = new ArrayList<String>();
+ String path = "";
+ PhysicalVolumeNavigator.getLeafPaths(layerPaths, layer.getGeometry().getPhysicalVolume(), path);
+ pathGroups.add(layerPaths);
+ }
+ }
+ return pathGroups;
+ }
+
+ }
+
+ /**
* Creates a new instance of MaterialManager
*/
public MaterialManagerNew()
{
// Barrel VolumeGrouper.
- SubdetectorVolumeGrouper barrelGroup = new BarrelLayerVolumeGroup();
+ SubdetectorVolumeGrouper barrelGrouper = new BarrelLayerVolumeGroup();
// Add VolumeGrouper for tracker barrel types.
- subdetGroups.put(SiTrackerBarrel.class, barrelGroup);
- subdetGroups.put(MultiLayerTracker.class, barrelGroup);
+ subdetGroups.put(SiTrackerBarrel.class, barrelGrouper);
+ subdetGroups.put(MultiLayerTracker.class, barrelGrouper);
+
+ // Add default endcap VolumeGrouper.
+ SubdetectorVolumeGrouper endcapGrouper = new EndcapVolumeGrouper();
+ subdetGroups.put(SiTrackerEndcap.class, endcapGrouper);
+ subdetGroups.put(DiskTracker.class, endcapGrouper);
// Add VolumeGrouper for SiTrackerEndcap2.
subdetGroups.put(SiTrackerEndcap2.class, new SiTrackerEndap2VolumeGrouper());
// Add VolumeGrouper for PolyconeSupport.
- subdetGroups.put(PolyconeSupport.class, new PolyconeSupportVolumeGrouper());
-
- // FIXME Need VolumeGrouper for SiTrackerEndcap.
+ subdetGroups.put(PolyconeSupport.class, new PolyconeSupportVolumeGrouper());
}
@@ -203,18 +233,23 @@
}
// Get the VolumeGrouper for this type.
- SubdetectorVolumeGrouper subdetGroup = subdetGroups.get(subdet.getClass());
+ SubdetectorVolumeGrouper subdetGrouper = subdetGroups.get(subdet.getClass());
// Can't handle this type.
- if (subdetGroup == null)
+ if (subdetGrouper == null)
{
System.out.println("WARNING: Can't handle Subdetector of type <"
+ subdet.getClass().getCanonicalName() + ">.");
}
else
{
+ if (DEBUG)
+ {
+ System.out.println("Found VolumeGrouper <" + subdetGrouper.getClass().getName() + ">.");
+ }
+
// Make the list of path groups for this Subdetector.
- List<List<String>> pathGroups = subdetGroup.getPathGroups(subdet, trackingVol);
+ List<List<String>> pathGroups = subdetGrouper.getPathGroups(subdet, trackingVol);
if (DEBUG)
{
lcsim/test/org/lcsim/recon/tracking/seedtracker
diff -u -r1.1 -r1.2
--- MaterialManagerNewTest.java 9 Feb 2011 18:17:18 -0000 1.1
+++ MaterialManagerNewTest.java 10 Feb 2011 01:10:23 -0000 1.2
@@ -1,6 +1,6 @@
/**
* @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: MaterialManagerNewTest.java,v 1.1 2011/02/09 18:17:18 jeremy Exp $
+ * @version $Id: MaterialManagerNewTest.java,v 1.2 2011/02/10 01:10:23 jeremy Exp $
*/
package org.lcsim.recon.tracking.seedtracker;
@@ -29,7 +29,7 @@
LCSimLoop loop = new LCSimLoop();
loop.add(new MaterialManagerNewTestDriver());
loop.setLCIORecordSource(file);
- loop.loop(1);
+ loop.loop(1, null);
}
static class MaterialManagerNewTestDriver extends Driver