View Javadoc

1   package org.lcsim.recon.tracking.trflayer;
2   import java.util.*;
3   import org.lcsim.recon.tracking.trfbase.Surface;
4   import org.lcsim.recon.tracking.trfbase.ETrack;
5   import org.lcsim.recon.tracking.trfbase.Cluster;
6   /**
7    * This a cluster finder which simply returns all the clusters
8    * for either request.  The clusters are stored in the same
9    * format in which they are returned.
10   *
11   *@author Norman A. Graf
12   *@version 1.0
13   *
14   **/
15  
16  public class ClusterFindAll extends ClusterFindManager
17  {
18      
19      // static methods
20      
21      //
22      
23      /**
24       *Return the type name.
25       *
26       * @return String representation of class type
27       *Included for completeness with C++ version
28       */
29      public static String typeName()
30      { return "ClusterFindAll"; }
31      
32      //
33      
34      /**
35       *Return the type.
36       *
37       * @return String representation of class type
38       *Included for completeness with C++ version
39       */
40      public static String staticType()
41      { return typeName(); }
42      
43      // attributes
44      
45      // surface
46      private Surface _srf;
47      
48      // list of clusters
49      private  List _clusters;
50      
51      
52      // methods
53      
54      //
55      
56      /**
57       *constructor from a surface
58       *
59       * @param   srf Surface for this finder
60       */
61      public ClusterFindAll( Surface srf)
62      {
63          _srf = srf;
64          _clusters = new ArrayList();
65      }
66      
67      //
68      
69      /**
70       *Return the type.
71       *
72       * @return String representation of class type
73       *Included for completeness with C++ version
74       */
75      public String type()
76      { return staticType(); }
77      
78      
79      //
80      
81      /**
82       *add a cluster
83       *
84       * @param   clu Cluster to add to this finder
85       * @return 0 if successful
86       */
87      public int addCluster( Cluster clu)
88      {
89          _clusters.add(clu);
90          return 0;
91      }
92      
93      //
94      
95      /**
96       *drop the clusters
97       *
98       */
99      public void dropClusters()
100     {
101         _clusters.clear();
102     }
103     
104     //
105     
106     /**
107      *Return the surface.
108      *
109      * @return Surface for this Finder
110      */
111     public  Surface surface()
112     { return _srf; }
113     
114     //
115     
116     /**
117      *Return all the clusters associated with this surface.
118      *
119      * @return a List of all Clusters
120      */
121     public List clusters()
122     {
123         return _clusters;
124     }
125     
126     //
127     
128     /**
129      *Return all the clusters near the specified track at the surface.
130      * Here we return all.
131      *
132      * @param   tre Etrack
133      * @return List of all Clusters close to this track
134      */
135     public List clusters(  ETrack  tre)
136     {
137         return _clusters;
138     }
139     
140     
141     /**
142      * output stream
143      *
144      * @return String representation of this class
145      */
146     public String toString()
147     {
148         StringBuffer sb = new StringBuffer(getClass().getName()+" Finder for all clusters. \n Finder surface: " + _srf
149                 +"\n");
150         int size = _clusters.size();
151         if ( size == 1 ) sb.append("There is " + size + " cluster");
152         else             sb.append("Finder has " + size + " clusters");
153         if ( size == 0 ) sb.append(".");
154         else
155         {
156             sb.append(":");
157             for ( Iterator iclu=_clusters.iterator(); iclu.hasNext(); )
158                 sb.append("\n "+iclu.next());
159         }
160         return sb.toString();
161     }
162     
163 }