Print

Print


Commit in lcsim/src/org/lcsim/contrib/RobKutschke/TKNHits on MAIN
TKNRawHitsDriverV1.java+91-1011.3 -> 1.4


lcsim/src/org/lcsim/contrib/RobKutschke/TKNHits
TKNRawHitsDriverV1.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- TKNRawHitsDriverV1.java	11 Dec 2007 18:51:07 -0000	1.3
+++ TKNRawHitsDriverV1.java	6 Dec 2008 21:53:27 -0000	1.4
@@ -35,117 +35,107 @@
  *
  * The driver SimTrackerHitIdentifierReadoutDriver must be called before this code is run.
  *
- *@author $Author: tknelson $
- *@version $Id: TKNRawHitsDriverV1.java,v 1.3 2007/12/11 18:51:07 tknelson Exp $
+ *@author $Author: onoprien $
+ *@version $Id: TKNRawHitsDriverV1.java,v 1.4 2008/12/06 21:53:27 onoprien Exp $
  *
- * Date $Date: 2007/12/11 18:51:07 $
+ * Date $Date: 2008/12/06 21:53:27 $
  *
  */
 
 
-public class TKNRawHitsDriverV1 extends Driver
-{
+public class TKNRawHitsDriverV1 extends Driver {
+  
+  // Names of input and output collections.
+  private String[] input  = null;
+  private String[] output = null;
+  
+  /**
+   * Constructor:
+   * The arguments are two arrays of strings.  The arrays must be of the same length
+   * and are used pairwise.  Each pair of elements specifies the name of an input collection
+   * and the name of an output collection.
+   *
+   */
+  public TKNRawHitsDriverV1( String[] in, String[] out) {
+    input  = in;
+    output = out;
     
-    // Names of input and output collections.
-    private String[] input  = null;
-    private String[] output = null;
-    
-    /**
-     * Constructor:
-     * The arguments are two arrays of strings.  The arrays must be of the same length
-     * and are used pairwise.  Each pair of elements specifies the name of an input collection
-     * and the name of an output collection.
-     *
-     */
-    public TKNRawHitsDriverV1( String[] in, String[] out)
-    {
-        input  = in;
-        output = out;
-        
-        // If lengths of arrays are not equal, abort.
-        if ( in.length != out.length )
-        {
-            System.out.println("Fatal error from TKNRawHitsDriverV1.  Different length lists for input and outputs!");
-            System.out.println("Number of inputs/outputs: " + input.length + "/" + output.length );
-            System.out.println("Inputs:  " + input );
-            System.out.println("Outputs: " + output );
-            System.exit(-1);
-        }
+    // If lengths of arrays are not equal, abort.
+    if ( in.length != out.length ) {
+      System.out.println("Fatal error from TKNRawHitsDriverV1.  Different length lists for input and outputs!");
+      System.out.println("Number of inputs/outputs: " + input.length + "/" + output.length );
+      System.out.println("Inputs:  " + input );
+      System.out.println("Outputs: " + output );
+      System.exit(-1);
     }
+  }
+  
+  /**
+   *  The main work of the class.
+   */
+  protected void process(EventHeader header) {
     
-    /**
-     *  The main work of the class.
-     */
-    protected void process(EventHeader header)
-    {
+    // Loop over all of the collections to process.
+    for ( int i=0; i<input.length; ++i ) {
+      
+      List<SimTrackerHit> eventHits = header.get(SimTrackerHit.class, input[i]);
+      
+      // Set of sensors with hits.
+      Set<SiSensor> hit_sensors = new HashSet<SiSensor>();
+      for (SimTrackerHit hit : eventHits) {
+        SiSensor sensor = (SiSensor)hit.getDetectorElement();
+        hit_sensors.add(sensor);
+      }
+      
+      // Instantiate simulation.
+      SiSensorSim si_simulation = new CDFSiSensorSim();
+      ReadoutChip kpix = new Kpix();
+      
+      // Output container.
+      List<RawTrackerHit> raw_hits = new ArrayList<RawTrackerHit>();
+      
+      // Loop over sensors with hits.
+      for (SiSensor sensor : hit_sensors) {
         
-        // Loop over all of the collections to process.
-        for ( int i=0; i<input.length; ++i )
-        {
-            
-            List<SimTrackerHit> eventHits = header.get(SimTrackerHit.class, input[i]);
+        // Deposit charge with CDF/Padova model
+        si_simulation.setSensor(sensor);
+        Map<ChargeCarrier,SiElectrodeDataCollection> electrode_data = si_simulation.computeElectrodeData();
+        
+        for (ChargeCarrier carrier : ChargeCarrier.values()) {
+          if (sensor.hasElectrodesOnSide(carrier)) {
             
-            // Set of sensors with hits.
-            Set<SiSensor> hit_sensors = new HashSet<SiSensor>();
-            for (SimTrackerHit hit : eventHits)
-            {
-                SiSensor sensor = (SiSensor)hit.getDetectorElement();
-                hit_sensors.add(sensor);
+            // Create digitized hit strips/pixels.
+            SortedMap<Integer,List<Integer>> digitized_hits =
+                    kpix.readout(electrode_data.get(carrier),sensor.getReadoutElectrodes(carrier));
+            
+            // Create RawTrackerHits.
+            for (Integer readout_cell : digitized_hits.keySet()) {
+              
+              // Need to fix this.
+              int time = 0;
+              
+              long cell_id = sensor.makeStripId(readout_cell,carrier.charge()).getValue();
+              short[] adc_values = {digitized_hits.get(readout_cell).get(0).shortValue(),digitized_hits.get(readout_cell).get(1).shortValue()};
+              Set<SimTrackerHit> simulated_hits =
+                      electrode_data.get(carrier).get(readout_cell).getSimulatedHits();
+              IDetectorElement detector_element = sensor;
+              
+              // Create the hit and add it to the output list.
+              RawTrackerHit raw_hit = new BaseRawTrackerHit(time,cell_id,adc_values,new ArrayList<SimTrackerHit>(simulated_hits),detector_element);
+              raw_hits.add(raw_hit);
+              
             }
-            
-            // Instantiate simulation.
-            SiSensorSim si_simulation = new CDFSiSensorSim();
-            ReadoutChip kpix = new Kpix();
-            
-            // Output container.
-            List<RawTrackerHit> raw_hits = new ArrayList<RawTrackerHit>();
-            
-            // Loop over sensors with hits.
-            for (SiSensor sensor : hit_sensors)
-            {
-                
-                // Deposit charge with CDF/Padova model
-                si_simulation.setSensor(sensor);
-                Map<ChargeCarrier,SiElectrodeDataCollection> electrode_data = si_simulation.computeElectrodeData();
-                
-                for (ChargeCarrier carrier : ChargeCarrier.values())
-                {
-                    if (sensor.hasElectrodesOnSide(carrier))
-                    {
-                        
-                        // Create digitized hit strips/pixels.
-                        SortedMap<Integer,List<Integer>> digitized_hits =
-                                kpix.readout(electrode_data.get(carrier),sensor.getReadoutElectrodes(carrier));
-                        
-                        // Create RawTrackerHits.
-                        for (Integer readout_cell : digitized_hits.keySet())
-                        {
-                            
-                            // Need to fix this.
-                            int time = 0;
-                            
-                            long cell_id = sensor.makeStripId(readout_cell,carrier.charge()).getValue();
-                            short[] adc_values = {digitized_hits.get(readout_cell).get(0).shortValue(),digitized_hits.get(readout_cell).get(1).shortValue()};
-                            Set<SimTrackerHit> simulated_hits =
-                                    electrode_data.get(carrier).get(readout_cell).getSimulatedHits();
-                            IDetectorElement detector_element = sensor;
-                            
-                            // Create the hit and add it to the output list.
-                            RawTrackerHit raw_hit = new BaseRawTrackerHit(time,cell_id,adc_values,new ArrayList<SimTrackerHit>(simulated_hits),detector_element);
-                            raw_hits.add(raw_hit);
-                            
-                        }
-                    }
-                } // Charge carriers.
-                
-                // Clear simulation.
-                si_simulation.clearReadout();
-                
-            } // Loop over hit sensors.
-            
-            // Add to event.
-            header.put(output[i], raw_hits, RawTrackerHit.class, 0, "Kpix");
-        }
+          }
+        } // Charge carriers.
+        
+        // Clear simulation.
+        si_simulation.clearReadout();
         
-    } // process()
+      } // Loop over hit sensors.
+      
+      // Add to event.
+      header.put(output[i], raw_hits, RawTrackerHit.class, 0, "Kpix");
+    }
+    
+  } // process()
 }
CVSspam 0.2.8