1 added + 4 modified, total 5 files
hps-java/src/main/java/org/lcsim/hps/evio
diff -N EvioReader.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ EvioReader.java 22 Apr 2012 16:07:38 -0000 1.1
@@ -0,0 +1,29 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.lcsim.hps.evio;
+
+import org.jlab.coda.jevio.EvioEvent;
+import org.lcsim.event.EventHeader;
+
+/**
+ *
+ * @author meeg
+ */
+public abstract class EvioReader {
+
+ // Debug flag.
+ protected boolean debug = false;
+ protected String hitCollectionName = null;
+
+ abstract void makeHits(EvioEvent event, EventHeader lcsimEvent);
+
+ public void setHitCollectionName(String hitCollectionName) {
+ this.hitCollectionName = hitCollectionName;
+ }
+
+ public void setDebug(boolean debug) {
+ this.debug = debug;
+ }
+}
hps-java/src/main/java/org/lcsim/hps/evio
diff -u -r1.10 -r1.11
--- LCSimTestRunEventBuilder.java 12 Apr 2012 19:00:30 -0000 1.10
+++ LCSimTestRunEventBuilder.java 22 Apr 2012 16:07:38 -0000 1.11
@@ -18,41 +18,37 @@
/**
* Build LCSim events from EVIO data.
+ *
* @author Sho Uemura <[log in to unmask]>
* @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: LCSimTestRunEventBuilder.java,v 1.10 2012/04/12 19:00:30 jeremy Exp $
+ * @version $Id: LCSimTestRunEventBuilder.java,v 1.10 2012/04/12 19:00:30 jeremy
+ * Exp $
*/
public class LCSimTestRunEventBuilder implements LCSimEventBuilder {
// Names of subdetectors.
private String trackerName;
- private String calorimeterName;
// Names of raw data collections with default settings.
- private String rawCalorimeterHitCollectionName = "EcalRawHits";
private String svtDataCollectionName = "SVTData";
// Detector conditions object.
private Detector detector;
// Debug flag.
private boolean debug = false;
ECalEvioReader ecalReader = null;
- private int ecalMode = EventConstants.ECAL_PULSE_INTEGRAL_MODE;
-
+
public LCSimTestRunEventBuilder() {
LCSimConditionsManagerImplementation.register();
+ ecalReader = new ECalEvioReader();
}
public void setEcalMode(int ecalMode) {
- this.ecalMode = ecalMode;
if (ecalMode != EventConstants.ECAL_WINDOW_MODE && ecalMode != EventConstants.ECAL_PULSE_MODE && ecalMode != EventConstants.ECAL_PULSE_INTEGRAL_MODE) {
throw new IllegalArgumentException("invalid mode " + ecalMode);
}
- if (ecalReader != null) {
- ecalReader.setMode(ecalMode);
- }
+ ecalReader.setMode(ecalMode);
}
public void setDetectorName(String detectorName) {
-
// Make a dummy event to setup the conditions system.
EventHeader dummyEvent = new BaseLCSimEvent(0, 0, detectorName);
detector = dummyEvent.getDetector();
@@ -63,7 +59,7 @@
trackerName = subdet.getName();
//System.out.println("trackerName = " + trackerName);
} else if (subdet instanceof HPSEcal3) {
- calorimeterName = subdet.getName();
+ ecalReader.setEcalName(subdet.getName());
//System.out.println("calorimeterName = " + calorimeterName);
}
}
@@ -71,26 +67,17 @@
public void setDebug(boolean debug) {
this.debug = debug;
- ecalReader = null;
+ ecalReader.setDebug(debug);
}
- public String getRawCalorimeterHitCollectionName() {
- return rawCalorimeterHitCollectionName;
- }
-
- public void setRawCalorimeterHitCollectionName(String rawCalorimeterHitCollectionName) {
- this.rawCalorimeterHitCollectionName = rawCalorimeterHitCollectionName;
- ecalReader = null;
+ public void setEcalHitCollectionName(String ecalHitCollectionName) {
+ ecalReader.setHitCollectionName(ecalHitCollectionName);
}
public void setSvtDataCollectionName(String svtDataCollectionName) {
this.svtDataCollectionName = svtDataCollectionName;
}
- public String getTrackerName() {
- return trackerName;
- }
-
public void setTrackerName(String trackerName) {
this.trackerName = trackerName;
}
@@ -99,17 +86,8 @@
return detector.getSubdetector(trackerName).getReadout().getName();
}
- public String getCalorimeterName() {
- return calorimeterName;
- }
-
- public void setCalorimeterName(String calorimeterName) {
- this.calorimeterName = calorimeterName;
- ecalReader = null;
- }
-
- public String getCalorimeterReadoutName() {
- return detector.getSubdetector(calorimeterName).getReadout().getName();
+ public void setEcalName(String ecalName) {
+ ecalReader.setEcalName(ecalName);
}
public Detector getDetector() {
@@ -123,16 +101,8 @@
// Create a new LCSimEvent.
EventHeader lcsimEvent = new BaseLCSimEvent(0, evioEvent.getHeader().getNumber(), detector.getDetectorName());
- if (ecalReader == null) {
- ecalReader = new ECalEvioReader();
- ecalReader.setEcalName(calorimeterName);
- ecalReader.setRawCalorimeterHitCollectionName(rawCalorimeterHitCollectionName);
- ecalReader.setMode(ecalMode);
- ecalReader.setDebug(debug);
- }
-
// Make RawCalorimeterHit collection, combining top and bottom section of ECal into one list.
- ecalReader.makeRawCalorimeterHits(evioEvent, lcsimEvent);
+ ecalReader.makeHits(evioEvent, lcsimEvent);
// Make SVT data.
List<HPSSVTData> svtData = makeSVTData(evioEvent);
@@ -175,16 +145,23 @@
svtDataCollection.add(svtData);
/*
- int fpga = svtData.getFPGAAddress();
- int hybrid = svtData.getHybridNumber();
- int channel = svtData.getChannelNumber();
- int apv = svtData.getAPVNumber();
-
- System.out.println("fpga=" + fpga + "; hybrid=" + hybrid + "; channel=" + channel + "; apv=" + apv);
- for (int j=0; j<6; j++) {
- int val = svtData.getSample(j);
- System.out.println(" sample[" + j + "]="+val);
- }
+ * int fpga =
+ * svtData.getFPGAAddress(); int
+ * hybrid =
+ * svtData.getHybridNumber();
+ * int channel =
+ * svtData.getChannelNumber();
+ * int apv =
+ * svtData.getAPVNumber();
+ *
+ * System.out.println("fpga=" +
+ * fpga + "; hybrid=" + hybrid +
+ * "; channel=" + channel + ";
+ * apv=" + apv); for (int j=0;
+ * j<6; j++) { int val =
+ * svtData.getSample(j);
+ * System.out.println(" sample["
+ * + j + "]="+val); }
*/
}
}
hps-java/src/main/java/org/lcsim/hps/evio
diff -u -r1.3 -r1.4
--- ECalEvioReader.java 10 Apr 2012 01:00:13 -0000 1.3
+++ ECalEvioReader.java 22 Apr 2012 16:07:38 -0000 1.4
@@ -4,31 +4,24 @@
*/
package org.lcsim.hps.evio;
-import org.lcsim.event.base.BaseRawCalorimeterHit;
-import org.jlab.coda.jevio.BaseStructureHeader;
-import org.jlab.coda.jevio.BaseStructure;
-import org.jlab.coda.jevio.EvioEvent;
-import org.jlab.coda.jevio.CompositeData;
import java.util.ArrayList;
import java.util.List;
-import org.jlab.coda.jevio.EvioException;
+import org.jlab.coda.jevio.*;
import org.lcsim.event.EventHeader;
import org.lcsim.event.RawCalorimeterHit;
import org.lcsim.event.RawTrackerHit;
+import org.lcsim.event.base.BaseRawCalorimeterHit;
import org.lcsim.event.base.BaseRawTrackerHit;
import org.lcsim.hps.recon.ecal.HPSEcalDaqIDConverter;
/**
*
* @author Sho Uemura <[log in to unmask]>
- * @version $Id: ECalEvioReader.java,v 1.3 2012/04/10 01:00:13 meeg Exp $
+ * @version $Id: ECalEvioReader.java,v 1.4 2012/04/22 16:07:38 meeg Exp $
*/
-public class ECalEvioReader {
+public class ECalEvioReader extends EvioReader {
// Names of subdetectors.
- // Debug flag.
- private boolean debug = false;
- private String rawCalorimeterHitCollectionName = "EcalReadoutHits";
private String ecalName = "Ecal";
private HPSEcalDaqIDConverter ecalIDConverter = null;
private int mode = EventConstants.ECAL_PULSE_INTEGRAL_MODE;
@@ -36,6 +29,7 @@
private Class hitClass = RawCalorimeterHit.class;
public ECalEvioReader() {
+ hitCollectionName = "EcalReadoutHits";
}
public void setEcalName(String ecalName) {
@@ -43,14 +37,6 @@
ecalIDConverter = null;
}
- public void setRawCalorimeterHitCollectionName(String rawCalorimeterHitCollectionName) {
- this.rawCalorimeterHitCollectionName = rawCalorimeterHitCollectionName;
- }
-
- public void setDebug(boolean debug) {
- this.debug = debug;
- }
-
public void setMode(int mode) {
this.mode = mode;
if (mode != EventConstants.ECAL_WINDOW_MODE && mode != EventConstants.ECAL_PULSE_MODE && mode != EventConstants.ECAL_PULSE_INTEGRAL_MODE) {
@@ -72,7 +58,8 @@
}
}
- public void makeRawCalorimeterHits(EvioEvent event, EventHeader lcsimEvent) {
+ @Override
+ public void makeHits(EvioEvent event, EventHeader lcsimEvent) {
if (ecalIDConverter == null) {
ecalIDConverter = new HPSEcalDaqIDConverter();
ecalIDConverter.fillDaqCellMap(lcsimEvent.getDetector().getSubdetector(ecalName));
@@ -112,7 +99,7 @@
}
}
String readoutName = lcsimEvent.getDetector().getSubdetector(ecalName).getReadout().getName();
- lcsimEvent.put(rawCalorimeterHitCollectionName, hits, hitClass, 0, readoutName);
+ lcsimEvent.put(hitCollectionName, hits, hitClass, 0, readoutName);
}
private List<BaseRawTrackerHit> makeWindowHits(CompositeData cdata, int bankTag) {
hps-java/src/main/java/org/lcsim/hps/evio
diff -u -r1.5 -r1.6
--- EventConstants.java 21 Apr 2012 07:47:46 -0000 1.5
+++ EventConstants.java 22 Apr 2012 16:07:38 -0000 1.6
@@ -1,37 +1,34 @@
package org.lcsim.hps.evio;
public final class EventConstants {
-
- // These correspond to ROC (readout crate) IDs from the DAQ.
- // TODO Double check that these match the actual values.
+
+ //event type tag
+ public static final int EVENT_TAG = 1;
+ // 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;
public static final int ECAL_BOTTOM_BANK_TAG = 0x2;
public static final int SVT_BANK_TAG = 0x3;
-
// These values are put into the number field of the banks.
// FIXME Bank numbers should actually be sequentially numbered and not hard-coded.
public static final int SVT_BANK_NUMBER = 1;
public static final int ECAL_BANK_NUMBER = 2;
-
- public static final int ECAL_WINDOW_MODE = 1;
- public static final int ECAL_PULSE_MODE = 2;
- public static final int ECAL_PULSE_INTEGRAL_MODE = 3;
-
+ public static final int ECAL_WINDOW_MODE = 1;
+ public static final int ECAL_PULSE_MODE = 2;
+ public static final int ECAL_PULSE_INTEGRAL_MODE = 3;
// The composite data format for window ecal data.
public static final String ECAL_WINDOW_FORMAT = "c,i,l,N(c,Ns)";
// The composite data format for pulse ecal data.
public static final String ECAL_PULSE_FORMAT = "c,i,l,N(c,N(c,Ns))";
// The composite data format for pulse integral ecal data.
public static final String ECAL_PULSE_INTEGRAL_FORMAT = "c,i,l,N(c,N(s,i))";
-
// The tag for ECal window data.
public static final int ECAL_WINDOW_BANK_TAG = 0xe101;
// The tag for ECal pulse data.
public static final int ECAL_PULSE_BANK_TAG = 0xe102;
// The tag for ECal pulse integral data.
public static final int ECAL_PULSE_INTEGRAL_BANK_TAG = 0xe103;
-
- // layer ID used for encoding of physical ID
+ // layer ID used for encoding of physical ID
public static final int ECAL_LAYER = 0;
public static final int SVT_TOTAL_NUMBER_FPGAS = 7;
hps-java/src/main/java/org/lcsim/hps/evio
diff -u -r1.5 -r1.6
--- TestRunTriggeredReconToEvio.java 7 Apr 2012 00:07:24 -0000 1.5
+++ TestRunTriggeredReconToEvio.java 22 Apr 2012 16:07:38 -0000 1.6
@@ -103,7 +103,7 @@
protected void process(EventHeader event) {
if (triggerBit) {
// Make a new EVIO event.
- EventBuilder builder = new EventBuilder(0, DataType.BANK, event.getEventNumber());
+ EventBuilder builder = new EventBuilder(EventConstants.EVENT_TAG, DataType.BANK, event.getEventNumber());
builderQueue.add(new QueuedEtEvent(builder, writers.size()));
triggerBit = false;
}
CVSspam 0.2.12