View Javadoc

1   /*
2    * SeedStrategy.java
3    *
4    * Created on March 29, 2006, 3:04 PM
5    *
6    */
7   
8   package org.lcsim.recon.tracking.seedtracker;
9   
10  import java.util.List;
11  import java.util.ArrayList;
12  
13  import org.lcsim.recon.tracking.seedtracker.SeedLayer.SeedType;
14  
15  /**
16   * Encapsulate the parameters and layers used for this track finding strategy
17   * @author Richard Partridge
18   * @version 1.0
19   */
20  public class SeedStrategy {
21      private String _Name;
22      private List<SeedLayer> _LayerList = new ArrayList<SeedLayer>();
23      private double _MinPT = 1.0;
24      private double _MaxDCA = 10.0;
25      private double _MaxZ0 = 10.0;
26      private double _MaxChisq = 100.;
27      private double _BadHitChisq = 15.;
28      private int _MinConfirm = 1;
29      private int _MinHits = 7;
30      
31      /**
32       * Fully qualified constructor
33       * @param Name Name assigned to this strategy
34       * @param LayerList SeedLayers for this strategy
35       * @param MinPT Minimum pT for this strategy
36       * @param MaxDCA Maximum DCA for this strategy
37       * @param MaxZ0 Maximum z0 for this strategy
38       * @param MaxChisq Maximum chi^2 for this strategy
39       * @param BadHitChisq chi^2 that invokes bad hit treatment
40       * @param MinConfirm Minimum confirmation hits for this strategy
41       * @param MinHits Minimum total number of hits for this strategy
42       */
43      public SeedStrategy(String Name, List<SeedLayer> LayerList, double MinPT,
44              double MaxDCA, double MaxZ0, double MaxChisq, double BadHitChisq, int MinConfirm, int MinHits) {
45          this(Name, LayerList);
46          _Name = Name;
47          _MinPT = MinPT;
48          _MaxDCA = MaxDCA;
49          _MaxZ0 = MaxZ0;
50          _MaxChisq = MaxChisq;
51          _BadHitChisq = BadHitChisq;
52          _MinConfirm = MinConfirm;
53          _MinHits = MinHits;
54      }
55      
56      /**
57       * Constructor for a strategy with the default parameter settings
58       * @param Name Name assigned to this strategy
59       * @param LayerList List of SeedLayers for this strategy
60       */
61      public SeedStrategy(String Name, List<SeedLayer> LayerList) {
62          this(Name);
63          _LayerList.addAll(LayerList);
64      }
65      
66      /**
67       * Bare-bones constructor - layers must be added and any changes to default parameters must be made
68       * @param Name Name assigned to this strategy
69       */
70       public SeedStrategy(String Name) {
71          _Name = Name;
72      }
73      
74      /**
75       * Return name assigned to this strategy
76       * @return Strategy name
77       */
78      public String getName() {
79          return _Name;
80      }
81      
82      /**
83       * Return list of SeedLayers used by this strategy
84       * @return List of SeedLayers used by this strategy
85       */
86      public List<SeedLayer> getLayerList() {
87          return _LayerList;
88      }
89      
90      /**
91       * Return minimum pT for this strategy
92       * @return Minimum pT for this strategy
93       */
94      public double getMinPT() {
95          return _MinPT;
96      }
97      
98      /**
99       * Return maximum Distance of Closest Approach (DCA) in the x-y plane for this strategy
100      * @return Maximum DCA for this strategy
101      */
102     public double getMaxDCA() {
103         return _MaxDCA;
104     }
105     
106     /**
107      * Return maximum s-z intercept z0 for this strategy
108      * @return Maximum z0 for this strategy
109      */
110     public double getMaxZ0() {
111         return _MaxZ0;
112     }
113     
114     /**
115      * Return maximum chi^2 for this strategy
116      * @return Maximum chi^2 for this strategy
117      */
118     public double getMaxChisq() {
119         return _MaxChisq;
120     }
121     
122     public double getBadHitChisq() {
123         return _BadHitChisq;
124     }
125     
126     /**
127      * Return minimum number of confirmation hits for this strategy
128      * @return Minimum number of confirmation hits for this strategy
129      */
130     public int getMinConfirm() {
131         return _MinConfirm;
132     }
133     
134     /**
135      * Return minimum number of total hits for this strategy
136      * @return Minimum number of total hits for this strategy
137      */
138     public int getMinHits() {
139         return _MinHits;
140     }
141     
142     /**
143      * Specify Seedlayers to be used for this strategy
144      * @param LayerList List of SeedLayers used by this strategy
145      */
146     public void putLayerList(List<SeedLayer> LayerList) {
147         _LayerList.addAll(LayerList);
148         return;
149     }
150     
151     /**
152      * Set the minimum pT for this strategy
153      * @param MinPT Minimum pT of this strategy
154      */
155     public void putMinPT(double MinPT) {
156         _MinPT = MinPT;
157         return;
158     }
159     
160     /**
161      * Set the maximum Distance of Closest Approach (DCA) in the x-y plane for this strategy
162      * @param MaxDCA Maximum DCA for this strategy
163      */
164     public void putMaxDCA(double MaxDCA) {
165         _MaxDCA = MaxDCA;
166         return;
167     }
168     
169     /**
170      * Set the maximum s-z intercept z0 for this strategy
171      * @param MaxZ0 Maximum z0 for this strategy
172      */
173     public void putMaxZ0(double MaxZ0) {
174         _MaxZ0 = MaxZ0;
175         return;
176     }
177     
178     /**
179      * Set the maximum chi^2 for this strategy
180      * @param MaxChisq Maximum chi^2 for this strategy
181      */
182     public void putMaxChisq(double MaxChisq) {
183         _MaxChisq = MaxChisq;
184         return;
185     }
186     
187     public void putBadHitChisq(double BadHitChisq) {
188         _BadHitChisq = BadHitChisq;
189         return;
190     }
191     
192     /**
193      * Set the minimum number of confirmation hits for this strategy
194      * @param MinConfirm Minimum number of confirmation hits for this strategy
195      */
196     public void putMinConfirm(int MinConfirm) {
197         _MinConfirm = MinConfirm;
198         return;
199     }
200     
201     /**
202      * Set the minimum number of total hits for this strategy
203      * @param MinHits Minimum number of total hits for this strategy
204      */
205     public void putMinHits(int MinHits) {
206         _MinHits = MinHits;
207         return;
208     }
209     
210     /**
211      * Add a SeedLayer for this strategy
212      * @param Layer SeedLayer to be added to this strategy
213      */
214     public void addLayer(SeedLayer Layer) {
215         _LayerList.add(Layer);
216         return;
217     }
218     
219     /**
220      * Return the list of SeedLayers of a given SeedType for this strategy
221      * @param type SeedType of the layers to be returned
222      * @return SeedLayers of the specified type for this strategy
223      */
224      public List<SeedLayer> getLayers(SeedType type) {
225         List<SeedLayer> layers = new ArrayList();
226         for (SeedLayer layer : _LayerList) {
227             if (layer.getType() == type) layers.add(layer);
228         }
229         return layers;
230     }
231      
232     /**
233      * Copies all the cutoffs (minpt, numhits etc.) from another strategy.
234      * Does not modify the name or the layer list. 
235      * @param other Another SeedStrategy
236      */ 
237     public void copyCutoffsFromStrategy(SeedStrategy other) {
238         this.putBadHitChisq(other.getBadHitChisq());
239         this.putMaxChisq(other.getMaxChisq());
240         this.putMaxDCA(other.getMaxDCA()); 
241         this.putMaxZ0(other.getMaxZ0());; 
242         this.putMinConfirm(other.getMinConfirm());
243         this.putMinHits(other.getMinHits());
244         this.putMinPT(other.getMinPT());
245     }
246      
247      @Override
248      public boolean equals(Object other) {
249          
250          if (this == other) return true; 
251          if (!(other instanceof SeedStrategy)) return false; 
252          SeedStrategy strat = (SeedStrategy) other; 
253          
254          return ( this._BadHitChisq == strat.getBadHitChisq() 
255                && this._MaxChisq == strat.getMaxChisq()
256                && this._MaxDCA == strat.getMaxDCA() 
257                && this._MaxZ0 == strat.getMaxZ0()
258                && this._MinConfirm == strat.getMinConfirm()
259                && this._MinHits == strat.getMinHits()
260                && this._MinPT == strat.getMinPT()
261                && this._Name.equals(strat.getName()) 
262                && this._LayerList.equals(strat.getLayerList()) ) ;
263          
264      }
265 }