LISTSERV mailing list manager LISTSERV 16.5

Help for HPS-SVN Archives


HPS-SVN Archives

HPS-SVN Archives


HPS-SVN@LISTSERV.SLAC.STANFORD.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

HPS-SVN Home

HPS-SVN Home

HPS-SVN  October 2014

HPS-SVN October 2014

Subject:

r1375 - /java/branches/hps_java_trunk_HPSJAVA-255/integration-tests/src/test/java/org/hps/MCFilteredReconTest.java

From:

[log in to unmask]

Reply-To:

Notification of commits to the hps svn repository <[log in to unmask]>

Date:

Sat, 1 Nov 2014 01:02:51 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (139 lines)

Author: [log in to unmask]
Date: Fri Oct 31 18:02:49 2014
New Revision: 1375

Log:
Fix up failing test.  Use different input file.

Modified:
    java/branches/hps_java_trunk_HPSJAVA-255/integration-tests/src/test/java/org/hps/MCFilteredReconTest.java

Modified: java/branches/hps_java_trunk_HPSJAVA-255/integration-tests/src/test/java/org/hps/MCFilteredReconTest.java
 =============================================================================
--- java/branches/hps_java_trunk_HPSJAVA-255/integration-tests/src/test/java/org/hps/MCFilteredReconTest.java	(original)
+++ java/branches/hps_java_trunk_HPSJAVA-255/integration-tests/src/test/java/org/hps/MCFilteredReconTest.java	Fri Oct 31 18:02:49 2014
@@ -1,17 +1,17 @@
 package org.hps;
 
 import java.io.File;
-import java.io.IOException;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.List;
 
 import junit.framework.TestCase;
 
+import org.hps.readout.ecal.FADCEcalReadoutDriver;
 import org.hps.users.meeg.FilterMCBunches;
 import org.lcsim.job.JobControlManager;
+import org.lcsim.util.Driver;
 import org.lcsim.util.cache.FileCache;
-import org.lcsim.util.loop.LCSimLoop;
 import org.lcsim.util.test.TestUtil.TestOutputFile;
 
 /**
@@ -19,22 +19,25 @@
  * Insert empty events into an input MC file using <code>FilterMCBunches</code> 
  * and then run the resulting output through the readout simulation and reconstruction.
  * <p>
- * The original name of the MC input file was:
- * <p>
- * ap075mev_egs_tri_2.2gev_0.00125x0_200na_5e5b_30mr_001_SLIC-v04-00-00_Geant4-v10-00-02_QGSP_BERT_HPS-Proposal2014-v8-2pt2.slcio
- * <p>
  * See this wiki page:
  * <p>
  * <a href="https://confluence.slac.stanford.edu/display/hpsg/Running+Readout+Simulation">Running Readout Simulation</a>
  * <p>
  * under "Filter and space out events" for details about inserting empty events.
+ * <p>
+ * The test runs the filtering on 10 Aprime events, inserting 250 empty events in between in order to simulate a single readout window.
+ * Then the filtered events are run through the readout simulation to run the triggering algorithms.  The acceptance is approximately 20%
+ * so the 10 input events ends up as 2 events in the recon.
  * 
  * @author Jeremy McCormick <[log in to unmask]>
  */
+// TODO: Remove noise from readout simulation Driver and add test assertions.
 public class MCFilteredReconTest extends TestCase {
+        
+    final static String fileLocation = 
+    		"http://www.lcsim.org/test/hps-java/MCFilteredReconTest/ap2.2gev075mev_SLIC-v04-00-00_Geant4-v10-00-02_QGSP_BERT_HPS-Proposal2014-v7-2pt2.slcio";
     
-    final static String fileLocation = "http://www.lcsim.org/test/hps-java/MCFilteredReconTest.slcio"; 
-    
+    // 250 bunches which is ~250 ns or time of readout window.  
     static final Integer EMPTY_EVENTS = 250;
     
     public void testMCFilteredRecon() throws Exception {
@@ -46,10 +49,7 @@
         System.out.println("Downloading MC input file ...");
         FileCache cache = new FileCache();
         File inputFile = cache.getCachedFile(new URL(fileLocation));
-        
-        // Get the number of events in the MC input file.
-        long nMC = countEvents(inputFile);
-        
+                
         // 1) Filter MC events to insert 250 empty events between Aprime events.
         List<String> args = new ArrayList<String>();
         args.add(inputFile.getPath());
@@ -61,22 +61,22 @@
         System.out.println("Running FilterMCBunches.main on " + inputFile.getPath() + " with ");
         FilterMCBunches.main(args.toArray(new String[]{}));
         System.out.print("Created filtered MC file " + filteredOutputFile.getPath());
-        
-        // Get number of events in filtered output file.
-        long nFiltered = countEvents(filteredOutputFile);
-        
+                
         // 2) Run readout simulation.
         JobControlManager job = new JobControlManager();        
         File readoutOutputFile = new TestOutputFile(this.getClass().getSimpleName() + File.separator + this.getClass().getSimpleName() + "_readout");
         job.addVariableDefinition("outputFile", readoutOutputFile.getPath());
         job.addInputFile(filteredOutputFile);
         job.setup("/org/hps/steering/readout/HPS2014ReadoutToLcio.lcsim");
+        for (Driver driver : job.getDriverAdapter().getDriver().drivers()) {
+        	if (driver instanceof FADCEcalReadoutDriver) {
+        		// Turn off noise in the readout driver.
+        		((FADCEcalReadoutDriver)driver).setAddNoise(false);
+        	}
+        }
         job.run();                
         System.out.println("Created readout file " + readoutOutputFile.getPath());
-        
-        // Get number of events created by readout simulation.
-        long nReadout = countEvents(new File(readoutOutputFile.getPath() + ".slcio"));
-        
+                
         // 3) Run readout events through reconstruction.
         File reconOutputFile = new TestOutputFile(this.getClass().getSimpleName() + File.separator + this.getClass().getSimpleName() + "_recon");
         job = new JobControlManager();
@@ -85,26 +85,8 @@
         job.setup("/org/hps/steering/recon/HPS2014OfflineTruthRecon.lcsim");
         System.out.println("Running recon on filtered events ...");
         job.run();        
-        long nRecon = job.getLCSimLoop().getTotalSupplied();
         System.out.println("Created recon file " + reconOutputFile.getPath() + ".slcio");
         
-        System.out.println("---------------------------------------------------");
-        System.out.println("Job summary ...");
-        System.out.println("  MC input events: " + nMC);
-        System.out.println("  filtered output events: " + nFiltered);
-        System.out.println("  readout output events: " + nReadout);
-        System.out.println("  recon output events: " + nRecon);
-        System.out.println("  nRecon / nMC = " + (double)nRecon / (double)nMC);
-        System.out.println("---------------------------------------------------");
-        System.out.println();
-        System.out.println("Done!");        
-    }
-    
-    public long countEvents(File file) throws IOException {
-        LCSimLoop loop = new LCSimLoop();
-        loop.setLCIORecordSource(file);
-        loop.loop(-1, null);
-        return loop.getTotalSupplied();
-    }
-
+        System.out.println("Created " + job.getLCSimLoop().getTotalSupplied() + " recon output events.");
+    }    
 }

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

November 2017
August 2017
July 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013

ATOM RSS1 RSS2



LISTSERV.SLAC.STANFORD.EDU

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager

Privacy Notice, Security Notice and Terms of Use