hps-java/src/test/java/org/lcsim
diff -u -r1.8 -r1.9
--- DoEvioTest.java 18 Feb 2012 16:49:18 -0000 1.8
+++ DoEvioTest.java 18 Feb 2012 23:13:34 -0000 1.9
@@ -1,15 +1,15 @@
package org.lcsim;
import junit.framework.TestCase;
-import java.nio.channels.FileChannel;
import org.jlab.coda.jevio.EvioFile;
import org.jlab.coda.jevio.IEvioListener;
import org.jlab.coda.jevio.EvioEvent;
import org.jlab.coda.jevio.BlockHeader;
import org.jlab.coda.jevio.EventParser;
-import org.lcsim.HPSTrackerSample;
-import org.lcsim.HPSTrackerEvent;
+//import org.lcsim.HPSTrackerSample;
+//import org.lcsim.HPSTrackerEvent;
+import org.lcsim.MapDAQCellID;
import org.lcsim.event.RawTrackerHit;
import org.lcsim.event.base.BaseRawTrackerHit;
import org.lcsim.detector.IDetectorElement;
@@ -18,45 +18,33 @@
import java.io.*;
import java.nio.*;
-import org.jlab.coda.jevio.ByteParser;
+//import org.jlab.coda.jevio.ByteParser;
import org.jlab.coda.jevio.IEvioStructure;
import org.jlab.coda.jevio.BaseStructureHeader;
import org.jlab.coda.jevio.EvioException;
import java.io.File;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
-import java.util.Map;
import java.util.Iterator;
-import java.util.Set;
-import java.util.logging.Logger;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.EventHeader.LCMetaData;
import org.lcsim.util.lcio.LCIOWriter;
-//import org.lcsim.util.lcio.LCIORunHeader;
-import org.lcsim.util.loop.LCIODriver;
import org.lcsim.event.base.BaseLCSimEvent;
-import java.util.HashMap;
-import java.util.Map;
import org.lcsim.HPSDetectorTag;
/**
* This is a test of using jevio routines to read EVIO files.
*
* @author homer
- * @version $Id: DoEvioTest.java,v 1.8 2012/02/18 16:49:18 homer Exp $
+ * @version $Id: DoEvioTest.java,v 1.9 2012/02/18 23:13:34 homer Exp $
*/
public class DoEvioTest extends TestCase {
private LCIOWriter writer;
BaseLCSimEvent newEvent;
int VERBOSE = 2;
+
/**
* The buffer representing a map of the input file.
*/
@@ -89,7 +77,11 @@
int ALSOTAGSEGMENT = (0x40);
final int TRACKERTAG = (600);
-// String fileName = "/mydat/neal/hps/cedExport/data/dvcs_5_500.ev";
+ // load the DAQ to LCSim cell maps
+final MapDAQCellID mapcell = new MapDAQCellID();
+ mapcell.fillSVTCellMap();
+
+ // String fileName = "/mydat/neal/hps/cedExport/data/dvcs_5_500.ev";
String fileName = "/mydat/myhpstest/hps_test_data_2011_nov_18_1.evio";
// String fileName = "/mydat/myhpstest/sample.dat";
// Tracker data file name for testing
@@ -186,6 +178,11 @@
if (VERBOSE > 3) {
System.out.println("got CellID");
}
+ int LCSimCellID_ = mapcell.SVTCellIDlookup(chanaddr);
+ if (VERBOSE > 3) {
+ System.out.println("got corresponding LCSim CellID = "+LCSimCellID_);
+ }
+
long chanapv = trksamp.apv();
if (VERBOSE > 3) {
System.out.println("got apv");
@@ -203,11 +200,11 @@
IDetectorElement detector_element = null;
if (VERBOSE > 2) {
- System.out.println("Creating raw_hit with channel,apv = " + chanaddr + " , " + chanapv + " and adc = " + chanadc[0]);
+ System.out.println("Creating raw_hit with channel,apv = " + LCSimCellID_ + " , " + chanapv + " and adc = " + chanadc[0]);
}
int time = 0; // need to find source of this
- RawTrackerHit raw_hit = new BaseRawTrackerHit(time, chanaddr, chanadc, sim_hits, detector_element);
+ RawTrackerHit raw_hit = new BaseRawTrackerHit(time, LCSimCellID_, chanadc, sim_hits, detector_element);
// Put hits onto readout and hit list
// ro.addHit(raw_hit);
raw_hits.add(raw_hit);
@@ -404,5 +401,7 @@
System.out.println(e);
}
// read events until eof reached
+ inputChannel.close();
+
}
}