lcsim/test/org/lcsim/recon/tracking/trfdca
diff -u -r1.2 -r1.3
--- SurfDCA_t.java 25 Jul 2007 17:59:50 -0000 1.2
+++ SurfDCA_t.java 9 Aug 2007 18:27:00 -0000 1.3
@@ -3,7 +3,7 @@
*
* Created on July 24, 2007, 9:03 PM
*
- * $Id: SurfDCA_t.java,v 1.2 2007/07/25 17:59:50 ngraf Exp $
+ * $Id: SurfDCA_t.java,v 1.3 2007/08/09 18:27:00 ngraf Exp $
*/
package org.lcsim.recon.tracking.trfdca;
@@ -33,12 +33,12 @@
String ok_prefix = "test SurfDCA (I): ";
String error_prefix = "test SurfDCA (E): ";
- System.out.println(ok_prefix
+ if(debug) System.out.println(ok_prefix
+ "------ Testing component SurfDCA. ------" );
//********************************************************************
- System.out.println(ok_prefix + "Check indices." );
+ if(debug) System.out.println(ok_prefix + "Check indices." );
Assert.assertTrue( SurfDCA.IRSIGNED == 0 );
Assert.assertTrue( SurfDCA.IZ == 1 );
Assert.assertTrue( SurfDCA.IPHID == 2 );
@@ -47,17 +47,17 @@
//********************************************************************
- System.out.println(ok_prefix + "Test constructor." );
+ if(debug) System.out.println(ok_prefix + "Test constructor." );
SurfDCA sdca1 = new SurfDCA();
- System.out.println(sdca1 );
+ if(debug) System.out.println(sdca1 );
SurfDCA sdca_x1 = new SurfDCA(0.1, 0.2);
- System.out.println(sdca_x1 );
+ if(debug) System.out.println(sdca_x1 );
SurfDCA sdca_x2 = new SurfDCA(0.1, 0.3, 0.01, 0.02);
- System.out.println(sdca_x2 );
+ if(debug) System.out.println(sdca_x2 );
//********************************************************************
- System.out.println(ok_prefix + "Test equality and ordering." );
+ if(debug) System.out.println(ok_prefix + "Test equality and ordering." );
Assert.assertTrue( sdca1.pureEqual(sdca1) );
Assert.assertTrue( ! sdca1.pureLessThan(sdca1) );
Assert.assertTrue( sdca_x1.pureEqual(sdca_x1) );
@@ -68,28 +68,28 @@
//********************************************************************
- System.out.println(ok_prefix + "Test virtual constructor." );
+ if(debug) System.out.println(ok_prefix + "Test virtual constructor." );
SurfDCA psdca4 = (SurfDCA) sdca1.newPureSurface();
if ( !sdca1.equals(psdca4) )
{
- System.out.println(error_prefix + "Virtual construction failed." );
+ if(debug) System.out.println(error_prefix + "Virtual construction failed." );
System.exit(5);
}
//********************************************************************
- System.out.println(ok_prefix + "Test type." );
- System.out.println(SurfDCA.staticType() );
+ if(debug) System.out.println(ok_prefix + "Test type." );
+ if(debug) System.out.println(SurfDCA.staticType() );
// method get_type is implemented in class Surface
// it returns get_pure_type, which is implemented in SurfDCA
- System.out.println(sdca1.type() );
+ if(debug) System.out.println(sdca1.type() );
Assert.assertTrue( sdca1.type() != null );
Assert.assertTrue( sdca1.type().equals(SurfDCA.staticType()) );
//********************************************************************
- System.out.println( ok_prefix + "Test parameter access." );
- System.out.println(sdca_x2.parameter(SurfDCA.IX));
+ if(debug) System.out.println( ok_prefix + "Test parameter access." );
+ if(debug) System.out.println(sdca_x2.parameter(SurfDCA.IX));
Assert.assertTrue( sdca_x2.parameter(SurfDCA.IX) == 0.1);
Assert.assertTrue( sdca_x2.parameter(SurfDCA.IY) == 0.3);
Assert.assertTrue( sdca_x2.parameter(SurfDCA.IDXDZ) == 0.01);
@@ -105,7 +105,7 @@
//********************************************************************
- System.out.println(ok_prefix + "construct a Track Vector." );
+ if(debug) System.out.println(ok_prefix + "construct a Track Vector." );
TrackVector tvec = new TrackVector();
tvec.set(0, 1.0); // r_signed
@@ -113,12 +113,12 @@
tvec.set(2, 3.0); // phi_direction
tvec.set(3, 4.0); // tlm
tvec.set(4, 5.0); // qpt
- System.out.println(" *** TrackVector tvec = " + tvec );
- System.out.println(" *** r_signed = " + tvec.get(0) );
- System.out.println(" *** z = " + tvec.get(1) );
- System.out.println(" *** phi_direction = " + tvec.get(2) );
- System.out.println(" *** tlm = " + tvec.get(3) );
- System.out.println(" *** qpt = " + tvec.get(4) );
+ if(debug) System.out.println(" *** TrackVector tvec = " + tvec );
+ if(debug) System.out.println(" *** r_signed = " + tvec.get(0) );
+ if(debug) System.out.println(" *** z = " + tvec.get(1) );
+ if(debug) System.out.println(" *** phi_direction = " + tvec.get(2) );
+ if(debug) System.out.println(" *** tlm = " + tvec.get(3) );
+ if(debug) System.out.println(" *** qpt = " + tvec.get(4) );
double r = Math.abs(tvec.get(0));
double z = tvec.get(1);
@@ -132,9 +132,9 @@
}
double tlam = tvec.get(3);
- System.out.println(" *** r = " + r );
- System.out.println(" *** phi = " + phi );
- System.out.println(" *** z = " + z );
+ if(debug) System.out.println(" *** r = " + r );
+ if(debug) System.out.println(" *** phi = " + phi );
+ if(debug) System.out.println(" *** z = " + z );
Assert.assertTrue( Math.abs(phi-( 1.4292)) < 1.e-4 ) ; // for r_signed = +1
// Assert.assertTrue( fabs(phi-(-1.7124)) < 1.e-4 ) ; // for r_signed = -1
@@ -142,7 +142,7 @@
//********************************************************************
- System.out.println(ok_prefix + "Test crossing status." );
+ if(debug) System.out.println(ok_prefix + "Test crossing status." );
double clam = 1.0/Math.sqrt(1.0+tlam*tlam);
double slam = tlam/Math.sqrt(1.0+tlam*tlam);
@@ -166,46 +166,46 @@
SurfTest stest_out= new SurfTest(cpth_out);
VTrack ton = new VTrack( sdca1.newPureSurface(), tvec );
- System.out.println(" sdca1 = " + sdca1 );
- System.out.println(" VTrack ton = " + ton );
+ if(debug) System.out.println(" sdca1 = " + sdca1 );
+ if(debug) System.out.println(" VTrack ton = " + ton );
VTrack tin= new VTrack( stest_in.newPureSurface(), tvec );
- System.out.println(" stest_in = " + stest_in );
- System.out.println(" VTrack tin = " + tin );
+ if(debug) System.out.println(" stest_in = " + stest_in );
+ if(debug) System.out.println(" VTrack tin = " + tin );
VTrack tout= new VTrack( stest_out.newPureSurface(), tvec );
- System.out.println(" stest_out = " + stest_out );
- System.out.println(" VTrack tout = " + tout );
+ if(debug) System.out.println(" stest_out = " + stest_out );
+ if(debug) System.out.println(" VTrack tout = " + tout );
SpacePath sp_on = ton.spacePath();
SpacePath sp_in = tin.spacePath();
SpacePath sp_out = tout.spacePath();
- System.out.println(" *** sp_on *** " );
- System.out.println(sp_on );
- System.out.println(" *** sp_in *** " );
- System.out.println(sp_in );
- System.out.println(" *** sp_out *** " );
- System.out.println(sp_out );
+ if(debug) System.out.println(" *** sp_on *** " );
+ if(debug) System.out.println(sp_on );
+ if(debug) System.out.println(" *** sp_in *** " );
+ if(debug) System.out.println(sp_in );
+ if(debug) System.out.println(" *** sp_out *** " );
+ if(debug) System.out.println(sp_out );
CrossStat xs1 = sdca1.pureStatus(ton);
- System.out.println("xs1 = " + xs1 );
+ if(debug) System.out.println("xs1 = " + xs1 );
Assert.assertTrue( xs1.at() && xs1.on() && !xs1.inside() && !xs1.outside()
&& !xs1.inBounds() && ! xs1.outOfBounds() );
- System.out.println(stest_in );
+ if(debug) System.out.println(stest_in );
CrossStat xs2 = sdca1.pureStatus(tin);
- System.out.println("xs2 = " + xs2 );
+ if(debug) System.out.println("xs2 = " + xs2 );
Assert.assertTrue( !xs2.at() && !xs2.on() && xs2.inside() && !xs2.outside()
&& !xs2.inBounds() && ! xs2.outOfBounds() );
- System.out.println(stest_out );
+ if(debug) System.out.println(stest_out );
CrossStat xs3 = sdca1.pureStatus(tout);
- System.out.println("xs3 = " + xs3 );
+ if(debug) System.out.println("xs3 = " + xs3 );
Assert.assertTrue( !xs3.at() && !xs3.on() && !xs3.inside() && xs3.outside()
&& !xs3.inBounds() && ! xs3.outOfBounds() );
//********************************************************************
- System.out.println(ok_prefix + "Test vector difference." );
+ if(debug) System.out.println(ok_prefix + "Test vector difference." );
TrackVector tvec2 = new TrackVector();
tvec2.set(0, 1.1); // r_signed
tvec2.set(1, 2.2); // z
@@ -222,7 +222,7 @@
TrackVector zero = new TrackVector(diff.minus(ediff));
if ( zero.amax() > 1.e-10 )
{
- System.out.println( error_prefix + "Incorrect difference." );
+ if(debug) System.out.println( error_prefix + "Incorrect difference." );
System.exit(9);
}
@@ -230,9 +230,9 @@
//********************************************************************
- System.out.println(ok_prefix + "Test space point." );
+ if(debug) System.out.println(ok_prefix + "Test space point." );
SpacePoint spt = ton.spacePoint();
- System.out.println("spt= "+spt);
+ if(debug) System.out.println("spt= "+spt);
Assert.assertTrue( myequal(spt.rxy(), 1.0) );
Assert.assertTrue( Math.abs(spt.phi()-phi) < 1.e-4 );
Assert.assertTrue( spt.z() == 2.0 );
@@ -245,8 +245,8 @@
trv_1.setVector(vec_1);
trv_1.setForward();
- System.out.println("trv_1= "+trv_1);
- System.out.println("trv_1.spacePoint()"+trv_1.spacePoint());
+ if(debug) System.out.println("trv_1= "+trv_1);
+ if(debug) System.out.println("trv_1.spacePoint()"+trv_1.spacePoint());
Assert.assertTrue( myequal(trv_1.spacePoint().x(),0.1) );
Assert.assertTrue( myequal(trv_1.spacePoint().y(),0.2) );
@@ -270,7 +270,7 @@
//********************************************************************
- System.out.println(ok_prefix + "Test space vector." );
+ if(debug) System.out.println(ok_prefix + "Test space vector." );
SpacePath svec = ton.spacePath();
double lam = Math.atan(4.0);
Assert.assertTrue( myequal(svec.rxy(), 1.0) );
@@ -280,9 +280,9 @@
// Assert.assertTrue( myequal( svec.drxy(), Math.cos(lam)*Math.cos(TRFMath.PI2) ) );
// Assert.assertTrue( myequal( svec.rxy_dphi(), Math.cos(lam)*Math.sin(sign*TRFMath.PI2) ) );
// Assert.assertTrue( myequal( svec.dz(), Math.sin(lam) ) );
-//
+//
// //********************************************************************
-//
+//
// vec_1.set(SurfDCA.IRSIGNED,0.3);
// vec_1.set(SurfDCA.IPHID, -Math.PI);
// trv_1.setVector(vec_1);
@@ -303,10 +303,10 @@
// Assert.assertTrue( myequal(trv_1.spacePath().dx(),0.0) );
// Assert.assertTrue( myequal(trv_1.spacePath().dz(),0.0) );
// Assert.assertTrue( myequal(trv_1.spacePath().dy(),1.0) );
-//
+//
//********************************************************************
- System.out.println(ok_prefix
+ if(debug) System.out.println(ok_prefix
+ "------------- All tests passed. -------------" );
//********************************************************************