1
2
3
4
5
6
7
8
9 package org.lcsim.recon.tracking.trfeloss;
10
11 import junit.framework.TestCase;
12 import org.lcsim.recon.tracking.trfutil.Assert;
13
14
15
16
17
18 public class DeDx_Test extends TestCase
19 {
20 private boolean debug;
21
22 public void testDeDx()
23 {
24 String component = "DeDx";
25 String ok_prefix = component + " (I): ";
26 String error_prefix = component + " test (E): ";
27
28 if(debug) System.out.println( ok_prefix
29 + "-------- Testing component " + component
30 + ". --------" );
31
32 DeDxTest test = new DeDxTest();
33 if(debug) System.out.println(test);
34 double energy = 1.;
35 double x = 10.;
36 Assert.assertTrue(test.dEdX(energy)==0.1*energy);
37 Assert.assertTrue(test.sigmaEnergy(energy,x)==0.01*energy*x);
38 Assert.assertTrue(test.loseEnergy(energy,x)==-energy*x);
39
40 if(debug) System.out.println( ok_prefix
41 + "------------- All tests passed. -------------" );
42
43 }
44
45 }