View Javadoc

1   package org.lcsim.recon.tracking.seedtracker.strategybuilder;
2   
3   import java.io.File;
4   import java.util.List;
5   
6   import org.lcsim.event.EventHeader;
7   import org.lcsim.recon.tracking.seedtracker.SeedStrategy;
8   import org.lcsim.recon.tracking.seedtracker.StrategyXMLUtils;
9   import org.lcsim.util.Driver;
10  
11  /**
12   * This Driver makes the StrategyBuilder accessible from an LCSim XML steering file.
13   * 
14   * @author jeremym
15   */
16  public class StrategyDriver extends Driver
17  {
18      String outputFile = null;
19      String prototypeFile = null;
20      boolean verbose = false;
21      
22      public StrategyDriver()
23      {}
24      
25      /**
26       * Set the output file path for the generated strategies.
27       * @param outputFile The output file path.
28       */
29      public void setOutputFile(String outputFile)
30      {        
31          this.outputFile = outputFile;
32      }
33      
34      /**
35       * Set verbose flag for debugging.
36       * @param verbose True to turn on debug output; false to turn off.
37       */
38      public void setVerbose(boolean verbose)
39      {
40          this.verbose = verbose;
41      }
42      
43      /**
44       * Set a strategy file to use as a prototype for the output strategies.
45       * @param prototypeFile The prototype strategy file.
46       */
47      public void setPrototypeStrategyFile(String prototypeFile)
48      {
49          this.prototypeFile = prototypeFile; 
50      }
51      
52      public void startOfData()
53      {        
54          // Setup the StrategyBuilder Driver and add to child Driver list.
55          StrategyBuilder builder = new StrategyBuilder();
56          builder.setOutput(this.outputFile);
57          builder.setSymmetrize(true);        
58          List<SeedStrategy> prototype = StrategyXMLUtils.getStrategyListFromFile(new File(prototypeFile));   
59          builder.setStrategyPrototype(prototype.get(0));
60          builder.setMinimumUnweightedScore(1);
61          this.add(builder);        
62          super.startOfData();
63      }
64      
65      public void process(EventHeader event)
66      {
67          super.process(event);
68      }
69  }