Commit in lcsim/src/org/lcsim/detector on MAIN
ReadoutCleanupDriver.java-621.2 removed
driver/CollectionHandler.java+34added 1.1
      /ReadoutCleanupDriver.java+43added 1.1
      /SimTrackerHitPositionalReadoutDriver.java+48added 1.1
      /SimTrackerHitReadout.java+8added 1.1
+133-62
4 added + 1 removed, total 5 files
JM: Move detector drivers to org.lcsim.detector.driver to avoid packages split between lcsim and GC.

lcsim/src/org/lcsim/detector
ReadoutCleanupDriver.java removed after 1.2
diff -N ReadoutCleanupDriver.java
--- ReadoutCleanupDriver.java	27 Apr 2007 23:38:18 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,62 +0,0 @@
-package org.lcsim.detector;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.lcsim.event.EventHeader;
-import org.lcsim.util.Driver;
-import org.lcsim.detector.DetectorElementStore;
-import org.lcsim.detector.IDetectorElement;
-import org.lcsim.detector.IDetectorElementStore;
-import org.lcsim.geometry.Detector;
-import org.lcsim.geometry.compact.Subdetector;
-
-/**
- * This Driver clears the DetectorElement Readout
- * associated with a given collection in the event header.  
- * It accepts a list of collection names and ignores
- * others.
- * 
- * @author <a href="mail:[log in to unmask]>Jeremy McCormick</a>
- *
- */
-public class ReadoutCleanupDriver
-extends Driver
-{
-    Map<String,String> collectionMap = new HashMap<String,String>();
-    
-    public ReadoutCleanupDriver(List<String> collectionNames)
-    {        
-        for ( String collection : collectionNames )
-        {
-            this.collectionMap.put(collection, collection);
-        }
-    }
-    
-    public ReadoutCleanupDriver(String[] collectionNames)
-    {        
-        for ( String collection : collectionNames )
-        {
-            this.collectionMap.put(collection, collection);
-        }
-    }
-    
-    protected void process(EventHeader event)
-    {        
-        Detector detector = event.getDetector();
-
-        for ( Subdetector subdet : detector.getSubdetectors().values() )
-        {
-            if ( handleCollection( subdet.getReadout().getName() ) )
-            {
-                subdet.getDetectorElement().clearReadouts();
-            }
-        }        
-    } 
-    
-    private boolean handleCollection( String collectionName )
-    {
-        return collectionMap.get( collectionName ) != null;
-    }
-}

lcsim/src/org/lcsim/detector/driver
CollectionHandler.java added at 1.1
diff -N CollectionHandler.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ CollectionHandler.java	1 May 2007 23:36:37 -0000	1.1
@@ -0,0 +1,34 @@
+package org.lcsim.detector.driver;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.lcsim.util.Driver;
+
+public class CollectionHandler
+extends Driver
+{
+    Set<String> collections = new HashSet<String>();
+    
+    public CollectionHandler(List<String> collectionNames)
+    {        
+        for ( String collection : collectionNames )
+        {
+            this.collections.add(collection);
+        }
+    }
+    
+    public CollectionHandler(String[] collectionNames)
+    {        
+        for ( String collection : collectionNames )
+        {
+            this.collections.add(collection);
+        }
+    }
+       
+    public boolean canHandle( String collectionName )
+    {
+        return collections.contains( collectionName );
+    }
+}
\ No newline at end of file

lcsim/src/org/lcsim/detector/driver
ReadoutCleanupDriver.java added at 1.1
diff -N ReadoutCleanupDriver.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ReadoutCleanupDriver.java	1 May 2007 23:36:37 -0000	1.1
@@ -0,0 +1,43 @@
+package org.lcsim.detector.driver;
+
+import java.util.List;
+
+import org.lcsim.event.EventHeader;
+import org.lcsim.geometry.Detector;
+import org.lcsim.geometry.compact.Subdetector;
+
+/**
+ * This Driver clears the DetectorElement Readout
+ * associated with a given collection in the event header.  
+ * It accepts a list of collection names and ignores
+ * others.
+ * 
+ * @author jeremym
+ * @version $Id: ReadoutCleanupDriver.java,v 1.1 2007/05/01 23:36:37 jeremy Exp $
+ */
+public class ReadoutCleanupDriver
+extends CollectionHandler
+{    
+    public ReadoutCleanupDriver(List<String> collectionNames)
+    {
+        super(collectionNames);
+    }
+    
+    public ReadoutCleanupDriver(String[] collectionNames)
+    {
+        super(collectionNames);
+    }
+    
+    protected void process(EventHeader event)
+    {        
+        Detector detector = event.getDetector();
+
+        for ( Subdetector subdet : detector.getSubdetectors().values() )
+        {
+            if ( canHandle( subdet.getReadout().getName() ) )
+            {
+                subdet.getDetectorElement().clearReadouts();
+            }
+        }        
+    }     
+}
\ No newline at end of file

lcsim/src/org/lcsim/detector/driver
SimTrackerHitPositionalReadoutDriver.java added at 1.1
diff -N SimTrackerHitPositionalReadoutDriver.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ SimTrackerHitPositionalReadoutDriver.java	1 May 2007 23:36:37 -0000	1.1
@@ -0,0 +1,48 @@
+package org.lcsim.detector.driver;
+
+import hep.physics.vec.BasicHep3Vector;
+
+import java.util.List;
+
+import org.lcsim.detector.DetectorElement;
+import org.lcsim.detector.IDetectorElement;
+import org.lcsim.detector.Readout;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.SimTrackerHit;
+
+public class SimTrackerHitPositionalReadoutDriver 
+extends CollectionHandler
+{
+    public SimTrackerHitPositionalReadoutDriver(List<String> collectionNames)
+    {
+        super(collectionNames);
+        add( new ReadoutCleanupDriver( collectionNames ) );
+    }
+
+    public SimTrackerHitPositionalReadoutDriver(String[] collectionNames)
+    {        
+        super(collectionNames);
+        add( new ReadoutCleanupDriver( collectionNames ) );
+    }
+
+    protected void process(EventHeader header)
+    {           
+        super.process(header);
+        List<List<SimTrackerHit>> collections = header.get(SimTrackerHit.class);
+        for ( List<SimTrackerHit> collection : collections )
+        {
+            if ( canHandle( header.getMetaData( collection ).getName() ) )
+            {
+                for ( SimTrackerHit hit : collection )
+                {
+                    IDetectorElement deSubdet = hit.getSubdetector().getDetectorElement();
+                    DetectorElement deHit = 
+                        (DetectorElement)deSubdet.findDetectorElement( new BasicHep3Vector( hit.getPoint() ) );               
+                    hit.setDetectorElement( deHit );
+                    Readout<SimTrackerHit> ro = (Readout<SimTrackerHit>)deHit.getReadout();
+                    ro.addHit( hit );
+                }
+            }
+        }        
+    }                     
+}
\ No newline at end of file

lcsim/src/org/lcsim/detector/driver
SimTrackerHitReadout.java added at 1.1
diff -N SimTrackerHitReadout.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ SimTrackerHitReadout.java	1 May 2007 23:36:37 -0000	1.1
@@ -0,0 +1,8 @@
+package org.lcsim.detector.driver;
+
+import org.lcsim.detector.Readout;
+import org.lcsim.event.SimTrackerHit;
+
+public  class SimTrackerHitReadout
+extends Readout<SimTrackerHit>
+{}
CVSspam 0.2.8