lcsim/src/org/lcsim/detector/driver
diff -u -r1.3 -r1.4
--- CollectionHandler.java 15 Dec 2008 23:53:32 -0000 1.3
+++ CollectionHandler.java 16 Dec 2008 00:26:50 -0000 1.4
@@ -7,19 +7,14 @@
import org.lcsim.util.Driver;
-public class CollectionHandler
+public abstract class CollectionHandler
extends Driver
{
Set<String> collections = new HashSet<String>();
public CollectionHandler()
{}
-
- public void setCollections(String[] collectionNames)
- {
- collections.addAll(Arrays.asList(collectionNames));
- }
-
+
public CollectionHandler(List<String> collectionNames)
{
for (String collection : collectionNames)
@@ -35,6 +30,11 @@
this.collections.add(collection);
}
}
+
+ public void setCollections(String[] collectionNames)
+ {
+ collections.addAll(Arrays.asList(collectionNames));
+ }
/**
* Return whether this CollectionHandler can handle the collection called
lcsim/src/org/lcsim/detector/driver
diff -u -r1.2 -r1.3
--- ReadoutCleanupDriver.java 25 May 2007 20:17:09 -0000 1.2
+++ ReadoutCleanupDriver.java 16 Dec 2008 00:26:50 -0000 1.3
@@ -13,7 +13,7 @@
* others.
*
* @author jeremym
- * @version $Id: ReadoutCleanupDriver.java,v 1.2 2007/05/25 20:17:09 jeremy Exp $
+ * @version $Id: ReadoutCleanupDriver.java,v 1.3 2008/12/16 00:26:50 jeremy Exp $
*/
public class ReadoutCleanupDriver
extends CollectionHandler
@@ -32,7 +32,7 @@
{
Detector detector = event.getDetector();
- for ( Subdetector subdet : detector.getSubdetectors().values() )
+ for (Subdetector subdet : detector.getSubdetectors().values())
{
if (subdet.getReadout() != null)
{
lcsim/src/org/lcsim/detector/driver
diff -u -r1.8 -r1.9
--- SimTrackerHitIdentifierReadoutDriver.java 15 Dec 2008 23:53:32 -0000 1.8
+++ SimTrackerHitIdentifierReadoutDriver.java 16 Dec 2008 00:26:50 -0000 1.9
@@ -7,15 +7,15 @@
import org.lcsim.detector.IDetectorElementContainer;
import org.lcsim.detector.IReadout;
import org.lcsim.detector.identifier.IIdentifier;
-import org.lcsim.detector.identifier.IIdentifierHelper;
import org.lcsim.detector.identifier.Identifier;
import org.lcsim.event.EventHeader;
import org.lcsim.event.SimTrackerHit;
+import org.lcsim.geometry.Detector;
public class SimTrackerHitIdentifierReadoutDriver
extends CollectionHandler
{
- boolean cleanupSet=false;
+ boolean needCleanupDriver=true;
public SimTrackerHitIdentifierReadoutDriver()
{}
@@ -27,18 +27,19 @@
public SimTrackerHitIdentifierReadoutDriver(String[] collectionNames)
{
- super(collectionNames);
+ super(collectionNames);
}
- public void startOfData()
+ // FIXME: This should go in startOfData() but that method may not always be called.
+ public void detectorChanged(Detector detector)
{
- if (!cleanupSet)
+ if (needCleanupDriver)
{
add(new ReadoutCleanupDriver(new ArrayList<String>(collections)));
- cleanupSet=true;
- }
+ needCleanupDriver=false;
+ }
}
-
+
protected void process(EventHeader header)
{
super.process(header);