View Javadoc

1   package org.lcsim.recon.tracking.trfbase;
2   
3   import org.lcsim.recon.tracking.trfbase.PropDir;
4   import org.lcsim.recon.tracking.trfbase.PropDirected;
5   import org.lcsim.recon.tracking.trfbase.PropStat;
6   import org.lcsim.recon.tracking.trfbase.Propagator;
7   import org.lcsim.recon.tracking.trfbase.Surface;
8   import org.lcsim.recon.tracking.trfbase.TrackDerivative;
9   import org.lcsim.recon.tracking.trfbase.TrackVector;
10  import org.lcsim.recon.tracking.trfbase.VTrack;
11  
12  // Concrete subclass for testing PropDirected.
13  
14  public class PropDirectedTest extends  PropDirected
15  {
16      
17      // static methods
18      
19      // Return the type name.
20      public static String typeName()
21      { return "PropDirectedTest"; }
22      
23      // Return the type.
24      public static String get_static_type()
25      { return typeName(); }
26      
27      // methods
28      
29      // implementation of the propagation
30      private PropStat
31              myprop(VTrack trv,  Surface srf,  PropDir dir)
32      {
33          trv.setSurface( srf.newPureSurface() );
34          PropStat pst = new PropStat();
35          TrackVector vec = trv.vector();
36          if ( dir.equals(PropDir.BACKWARD) )
37          {
38              vec.set(1, vec.get(1)-1.0);
39              pst.setForward();
40          }
41          else
42          {
43              vec.set(1, vec.get(1)+1.0);
44              pst.setBackward();
45          }
46          trv.setVector(vec);
47          return pst;
48      }
49      
50      // methods
51      
52      // Return the type.
53      public String get_type()
54      { return get_static_type(); };
55      
56      // clone
57      public Propagator newPropagator()
58      { return new PropDirectedTest(); };
59      
60      // propagate a track without error
61      public PropStat vecDirProp(VTrack trv, Surface srf,
62              PropDir dir, TrackDerivative deriv)
63      {
64          if ( deriv != null )
65          {
66              
67              deriv.set(0,0 , 1.1);
68              deriv.set(1,1 , 1.2);
69              deriv.set(2,2 , 1.3);
70              deriv.set(3,3 , 1.4);
71              deriv.set(4,4 , 1.5);
72          }
73          return myprop(trv,srf,dir);
74      }
75      
76      
77      public String toString()
78      {
79          return  "Test propagator" ;
80      }
81  }