Author: phansson
Date: Thu Dec 11 11:34:48 2014
New Revision: 1693
Log:
Add 2014 detector track recon test.
Added:
java/trunk/integration-tests/src/test/java/org/hps/HPSTracker2014GeometryTrackReconTest.java
java/trunk/integration-tests/src/test/resources/org/hps/steering/test/HPSTestRunTrackingDefaults.lcsim
- copied unchanged from r1658, java/trunk/integration-tests/src/test/resources/org/hps/steering/test/SVTTrackingRecon.lcsim
java/trunk/integration-tests/src/test/resources/org/hps/steering/test/HPSTrackingDefaults.lcsim
Removed:
java/trunk/integration-tests/src/test/resources/org/hps/steering/test/SVTTrackingRecon.lcsim
Modified:
java/trunk/integration-tests/pom.xml
java/trunk/integration-tests/src/test/java/org/hps/HPSTestRunTracker2014GeometryTrackReconTest.java
Modified: java/trunk/integration-tests/pom.xml
=============================================================================
--- java/trunk/integration-tests/pom.xml (original)
+++ java/trunk/integration-tests/pom.xml Thu Dec 11 11:34:48 2014
@@ -31,6 +31,7 @@
<exclude>org/hps/EtSystemTest.java</exclude>
<exclude>org/hps/DataQualityMonitorTest.java</exclude>
<exclude>org/hps/HPSTestRunTracker2014GeometryTrackReconTest.java</exclude>
+ <exclude>org/hps/HPSTracker2014GeometryTrackReconTest.java</exclude>
<exclude>org/hps/MCFilteredReconTest.java</exclude>
<exclude>org/hps/ReadoutToEvioTest.java</exclude>
<exclude>org/hps/ReadoutToLcioTest.java</exclude>
Modified: java/trunk/integration-tests/src/test/java/org/hps/HPSTestRunTracker2014GeometryTrackReconTest.java
=============================================================================
--- java/trunk/integration-tests/src/test/java/org/hps/HPSTestRunTracker2014GeometryTrackReconTest.java (original)
+++ java/trunk/integration-tests/src/test/java/org/hps/HPSTestRunTracker2014GeometryTrackReconTest.java Thu Dec 11 11:34:48 2014
@@ -24,23 +24,14 @@
static final String fileLocationBottom = "http://www.lcsim.org/test/hps-java/HPSTestRunTracker2014GeometryTrackerRecon-bottom.slcio";
static final String fileLocationTop = "http://www.lcsim.org/test/hps-java/HPSTestRunTracker2014GeometryTrackerRecon-top.slcio";
- //static final String fileLocationBottom = "http://www.lcsim.org/test/hps-java/mu-_10GeV_SLIC-v04-00-00_Geant4-v10-00-02_QGSP_BERT_HPSTestRunTracker2014-v0-50-bottom-tracks.slcio";
- //static final String fileLocationTop = "http://www.lcsim.org/test/hps-java/mu-_10GeV_SLIC-v04-00-00_Geant4-v10-00-02_QGSP_BERT_HPSTestRunTracker2014-v0-50-top-tracks.slcio";
- //static final String fileLocationBottom = "http://www.lcsim.org/test/hps-java/HPSTestRunTracker2014GeometryTrackerRecon-bottom.slcio";
- //static final String fileLocationTop = "http://www.lcsim.org/test/hps-java/HPSTestRunTracker2014GeometryTrackerRecon-bottom.slcio";
- //static final String fileLocationBottom = "http://www.slac.stanford.edu/~phansson/files/temp/mu-_10GeV_SLIC-v04-00-00_Geant4-v10-00-02_QGSP_BERT_HPSTestRunTracker2014-v0-50-bottom-tracks.slcio";
- //static final String fileLocationTop = "http://www.slac.stanford.edu/~phansson/files/temp/mu-_10GeV_SLIC-v04-00-00_Geant4-v10-00-02_QGSP_BERT_HPSTestRunTracker2014-v0-50-top-tracks.slcio";
- //static final String fileLocation = "/Users/phansson/work/HPS/software/run/geomDev/mu-_10GeV_SLIC-v04-00-00_Geant4-v10-00-02_QGSP_BERT_HPSTestRunTracker2014-v0.slcio";
- //static final String fileLocation = "http://www.lcsim.org/test/hps-java/MockDataReconTest.slcio";
-
+
static final String className = HPSTestRunTracker2014GeometryTrackReconTest.class.getSimpleName();
static final File outputDir = new File("./target/test-output/" + className);
static final File outputFile = new File(outputDir.getAbsolutePath() + File.separator + className);
static final File reconFile = new File(outputFile.getAbsolutePath() + ".slcio");
static final File aidaFile = new File(outputFile.getAbsolutePath() + ".aida");
- static final String steeringResource = "/org/hps/steering/test/SVTTrackingRecon.lcsim";
- //static final String steeringResource = "/org/hps/steering/readout/HPSTrackingDefaults.lcsim";
+ static final String steeringResource = "/org/hps/steering/test/HPSTestRunTrackingDefaults.lcsim";
static final int expectedTracks = 50;
Added: java/trunk/integration-tests/src/test/java/org/hps/HPSTracker2014GeometryTrackReconTest.java
=============================================================================
--- java/trunk/integration-tests/src/test/java/org/hps/HPSTracker2014GeometryTrackReconTest.java (added)
+++ java/trunk/integration-tests/src/test/java/org/hps/HPSTracker2014GeometryTrackReconTest.java Thu Dec 11 11:34:48 2014
@@ -0,0 +1,156 @@
+package org.hps;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.hps.job.JobManager;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.ReconstructedParticle;
+import org.lcsim.event.Track;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+import org.lcsim.util.cache.FileCache;
+import org.lcsim.util.loop.LCSimLoop;
+
+/**
+ * This test runs the standard reconstruction on a small set of input events.
+ *
+ * @author Per Hansson Adrian <[log in to unmask]>
+ */
+public class HPSTracker2014GeometryTrackReconTest extends TestCase {
+
+ static final String fileLocationBottom = "http://www.lcsim.org/test/hps-java/mu-_10GeV_SLIC-v04-00-00_Geant4-v10-00-02_QGSP_BERT_HPSTracker2014-v0-bot-50k.slcio";
+ static final String fileLocationTop = "http://www.lcsim.org/test/hps-java/mu-_10GeV_SLIC-v04-00-00_Geant4-v10-00-02_QGSP_BERT_HPSTracker2014-v0-top-50k.slcio";
+
+ static final String className = HPSTracker2014GeometryTrackReconTest.class.getSimpleName();
+ static final File outputDir = new File("./target/test-output/" + className);
+ static final File outputFile = new File(outputDir.getAbsolutePath() + File.separator + className);
+ static final File reconFile = new File(outputFile.getAbsolutePath() + ".slcio");
+ static final File aidaFile = new File(outputFile.getAbsolutePath() + ".aida");
+
+ static final String steeringResource = "/org/hps/steering/test//HPSTrackingDefaults.lcsim";
+
+ static final int expectedTracks = 50;
+
+ static final String reconstructedParticleCollectionName = "MCParticle";
+ static final String trackCollectionName = "MatchedTracks";
+
+ AIDA aida = AIDA.defaultInstance();
+
+ public void setUp() {
+ clear();
+ }
+
+ private void clear() {
+ // Delete files if they already exist.
+ if (reconFile.exists())
+ reconFile.delete();
+ if (aidaFile.exists())
+ aidaFile.delete();
+
+ // Create output dir.
+ outputDir.mkdirs();
+ if (!outputDir.exists()) {
+ throw new RuntimeException("Failed to create test output dir.");
+ }
+ }
+
+ public void testTrackRecon() {
+ runTrackReconBottom();
+ checkOutput();
+ //checkPlots();
+ runTrackReconTop();
+ checkOutput();
+ //checkPlots();
+
+ }
+
+ private void runTrackReconBottom() {
+
+ //setup dirs and files
+ clear();
+
+ // Run the reconstruction over input events.
+ runRecon(fileLocationBottom);
+
+ }
+
+ private void runTrackReconTop() {
+
+ //setup dirs and files
+ clear();
+
+ // Run the reconstruction over input events.
+ runRecon(fileLocationTop);
+
+ }
+
+
+
+ private void runRecon(String fileLoc) {
+
+ System.out.println("caching file ...");
+ System.out.println(fileLoc);
+
+ File mockDataFile = null;
+ //File mockDataFile = new File(fileLocation);
+ try {
+ FileCache cache = new FileCache();
+ mockDataFile = cache.getCachedFile(new URL(fileLoc));
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+
+ System.out.println("running recon using steering resource " + steeringResource);
+ JobManager jobManager = new JobManager();
+ jobManager.addVariableDefinition("outputFile", outputFile.getPath());
+ jobManager.addInputFile(mockDataFile);
+ jobManager.setup(steeringResource);
+ jobManager.run();
+ }
+
+ private void checkOutput() {
+ System.out.println("check output file ...");
+ LCSimLoop loop = new LCSimLoop();
+ loop.add(new CheckDriver());
+ try {
+ loop.setLCIORecordSource(reconFile);
+ loop.loop(-1);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+
+ static class CheckDriver extends Driver {
+ int ntracks;
+ int nparticles;
+ int nevents;
+
+ public void process(EventHeader event) {
+ ++nevents;
+ ntracks += event.get(Track.class, trackCollectionName).size();
+ nparticles += event.get(ReconstructedParticle.class, reconstructedParticleCollectionName).size();
+ }
+
+ public void endOfData() {
+ System.out.println("CheckDriver got the following ...");
+ System.out.println(" nevents = " + nevents);
+ System.out.println(" ntracks = " + ntracks);
+ System.out.println(" nparticles = " + nparticles);
+ System.out.println(" <ntracks / nevents> = " + ((double)ntracks / (double)nevents));
+ System.out.println(" <nparticles / nevents> = " + ((double)nparticles / (double)nevents));
+
+ // check that there is one track per event
+ assertTrue("Failed to find expected number of tracks.",Math.abs(((double)ntracks / (double)nevents) - 1) < 0.000001);
+
+ System.out.println("CheckDriver compare to following ...");
+
+
+ }
+
+ }
+}
Added: java/trunk/integration-tests/src/test/resources/org/hps/steering/test/HPSTrackingDefaults.lcsim
=============================================================================
--- java/trunk/integration-tests/src/test/resources/org/hps/steering/test/HPSTrackingDefaults.lcsim (added)
+++ java/trunk/integration-tests/src/test/resources/org/hps/steering/test/HPSTrackingDefaults.lcsim Thu Dec 11 11:34:48 2014
@@ -0,0 +1,60 @@
+
+<lcsim xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+ xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/lcsim/1.0/lcsim.xsd">
+ <control>
+ <printInputFiles>false</printInputFiles>
+ <printDriversDetailed>false</printDriversDetailed>
+ </control>
+ <execute>
+ <driver name="EventMarkerDriver"/>
+ <driver name="SvtSensorSetup" />
+ <driver name="TrackerDigiDriver"/>
+ <driver name="HelicalTrackHitDriver"/>
+ <driver name="TrackerReconDriver"/>
+<!--
+ <driver name="SVTEventInfo"/>
+ <driver name="SVTHitReconstructionPlots"/>
+ <driver name="TrackingReconstructionPlots"/>
+-->
+ <driver name="LCIOWriter"/>
+ </execute>
+ <drivers>
+ <driver name="EventMarkerDriver" type="org.lcsim.job.EventMarkerDriver">
+ <eventInterval>1</eventInterval>
+ </driver>
+ <driver name="SvtSensorSetup" type="org.hps.recon.tracking.SvtSensorSetup" />
+ <driver name="TrackerDigiDriver" type="org.hps.recon.tracking.SimpleTrackerDigiDriver">
+<!-- <dropBadChannels>true</dropBadChannels>-->
+ <debug>false</debug>
+ </driver>
+ <driver name="HelicalTrackHitDriver" type="org.hps.recon.tracking.HelicalTrackHitDriver">
+ <debug>false</debug>
+ <maxSeperation>20.0</maxSeperation>
+ <tolerance>1.0</tolerance>
+ </driver>
+ <driver name="TrackerReconDriver" type="org.hps.recon.tracking.TrackerReconDriver">
+ <debug>false</debug>
+ <strategyResource>HPS-Full-All.xml</strategyResource>
+ </driver>
+ <driver name="LCIOWriter" type="org.lcsim.util.loop.LCIODriver">
+ <outputFilePath>${outputFile}</outputFilePath>
+ </driver>
+
+
+
+
+ <driver name="TrackingReconstructionPlots" type="org.hps.monitoring.drivers.svt.TrackingReconstructionPlots">
+ <outputPlots>TrackingReconstructionPlots.aida</outputPlots>
+ </driver>
+
+ <driver name="SVTHitReconstructionPlots" type="org.hps.monitoring.drivers.svt.SVTHitReconstructionPlots">
+ <outputPlots>SVTHitReconstructionPlots.aida</outputPlots>
+ </driver>
+
+ <driver name="SVTEventInfo" type="org.hps.monitoring.drivers.svt.SVTEventInfo">
+ </driver>
+
+
+
+ </drivers>
+</lcsim>
|