View Javadoc

1   package  org.lcsim.recon.tracking.trfzp;
2   
3   import org.lcsim.recon.tracking.trfutil.Assert;
4   import org.lcsim.recon.tracking.trfutil.TRFMath;
5   
6   import org.lcsim.recon.tracking.trfbase.ETrack;
7   import org.lcsim.recon.tracking.trfbase.TrackError;
8   import org.lcsim.recon.tracking.trfbase.TrackVector;
9   import org.lcsim.recon.tracking.trfbase.Surface;
10  import org.lcsim.recon.tracking.trfbase.VTrack;
11  import org.lcsim.recon.tracking.trfbase.Interactor;
12  
13  /**
14   * This class modifies the covariance matrix of a track
15   *corresponding to multiple
16   *scattering in a thin z plane whose material is
17   *represented by the number of radiation lengths.
18   *
19   *@author Norman A. Graf
20   *@version 1.0
21   *
22   */
23  
24  public class ThinZPlaneMs extends Interactor
25  {
26      
27      // static methods
28      
29      //
30      
31      /**
32       *Return a String representation of the class' type name.
33       *Included for completeness with the C++ version.
34       *
35       * @return   A String representation of the class' type name.
36       */
37      public  static String typeName()
38      { return "ThinZPlaneMs"; }
39      
40      //
41      
42      /**
43       *Return a String representation of the class' type name.
44       *Included for completeness with the C++ version.
45       *
46       * @return   A String representation of the class' type name.
47       */
48      public  static String staticType()
49      { return typeName(); }
50      
51      // static attributes
52      // Assign track parameter indices.
53      
54      private static final int IX = SurfZPlane.IX;
55      private static final int IY   = SurfZPlane.IY;
56      private static final int IDXDZ = SurfZPlane.IDXDZ;
57      private static final int IDYDZ = SurfZPlane.IDYDZ;
58      private static final int IQP  = SurfZPlane.IQP;
59      
60      
61      // attributes
62      private double _radLength;
63      
64      //
65      
66      /**
67       * Construct an instance from the number of radiation
68       * lengths of the thin z plane material.
69       * The Interactor is constructed with the
70       * appropriate number of radiation lengths.
71       *
72       * @param   radLength The thickness of the material in radiation lengths.
73       */
74      public ThinZPlaneMs( double radLength )
75      {
76          _radLength = radLength;
77      }
78      
79      //
80      
81      /**
82       *Interact the given track in this z plane,
83       *using the thin material approximation for multiple scattering.
84       *Note that the track parameters are not modified. Only the
85       *covariance matrix is updated to reflect the uncertainty caused
86       *by traversing the thin z plane of material.
87       *
88       * @param   tre The ETrack to scatter.
89       */
90      public void interact(ETrack tre)
91      {
92          // This can only be used with zplanes... check that we have one..
93          SurfZPlane szp = new SurfZPlane(1.0);
94          Surface srf = tre.surface();
95          Assert.assertTrue( srf.pureType().equals(szp.pureType()) );
96          
97          TrackError cleanError = tre.error();
98          TrackError newError = new TrackError(cleanError);
99          
100         // set the rms scattering appropriate to this momentum
101         
102         // Theta = (0.0136 GeV)*(z/p)*(sqrt(radLength))*(1+0.038*log(radLength))
103         
104         
105         
106         TrackVector theVec = tre.vector();
107         double trackMomentum = theVec.get(IQP);
108         
109         double f = theVec.get(IDXDZ);
110         double g = theVec.get(IDYDZ);
111         
112         double theta = Math.atan(Math.sqrt(f*f + g*g));
113         double phi = f!=0 ? Math.atan(Math.sqrt((g*g)/(f*f))) : TRFMath.PI2;
114         if ( f==0 && g<0 ) phi=3*TRFMath.PI2;
115         if((f<0)&&(g>0))
116             phi = Math.PI - phi;
117         if((f<0)&&(g<0))
118             phi = Math.PI + phi;
119         if((f>0)&&(g<0))
120             phi = 2*Math.PI - phi;
121         
122         double trueLength = _radLength/Math.cos(theta);
123         
124         double stdTheta = (0.0136)*trackMomentum*Math.sqrt(trueLength)*
125                 (1 + 0.038*Math.log(trueLength));
126         
127         double zhat = Math.sqrt(1-Math.sin(theta)*Math.sin(theta));
128         double xhat = Math.sin(theta)*Math.cos(phi);
129         double yhat = Math.sin(theta)*Math.sin(phi);
130         
131         double Qxz,Qyz,Qxy;
132         
133         // The MS covariance matrix can now be set.
134         
135         // **************** code for matrix *********************** //
136         
137         
138         // Insert values for upper triangle... use symmetry to set lower.
139         
140         double norm = Math.sqrt(xhat*xhat + yhat*yhat);
141         
142         Qxz = (yhat/(norm*zhat))*(yhat/(norm*zhat));
143         Qxz += Math.pow((xhat/norm)*(1 + (norm*norm)/(zhat*zhat)),2.0);
144         Qxz *= stdTheta;
145         Qxz *= stdTheta;
146         
147         Qyz = (xhat/(norm*zhat))*(xhat/(norm*zhat));
148         Qyz += Math.pow((xhat/norm)*(1 + (norm*norm)/(zhat*zhat)),2.0);
149         Qyz *= stdTheta;
150         Qyz *= stdTheta;
151         
152         Qxy = -xhat*yhat/(zhat*zhat);
153         Qxy += xhat*yhat/(norm*norm)*Math.pow((1 + (norm*norm)/(zhat*zhat)),2.0);
154         Qxy *= stdTheta;
155         Qxy *= stdTheta;
156         
157         newError.set(IDXDZ,IDXDZ, newError.get(IDXDZ,IDXDZ) + Qxz);
158         newError.set(IDYDZ,IDYDZ, newError.get(IDYDZ,IDYDZ) + Qyz);
159         newError.set(IDXDZ,IDYDZ, newError.get(IDXDZ,IDYDZ) + Qxy);
160         
161         //**********************************************************************
162         
163         tre.setError( newError );
164         
165     }
166     
167     //
168     
169     /**
170      *Return the number of radiation lengths.
171      *
172      * @return The thickness of the scattering material in radiation lengths.
173      */
174     public double radLength()
175     {
176         return _radLength;
177     }
178     
179     
180     //
181     
182     /**
183      *Make a clone of this object.
184      *
185      * @return A Clone of this instance.
186      */
187     public Interactor newCopy()
188     {
189         return new ThinZPlaneMs(_radLength);
190     }
191     
192     
193     //
194     
195     /**
196      *Return a String representation of the class' type name.
197      *Included for completeness with the C++ version.
198      *
199      * @return   A String representation of the class' type name.
200      */
201     public String type()
202     {
203         return staticType();
204     }
205     
206     
207     
208     /**
209      *output stream
210      *
211      * @return  A String representation of this instance.
212      */
213     public String toString()
214     {
215         return "ThinZPlaneMs with "+_radLength+" radiation lengths";
216     }
217     
218 }