12 modified files
hps-java/src/main/java/org/lcsim/hps/evio
diff -u -r1.1 -r1.2
--- MCEventBuilder.java 3 Apr 2012 18:36:48 -0000 1.1
+++ MCEventBuilder.java 26 Apr 2012 21:16:50 -0000 1.2
@@ -275,5 +275,10 @@
hits.add(new BaseRawCalorimeterHit(id, amplitude, timestamp));
}
return hits;
- }
+ }
+
+ @Override
+ public boolean isPhysicsEvent(EvioEvent evioEvent) {
+ return true;
+ }
}
\ No newline at end of file
hps-java/src/main/java/org/lcsim/hps/evio
diff -u -r1.12 -r1.13
--- LCSimTestRunEventBuilder.java 25 Apr 2012 05:02:21 -0000 1.12
+++ LCSimTestRunEventBuilder.java 26 Apr 2012 21:16:50 -0000 1.13
@@ -1,6 +1,8 @@
package org.lcsim.hps.evio;
+import org.jlab.coda.jevio.BaseStructure;
import org.jlab.coda.jevio.EvioEvent;
+import org.jlab.coda.jevio.EvioException;
import org.lcsim.event.EventHeader;
import org.lcsim.event.base.BaseLCSimEvent;
import org.lcsim.geometry.Detector;
@@ -14,25 +16,23 @@
*
* @author Sho Uemura <[log in to unmask]>
* @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: LCSimTestRunEventBuilder.java,v 1.12 2012/04/25 05:02:21 omoreno Exp $
+ * @version $Id: LCSimTestRunEventBuilder.java,v 1.12 2012/04/25 05:02:21
+ * omoreno Exp $
*/
public class LCSimTestRunEventBuilder implements LCSimEventBuilder {
// Names of subdetectors.
private String trackerName;
-
// Detector conditions object.
private Detector detector;
-
// Debug flag.
private boolean debug = false;
-
ECalEvioReader ecalReader = null;
SVTEvioReader svtReader = null;
public LCSimTestRunEventBuilder() {
LCSimConditionsManagerImplementation.register();
-
+
ecalReader = new ECalEvioReader();
svtReader = new SVTEvioReader();
}
@@ -85,19 +85,40 @@
return detector;
}
- public EventHeader makeLCSimEvent(EvioEvent evioEvent) {
-
- if (debug) System.out.println("Read EVIO event number " + evioEvent.getHeader().getNumber());
-
+ public EventHeader makeLCSimEvent(EvioEvent evioEvent) throws EvioException {
+ if (!isPhysicsEvent(evioEvent)) {
+ throw new EvioException("Not a physics event: event tag " + evioEvent.getHeader().getTag());
+ }
+
+ int[] eventID = {0, 0, 0};
+ //array of length 3: {event number, trigger code, readout status}
+ if (evioEvent.getChildCount() > 0) {
+ for (BaseStructure bank : evioEvent.getChildren()) {
+ if (bank.getHeader().getTag() == EventConstants.EVENTID_BANK_TAG) {
+ eventID = bank.getIntData();
+ }
+ }
+ }
+
+ if (debug) {
+ System.out.println("Read EVIO event number " + eventID[0]);
+ }
+
+
// Create a new LCSimEvent.
- EventHeader lcsimEvent = new BaseLCSimEvent(0, evioEvent.getHeader().getNumber(), detector.getDetectorName());
+ EventHeader lcsimEvent = new BaseLCSimEvent(0, eventID[0], detector.getDetectorName());
// Make RawCalorimeterHit collection, combining top and bottom section of ECal into one list.
ecalReader.makeHits(evioEvent, lcsimEvent);
-
+
// Make SVT RawTrackerHits
svtReader.makeHits(evioEvent, lcsimEvent);
return lcsimEvent;
}
+
+ @Override
+ public boolean isPhysicsEvent(EvioEvent evioEvent) {
+ return (evioEvent.getHeader().getTag() == EventConstants.PHYSICS_EVENT_TAG);
+ }
}
\ No newline at end of file
hps-java/src/main/java/org/lcsim/hps/evio
diff -u -r1.2 -r1.3
--- TestRunEvioToLcio.java 13 Apr 2012 00:05:37 -0000 1.2
+++ TestRunEvioToLcio.java 26 Apr 2012 21:16:50 -0000 1.3
@@ -21,131 +21,131 @@
* This class is for converting Test Run EVIO to LCIO events and performing an
* LCSim job in the same session. The processed events are then written to disk
* using an LCIOWriter.
- *
+ *
* To run this class from command line:
- *
- * TestRunEvioToLcio -e [evioFile] -l [lcioFile] -d [detectorName] -x [lcsimXmlFile]
- *
+ *
+ * TestRunEvioToLcio -e [evioFile] -l [lcioFile] -d [detectorName] -x
+ * [lcsimXmlFile]
+ *
* @author Jeremy McCormick <[log in to unmask]>
*/
public class TestRunEvioToLcio {
- /**
- * Defines command line options for this program.
- *
- * @return The command line options.
- */
- private static Options createCommandLineOptions() {
- Options options = new Options();
-
- Option evioFileOpt = new Option("e", true, "The input EVIO file containing Test Run data.");
- Option lcioFileOpt = new Option("l", true, "The name of the output LCIO file.");
- Option detectorNameOpt = new Option("d", true, "The name of the detector to use for LCSim conditions.");
- Option lcsimXmlOpt = new Option("x", true, "The LCSim XML file to process the LCIO events.");
-
- options.addOption(evioFileOpt);
- options.addOption(lcioFileOpt);
- options.addOption(detectorNameOpt);
- options.addOption(lcsimXmlOpt);
-
- return options;
- }
-
- /**
- * This method will execute the EVIO to LCIO conversion and perform an
- * intermediate LCSim job. Then the resultant LCIO events will be written to
- * disk.
- *
- * @param args The command line arguments.
- */
- public static void main(String[] args) {
-
- // Set up command line parsing.
- Options options = createCommandLineOptions();
- if (args.length == 0) {
- System.out.println("TestRunEvioToLcio [options]");
- HelpFormatter help = new HelpFormatter();
- help.printHelp(" ", options);
- System.exit(1);
- }
- CommandLineParser parser = new PosixParser();
-
- // Parse command line arguments.
- CommandLine cl = null;
- try {
- cl = parser.parse(options, args);
- }
- catch (ParseException e) {
- throw new RuntimeException("Problem parsing command line options.", e);
- }
-
- // EVIO input file.
- String evioFileName = cl.getOptionValue("e");
- File evioFile = new File(evioFileName);
-
- // LCIO output file.
- String lcioFileName = cl.getOptionValue("l");
- File lcioFile = new File(lcioFileName);
-
- // Name of detector.
- String detectorName = cl.getOptionValue("d");
-
- // LCSim XML file to execute inline.
- String lcsimXmlName = cl.getOptionValue("x");
- File lcsimXmlFile = new File(lcsimXmlName);
-
- // EVIO reader.
- EvioReader reader = null;
- try {
- reader = new EvioReader(evioFile);
- }
- catch (IOException e) {
- throw new RuntimeException(e);
- }
-
- // LCIO writer.
- LCIOWriter writer = null;
- try {
- writer = new LCIOWriter(lcioFile);
- }
- catch (IOException e) {
- throw new RuntimeException(e);
- }
-
- // LCSim job manager.
- JobControlManager jobManager = new JobControlManager();
- jobManager.setup(lcsimXmlFile);
- jobManager.configure();
-
- // LCSim event builder.
- LCSimEventBuilder eventBuilder = new LCSimTestRunEventBuilder();
- eventBuilder.setDetectorName(detectorName);
-
- // Loop over EVIO events, build LCSim events, process them, and then
- // write events to disk.
- while (true) {
- try {
- EvioEvent evioEvent = reader.parseNextEvent();
- EventHeader lcioEvent = eventBuilder.makeLCSimEvent(evioEvent);
- jobManager.processEvent(lcioEvent);
- writer.write(lcioEvent);
- if (reader.getNumEventsRemaining() == 0) {
- break;
- }
- }
- catch (EvioException e) {
- throw new RuntimeException(e);
- }
- catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
- jobManager.finish();
- try {
- writer.close();
- }
- catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
+ /**
+ * Defines command line options for this program.
+ *
+ * @return The command line options.
+ */
+ private static Options createCommandLineOptions() {
+ Options options = new Options();
+
+ Option evioFileOpt = new Option("e", true, "The input EVIO file containing Test Run data.");
+ Option lcioFileOpt = new Option("l", true, "The name of the output LCIO file.");
+ Option detectorNameOpt = new Option("d", true, "The name of the detector to use for LCSim conditions.");
+ Option lcsimXmlOpt = new Option("x", true, "The LCSim XML file to process the LCIO events.");
+
+ options.addOption(evioFileOpt);
+ options.addOption(lcioFileOpt);
+ options.addOption(detectorNameOpt);
+ options.addOption(lcsimXmlOpt);
+
+ return options;
+ }
+
+ /**
+ * This method will execute the EVIO to LCIO conversion and perform an
+ * intermediate LCSim job. Then the resultant LCIO events will be
+ * written to disk.
+ *
+ * @param args The command line arguments.
+ */
+ public static void main(String[] args) {
+
+ // Set up command line parsing.
+ Options options = createCommandLineOptions();
+ if (args.length == 0) {
+ System.out.println("TestRunEvioToLcio [options]");
+ HelpFormatter help = new HelpFormatter();
+ help.printHelp(" ", options);
+ System.exit(1);
+ }
+ CommandLineParser parser = new PosixParser();
+
+ // Parse command line arguments.
+ CommandLine cl = null;
+ try {
+ cl = parser.parse(options, args);
+ } catch (ParseException e) {
+ throw new RuntimeException("Problem parsing command line options.", e);
+ }
+
+ // EVIO input file.
+ String evioFileName = cl.getOptionValue("e");
+ File evioFile = new File(evioFileName);
+
+ // LCIO output file.
+ String lcioFileName = cl.getOptionValue("l");
+ File lcioFile = new File(lcioFileName);
+
+ // Name of detector.
+ String detectorName = cl.getOptionValue("d");
+
+ // LCSim XML file to execute inline.
+ String lcsimXmlName = cl.getOptionValue("x");
+ File lcsimXmlFile = new File(lcsimXmlName);
+
+ // EVIO reader.
+ EvioReader reader = null;
+ try {
+ reader = new EvioReader(evioFile);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+
+ // LCIO writer.
+ LCIOWriter writer = null;
+ try {
+ writer = new LCIOWriter(lcioFile);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+
+ // LCSim job manager.
+ JobControlManager jobManager = new JobControlManager();
+ jobManager.setup(lcsimXmlFile);
+ jobManager.configure();
+
+ // LCSim event builder.
+ LCSimEventBuilder eventBuilder = new LCSimTestRunEventBuilder();
+ eventBuilder.setDetectorName(detectorName);
+
+ // Loop over EVIO events, build LCSim events, process them, and then
+ // write events to disk.
+ while (true) {
+ EvioEvent evioEvent = null;
+ EventHeader lcioEvent = null;
+ try {
+ do {
+ evioEvent = reader.parseNextEvent();
+ } while (!eventBuilder.isPhysicsEvent(evioEvent));
+
+ lcioEvent = eventBuilder.makeLCSimEvent(evioEvent);
+ jobManager.processEvent(lcioEvent);
+ writer.write(lcioEvent);
+ if (reader.getNumEventsRemaining() == 0) {
+ break;
+ }
+ } catch (EvioException e) {
+ throw new RuntimeException(e);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ jobManager.finish();
+ try {
+ writer.close();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
}
\ No newline at end of file
hps-java/src/main/java/org/lcsim/hps/evio
diff -u -r1.1 -r1.2
--- EvioReader.java 22 Apr 2012 16:07:38 -0000 1.1
+++ EvioReader.java 26 Apr 2012 21:16:50 -0000 1.2
@@ -17,7 +17,8 @@
protected boolean debug = false;
protected String hitCollectionName = null;
- abstract void makeHits(EvioEvent event, EventHeader lcsimEvent);
+ //return true if appropriate EVIO bank found
+ abstract boolean makeHits(EvioEvent event, EventHeader lcsimEvent);
public void setHitCollectionName(String hitCollectionName) {
this.hitCollectionName = hitCollectionName;
hps-java/src/main/java/org/lcsim/hps/evio
diff -u -r1.3 -r1.4
--- LCSimEventBuilder.java 3 Apr 2012 18:36:48 -0000 1.3
+++ LCSimEventBuilder.java 26 Apr 2012 21:16:50 -0000 1.4
@@ -1,10 +1,12 @@
package org.lcsim.hps.evio;
import org.jlab.coda.jevio.EvioEvent;
+import org.jlab.coda.jevio.EvioException;
import org.lcsim.event.EventHeader;
public interface LCSimEventBuilder {
- EventHeader makeLCSimEvent(EvioEvent evioEvent);
+ EventHeader makeLCSimEvent(EvioEvent evioEvent) throws EvioException;
+ boolean isPhysicsEvent(EvioEvent evioEvent);
void setDetectorName(String detectorName);
void setDebug(boolean debug);
}
hps-java/src/main/java/org/lcsim/hps/evio
diff -u -r1.1 -r1.2
--- SVTEvioReader.java 25 Apr 2012 04:59:32 -0000 1.1
+++ SVTEvioReader.java 26 Apr 2012 21:16:50 -0000 1.2
@@ -21,7 +21,7 @@
/**
*
* @author Omar Moreno <[log in to unmask]>
- * @version $Id: SVTEvioReader.java,v 1.1 2012/04/25 04:59:32 omoreno Exp $
+ * @version $Id: SVTEvioReader.java,v 1.2 2012/04/26 21:16:50 meeg Exp $
*
*/
public class SVTEvioReader extends EvioReader {
@@ -41,13 +41,14 @@
/**
*
*/
- public void makeHits(EvioEvent event, EventHeader lcsimEvent)
+ public boolean makeHits(EvioEvent event, EventHeader lcsimEvent)
{
// Create a list of HPSSVTData
List<HPSSVTData> svtData = new ArrayList<HPSSVTData>();
- svtData.addAll(this.makeSVTData(event));
+ boolean foundBank = makeSVTData(event, svtData);
lcsimEvent.put(hitCollectionName, svtData, HPSSVTData.class, 0);
+ return foundBank;
}
/**
@@ -55,16 +56,15 @@
* @param event
* @return
*/
- public List<HPSSVTData> makeSVTData(EvioEvent event)
+ public boolean makeSVTData(EvioEvent event, List<HPSSVTData> svtDataCollection)
{
- // Create the HPSSVTData collection
- List<HPSSVTData> svtDataCollection = new ArrayList<HPSSVTData>();
-
+ boolean foundBank = false;
for(BaseStructure crateBank : event.getChildren()){
int crateTag = crateBank.getHeader().getTag();
// Process only events inside the SVT Bank
if(crateTag == SVT_BANK_TAG){
+ foundBank = true;
if(crateBank.getChildCount() == 0)
throw new RuntimeException("No children found in SVT bank!");
@@ -122,6 +122,6 @@
}
}
System.out.println("Adding SVTData Collection of Size " + svtDataCollection.size());
- return svtDataCollection;
+ return foundBank;
}
}
hps-java/src/main/java/org/lcsim/hps/evio
diff -u -r1.1 -r1.2
--- DummyEventBuilder.java 20 Apr 2012 18:47:19 -0000 1.1
+++ DummyEventBuilder.java 26 Apr 2012 21:16:50 -0000 1.2
@@ -11,7 +11,7 @@
/**
* @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: DummyEventBuilder.java,v 1.1 2012/04/20 18:47:19 jeremy Exp $
+ * @version $Id: DummyEventBuilder.java,v 1.2 2012/04/26 21:16:50 meeg Exp $
*/
public class DummyEventBuilder implements LCSimEventBuilder {
@@ -36,4 +36,9 @@
public void setDetectorName(String detectorName) {}
public void setDebug(boolean debug) {}
+
+ @Override
+ public boolean isPhysicsEvent(EvioEvent evioEvent) {
+ return true;
+ }
}
\ No newline at end of file
hps-java/src/main/java/org/lcsim/hps/evio
diff -u -r1.4 -r1.5
--- ECalEvioReader.java 22 Apr 2012 16:07:38 -0000 1.4
+++ ECalEvioReader.java 26 Apr 2012 21:16:50 -0000 1.5
@@ -17,7 +17,7 @@
/**
*
* @author Sho Uemura <[log in to unmask]>
- * @version $Id: ECalEvioReader.java,v 1.4 2012/04/22 16:07:38 meeg Exp $
+ * @version $Id: ECalEvioReader.java,v 1.5 2012/04/26 21:16:50 meeg Exp $
*/
public class ECalEvioReader extends EvioReader {
// Names of subdetectors.
@@ -59,12 +59,14 @@
}
@Override
- public void makeHits(EvioEvent event, EventHeader lcsimEvent) {
+ public boolean makeHits(EvioEvent event, EventHeader lcsimEvent) {
+ boolean foundHits = false;
if (ecalIDConverter == null) {
ecalIDConverter = new HPSEcalDaqIDConverter();
ecalIDConverter.fillDaqCellMap(lcsimEvent.getDetector().getSubdetector(ecalName));
}
List<Object> hits = new ArrayList<Object>();
+ hitClass = Object.class;
for (BaseStructure bank : event.getChildren()) {
BaseStructureHeader header = bank.getHeader();
int crateBankTag = header.getTag();
@@ -74,6 +76,7 @@
System.out.println("ECal bank tag: " + header.getTag() + "; childCount: " + bank.getChildCount());
}
for (BaseStructure slotBank : bank.getChildren()) {
+ foundHits = true;
CompositeData cdata = null;
try {
cdata = slotBank.getCompositeData();
@@ -81,18 +84,24 @@
throw new RuntimeException(e);
}
if (slotBank.getHeader().getTag() != bankTag) {
- throw new RuntimeException("Unsupported ECal format - bank tag " + slotBank.getHeader().getTag());
+ System.out.println("Unexpected ECal format - bank tag " + slotBank.getHeader().getTag());
}
- switch (mode) {
- case EventConstants.ECAL_WINDOW_MODE:
+ switch (slotBank.getHeader().getTag()) {
+ case EventConstants.ECAL_WINDOW_BANK_TAG:
hits.addAll(makeWindowHits(cdata, crateBankTag));
+ hitClass = RawTrackerHit.class;
break;
- case EventConstants.ECAL_PULSE_MODE:
+ case EventConstants.ECAL_PULSE_BANK_TAG:
hits.addAll(makePulseHits(cdata, crateBankTag));
+ hitClass = RawTrackerHit.class;
break;
- case EventConstants.ECAL_PULSE_INTEGRAL_MODE:
+ case EventConstants.ECAL_PULSE_INTEGRAL_BANK_TAG:
hits.addAll(makeIntegralHits(cdata, crateBankTag));
+ hitClass = RawCalorimeterHit.class;
break;
+ default:
+ throw new RuntimeException("Unsupported ECal format - bank tag " + slotBank.getHeader().getTag());
+
}
}
}
@@ -100,6 +109,7 @@
}
String readoutName = lcsimEvent.getDetector().getSubdetector(ecalName).getReadout().getName();
lcsimEvent.put(hitCollectionName, hits, hitClass, 0, readoutName);
+ return foundHits;
}
private List<BaseRawTrackerHit> makeWindowHits(CompositeData cdata, int bankTag) {
hps-java/src/main/java/org/lcsim/hps/evio
diff -u -r1.7 -r1.8
--- EventConstants.java 25 Apr 2012 05:00:38 -0000 1.7
+++ EventConstants.java 26 Apr 2012 21:16:50 -0000 1.8
@@ -3,7 +3,14 @@
public final class EventConstants {
//event type tag
- public static final int EVENT_TAG = 1;
+ public static final int PHYSICS_EVENT_TAG = 1;
+ public static final int SYNC_EVENT_TAG = 16;
+ public static final int PRESTART_EVENT_TAG = 17;
+ public static final int GO_EVENT_TAG = 18;
+ public static final int PAUSE_EVENT_TAG = 19;
+ public static final int END_EVENT_TAG = 20;
+ //event type tag
+ public static final int EVENTID_BANK_TAG = 0xC000;
// These correspond to ROC (readout crate) IDs from the DAQ.
// TODO Double check that these match the actual values.
public static final int ECAL_TOP_BANK_TAG = 0x1;
hps-java/src/main/java/org/lcsim/hps/evio
diff -u -r1.6 -r1.7
--- TestRunTriggeredReconToEvio.java 22 Apr 2012 16:07:38 -0000 1.6
+++ TestRunTriggeredReconToEvio.java 26 Apr 2012 21:16:50 -0000 1.7
@@ -103,7 +103,7 @@
protected void process(EventHeader event) {
if (triggerBit) {
// Make a new EVIO event.
- EventBuilder builder = new EventBuilder(EventConstants.EVENT_TAG, DataType.BANK, event.getEventNumber());
+ EventBuilder builder = new EventBuilder(EventConstants.PHYSICS_EVENT_TAG, DataType.BANK, event.getEventNumber());
builderQueue.add(new QueuedEtEvent(builder, writers.size()));
triggerBit = false;
}
hps-java/src/main/java/org/lcsim/hps/users/meeg
diff -u -r1.7 -r1.8
--- EvioFileReader.java 25 Apr 2012 03:57:49 -0000 1.7
+++ EvioFileReader.java 26 Apr 2012 21:16:50 -0000 1.8
@@ -5,6 +5,7 @@
import org.freehep.record.loop.event.RecordSuppliedEvent;
import org.jlab.coda.jevio.EvioEvent;
+import org.jlab.coda.jevio.EvioException;
import org.jlab.coda.jevio.EvioReader;
import org.lcsim.event.EventHeader;
import org.lcsim.hps.evio.EventConstants;
@@ -100,18 +101,19 @@
// Loop until event source is exhausted.
//int eventCount = 0;
- EvioEvent event = reader.parseNextEvent();
- while (event != null) {
- if (event.getHeader().getTag() != EventConstants.EVENT_TAG) {
- event = reader.parseNextEvent();
- continue;
- }
+ EvioEvent evioEvent = reader.parseNextEvent();
+ while (evioEvent != null) {
+ EventHeader lcsimEvent = null;
// Create LCSim event from EVIO data.
- EventHeader lcsimEvent = eventBuilder.makeLCSimEvent(event);
+
+ do {
+ evioEvent = reader.parseNextEvent();
+ } while (!eventBuilder.isPhysicsEvent(evioEvent));
+ lcsimEvent = eventBuilder.makeLCSimEvent(evioEvent);
// Supply record to Driver Adapter.
driverAdapter.recordSupplied(new RecordSuppliedEvent(new Object(), lcsimEvent));
- event = reader.parseNextEvent();
+ evioEvent = reader.parseNextEvent();
Thread.currentThread().sleep(delay);
}
// Cleanup.
hps-java/src/main/java/org/lcsim/hps/monitoring
diff -u -r1.25 -r1.26
--- MonitoringApplication.java 23 Apr 2012 21:05:11 -0000 1.25
+++ MonitoringApplication.java 26 Apr 2012 21:16:50 -0000 1.26
@@ -825,16 +825,20 @@
// Start of event GUI hook.
startEvent();
-
- // Create EvioEvent from EtEvent and skip if failed.
- EvioEvent evioEvent = createEvioEvent(mev);
-
- // Throw an error if EVIO event is null.
- if (evioEvent == null)
- throw new RuntimeException("Failed to create EVIO event.");
-
- // Create the LCSim event.
- EventHeader lcsimEvent = eventBuilder.makeLCSimEvent(evioEvent);
+ EvioEvent evioEvent = null;
+ EventHeader lcsimEvent = null;
+ do {
+ // Create EvioEvent from EtEvent and skip if failed.
+ evioEvent = createEvioEvent(mev);
+
+ // Throw an error if EVIO event is null.
+ if (evioEvent == null) {
+ throw new RuntimeException("Failed to create EVIO event.");
+ }
+ } while (!eventBuilder.isPhysicsEvent(evioEvent));
+
+ // Create the LCSim event.
+ lcsimEvent = eventBuilder.makeLCSimEvent(evioEvent);
// Throw an error if LCSim event is null.
if (lcsimEvent == null)
CVSspam 0.2.12