lcsim/test
diff -u -r1.2 -r1.3
--- EventHeaderTest.java 25 Jul 2005 05:28:28 -0000 1.2
+++ EventHeaderTest.java 25 Jul 2005 20:09:41 -0000 1.3
@@ -28,51 +28,65 @@
public class EventHeaderTest extends TestCase
{
int maxEvents = 10;
-
+
/** Creates a new instance of EventHeaderTest */
public EventHeaderTest()
{}
-
+
public static Test suite()
{
return new TestSuite(EventHeaderTest.class);
}
-
+
public void testEventHeader() throws Exception
{
runTestFile("http://www.lcsim.org/test/lcio/muons_SLIC_v1r9p1_sidmay05.slcio");
}
-
+
private void runTestFile(String s) throws Exception
{
- System.out.println("Running HitPositionTest on file: " + s);
-
+ System.out.println("Running EventHeaderTest on file: " + s);
+
URL url = new URL(s);
FileCache cache = new FileCache();
File file = cache.getCachedFile(url);
-
+
LCSimLoop loop = new LCSimLoop();
loop.setLCIORecordSource(file);
loop.add(new EventHeaderTestDriver() );
loop.loop(maxEvents);
loop.dispose();
}
-
+
public void checkIDDecoder(EventHeader event)
{
//Fetch all of the collections containing SimTrackerHits...
List<List<SimTrackerHit>> simTrackerHitSets = event.get(SimTrackerHit.class);
-
+
// loop over the collections
for (List<SimTrackerHit> simTrackerHits : simTrackerHitSets)
{
LCMetaData meta = event.getMetaData(simTrackerHits);
+
+ //System.out.println("coll name: " + meta.getName() );
IDDecoder decoder = meta.getIDDecoder();
- System.out.println("decoder = "+decoder); // <==== always null.
- //assert(decoder != null);
+
+ if ( decoder == null )
+ {
+ throw new RuntimeException("trackerIDDecoder is null.");
+ }
+
+ if ( !simTrackerHits.isEmpty() )
+ {
+ for ( SimTrackerHit hit : simTrackerHits )
+ {
+ decoder.setID( hit.getCellID() );
+ //System.out.println("decoder = " + decoder);
+ }
+ }
}
}
-
+
private class EventHeaderTestDriver extends Driver
{
public void process(EventHeader event)