ExampleProject/src
diff -N TestKalm.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ TestKalm.java 21 May 2007 17:11:35 -0000 1.1
@@ -0,0 +1,54 @@
+import org.lcsim.util.aida.AIDA;
+import org.lcsim.util.step.*;
+/** Small program to test the Kalman stepper
+* input array rp with rp[0]=x,rp[1]=y,rp[2]=z,
+* rp[3]=px, rp[4]=py, rp[5]=pz,
+* rp[6]=-1(+1) for a negative(positive) particle of charge 1
+* rp[7]=Particle mass,
+* allow to step from the point (x,y,z), here chosen the Interaction
+* point (0.,0.,0.),while chosing any component of the momentum
+* e.g.px= 1 GeV,px=3GeV, etc..
+* The number of steps is nn, here 1000. and the stepsize is ds
+* the step length in KalmStpr.stepByDs(ds).
+*
+*/
+public class TestKalm{
+public double[] rptst= new double[6];
+public double [][] covtst;
+public double sign;
+public double fieldZ;
+public static AIDA aida = AIDA.defaultInstance();
+public static void main(String args[]){
+ double[] rp=new double[8];
+ rp[0]=0.; rp[1]=0.; rp[2]=0.;
+ rp[3]=10.; rp[4]=0.5;rp[5]=0.1;
+ rp[6]=-1.; rp[7]=.105;
+ double[][] cv = new double[6][6];
+ double sg=rp[6]; double fBB=5.0;
+ rp[7]=0.105;
+ for(int i=0;i<6;i++)cv[i][i]=100.;
+ TestKalm(rp,cv,sg,fBB);
+}
+public static void TestKalm(double [] rptst,double[][] covtst,double sign,double fieldZ ){
+CamKalmanStepper KalmStpr = new CamKalmanStepper(rptst,covtst);
+double zz=1.; double rho=7.87; double zovera=0.5;
+//KalmStpr.setZRhoZoverA(zz,rho,zovera);
+KalmStpr.setSign(sign);
+KalmStpr.setBField1Dim(fieldZ);
+System.out.println("particle charge="+sign+" BField="+fieldZ);
+double[] x= new double[500];
+double[] y= new double[500];
+double[] z= new double[500];
+double nn=500.;
+double pmom=Math.sqrt(rptst[3]*rptst[3]+rptst[4]*rptst[4]+rptst[5]*rptst[5]);
+double ds=2.*pmom/nn;
+// aida.cloud2D("x versus y").reset();
+for (int i=0;i<nn;i++){
+ for (int j=0;j<10;j++) {
+ // if(KalmStpr.getStopTkELow())break;
+ KalmStpr.stepByDs(ds);}
+ x[i]=KalmStpr.getX() ; y[i]=KalmStpr.getY() ; z[i]=KalmStpr.getZ();
+ aida.cloud2D("x versus y").fill(x[i],y[i]);
+ }
+ }
+}