lcsim/test/org/lcsim/recon/tracking/trfcylplane
diff -u -r1.1 -r1.2
--- PropZXY_t.java 25 Jul 2007 17:24:15 -0000 1.1
+++ PropZXY_t.java 25 Jul 2007 18:32:16 -0000 1.2
@@ -3,7 +3,7 @@
*
* Created on July 24, 2007, 10:40 PM
*
- * $Id: PropZXY_t.java,v 1.1 2007/07/25 17:24:15 ngraf Exp $
+ * $Id: PropZXY_t.java,v 1.2 2007/07/25 18:32:16 ngraf Exp $
*/
package org.lcsim.recon.tracking.trfcylplane;
@@ -53,13 +53,13 @@
String ok_prefix = "PropZXY (I): ";
String error_prefix = "PropZXY test (E): ";
- System.out.println( ok_prefix
+ if(debug) System.out.println( ok_prefix
+ "-------- Testing component PropZXY. --------" );
- System.out.println( ok_prefix + "Test constructor." );
+ if(debug) System.out.println( ok_prefix + "Test constructor." );
double BFIELD = 2.0*TRFMath.BFAC;
PropZXY prop = new PropZXY(BFIELD/TRFMath.BFAC);
- System.out.println( prop );
+ if(debug) System.out.println( prop );
//********************************************************************
@@ -67,7 +67,7 @@
// the same track forward and backward but using method
// that we checked very thoroughly before.
- System.out.println( ok_prefix + "Check against correct propagation." );
+ if(debug) System.out.println( ok_prefix + "Check against correct propagation." );
double z1[] ={10., 10., 10., 10., 10., 10. };
int sign_dz[]={ -1, 1, -1, 1, 1, -1 };
@@ -87,7 +87,7 @@
int i;
for ( i=0; i<ntrk; ++i )
{
- System.out.println( "********** Propagate track " + i + ". **********" );
+ if(debug) System.out.println( "********** Propagate track " + i + ". **********" );
PropStat pstat = new PropStat();
SurfZPlane szp1 = new SurfZPlane(z1[i]);
SurfXYPlane sxyp2 = new SurfXYPlane(u2[i],phi2[i]);
@@ -102,37 +102,37 @@
VTrack trv1 = new VTrack(szp1.newPureSurface(),vec1);
if (sign_dz[i]==1) trv1.setForward();
else trv1.setBackward();
- System.out.println( " starting: " + trv1 );
+ if(debug) System.out.println( " starting: " + trv1 );
VTrack trv2f = new VTrack(trv1);
pstat = prop.vecDirProp(trv2f,sxyp2,PropDir.FORWARD);
Assert.assertTrue( pstat.forward() );
- System.out.println( " forward: " + trv2f );
+ if(debug) System.out.println( " forward: " + trv2f );
VTrack trv2b = new VTrack(trv1);
pstat = prop.vecDirProp(trv2b,sxyp2b,PropDir.BACKWARD);
Assert.assertTrue( pstat.backward() );
- System.out.println( " backward: " + trv2b );
+ if(debug) System.out.println( " backward: " + trv2b );
// Check against correct propagator that I checked somewhere else
VTrack trv2fc = new VTrack(trv1);
pstat = vec_propzxy(BFIELD,trv2fc,sxyp2,PropDir.FORWARD);
Assert.assertTrue( pstat.forward() );
- System.out.println( " forward: " + trv2fc );
+ if(debug) System.out.println( " forward: " + trv2fc );
VTrack trv2bc = new VTrack(trv1);
pstat = vec_propzxy(BFIELD,trv2bc,sxyp2b,PropDir.BACKWARD);
Assert.assertTrue( pstat.backward() );
- System.out.println( " backward: " + trv2bc );
+ if(debug) System.out.println( " backward: " + trv2bc );
double difff =
sxyp2.vecDiff(trv2f.vector(),trv2fc.vector()).amax();
double diffb =
sxyp2b.vecDiff(trv2b.vector(),trv2bc.vector()).amax();
- System.out.println( "diffs: " + difff + ' ' + diffb );
+ if(debug) System.out.println( "diffs: " + difff + ' ' + diffb );
Assert.assertTrue( difff < maxdiff );
Assert.assertTrue( diffb < maxdiff );
}
// Repeat the above with errors.
- System.out.println( ok_prefix + "Check reversibility with errors." );
+ if(debug) System.out.println( ok_prefix + "Check reversibility with errors." );
double exx[] = { 0.01, 0.01, 0.01, 0.01, 0.01, 0.01 };
double exy[] = { 0.01, -0.01, 0.01, -0.01, 0.01, -0.01 };
double eyy[] = { 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, };
@@ -152,7 +152,7 @@
maxdiff = 1.e-6;
for ( i=0; i<ntrk; ++i )
{
- System.out.println( "********** Propagate track " + i + ". **********" );
+ if(debug) System.out.println( "********** Propagate track " + i + ". **********" );
PropStat pstat = new PropStat();
SurfZPlane szp1 = new SurfZPlane(z1[i]);
SurfXYPlane sxyp2 = new SurfXYPlane(u2[i],phi2[i]);
@@ -185,16 +185,16 @@
ETrack trv1 = new ETrack(szp1.newPureSurface(),vec1,err1);
if (sign_dz[i]==1) trv1.setForward();
else trv1.setBackward();
- System.out.println( " starting: " + trv1 );
+ if(debug) System.out.println( " starting: " + trv1 );
ETrack trv2f = new ETrack(trv1);
pstat = prop.errDirProp(trv2f,sxyp2,PropDir.FORWARD);
Assert.assertTrue( pstat.forward() );
- System.out.println( " forward: " + trv2f );
+ if(debug) System.out.println( " forward: " + trv2f );
ETrack trv2b = new ETrack(trv1);
pstat = prop.errDirProp(trv2b,sxyp2b,PropDir.BACKWARD);
Assert.assertTrue( pstat.backward() );
- System.out.println( " backward: " + trv2b );
+ if(debug) System.out.println( " backward: " + trv2b );
// Check against correct propagator that I checked somewhere else
ETrack trv2fc = new ETrack(trv1);
@@ -203,20 +203,20 @@
Assert.assertTrue( pstat.forward() );
TrackError err = trv2fc.error();
trv2fc.setError( err.Xform(deriv) );
- System.out.println( " forward: " + trv2fc );
+ if(debug) System.out.println( " forward: " + trv2fc );
ETrack trv2bc = new ETrack(trv1);
pstat = vec_propzxy(BFIELD,trv2bc,sxyp2b,PropDir.BACKWARD,deriv);
Assert.assertTrue( pstat.backward() );
err = trv2bc.error();
trv2bc.setError( err.Xform(deriv) );
- System.out.println( " backward: " + trv2bc );
+ if(debug) System.out.println( " backward: " + trv2bc );
double difff =
sxyp2.vecDiff(trv2f.vector(),trv2fc.vector()).amax();
double diffb =
sxyp2b.vecDiff(trv2b.vector(),trv2bc.vector()).amax();
- System.out.println( "diffs: " + difff + ' ' + diffb );
+ if(debug) System.out.println( "diffs: " + difff + ' ' + diffb );
Assert.assertTrue( difff < maxdiff );
Assert.assertTrue( diffb < maxdiff );
@@ -224,7 +224,7 @@
TrackError dbc = trv2b.error().minus(trv2bc.error());
double edifff = dfc.amax();
double ediffb = dbc.amax();
- System.out.println( "err diffs: " + edifff + ' ' + ediffb );
+ if(debug) System.out.println( "err diffs: " + edifff + ' ' + ediffb );
Assert.assertTrue( edifff < maxdiff );
Assert.assertTrue( ediffb < maxdiff );
@@ -233,10 +233,10 @@
//********************************************************************
- System.out.println( ok_prefix + "Test Zero Field Propagation." );
+ if(debug) System.out.println( ok_prefix + "Test Zero Field Propagation." );
{
PropZXY prop0 = new PropZXY(0.0);
- System.out.println( prop0 );
+ if(debug) System.out.println( prop0 );
Assert.assertTrue( prop0.bField() == 0. );
double u=10.;
@@ -256,7 +256,7 @@
VTrack trv = new VTrack(trv0);
VTrack trv_der = new VTrack(trv);
PropStat pstat = prop0.vecDirProp(trv,srf_to,PropDir.NEAREST);
- System.out.println(trv);
+ if(debug) System.out.println(trv);
Assert.assertTrue( pstat.success() );
Assert.assertTrue( pstat.backward() );
@@ -269,7 +269,7 @@
trv = new VTrack(trv0);
trv_der = new VTrack(trv);
pstat = prop0.vecDirProp(trv,srf_to,PropDir.NEAREST);
- System.out.println(trv);
+ if(debug) System.out.println(trv);
Assert.assertTrue( pstat.success() );
Assert.assertTrue( pstat.same() );
@@ -281,18 +281,18 @@
//********************************************************************
- System.out.println( ok_prefix + "Test cloning." );
+ if(debug) System.out.println( ok_prefix + "Test cloning." );
Assert.assertTrue( prop.newPropagator() != null );
//********************************************************************
- System.out.println( ok_prefix + "Test the field." );
+ if(debug) System.out.println( ok_prefix + "Test the field." );
Assert.assertTrue( prop.bField() == 2.0 );
//********************************************************************
- System.out.println( ok_prefix
+ if(debug) System.out.println( ok_prefix
+ "------------- All tests passed. -------------" );
}