Author: [log in to unmask] Date: Wed Jan 14 12:23:02 2015 New Revision: 1930 Log: Remove setting of detector and run on the event builder. This comes from the conditions system now. Modified: java/trunk/evio/src/main/java/org/hps/evio/DummyEventBuilder.java java/trunk/evio/src/main/java/org/hps/evio/LCSimTestRunEventBuilder.java java/trunk/evio/src/test/java/org/hps/evio/LCSimEngRunEventBuilderTest.java java/trunk/evio/src/test/java/org/hps/evio/LCSimTestRunEventBuilderTest.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/MonitoringApplication.java java/trunk/record-util/src/main/java/org/hps/record/LCSimEventBuilder.java java/trunk/record-util/src/main/java/org/hps/record/composite/CompositeLoop.java Modified: java/trunk/evio/src/main/java/org/hps/evio/DummyEventBuilder.java ============================================================================= --- java/trunk/evio/src/main/java/org/hps/evio/DummyEventBuilder.java (original) +++ java/trunk/evio/src/main/java/org/hps/evio/DummyEventBuilder.java Wed Jan 14 12:23:02 2015 @@ -38,14 +38,10 @@ } @Override - public void setDetectorName(String detectorName) { - } - - @Override public void readEvioEvent(EvioEvent evioEvent) { } @Override public void conditionsChanged(ConditionsEvent conditionsEvent) { - } + } } Modified: java/trunk/evio/src/main/java/org/hps/evio/LCSimTestRunEventBuilder.java ============================================================================= --- java/trunk/evio/src/main/java/org/hps/evio/LCSimTestRunEventBuilder.java (original) +++ java/trunk/evio/src/main/java/org/hps/evio/LCSimTestRunEventBuilder.java Wed Jan 14 12:23:02 2015 @@ -14,6 +14,7 @@ import org.jlab.coda.jevio.EvioEvent; import org.lcsim.conditions.ConditionsEvent; import org.lcsim.conditions.ConditionsListener; +import org.lcsim.conditions.ConditionsManager; import org.lcsim.event.EventHeader; import org.lcsim.event.base.BaseLCSimEvent; import org.lcsim.util.log.LogUtil; @@ -26,10 +27,8 @@ */ public class LCSimTestRunEventBuilder implements LCSimEventBuilder, ConditionsListener { - String detectorName = null; ECalEvioReader ecalReader = null; AbstractSvtEvioReader svtReader = null; - protected int run = 0; //current run number, taken from prestart and end events protected long time = 0; //most recent event time (ns), taken from prestart and end events, and trigger banks (if any) protected int sspCrateBankTag = 0x1; //bank ID of the crate containing the SSP protected int sspBankTag = 0xe106; //SSP bank's tag @@ -39,11 +38,6 @@ ecalReader = new ECalEvioReader(0x1, 0x2); svtReader = new TestRunSvtEvioReader(); logger.setLevel(Level.FINE); - } - - @Override - public void setDetectorName(String detectorName) { - this.detectorName = detectorName; } public void setEcalHitCollectionName(String ecalHitCollectionName) { @@ -61,7 +55,7 @@ if (data != null) { int seconds = data[0]; time = ((long) seconds) * 1000000000; - run = data[1]; + int run = data[1]; logger.info("Prestart event: time " + seconds + " - " + new Date(((long) seconds) * 1000) + ", run " + run + ", run type " + data[2]); } } else if (EvioEventUtilities.isGoEvent(evioEvent)) { @@ -80,7 +74,7 @@ int[] data = EvioEventUtilities.getControlEventData(evioEvent); int seconds = data[0]; time = ((long) seconds) * 1000000000; - run = 0; + //run = 0; logger.info("End event: time " + seconds + " - " + new Date(((long) seconds) * 1000) + ", event count " + data[2]); } } @@ -90,7 +84,7 @@ if (!EvioEventUtilities.isPhysicsEvent(evioEvent)) { throw new RuntimeException("Not a physics event: event tag " + evioEvent.getHeader().getTag()); } - + // Create a new LCSimEvent. EventHeader lcsimEvent = getEventData(evioEvent); @@ -121,10 +115,10 @@ for (BaseStructure bank : evioEvent.getChildren()) { if (bank.getHeader().getTag() == EvioEventConstants.EVENTID_BANK_TAG) { eventID = bank.getIntData(); - } + } } } - + if (eventID == null) { logger.warning("No event ID bank found"); eventID = new int[3]; @@ -145,7 +139,11 @@ } // Create a new LCSimEvent. - EventHeader lcsimEvent = new BaseLCSimEvent(run, eventID[0], detectorName, time); + EventHeader lcsimEvent = new BaseLCSimEvent( + ConditionsManager.defaultInstance().getRun(), + eventID[0], + ConditionsManager.defaultInstance().getDetector(), + time); lcsimEvent.put("TriggerBank", triggerList, TriggerData.class, 0); return lcsimEvent; Modified: java/trunk/evio/src/test/java/org/hps/evio/LCSimEngRunEventBuilderTest.java ============================================================================= --- java/trunk/evio/src/test/java/org/hps/evio/LCSimEngRunEventBuilderTest.java (original) +++ java/trunk/evio/src/test/java/org/hps/evio/LCSimEngRunEventBuilderTest.java Wed Jan 14 12:23:02 2015 @@ -44,7 +44,8 @@ // Create event builder. LCSimEventBuilder builder = new LCSimEngRunEventBuilder(); conditionsManager.addConditionsListener(builder); - builder.setDetectorName("HPS-Proposal2014-v8-6pt6"); + //builder.setDetectorName("HPS-Proposal2014-v8-6pt6"); + conditionsManager.setDetector("HPS-Proposal2014-v8-6pt6", 2744); // Get remote test file. FileCache cache = new FileCache(); Modified: java/trunk/evio/src/test/java/org/hps/evio/LCSimTestRunEventBuilderTest.java ============================================================================= --- java/trunk/evio/src/test/java/org/hps/evio/LCSimTestRunEventBuilderTest.java (original) +++ java/trunk/evio/src/test/java/org/hps/evio/LCSimTestRunEventBuilderTest.java Wed Jan 14 12:23:02 2015 @@ -27,22 +27,19 @@ //-----------------// private static final String DB_CONFIGURATION = "/org/hps/conditions/config/conditions_database_testrun_2012.xml"; - private static final String DETECTOR = "HPS-TestRun-v5"; - private static final int RUN_NUMBER = 1351; public void testLCSimTestRunEventBuilder() throws Exception { - // Configure the conditions system to retrieve test run conditions for - // run 1351 + // Configure the conditions system to retrieve test run conditions fo run 1351. DatabaseConditionsManager conditionsManager = new DatabaseConditionsManager(); conditionsManager.setXmlConfig(DB_CONFIGURATION); - //conditionsManager.setDetector(DETECTOR, RUN_NUMBER); - + // Create the test run event builder LCSimTestRunEventBuilder builder = new LCSimTestRunEventBuilder(); conditionsManager.addConditionsListener(builder); - builder.setDetectorName("HPS-TestRun-v5"); - + + conditionsManager.setDetector("HPS-TestRun-v5", 1351); + // Retrieve the remote test file. The file currently being contains a // subset of events from run 1351 FileCache cache = new FileCache(); Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/MonitoringApplication.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/MonitoringApplication.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/MonitoringApplication.java Wed Jan 14 12:23:02 2015 @@ -1183,7 +1183,7 @@ // Set the detector name on the event builder so it can find conditions data. // FIXME: This call should be made unnecessary by modifying the EventBuilder API to remove setDetectorName. - eventBuilder.setDetectorName(configurationModel.getDetectorName()); + //eventBuilder.setDetectorName(configurationModel.getDetectorName()); ConditionsManager.defaultInstance().addConditionsListener(eventBuilder); Modified: java/trunk/record-util/src/main/java/org/hps/record/LCSimEventBuilder.java ============================================================================= --- java/trunk/record-util/src/main/java/org/hps/record/LCSimEventBuilder.java (original) +++ java/trunk/record-util/src/main/java/org/hps/record/LCSimEventBuilder.java Wed Jan 14 12:23:02 2015 @@ -12,8 +12,9 @@ public interface LCSimEventBuilder extends ConditionsListener { /** - * Read information from an EVIO event to set the event builder's state. - * This does not actually build an LCSim event. + * Read information from an EVIO control event such as go or pre start + * to set the event builder's state. This does not actually build an + * LCSim event. * @param evioEvent The input EvioEvent. */ void readEvioEvent(EvioEvent evioEvent); @@ -24,10 +25,4 @@ * @return The LCSim event. */ EventHeader makeLCSimEvent(EvioEvent evioEvent); - - /** - * Set the detector to be used for LCSim conditions. - * @param detectorName The detector name. - */ - void setDetectorName(String detectorName); } Modified: java/trunk/record-util/src/main/java/org/hps/record/composite/CompositeLoop.java ============================================================================= --- java/trunk/record-util/src/main/java/org/hps/record/composite/CompositeLoop.java (original) +++ java/trunk/record-util/src/main/java/org/hps/record/composite/CompositeLoop.java Wed Jan 14 12:23:02 2015 @@ -296,7 +296,7 @@ if (!ConditionsManager.isSetup()) // Setup LCSim conditions system if not already. LCSimConditionsManagerImplementation.register(); - config.eventBuilder.setDetectorName(config.detectorName); + //config.eventBuilder.setDetectorName(config.detectorName); } else { throw new IllegalArgumentException("Missing detectorName in configuration."); }