View Javadoc

1   package org.lcsim.recon.tracking.digitization.sisim.config;
2   
3   import java.util.Arrays;
4   import java.util.HashSet;
5   import java.util.List;
6   
7   import org.lcsim.event.EventHeader;
8   import org.lcsim.geometry.Detector;
9   import org.lcsim.geometry.compact.Subdetector;
10  
11  /**
12   * This Driver clears the DetectorElement Readout
13   * associated with a given collection in the event header.  
14   * It accepts a list of collection names and ignores
15   * others.
16   * 
17   * @author jeremym
18   * @version $Id: ReadoutCleanupDriver.java,v 1.2 2012/04/25 14:27:00 jeremy Exp $
19   */
20  public class ReadoutCleanupDriver
21  extends CollectionHandler
22  {    
23      public ReadoutCleanupDriver() 
24      {}
25      
26      public ReadoutCleanupDriver(List<String> collectionNames) {
27          super(collectionNames);
28      }
29      
30      public ReadoutCleanupDriver(String[] collectionNames) {
31          super(collectionNames);
32      }
33      
34      public void setCollectionNames(String[] collectionNames) {
35          this.collections = new HashSet<String>(Arrays.asList(collectionNames));
36      }
37      
38      protected void process(EventHeader event)
39      {        
40          Detector detector = event.getDetector();
41  
42          for (Subdetector subdet : detector.getSubdetectors().values()) {
43              if (subdet.getReadout() != null) {
44                  if (canHandle(subdet.getReadout().getName())) {
45                      if (subdet.getDetectorElement() != null) {
46                          subdet.getDetectorElement().clearReadouts();
47                      }
48                  }
49              }
50          }        
51      }     
52  }