lcsim/src/org/lcsim/detector/driver
diff -u -r1.1 -r1.2
--- CollectionHandler.java 1 May 2007 23:36:37 -0000 1.1
+++ CollectionHandler.java 4 Dec 2008 00:12:51 -0000 1.2
@@ -1,5 +1,6 @@
package org.lcsim.detector.driver;
+import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -11,6 +12,14 @@
{
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 )
@@ -26,7 +35,7 @@
this.collections.add(collection);
}
}
-
+
public boolean canHandle( String collectionName )
{
return collections.contains( collectionName );
lcsim/src/org/lcsim/detector/driver
diff -u -r1.4 -r1.5
--- SimTrackerHitIdentifierReadoutDriver.java 6 Aug 2007 20:40:41 -0000 1.4
+++ SimTrackerHitIdentifierReadoutDriver.java 4 Dec 2008 00:12:51 -0000 1.5
@@ -3,9 +3,11 @@
import java.util.List;
import org.lcsim.detector.DetectorElementStore;
+import org.lcsim.detector.IDetectorElement;
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;
@@ -13,6 +15,9 @@
public class SimTrackerHitIdentifierReadoutDriver
extends CollectionHandler
{
+ public SimTrackerHitIdentifierReadoutDriver()
+ {}
+
public SimTrackerHitIdentifierReadoutDriver(List<String> collectionNames)
{
super(collectionNames);
@@ -28,16 +33,25 @@
protected void process(EventHeader header)
{
super.process(header);
+ //System.out.println("DE count: " + DetectorElementStore.getInstance().size());
+ for (IDetectorElement de : DetectorElementStore.getInstance())
+ {
+ if (de.getIdentifier() != null && de.getIdentifierHelper() != null)
+ {
+ IIdentifierHelper helper = de.getIdentifierHelper();
+ System.out.println(de.getName() + " - " + helper.unpack(de.getIdentifier()).toString());
+ helper.getIdentifierDictionary().toString();
+ }
+ }
List<List<SimTrackerHit>> collections = header.get(SimTrackerHit.class);
- for ( List<SimTrackerHit> collection : collections )
+ for (List<SimTrackerHit> collection : collections)
{
- if ( canHandle( header.getMetaData( collection ).getName() ) )
+ if (canHandle(header.getMetaData(collection).getName()))
{
- for ( SimTrackerHit hit : collection )
+ for (SimTrackerHit hit : collection)
{
IIdentifier hitId = new Identifier(hit.getCellID());
- IDetectorElementContainer deHit =
- DetectorElementStore.getInstance().find(hitId);
+ IDetectorElementContainer deHit = DetectorElementStore.getInstance().find(hitId);
if (deHit.size() == 0)
{
throw new RuntimeException("No DetectorElement found for id <"+hitId.toString()+">.");