View Javadoc

1   package  org.lcsim.recon.tracking.trfzp;
2   // Generator for ClusZPlane1 objects.
3   
4   import org.lcsim.recon.tracking.trfutil.Assert;
5   
6   import org.lcsim.recon.tracking.trfbase.HitGenerator;
7   import org.lcsim.recon.tracking.trfbase.VTrack;
8   import org.lcsim.recon.tracking.trfbase.Surface;
9   import org.lcsim.recon.tracking.trfbase.Cluster;
10  
11  /**
12   * Generates one dimensional xy hits on a z plane with a gaussian spread in the measurement.
13   *
14   *@author Norman A. Graf
15   *@version 1.0
16   *
17   */
18  public class HitZPlane1Generator extends HitGenerator
19  {
20      
21      // attributes
22      
23      // the surface
24      private SurfZPlane _szp;
25      
26      // the x axis weight
27      private double _wx;
28      
29      // the y axis weight
30      private double _wy;
31      
32      // the error (standard deviation) for the measurement axy = wx*x + wy*y
33      private double _daxy;
34      
35      
36      //
37      
38      /**
39       *Construct an instance  from the z plane position, mixing and measurement uncertainty as a gaussian sigma.
40       *
41       * @param   zpos  The z position of the plane.
42       * @param   wx  The stereo angle in the x direction.
43       * @param   wy  The stereo angle in the y direction.
44       * @param   daxy  The gaussian sigma for the xy measurement uncertainty.
45       */
46      public HitZPlane1Generator(double zpos, double wx, double wy,double daxy)
47      {
48          super();
49          _szp = new SurfZPlane(zpos);
50          _wx = wx;
51          _wy = wy;
52          _daxy = daxy;
53          Assert.assertTrue( _daxy >= 0.0 );
54      }
55      
56      //
57      
58      /**
59       *Construct an instance  from the z plane position, mixing,
60       * measurement uncertainty as a gaussian sigma and random number seed.
61       *
62       * @param   zpos  The z position of the plane.
63       * @param   wx  The stereo angle in the x direction.
64       * @param   wy  The stereo angle in the y direction.
65       * @param   daxy  The gaussian sigma for the xy measurement uncertainty.
66       * @param   iseed The seed for the random number used by the HitGenerator.
67       */
68      public HitZPlane1Generator(double zpos, double wx, double wy,
69      double daxy, long iseed)
70      {
71          super(iseed);
72          _szp = new SurfZPlane(zpos);
73          _wx = wx;
74          _wy = wy;
75          _daxy = daxy;
76          Assert.assertTrue( _daxy >= 0.0 );
77      }
78      
79      //
80      
81      /**
82       *Construct an instance replicating the HitZPlane1Generator ( copy constructor ).
83       *
84       * @param  gen The HitZPlane1Generator to replicate.
85       */
86      public HitZPlane1Generator( HitZPlane1Generator gen)
87      {
88          super(gen);
89          _szp = new SurfZPlane(gen._szp);
90          _wx = gen._wx;
91          _wy = gen._wy;
92          _daxy = gen._daxy;
93          Assert.assertTrue( _daxy >= 0.0 );
94      }
95      
96      //
97      
98      /**
99       *Return the surface associated with this HitZPlane1Generator.
100      *
101      * @return The surface associated with this HitZPlane1Generator.
102      */
103     public  Surface surface()
104     { return _szp; }
105     
106     //
107     
108     /**
109      *Generate a new cluster.
110      * Return null for failure.
111      *
112      * @param   trv The VTrack for which to generate a cluster at this surface.
113      * @return   The cluster for this track at this surface, null for failure.
114      */
115     public Cluster newCluster( VTrack trv)
116     {
117         return newCluster(trv, 0);
118     }
119     
120     /**
121      *Generate a new cluster with the specified Monte Carlo track ID.
122      * Return null for failure.
123      *
124     * @param   trv The VTrack for which to generate a cluster at this surface.
125      * @param   mcid The MC ID to associate with this cluster.
126      * @return   The cluster for this track at this surface, null for failure.
127      */
128     public Cluster newCluster( VTrack trv, int mcid)
129     {
130         
131         // Check track has been propagated to the surface.
132         Assert.assertTrue( _szp.pureEqual( trv.surface() ) );
133         if ( ! _szp.pureEqual( trv.surface() ) ) return null;
134         
135         // calculate axy.
136         double x_track = trv.vector().get(SurfZPlane.IX);
137         double y_track = trv.vector().get(SurfZPlane.IY);
138         double axy = _wx*x_track + _wy*y_track
139         + _daxy*gauss();
140         
141         // construct cluster
142         double zpos = _szp.parameter(SurfZPlane.ZPOS);
143         return new ClusZPlane1(zpos, _wx, _wy, axy, _daxy, mcid );
144     }
145     
146     
147     /**
148      *output stream
149      *
150      * @return A String representation of this instance.
151      */
152     public String toString()
153     {
154         return  "Surface: " + _szp
155         + "\n X slope: " + _wx +" Y slope: " + _wy
156         + "\n Measurement error (daxy): " + _daxy ;
157     }
158     
159 }
160