10 added + 9 removed, total 19 files
lcsim/test
diff -N EventHeaderTest.java
--- EventHeaderTest.java 16 May 2007 23:36:25 -0000 1.8
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,104 +0,0 @@
-/*
- * EventHeaderTest.java
- *
- * Created on July 24, 2005, 8:58 PM
- *
- */
-
-import java.io.File;
-import java.net.URL;
-
-import java.util.List;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.lcsim.util.Driver;
-import org.lcsim.geometry.IDDecoder;
-import org.lcsim.util.cache.FileCache;
-import org.lcsim.util.loop.LCSimLoop;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.EventHeader.LCMetaData;
-import org.lcsim.event.SimTrackerHit;
-import org.lcsim.geometry.Subdetector;
-
-/**
- *
- * @author jeremym
- */
-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
- {
- 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();
- }
-
-
- private class EventHeaderTestDriver extends Driver
- {
- public void process(EventHeader event)
- {
- checkIDDecoder(event);
- }
-
- private 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);
- IDDecoder decoder = meta.getIDDecoder();
-
- if ( decoder == null )
- {
- throw new RuntimeException("trackerIDDecoder is null.");
- }
-
- if ( !simTrackerHits.isEmpty() )
- {
- for ( SimTrackerHit hit : simTrackerHits )
- {
- decoder.setID( hit.getCellID() );
- assertTrue(decoder.toString() != null);
- assertTrue(decoder.toString().length() > 0);
-
-// IDDecoder hit_dc = hit.getIDDecoder();
-// Subdetector hit_sd = hit.getSubdetector();
-//
-// // Check that the hit's IDDecoder and Subdetector match that
-// // fetched from meta.
-// assert(hit_dc == decoder);
-// assert(hit_sd == decoder.getSubdetector());
- }
- }
- }
- }
- }
-}
lcsim/test
diff -N HitPositionTest.java
--- HitPositionTest.java 21 Jun 2006 18:10:18 -0000 1.17
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,156 +0,0 @@
-import java.io.File;
-import java.net.URL;
-import java.util.List;
-
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.SimCalorimeterHit;
-import org.lcsim.geometry.IDDecoder;
-import org.lcsim.geometry.Subdetector;
-import org.lcsim.geometry.util.BaseIDDecoder;
-import org.lcsim.util.Driver;
-import org.lcsim.util.cache.FileCache;
-import org.lcsim.util.loop.LCSimLoop;
-
-import junit.framework.*;
-
-/**
- * @author tonyj
- */
-public class HitPositionTest extends TestCase
-{
- private static final String[] detectors =
- { "sdfeb05", "sdjan03", "sdjan03", "sidmay05", "sidmay05_20mr", "sidmay05_2mr", "sidmay05_np", "sidmay05_scinthcal" };
- private static final String[] colls =
- { "EcalBarrHits", "EcalEndcapHits", "HcalBarrHits", "HcalEndcapHits" };
- private int recordCount = 0;
- private static final int maxEvents = 50;
-
- public void testHitPosition() throws Exception
- {
- for (String detectorName : getDetectors())
- {
- runTestFile(getBaseURL() + getFileChunk() + detectorName + ".slcio");
- }
- }
-
- /** Base URL for test files. */
- private static final String getBaseURL()
- {
- return "http://www.lcsim.org/test/lcio/";
- }
-
- /** Chunk of pathname to detector tag. */
- private static final String getFileChunk()
- {
- return "n/n_Theta90_1GeV_SLIC_v1r9p1_";
- }
-
- public void testMuScan() throws Exception
- {
- runTestFile("http://www.lcsim.org/test/lcio/muons_SLIC_v1r9p1_sidmay05.slcio");
- runTestFile("http://www.lcsim.org/test/lcio/muons_SLIC_v1r9p1_sidmay05_np.slcio");
- }
-
- private void runTestFile(String s) throws Exception
- {
- URL url = new URL(s);
- FileCache cache = new FileCache();
- File file = cache.getCachedFile(url);
-
- recordCount = 0;
- LCSimLoop loop = new LCSimLoop();
- loop.setLCIORecordSource(file);
- loop.add(new HitPositionDriver());
- loop.loop(maxEvents);
- loop.dispose();
- }
-
- /** Collections to test. */
- private static final String[] getColls()
- {
- return colls;
- }
-
- /** Detectors to test. */
- private static final String[] getDetectors()
- {
- return detectors;
- };
-
- public HitPositionTest(String testName)
- {
- super(testName);
- }
-
- public static Test suite()
- {
- return new TestSuite(HitPositionTest.class);
- }
-
- // protected void setUp() throws Exception
- // {
- // }
-
- /**
- * Tests whether position from hit matches the decoder's position from Id
- * and segmentation calculations.
- */
- private class HitPositionDriver extends Driver
- {
- public void process(EventHeader event)
- {
- ++recordCount;
- for (String s : colls)
- {
- List<SimCalorimeterHit> hits = event.get(SimCalorimeterHit.class, s);
- IDDecoder decoder = event.getMetaData(hits).getIDDecoder();
-
- if (decoder == null)
- {
- throw new RuntimeException("HitPositionTest - decoder is null");
- }
-
- for (SimCalorimeterHit hit : hits)
- {
- long id = hit.getCellID();
- decoder.setID(id);
-
- double[] pos = hit.getPosition();
- // if ( s == colls[0] )
- // {
- // System.out.println("");
- // System.out.println("hit: " + pos[0] + " " + pos[1] + " "
- // + pos[2]);
- // System.out.println("dec: " + decoder.getX() + " " +
- // decoder.getY() + " " + decoder.getZ() +
- // " " + decoder.getTheta() + " " + decoder.getPhi() + " " +
- // decoder.getValue("phi") + " " + decoder.getValue("z") );
- // }
- // FIXME: Could be added to IDDecoder as checkPosition()
- // with tolerance.
- assertEquals(decoder.getX(), pos[0], 0.001);
- assertEquals(decoder.getY(), pos[1], 0.001);
- assertEquals(decoder.getZ(), pos[2], 0.001);
-
- Subdetector subdet = decoder.getSubdetector();
-
- if (subdet == null)
- {
- throw new RuntimeException("IDDecoder's Subdetector is null.");
- }
-
- /* subdetector and decoder should agree on basic flags... */
- // BaseIDDecoder = (BaseIDDecoder) bdec;
- // if ( subdet.isBarrel() )
- // {
- // assertTrue(bdec.getBarrelEndcapFlag().isBarrel());
- // }
- // if ( subdet.isEndcap())
- // {
- // assertTrue(bdec.getBarrelEndcapFlag().isEndcap());
- // }
- }
- }
- }
- }
-}
lcsim/test
diff -N LCIOReadTest.java
--- LCIOReadTest.java 26 Apr 2007 22:28:56 -0000 1.14
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,127 +0,0 @@
-import java.io.File;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import org.lcsim.event.Cluster;
-import org.lcsim.event.EventHeader;
-import org.lcsim.recon.cluster.cheat.CheatClusterDriver;
-import org.lcsim.util.Driver;
-import org.lcsim.util.cache.FileCache;
-import org.lcsim.util.loop.LCIODriver;
-import org.lcsim.util.loop.LCIOEventSource;
-
-import org.lcsim.util.loop.LCSimLoop;
-
-/**
- * @author tonyj
- */
-public class LCIOReadTest extends TestCase
-{
-
- public LCIOReadTest(String testName)
- {
- super(testName);
- }
-
- public static Test suite()
- {
- return new TestSuite(LCIOReadTest.class);
- }
-
- public void testLCIORead() throws Exception
- {
- URL url = new URL("http://www.lcsim.org/test/lcio/muons_SLIC_v1r9p1_sidmay05.slcio");
- FileCache cache = new FileCache();
- File file = cache.getCachedFile(url);
-
- LCSimLoop loop = new LCSimLoop();
- loop.setLCIORecordSource(file);
- loop.add(new CheatClusterDriver());
- loop.add(new ReadDriver());
- loop.add(new LCIODriver(new File("test.slcio")));
- loop.loop(-1);
- assertEquals(200, loop.getTotalCountableSupplied());
- loop.dispose();
- }
-
- public void testLCIOReadChain() throws Exception
- {
- URL url = new URL("http://www.lcsim.org/test/lcio/muons_SLIC_v1r9p1_sidmay05.slcio");
- FileCache cache = new FileCache();
- File file = cache.getCachedFile(url);
-
- List<File> files = new ArrayList<File>();
- files.add(file);
- files.add(file);
- LCIOEventSource es = new LCIOEventSource("TestChain", files);
-
- LCSimLoop loop = new LCSimLoop();
- loop.setLCIORecordSource(es);
- loop.loop(-1);
- assertEquals(400, loop.getTotalCountableSupplied());
- loop.dispose();
- }
- public void testSkip() throws Exception
- {
- URL url = new URL("http://www.lcsim.org/test/lcio/muons_SLIC_v1r9p1_sidmay05.slcio");
- FileCache cache = new FileCache();
- File file = cache.getCachedFile(url);
-
- LCSimLoop loop = new LCSimLoop();
- loop.setLCIORecordSource(file);
- loop.add(new CheatClusterDriver());
- loop.skip(150);
- loop.loop(-1);
- assertEquals(50, loop.getTotalCountableSupplied());
- loop.dispose();
- }
- public void testSkip0() throws Exception
- {
- final String detectorName = "sidaug05";
- URL url = new URL("ftp://ftp-lcd.slac.stanford.edu/lcd/NewData/NLC500/ZZ/stdhep/pythia/pythiaZZ_nunu_bbbar.stdhep");
- FileCache cache = new FileCache();
- File stdhep = cache.getCachedFile(url);
-
- LCSimLoop loop = new LCSimLoop();
- loop.setStdhepRecordSource(stdhep,detectorName);
- long start = System.nanoTime();
- loop.skip(0);
- long stop = System.nanoTime();
- System.out.println("Skip took "+(stop-start)/1000000.+"ms");
- loop.loop(1000);
- assertEquals(1000, loop.getTotalCountableSupplied());
- loop.dispose();
- }
- public void testSkipSpeed() throws Exception
- {
- final String detectorName = "sidaug05";
- URL url = new URL("ftp://ftp-lcd.slac.stanford.edu/lcd/NewData/NLC500/ZZ/stdhep/pythia/pythiaZZ_nunu_bbbar.stdhep");
- FileCache cache = new FileCache();
- File stdhep = cache.getCachedFile(url);
-
- LCSimLoop loop = new LCSimLoop();
- loop.setStdhepRecordSource(stdhep,detectorName);
- long start = System.nanoTime();
- loop.skip(950);
- long stop = System.nanoTime();
- System.out.println("Skip took "+(stop-start)/1000000.+"ms");
- loop.loop(-1);
- assertEquals(50, loop.getTotalCountableSupplied());
- loop.dispose();
- }
- private class ReadDriver extends Driver
- {
- private int n;
-
- public void process(EventHeader event)
- {
- // Look for clusters
- List<List<Cluster>> collections = event.get(Cluster.class);
- if (n++ == 0)
- assertEquals(7, collections.size());
- }
- }
-}
\ No newline at end of file
lcsim/test
diff -N MokkaTest.java
--- MokkaTest.java 22 May 2006 19:55:07 -0000 1.4
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,76 +0,0 @@
-import java.io.File;
-import java.net.URL;
-import java.util.List;
-
-import org.lcsim.util.Driver;
-import org.lcsim.util.cache.FileCache;
-import org.lcsim.util.loop.LCSimLoop;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.EventHeader.LCMetaData;
-import org.lcsim.event.CalorimeterHit;
-import org.lcsim.geometry.Detector;
-import org.lcsim.geometry.Subdetector;
-import org.lcsim.geometry.IDDecoder;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-/**
- *
- * @author jeremym
- * @version $Id: MokkaTest.java,v 1.4 2006/05/22 19:55:07 tonyj Exp $
- */
-public class MokkaTest extends TestCase
-{
-
- public MokkaTest(String testName)
- {
- super(testName);
- }
-
- public static Test suite()
- {
- return new TestSuite(MokkaTest.class);
- }
-
- public void testMokka() throws Exception
- {
- // URL url = new
- // URL("http://www.lcsim.org/test/lcio/D12_mokka_muons.slcio");
- URL url = new URL(
- "http://www.lcsim.org/test/lcio/hcalFeRPC1_Mokka_muons.slcio");
- FileCache cache = new FileCache();
- File file = cache.getCachedFile(url);
-
- LCSimLoop loop = new LCSimLoop();
- loop.setLCIORecordSource(file);
- loop.add(new MokkaDriver());
- loop.loop(-1);
- loop.dispose();
- }
-
- private class MokkaDriver extends Driver
- {
- protected void process(EventHeader event)
- {
- List<List<CalorimeterHit>> calHitColls = event.get(CalorimeterHit.class);
- for ( List<CalorimeterHit> calHits : calHitColls )
- {
- LCMetaData meta = event.getMetaData(calHits);
- IDDecoder decoder = meta.getIDDecoder();
-
- for ( CalorimeterHit hit : calHits )
- {
- decoder.setID(hit.getCellID());
-
- int M = decoder.getValue("M");
- int S = decoder.getValue("S");
- int I = decoder.getValue("I");
- int J = decoder.getValue("J");
- int layer = decoder.getValue("layer");
- }
- }
- }
- }
-}
lcsim/test
diff -N ReadoutTest.java
--- ReadoutTest.java 21 Jun 2006 18:10:18 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,69 +0,0 @@
-import java.io.File;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.EventHeader.LCMetaData;
-import org.lcsim.event.SimCalorimeterHit;
-import org.lcsim.geometry.IDDecoder;
-import org.lcsim.util.Driver;
-import org.lcsim.util.cache.FileCache;
-import org.lcsim.util.loop.LCIODriver;
-import org.lcsim.util.loop.LCSimLoop;
-/**
- *
- * @author tonyj
- */
-public class ReadoutTest extends TestCase
-{
- public ReadoutTest(String testName)
- {
- super(testName);
- }
-
- public static Test suite()
- {
- return new TestSuite(ReadoutTest.class);
- }
-
- public void testLCIORead() throws Exception
- {
- URL url = new URL("http://www.lcsim.org/datasamples/slic_sdjan03_K0S_Theta90_1-10GeV.slcio");
- FileCache cache = new FileCache();
- File file = cache.getCachedFile(url);
-
- LCSimLoop loop = new LCSimLoop();
- loop.setLCIORecordSource(file);
- loop.add(new CopyDriver());
- loop.add(new LCIODriver(new File("test2.slcio")));
- loop.loop(-1);
- loop.dispose();
- }
- private class CopyDriver extends Driver
- {
- public void process(EventHeader event)
- {
- // Loop over all calorimeter hits, add
- List<List<SimCalorimeterHit>> collections = event.get(SimCalorimeterHit.class);
- int nBefore = collections.size();
- for (List<SimCalorimeterHit> collection : collections)
- {
- LCMetaData meta = event.getMetaData(collection);
- List<SimCalorimeterHit> copy = new ArrayList<SimCalorimeterHit>(collection);
- event.put(meta.getName()+"Copy",copy,SimCalorimeterHit.class,meta.getFlags(),meta.getName());
- }
- collections = event.get(SimCalorimeterHit.class);
- int nAfter = collections.size();
- assertEquals(2*nBefore,nAfter);
- for (List<SimCalorimeterHit> collection : collections)
- {
- LCMetaData meta = event.getMetaData(collection);
- IDDecoder decoder = meta.getIDDecoder();
- assertNotNull(decoder);
- }
- }
- }
-}
lcsim/test
diff -N SamplingFractionTest.java
--- SamplingFractionTest.java 8 Feb 2006 22:18:58 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,66 +0,0 @@
-import java.io.File;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.EventHeader.LCMetaData;
-import org.lcsim.event.SimCalorimeterHit;
-import org.lcsim.geometry.IDDecoder;
-import org.lcsim.util.Driver;
-import org.lcsim.util.cache.FileCache;
-import org.lcsim.util.loop.LCIODriver;
-import org.lcsim.util.loop.LCSimLoop;
-
-/**
- * @author tonyj
- */
-public class SamplingFractionTest extends TestCase
-{
- public SamplingFractionTest(String testName)
- {
- super(testName);
- }
-
- public static Test suite()
- {
- return new TestSuite(SamplingFractionTest.class);
- }
-
- public void testLCIORead() throws Exception
- {
- // URL url = new
- // URL("http://www.lcsim.org/datasamples/slic_sdjan03_K0S_Theta90_1-10GeV.slcio");
- URL url = new URL("http://www.lcsim.org/test/lcio/muons_SLIC_v1r9p1_sidmay05.slcio");
- FileCache cache = new FileCache();
- File file = cache.getCachedFile(url);
-
- LCSimLoop loop = new LCSimLoop();
- loop.setLCIORecordSource(file);
- loop.add(new TestDriver());
- loop.loop(-1);
- loop.dispose();
- }
- private class TestDriver extends Driver
- {
- public void process(EventHeader event)
- {
- // Loop over all calorimeter hits
- List<List<SimCalorimeterHit>> collections = event.get(SimCalorimeterHit.class);
- for (List<SimCalorimeterHit> collection : collections)
- {
- LCMetaData meta = event.getMetaData(collection);
- for (SimCalorimeterHit hit : collection)
- {
- assertEquals(meta.getIDDecoder(), hit.getIDDecoder());
- double raw = hit.getRawEnergy();
- double corrected = hit.getCorrectedEnergy();
- assertTrue(corrected > raw);
- }
- }
-
- }
- }
-}
lcsim/test
diff -N StdhepFilterTest.java
--- StdhepFilterTest.java 27 Mar 2007 16:43:29 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,44 +0,0 @@
-import java.io.File;
-import java.net.URL;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import org.lcsim.util.cache.FileCache;
-import org.lcsim.util.loop.LCSimLoop;
-import org.lcsim.util.loop.StdhepDriver;
-
-/**
- *
- * @author Tony Johnson
- */
-public class StdhepFilterTest extends TestCase
-{
- public StdhepFilterTest(String testName)
- {
- super(testName);
- }
-
- public static Test suite()
- {
- return new TestSuite(StdhepFilterTest.class);
- }
- /**
- * @param args the command line arguments
- */
- public void testStdhepFilter() throws Exception
- {
- final String detectorName = "sidaug05";
- URL url = new URL("ftp://ftp-lcd.slac.stanford.edu/lcd/NewData/NLC500/ZZ/stdhep/pythia/pythiaZZ_nunu_bbbar.stdhep");
- FileCache cache = new FileCache();
- File stdhep = cache.getCachedFile(url);
-
- StdhepDriver writer = new StdhepDriver("filter.stdhep","myTitle","myComment",0);
-
- LCSimLoop loop = new LCSimLoop();
- loop.setStdhepRecordSource(stdhep,detectorName);
- loop.add(writer);
- loop.loop(100);
- assertEquals(100,loop.getTotalCountableSupplied());
- loop.dispose();
- }
-}
\ No newline at end of file
lcsim/test
diff -N TestFastMC.java
--- TestFastMC.java 6 Jan 2006 23:32:33 -0000 1.11
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,56 +0,0 @@
-import org.lcsim.util.aida.AIDA;
-import java.io.File;
-import java.net.URL;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import org.lcsim.event.util.JetDriver;
-import org.lcsim.mc.fast.MCFast;
-import org.lcsim.util.Driver;
-import org.lcsim.util.cache.FileCache;
-
-import org.lcsim.util.loop.LCIODriver;
-import org.lcsim.util.loop.LCSimLoop;
-
-/**
- *
- * @author Tony Johnson
- */
-public class TestFastMC extends TestCase
-{
-
- public TestFastMC(String testName)
- {
- super(testName);
- }
-
- public static Test suite()
- {
- return new TestSuite(TestFastMC.class);
- }
- /**
- * @param args the command line arguments
- */
- public void testFastMC() throws Exception
- {
- final String detectorName = "sidaug05";
- URL url = new URL("ftp://ftp-lcd.slac.stanford.edu/lcd/NewData/NLC500/ZZ/stdhep/pythia/pythiaZZ_nunu_bbbar.stdhep");
- FileCache cache = new FileCache();
- File stdhep = cache.getCachedFile(url);
-
- Driver fast = new MCFast();
- fast.setHistogramLevel(1);
-
- LCIODriver writer = new LCIODriver("mcfast.slcio");
-
- LCSimLoop loop = new LCSimLoop();
- loop.setStdhepRecordSource(stdhep,detectorName);
- loop.add(fast);
- loop.add(new JetDriver());
- loop.add(writer);
- loop.loop(100);
- loop.dispose();
-
- AIDA.defaultInstance().saveAs("fastmc.aida");
- }
-}
\ No newline at end of file
lcsim/test
diff -N TestFastMCGenerator.java
--- TestFastMCGenerator.java 6 Jan 2006 23:32:33 -0000 1.10
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,51 +0,0 @@
-import org.lcsim.util.aida.AIDA;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import org.lcsim.mc.fast.MCFast;
-import org.lcsim.util.Driver;
-import org.lcsim.util.event.LCSimEventGenerator;
-
-import org.lcsim.util.loop.LCIODriver;
-import org.lcsim.util.loop.LCSimLoop;
-
-/**
- *
- * @author Tony Johnson
- */
-public class TestFastMCGenerator extends TestCase
-{
-
- public TestFastMCGenerator(String testName)
- {
- super(testName);
- }
-
- public static Test suite()
- {
- return new TestSuite(TestFastMCGenerator.class);
- }
-
- /**
- * @param args the command line arguments
- */
- public void testFastMCGenerator() throws Exception
- {
- final String detectorName = "sdjan03";
- LCSimEventGenerator gen = new LCSimEventGenerator(detectorName);
-
- Driver fast = new MCFast();
- fast.setHistogramLevel(1);
-
- LCIODriver writer = new LCIODriver("mcfastgenerator.slcio");
-
- LCSimLoop loop = new LCSimLoop();
- loop.setRecordSource(gen);
- loop.add(fast);
- loop.add(writer);
- loop.loop(100);
- loop.dispose();
-
- AIDA.defaultInstance().saveAs("fastmcgenerator.aida");
- }
-}
\ No newline at end of file
lcsim/test/org/lcsim
diff -N EventHeaderTest.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ EventHeaderTest.java 9 Aug 2007 20:12:09 -0000 1.1
@@ -0,0 +1,104 @@
+package org.lcsim;
+
+/*
+ * EventHeaderTest.java
+ *
+ */
+
+import java.io.File;
+import java.net.URL;
+
+import java.util.List;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.lcsim.util.Driver;
+import org.lcsim.geometry.IDDecoder;
+import org.lcsim.util.cache.FileCache;
+import org.lcsim.util.loop.LCSimLoop;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.EventHeader.LCMetaData;
+import org.lcsim.event.SimTrackerHit;
+import org.lcsim.geometry.Subdetector;
+
+/**
+ *
+ * @author jeremym
+ */
+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
+ {
+ 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();
+ }
+
+
+ private class EventHeaderTestDriver extends Driver
+ {
+ public void process(EventHeader event)
+ {
+ checkIDDecoder(event);
+ }
+
+ private 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);
+ IDDecoder decoder = meta.getIDDecoder();
+
+ if ( decoder == null )
+ {
+ throw new RuntimeException("trackerIDDecoder is null.");
+ }
+
+ if ( !simTrackerHits.isEmpty() )
+ {
+ for ( SimTrackerHit hit : simTrackerHits )
+ {
+ decoder.setID( hit.getCellID() );
+ assertTrue(decoder.toString() != null);
+ assertTrue(decoder.toString().length() > 0);
+
+// IDDecoder hit_dc = hit.getIDDecoder();
+// Subdetector hit_sd = hit.getSubdetector();
+//
+// // Check that the hit's IDDecoder and Subdetector match that
+// // fetched from meta.
+// assert(hit_dc == decoder);
+// assert(hit_sd == decoder.getSubdetector());
+ }
+ }
+ }
+ }
+ }
+}
lcsim/test/org/lcsim
diff -N HitPositionTest.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ HitPositionTest.java 9 Aug 2007 20:12:09 -0000 1.1
@@ -0,0 +1,158 @@
+package org.lcsim;
+
+import java.io.File;
+import java.net.URL;
+import java.util.List;
+
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.SimCalorimeterHit;
+import org.lcsim.geometry.IDDecoder;
+import org.lcsim.geometry.Subdetector;
+import org.lcsim.geometry.util.BaseIDDecoder;
+import org.lcsim.util.Driver;
+import org.lcsim.util.cache.FileCache;
+import org.lcsim.util.loop.LCSimLoop;
+
+import junit.framework.*;
+
+/**
+ * @author tonyj
+ */
+public class HitPositionTest extends TestCase
+{
+ private static final String[] detectors =
+ { "sdfeb05", "sdjan03", "sdjan03", "sidmay05", "sidmay05_20mr", "sidmay05_2mr", "sidmay05_np", "sidmay05_scinthcal" };
+ private static final String[] colls =
+ { "EcalBarrHits", "EcalEndcapHits", "HcalBarrHits", "HcalEndcapHits" };
+ private int recordCount = 0;
+ private static final int maxEvents = 50;
+
+ public void testHitPosition() throws Exception
+ {
+ for (String detectorName : getDetectors())
+ {
+ runTestFile(getBaseURL() + getFileChunk() + detectorName + ".slcio");
+ }
+ }
+
+ /** Base URL for test files. */
+ private static final String getBaseURL()
+ {
+ return "http://www.lcsim.org/test/lcio/";
+ }
+
+ /** Chunk of pathname to detector tag. */
+ private static final String getFileChunk()
+ {
+ return "n/n_Theta90_1GeV_SLIC_v1r9p1_";
+ }
+
+ public void testMuScan() throws Exception
+ {
+ runTestFile("http://www.lcsim.org/test/lcio/muons_SLIC_v1r9p1_sidmay05.slcio");
+ runTestFile("http://www.lcsim.org/test/lcio/muons_SLIC_v1r9p1_sidmay05_np.slcio");
+ }
+
+ private void runTestFile(String s) throws Exception
+ {
+ URL url = new URL(s);
+ FileCache cache = new FileCache();
+ File file = cache.getCachedFile(url);
+
+ recordCount = 0;
+ LCSimLoop loop = new LCSimLoop();
+ loop.setLCIORecordSource(file);
+ loop.add(new HitPositionDriver());
+ loop.loop(maxEvents);
+ loop.dispose();
+ }
+
+ /** Collections to test. */
+ private static final String[] getColls()
+ {
+ return colls;
+ }
+
+ /** Detectors to test. */
+ private static final String[] getDetectors()
+ {
+ return detectors;
+ };
+
+ public HitPositionTest(String testName)
+ {
+ super(testName);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(HitPositionTest.class);
+ }
+
+ // protected void setUp() throws Exception
+ // {
+ // }
+
+ /**
+ * Tests whether position from hit matches the decoder's position from Id
+ * and segmentation calculations.
+ */
+ private class HitPositionDriver extends Driver
+ {
+ public void process(EventHeader event)
+ {
+ ++recordCount;
+ for (String s : colls)
+ {
+ List<SimCalorimeterHit> hits = event.get(SimCalorimeterHit.class, s);
+ IDDecoder decoder = event.getMetaData(hits).getIDDecoder();
+
+ if (decoder == null)
+ {
+ throw new RuntimeException("HitPositionTest - decoder is null");
+ }
+
+ for (SimCalorimeterHit hit : hits)
+ {
+ long id = hit.getCellID();
+ decoder.setID(id);
+
+ double[] pos = hit.getPosition();
+ // if ( s == colls[0] )
+ // {
+ // System.out.println("");
+ // System.out.println("hit: " + pos[0] + " " + pos[1] + " "
+ // + pos[2]);
+ // System.out.println("dec: " + decoder.getX() + " " +
+ // decoder.getY() + " " + decoder.getZ() +
+ // " " + decoder.getTheta() + " " + decoder.getPhi() + " " +
+ // decoder.getValue("phi") + " " + decoder.getValue("z") );
+ // }
+ // FIXME: Could be added to IDDecoder as checkPosition()
+ // with tolerance.
+ assertEquals(decoder.getX(), pos[0], 0.001);
+ assertEquals(decoder.getY(), pos[1], 0.001);
+ assertEquals(decoder.getZ(), pos[2], 0.001);
+
+ Subdetector subdet = decoder.getSubdetector();
+
+ if (subdet == null)
+ {
+ throw new RuntimeException("IDDecoder's Subdetector is null.");
+ }
+
+ /* subdetector and decoder should agree on basic flags... */
+ // BaseIDDecoder = (BaseIDDecoder) bdec;
+ // if ( subdet.isBarrel() )
+ // {
+ // assertTrue(bdec.getBarrelEndcapFlag().isBarrel());
+ // }
+ // if ( subdet.isEndcap())
+ // {
+ // assertTrue(bdec.getBarrelEndcapFlag().isEndcap());
+ // }
+ }
+ }
+ }
+ }
+}
lcsim/test/org/lcsim
diff -N LCIOHeaderTest.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ LCIOHeaderTest.java 9 Aug 2007 20:12:09 -0000 1.1
@@ -0,0 +1,70 @@
+package org.lcsim;
+
+import java.io.File;
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.SimCalorimeterHit;
+import org.lcsim.event.EventHeader.LCMetaData;
+import org.lcsim.util.Driver;
+import org.lcsim.util.cache.FileCache;
+import org.lcsim.util.loop.LCSimLoop;
+
+public class LCIOHeaderTest
+extends TestCase
+{
+ public LCIOHeaderTest(String testName)
+ {
+ super(testName);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(LCIOHeaderTest.class);
+ }
+
+ public void testHeader() throws Exception
+ {
+ URL url = new URL("ftp://ftp-lcd.slac.stanford.edu/lcd/ILC/singleParticle/acme0605/slcio/slic/K0L_Theta100_10GeV_SLIC_v2r0p0_acme0605.slcio");
+ FileCache cache = new FileCache();
+ File file = cache.getCachedFile(url);
+
+ LCSimLoop loop = new LCSimLoop();
+ loop.add(new TestDriver());
+ loop.setLCIORecordSource(file);
+ loop.loop(1);
+ }
+
+ private class TestDriver
+ extends Driver
+ {
+ protected void process(EventHeader event)
+ {
+ List<List<SimCalorimeterHit>> colls = event.get(SimCalorimeterHit.class);
+ for (List<SimCalorimeterHit> coll : colls)
+ {
+ LCMetaData meta = event.getMetaData(coll);
+ if (meta.getStringParameters().size() == 0)
+ {
+ System.out.println(meta.getName() + " has no string params!!!");
+ }
+ for (Map.Entry<String,String[]> entry : meta.getStringParameters().entrySet() )
+ {
+ String key = entry.getKey();
+ String value[] = entry.getValue();
+ for (String v : value)
+ {
+ System.out.print(" " + v);
+ }
+ System.out.println();
+ }
+ }
+ }
+ }
+}
lcsim/test/org/lcsim
diff -N LCIOReadTest.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ LCIOReadTest.java 9 Aug 2007 20:12:09 -0000 1.1
@@ -0,0 +1,129 @@
+package org.lcsim;
+
+import java.io.File;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.lcsim.event.Cluster;
+import org.lcsim.event.EventHeader;
+import org.lcsim.recon.cluster.cheat.CheatClusterDriver;
+import org.lcsim.util.Driver;
+import org.lcsim.util.cache.FileCache;
+import org.lcsim.util.loop.LCIODriver;
+import org.lcsim.util.loop.LCIOEventSource;
+
+import org.lcsim.util.loop.LCSimLoop;
+
+/**
+ * @author tonyj
+ */
+public class LCIOReadTest extends TestCase
+{
+
+ public LCIOReadTest(String testName)
+ {
+ super(testName);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(LCIOReadTest.class);
+ }
+
+ public void testLCIORead() throws Exception
+ {
+ URL url = new URL("http://www.lcsim.org/test/lcio/muons_SLIC_v1r9p1_sidmay05.slcio");
+ FileCache cache = new FileCache();
+ File file = cache.getCachedFile(url);
+
+ LCSimLoop loop = new LCSimLoop();
+ loop.setLCIORecordSource(file);
+ loop.add(new CheatClusterDriver());
+ loop.add(new ReadDriver());
+ loop.add(new LCIODriver(new File("test.slcio")));
+ loop.loop(-1);
+ assertEquals(200, loop.getTotalCountableSupplied());
+ loop.dispose();
+ }
+
+ public void testLCIOReadChain() throws Exception
+ {
+ URL url = new URL("http://www.lcsim.org/test/lcio/muons_SLIC_v1r9p1_sidmay05.slcio");
+ FileCache cache = new FileCache();
+ File file = cache.getCachedFile(url);
+
+ List<File> files = new ArrayList<File>();
+ files.add(file);
+ files.add(file);
+ LCIOEventSource es = new LCIOEventSource("TestChain", files);
+
+ LCSimLoop loop = new LCSimLoop();
+ loop.setLCIORecordSource(es);
+ loop.loop(-1);
+ assertEquals(400, loop.getTotalCountableSupplied());
+ loop.dispose();
+ }
+ public void testSkip() throws Exception
+ {
+ URL url = new URL("http://www.lcsim.org/test/lcio/muons_SLIC_v1r9p1_sidmay05.slcio");
+ FileCache cache = new FileCache();
+ File file = cache.getCachedFile(url);
+
+ LCSimLoop loop = new LCSimLoop();
+ loop.setLCIORecordSource(file);
+ loop.add(new CheatClusterDriver());
+ loop.skip(150);
+ loop.loop(-1);
+ assertEquals(50, loop.getTotalCountableSupplied());
+ loop.dispose();
+ }
+ public void testSkip0() throws Exception
+ {
+ final String detectorName = "sidaug05";
+ URL url = new URL("ftp://ftp-lcd.slac.stanford.edu/lcd/NewData/NLC500/ZZ/stdhep/pythia/pythiaZZ_nunu_bbbar.stdhep");
+ FileCache cache = new FileCache();
+ File stdhep = cache.getCachedFile(url);
+
+ LCSimLoop loop = new LCSimLoop();
+ loop.setStdhepRecordSource(stdhep,detectorName);
+ long start = System.nanoTime();
+ loop.skip(0);
+ long stop = System.nanoTime();
+ System.out.println("Skip took "+(stop-start)/1000000.+"ms");
+ loop.loop(1000);
+ assertEquals(1000, loop.getTotalCountableSupplied());
+ loop.dispose();
+ }
+ public void testSkipSpeed() throws Exception
+ {
+ final String detectorName = "sidaug05";
+ URL url = new URL("ftp://ftp-lcd.slac.stanford.edu/lcd/NewData/NLC500/ZZ/stdhep/pythia/pythiaZZ_nunu_bbbar.stdhep");
+ FileCache cache = new FileCache();
+ File stdhep = cache.getCachedFile(url);
+
+ LCSimLoop loop = new LCSimLoop();
+ loop.setStdhepRecordSource(stdhep,detectorName);
+ long start = System.nanoTime();
+ loop.skip(950);
+ long stop = System.nanoTime();
+ System.out.println("Skip took "+(stop-start)/1000000.+"ms");
+ loop.loop(-1);
+ assertEquals(50, loop.getTotalCountableSupplied());
+ loop.dispose();
+ }
+ private class ReadDriver extends Driver
+ {
+ private int n;
+
+ public void process(EventHeader event)
+ {
+ // Look for clusters
+ List<List<Cluster>> collections = event.get(Cluster.class);
+ if (n++ == 0)
+ assertEquals(7, collections.size());
+ }
+ }
+}
lcsim/test/org/lcsim
diff -N MokkaTest.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ MokkaTest.java 9 Aug 2007 20:12:09 -0000 1.1
@@ -0,0 +1,78 @@
+package org.lcsim;
+
+import java.io.File;
+import java.net.URL;
+import java.util.List;
+
+import org.lcsim.util.Driver;
+import org.lcsim.util.cache.FileCache;
+import org.lcsim.util.loop.LCSimLoop;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.EventHeader.LCMetaData;
+import org.lcsim.event.CalorimeterHit;
+import org.lcsim.geometry.Detector;
+import org.lcsim.geometry.Subdetector;
+import org.lcsim.geometry.IDDecoder;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ *
+ * @author jeremym
+ * @version $Id: MokkaTest.java,v 1.1 2007/08/09 20:12:09 jeremy Exp $
+ */
+public class MokkaTest extends TestCase
+{
+
+ public MokkaTest(String testName)
+ {
+ super(testName);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(MokkaTest.class);
+ }
+
+ public void testMokka() throws Exception
+ {
+ // URL url = new
+ // URL("http://www.lcsim.org/test/lcio/D12_mokka_muons.slcio");
+ URL url = new URL(
+ "http://www.lcsim.org/test/lcio/hcalFeRPC1_Mokka_muons.slcio");
+ FileCache cache = new FileCache();
+ File file = cache.getCachedFile(url);
+
+ LCSimLoop loop = new LCSimLoop();
+ loop.setLCIORecordSource(file);
+ loop.add(new MokkaDriver());
+ loop.loop(-1);
+ loop.dispose();
+ }
+
+ private class MokkaDriver extends Driver
+ {
+ protected void process(EventHeader event)
+ {
+ List<List<CalorimeterHit>> calHitColls = event.get(CalorimeterHit.class);
+ for ( List<CalorimeterHit> calHits : calHitColls )
+ {
+ LCMetaData meta = event.getMetaData(calHits);
+ IDDecoder decoder = meta.getIDDecoder();
+
+ for ( CalorimeterHit hit : calHits )
+ {
+ decoder.setID(hit.getCellID());
+
+ int M = decoder.getValue("M");
+ int S = decoder.getValue("S");
+ int I = decoder.getValue("I");
+ int J = decoder.getValue("J");
+ int layer = decoder.getValue("layer");
+ }
+ }
+ }
+ }
+}
lcsim/test/org/lcsim
diff -N ReadoutTest.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ReadoutTest.java 9 Aug 2007 20:12:09 -0000 1.1
@@ -0,0 +1,71 @@
+package org.lcsim;
+
+import java.io.File;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.EventHeader.LCMetaData;
+import org.lcsim.event.SimCalorimeterHit;
+import org.lcsim.geometry.IDDecoder;
+import org.lcsim.util.Driver;
+import org.lcsim.util.cache.FileCache;
+import org.lcsim.util.loop.LCIODriver;
+import org.lcsim.util.loop.LCSimLoop;
+/**
+ *
+ * @author tonyj
+ */
+public class ReadoutTest extends TestCase
+{
+ public ReadoutTest(String testName)
+ {
+ super(testName);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(ReadoutTest.class);
+ }
+
+ public void testLCIORead() throws Exception
+ {
+ URL url = new URL("http://www.lcsim.org/datasamples/slic_sdjan03_K0S_Theta90_1-10GeV.slcio");
+ FileCache cache = new FileCache();
+ File file = cache.getCachedFile(url);
+
+ LCSimLoop loop = new LCSimLoop();
+ loop.setLCIORecordSource(file);
+ loop.add(new CopyDriver());
+ loop.add(new LCIODriver(new File("test2.slcio")));
+ loop.loop(-1);
+ loop.dispose();
+ }
+ private class CopyDriver extends Driver
+ {
+ public void process(EventHeader event)
+ {
+ // Loop over all calorimeter hits, add
+ List<List<SimCalorimeterHit>> collections = event.get(SimCalorimeterHit.class);
+ int nBefore = collections.size();
+ for (List<SimCalorimeterHit> collection : collections)
+ {
+ LCMetaData meta = event.getMetaData(collection);
+ List<SimCalorimeterHit> copy = new ArrayList<SimCalorimeterHit>(collection);
+ event.put(meta.getName()+"Copy",copy,SimCalorimeterHit.class,meta.getFlags(),meta.getName());
+ }
+ collections = event.get(SimCalorimeterHit.class);
+ int nAfter = collections.size();
+ assertEquals(2*nBefore,nAfter);
+ for (List<SimCalorimeterHit> collection : collections)
+ {
+ LCMetaData meta = event.getMetaData(collection);
+ IDDecoder decoder = meta.getIDDecoder();
+ assertNotNull(decoder);
+ }
+ }
+ }
+}
lcsim/test/org/lcsim
diff -N SamplingFractionTest.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ SamplingFractionTest.java 9 Aug 2007 20:12:09 -0000 1.1
@@ -0,0 +1,68 @@
+package org.lcsim;
+
+import java.io.File;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.EventHeader.LCMetaData;
+import org.lcsim.event.SimCalorimeterHit;
+import org.lcsim.geometry.IDDecoder;
+import org.lcsim.util.Driver;
+import org.lcsim.util.cache.FileCache;
+import org.lcsim.util.loop.LCIODriver;
+import org.lcsim.util.loop.LCSimLoop;
+
+/**
+ * @author tonyj
+ */
+public class SamplingFractionTest extends TestCase
+{
+ public SamplingFractionTest(String testName)
+ {
+ super(testName);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(SamplingFractionTest.class);
+ }
+
+ public void testLCIORead() throws Exception
+ {
+ // URL url = new
+ // URL("http://www.lcsim.org/datasamples/slic_sdjan03_K0S_Theta90_1-10GeV.slcio");
+ URL url = new URL("http://www.lcsim.org/test/lcio/muons_SLIC_v1r9p1_sidmay05.slcio");
+ FileCache cache = new FileCache();
+ File file = cache.getCachedFile(url);
+
+ LCSimLoop loop = new LCSimLoop();
+ loop.setLCIORecordSource(file);
+ loop.add(new TestDriver());
+ loop.loop(-1);
+ loop.dispose();
+ }
+ private class TestDriver extends Driver
+ {
+ public void process(EventHeader event)
+ {
+ // Loop over all calorimeter hits
+ List<List<SimCalorimeterHit>> collections = event.get(SimCalorimeterHit.class);
+ for (List<SimCalorimeterHit> collection : collections)
+ {
+ LCMetaData meta = event.getMetaData(collection);
+ for (SimCalorimeterHit hit : collection)
+ {
+ assertEquals(meta.getIDDecoder(), hit.getIDDecoder());
+ double raw = hit.getRawEnergy();
+ double corrected = hit.getCorrectedEnergy();
+ assertTrue(corrected > raw);
+ }
+ }
+
+ }
+ }
+}
lcsim/test/org/lcsim
diff -N StdhepFilterTest.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ StdhepFilterTest.java 9 Aug 2007 20:12:09 -0000 1.1
@@ -0,0 +1,46 @@
+package org.lcsim;
+
+import java.io.File;
+import java.net.URL;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.lcsim.util.cache.FileCache;
+import org.lcsim.util.loop.LCSimLoop;
+import org.lcsim.util.loop.StdhepDriver;
+
+/**
+ *
+ * @author Tony Johnson
+ */
+public class StdhepFilterTest extends TestCase
+{
+ public StdhepFilterTest(String testName)
+ {
+ super(testName);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(StdhepFilterTest.class);
+ }
+ /**
+ * @param args the command line arguments
+ */
+ public void testStdhepFilter() throws Exception
+ {
+ final String detectorName = "sidaug05";
+ URL url = new URL("ftp://ftp-lcd.slac.stanford.edu/lcd/NewData/NLC500/ZZ/stdhep/pythia/pythiaZZ_nunu_bbbar.stdhep");
+ FileCache cache = new FileCache();
+ File stdhep = cache.getCachedFile(url);
+
+ StdhepDriver writer = new StdhepDriver("filter.stdhep","myTitle","myComment",0);
+
+ LCSimLoop loop = new LCSimLoop();
+ loop.setStdhepRecordSource(stdhep,detectorName);
+ loop.add(writer);
+ loop.loop(100);
+ assertEquals(100,loop.getTotalCountableSupplied());
+ loop.dispose();
+ }
+}
lcsim/test/org/lcsim
diff -N TestFastMC.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ TestFastMC.java 9 Aug 2007 20:12:09 -0000 1.1
@@ -0,0 +1,58 @@
+package org.lcsim;
+
+import org.lcsim.util.aida.AIDA;
+import java.io.File;
+import java.net.URL;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.lcsim.event.util.JetDriver;
+import org.lcsim.mc.fast.MCFast;
+import org.lcsim.util.Driver;
+import org.lcsim.util.cache.FileCache;
+
+import org.lcsim.util.loop.LCIODriver;
+import org.lcsim.util.loop.LCSimLoop;
+
+/**
+ *
+ * @author Tony Johnson
+ */
+public class TestFastMC extends TestCase
+{
+
+ public TestFastMC(String testName)
+ {
+ super(testName);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(TestFastMC.class);
+ }
+ /**
+ * @param args the command line arguments
+ */
+ public void testFastMC() throws Exception
+ {
+ final String detectorName = "sidaug05";
+ URL url = new URL("ftp://ftp-lcd.slac.stanford.edu/lcd/NewData/NLC500/ZZ/stdhep/pythia/pythiaZZ_nunu_bbbar.stdhep");
+ FileCache cache = new FileCache();
+ File stdhep = cache.getCachedFile(url);
+
+ Driver fast = new MCFast();
+ fast.setHistogramLevel(1);
+
+ LCIODriver writer = new LCIODriver("mcfast.slcio");
+
+ LCSimLoop loop = new LCSimLoop();
+ loop.setStdhepRecordSource(stdhep,detectorName);
+ loop.add(fast);
+ loop.add(new JetDriver());
+ loop.add(writer);
+ loop.loop(100);
+ loop.dispose();
+
+ AIDA.defaultInstance().saveAs("fastmc.aida");
+ }
+}
lcsim/test/org/lcsim
diff -N TestFastMCGenerator.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ TestFastMCGenerator.java 9 Aug 2007 20:12:09 -0000 1.1
@@ -0,0 +1,53 @@
+package org.lcsim;
+
+import org.lcsim.util.aida.AIDA;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.lcsim.mc.fast.MCFast;
+import org.lcsim.util.Driver;
+import org.lcsim.util.event.LCSimEventGenerator;
+
+import org.lcsim.util.loop.LCIODriver;
+import org.lcsim.util.loop.LCSimLoop;
+
+/**
+ *
+ * @author Tony Johnson
+ */
+public class TestFastMCGenerator extends TestCase
+{
+
+ public TestFastMCGenerator(String testName)
+ {
+ super(testName);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(TestFastMCGenerator.class);
+ }
+
+ /**
+ * @param args the command line arguments
+ */
+ public void testFastMCGenerator() throws Exception
+ {
+ final String detectorName = "sdjan03";
+ LCSimEventGenerator gen = new LCSimEventGenerator(detectorName);
+
+ Driver fast = new MCFast();
+ fast.setHistogramLevel(1);
+
+ LCIODriver writer = new LCIODriver("mcfastgenerator.slcio");
+
+ LCSimLoop loop = new LCSimLoop();
+ loop.setRecordSource(gen);
+ loop.add(fast);
+ loop.add(writer);
+ loop.loop(100);
+ loop.dispose();
+
+ AIDA.defaultInstance().saveAs("fastmcgenerator.aida");
+ }
+}
CVSspam 0.2.8