Commit in hps-java/src/main/java/org/lcsim/hps/evio on MAIN | |||
LCSimTestRunEventBuilder.java | +13 | -82 | 1.11 -> 1.12 |
Put the SVT Evio reader in a seperate class
diff -u -r1.11 -r1.12 --- LCSimTestRunEventBuilder.java 22 Apr 2012 16:07:38 -0000 1.11 +++ LCSimTestRunEventBuilder.java 25 Apr 2012 05:02:21 -0000 1.12 @@ -1,11 +1,5 @@
package org.lcsim.hps.evio;
-import static org.lcsim.hps.evio.EventConstants.SVT_BANK_TAG; - -import java.util.ArrayList; -import java.util.List; - -import org.jlab.coda.jevio.BaseStructure;
import org.jlab.coda.jevio.EvioEvent; import org.lcsim.event.EventHeader; import org.lcsim.event.base.BaseLCSimEvent;
@@ -13,7 +7,6 @@
import org.lcsim.geometry.Subdetector; import org.lcsim.geometry.subdetector.HPSEcal3; import org.lcsim.geometry.subdetector.HPSTracker;
-import org.lcsim.hps.recon.tracking.HPSSVTData;
import org.lcsim.util.loop.LCSimConditionsManagerImplementation; /**
@@ -21,24 +14,27 @@
* * @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.12 2012/04/25 05:02:21 omoreno Exp $
*/ public class LCSimTestRunEventBuilder implements LCSimEventBuilder { // Names of subdetectors. private String trackerName;
- // Names of raw data collections with default settings. - private String svtDataCollectionName = "SVTData";
+
// 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();
} public void setEcalMode(int ecalMode) {
@@ -57,7 +53,6 @@
for (Subdetector subdet : detector.getSubdetectorList()) { if (subdet instanceof HPSTracker) { trackerName = subdet.getName();
- //System.out.println("trackerName = " + trackerName);
} else if (subdet instanceof HPSEcal3) { ecalReader.setEcalName(subdet.getName()); //System.out.println("calorimeterName = " + calorimeterName);
@@ -74,10 +69,6 @@
ecalReader.setHitCollectionName(ecalHitCollectionName); }
- public void setSvtDataCollectionName(String svtDataCollectionName) { - this.svtDataCollectionName = svtDataCollectionName; - } -
public void setTrackerName(String trackerName) { this.trackerName = trackerName; }
@@ -95,78 +86,18 @@
} public EventHeader makeLCSimEvent(EvioEvent evioEvent) {
- if (debug) { - System.out.println("Read EVIO event number " + evioEvent.getHeader().getNumber()); - }
+ + if (debug) System.out.println("Read EVIO event number " + evioEvent.getHeader().getNumber()); +
// Create a new LCSimEvent. EventHeader lcsimEvent = new BaseLCSimEvent(0, evioEvent.getHeader().getNumber(), detector.getDetectorName()); // Make RawCalorimeterHit collection, combining top and bottom section of ECal into one list. ecalReader.makeHits(evioEvent, lcsimEvent);
- - // Make SVT data. - List<HPSSVTData> svtData = makeSVTData(evioEvent); - lcsimEvent.put(svtDataCollectionName, svtData, HPSSVTData.class, 0);
+ + // Make SVT RawTrackerHits + svtReader.makeHits(evioEvent, lcsimEvent);
return lcsimEvent; }
- - private List<HPSSVTData> makeSVTData(EvioEvent event) { - List<HPSSVTData> svtDataCollection = new ArrayList<HPSSVTData>(); - for (BaseStructure crateBank : event.getChildren()) { - int crateTag = crateBank.getHeader().getTag(); - if (crateTag == SVT_BANK_TAG) { - if (crateBank.getChildCount() == 0) { - throw new RuntimeException("No children found in SVT bank."); - } - for (BaseStructure frameBank : crateBank.getChildren()) { - - if (frameBank.getHeader().getTag() == 7) { - //System.out.println("skipping FPGA 7 temp bank"); - continue; - } - - int[] intData = frameBank.getIntData(); - //System.out.println("intData.len = " + intData.length); - if (intData.length % 4 != 0) { - throw new RuntimeException("Size of int array not divisible by 4!"); - } - int n = intData.length; - for (int i = 0; i < n; i += 4) { - - int[] sampleData = new int[4]; - sampleData[0] = intData[i]; - sampleData[1] = intData[i + 1]; - sampleData[2] = intData[i + 2]; - sampleData[3] = intData[i + 3]; - - HPSSVTData svtData = new HPSSVTData(sampleData); - - 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); } - */ - } - } - } - } - return svtDataCollection; - }
}
\ No newline at end of file
Use REPLY-ALL to reply to list
To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1