Author: [log in to unmask] Date: Sun Mar 29 08:52:15 2015 New Revision: 2618 Log: Update the detector model to the latest. Change the default run number to 2000. Switch to using a logger. Modified: java/trunk/evio/src/test/java/org/hps/evio/SvtEvioReaderTest.java Modified: java/trunk/evio/src/test/java/org/hps/evio/SvtEvioReaderTest.java ============================================================================= --- java/trunk/evio/src/test/java/org/hps/evio/SvtEvioReaderTest.java (original) +++ java/trunk/evio/src/test/java/org/hps/evio/SvtEvioReaderTest.java Sun Mar 29 08:52:15 2015 @@ -4,19 +4,33 @@ import java.io.File; import java.net.URL; +import java.util.logging.Level; +import java.util.logging.Logger; import org.jlab.coda.jevio.EvioReader; import org.jlab.coda.jevio.EvioEvent; import org.lcsim.event.EventHeader; import org.lcsim.util.cache.FileCache; +import org.lcsim.util.log.DefaultLogFormatter; +import org.lcsim.util.log.LogUtil; import org.hps.record.evio.EvioEventUtilities; import org.hps.record.LCSimEventBuilder; -import org.hps.conditions.database.DatabaseConditionsManager; +import org.hps.conditions.database.DatabaseConditionsManager; +/** + * Test used to check the EVIO reader that will be used for the engineering + * run. + * + * @author Omar Moreno <[log in to unmask]> + */ public class SvtEvioReaderTest extends TestCase { + // Initialize the logger + protected static Logger logger = LogUtil.create(AbstractSvtEvioReader.class.getName(), + new DefaultLogFormatter(), Level.INFO); + public void testSvtEvioReaderTest() throws Exception { // Get the EVIO file that will be used to test the reader @@ -24,7 +38,7 @@ File evioFile = fileCache.getCachedFile( new URL("http://www.lcsim.org/test/hps-java/svt_evio_reader_test.evio")); - System.out.println("[ " + this.getClass().getSimpleName() + " ]: Opening file " + evioFile); + logger.info("Opening file " + evioFile); // Instantiate the EVIO reader and open the file EvioReader evioReader = new EvioReader(evioFile); @@ -34,15 +48,14 @@ // Setup the database conditions DatabaseConditionsManager conditionsManager = DatabaseConditionsManager.getInstance(); - conditionsManager.setDetector("HPS-Proposal2014-v8-2pt2", 0); + conditionsManager.setDetector("HPS-Proposal2014-v9-2pt2", 2000); // Instantiate the event builder LCSimEventBuilder eventBuilder = new LCSimEngRunEventBuilder(); // Check that the file contains the expected number of events int eventCount = evioReader.getEventCount(); - System.out.println("[ " + this.getClass().getSimpleName() + " ]: File " + evioFile - + " contains " + eventCount + " events."); + logger.info("File " + evioFile + " contains " + eventCount + " events."); // Loop through the EVIO events and process them. @@ -52,10 +65,10 @@ // Only process physics events if (!EvioEventUtilities.isPhysicsEvent(evioEvent)) continue; - System.out.println("[ " + this.getClass().getSimpleName() + " ]: Found physics event."); + logger.info("Found physics event."); EventHeader lcsimEvent = eventBuilder.makeLCSimEvent(evioEvent); - System.out.println("[ " + this.getClass().getSimpleName() + " ]: Created LCSim event # " + lcsimEvent.getEventNumber()); + logger.info("Created LCSim event # " + lcsimEvent.getEventNumber()); // Process the event using the SVT evio reader svtReader.processEvent(evioEvent, lcsimEvent);