Commit in hps-java/src/main/java/org/lcsim/hps on MAIN | |||
users/meeg/ECalCellIDPrintDriver.java | +80 | added 1.1 | |
/SVTCellIDPrintDriver.java | +67 | added 1.1 | |
/EvioFileReader.java | +1 | -1 | 1.9 -> 1.10 |
recon/tracking/HPSSVTRawTrackerHitMaker.java | +57 | -51 | 1.1 -> 1.2 |
/TrackerHitDriver.java | +2 | -2 | 1.3 -> 1.4 |
monitoring/EcalMonitoringPlots.java | +1 | -1 | 1.5 -> 1.6 |
/EcalWindowPlots.java | +1 | -1 | 1.3 -> 1.4 |
/EcalWindowPlotsXY.java | +1 | -1 | 1.2 -> 1.3 |
/EcalPedestalPlots.java | +1 | -1 | 1.2 -> 1.3 |
+211 | -58 |
changes to deal with real SVT data
diff -N ECalCellIDPrintDriver.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ ECalCellIDPrintDriver.java 27 Apr 2012 23:08:02 -0000 1.1 @@ -0,0 +1,80 @@
+package org.lcsim.hps.users.meeg; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.List; +import org.lcsim.event.EventHeader; +import org.lcsim.event.RawCalorimeterHit; +import org.lcsim.event.RawTrackerHit; +import org.lcsim.geometry.Detector; +import org.lcsim.geometry.IDDecoder; +import org.lcsim.geometry.Subdetector; +import org.lcsim.util.Driver; + +/** + * + * @author Sho Uemura <[log in to unmask]> + * @version $Id: ECalCellIDPrintDriver.java,v 1.1 2012/04/27 23:08:02 meeg Exp $ + */ +public class ECalCellIDPrintDriver extends Driver { + + Subdetector ecal; + IDDecoder dec; + String ecalName = "Ecal"; + String ecalCollectionName = "EcalReadoutHits"; + String outputFileName; + PrintWriter outputStream = null; + + public ECalCellIDPrintDriver() { + } + + public void setEcalCollectionName(String ecalCollectionName) { + this.ecalCollectionName = ecalCollectionName; + } + + public void setEcalName(String ecalName) { + this.ecalName = ecalName; + } + + public void setOutputFileName(String outputFileName) { + this.outputFileName = outputFileName; + } + + public void startOfData() { + if (outputFileName != null) { + try { + outputStream = new PrintWriter(outputFileName); + } catch (IOException ex) { + throw new RuntimeException("Invalid outputFilePath!"); + } + } else { + outputStream = new PrintWriter(System.out, true); + } + } + + public void detectorChanged(Detector detector) { + // Get the Subdetector. + ecal = (Subdetector) detector.getSubdetector(ecalName); + dec = ecal.getIDDecoder(); + } + + public void process(EventHeader event) { + // Get the list of ECal hits. + if (event.hasCollection(RawCalorimeterHit.class, ecalCollectionName)) { + List<RawCalorimeterHit> hits = event.get(RawCalorimeterHit.class, ecalCollectionName); + //outputStream.println("Reading RawCalorimeterHit from event " + event.getEventNumber()); + for (RawCalorimeterHit hit : hits) { + dec.setID(hit.getCellID()); + outputStream.printf("x=%d\ty=%d\n", dec.getValue("ix"), dec.getValue("iy")); + } + } + if (event.hasCollection(RawTrackerHit.class, ecalCollectionName)) { + List<RawTrackerHit> hits = event.get(RawTrackerHit.class, ecalCollectionName); + //outputStream.println("Reading RawCalorimeterHit from event " + event.getEventNumber()); + for (RawTrackerHit hit : hits) { + dec.setID(hit.getCellID()); + outputStream.printf("x=%d\ty=%d\n", dec.getValue("ix"), dec.getValue("iy")); + } + } + } +}
\ No newline at end of file
diff -N SVTCellIDPrintDriver.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ SVTCellIDPrintDriver.java 27 Apr 2012 23:08:02 -0000 1.1 @@ -0,0 +1,67 @@
+package org.lcsim.hps.users.meeg; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.List; +import org.lcsim.event.EventHeader; +import org.lcsim.event.RawTrackerHit; +import org.lcsim.hps.recon.tracking.HPSSVTData; +import org.lcsim.util.Driver; + +/** + * + * @author Sho Uemura <[log in to unmask]> + * @version $Id: HPSEcalDigitalPrintDriver.java,v 1.5 2012/04/27 22:13:52 meeg + * Exp $ + */ +public class SVTCellIDPrintDriver extends Driver { + + String rawTrackerHitCollectionName = "SVTData"; + String outputFileName; + PrintWriter outputStream = null; + + public SVTCellIDPrintDriver() { + } + + public void setRawTrackerHitCollectionName(String rawTrackerHitCollectionName) { + this.rawTrackerHitCollectionName = rawTrackerHitCollectionName; + } + + public void setOutputFileName(String outputFileName) { + this.outputFileName = outputFileName; + } + + public void startOfData() { + if (rawTrackerHitCollectionName == null) { + throw new RuntimeException("The parameter ecalCollectionName was not set!"); + } + + if (outputFileName != null) { + try { + outputStream = new PrintWriter(outputFileName); + } catch (IOException ex) { + throw new RuntimeException("Invalid outputFilePath!"); + } + } else { + outputStream = new PrintWriter(System.out, true); + } + } + + public void process(EventHeader event) { + // Get the list of ECal hits. + if (event.hasCollection(HPSSVTData.class, rawTrackerHitCollectionName)) { + List<HPSSVTData> hits = event.get(HPSSVTData.class, rawTrackerHitCollectionName); + //outputStream.println("Reading RawCalorimeterHit from event " + event.getEventNumber()); + for (HPSSVTData hit : hits) { + outputStream.printf("FPGA=%d\thybrid=%d\tchannel=%d\n", hit.getFPGAAddress(), hit.getHybridNumber(), hit.getChannelNumber()); + } + } + if (event.hasCollection(RawTrackerHit.class, rawTrackerHitCollectionName)) { + List<RawTrackerHit> hits = event.get(RawTrackerHit.class, rawTrackerHitCollectionName); + //outputStream.println("Reading RawCalorimeterHit from event " + event.getEventNumber()); + for (RawTrackerHit hit : hits) { + outputStream.printf("name=%s\tside=%d\tstrip=%d\n", hit.getDetectorElement().getName(), hit.getIdentifierFieldValue("side"), hit.getIdentifierFieldValue("strip")); + } + } + } +}
\ No newline at end of file
diff -u -r1.9 -r1.10 --- EvioFileReader.java 27 Apr 2012 22:13:52 -0000 1.9 +++ EvioFileReader.java 27 Apr 2012 23:08:02 -0000 1.10 @@ -53,7 +53,7 @@
} else if (args[i].equalsIgnoreCase("-v")) { debug = true; } else if (args[i].equalsIgnoreCase("-s")) {
- is = new FileInputStream(steeringFile);
+ is = new FileInputStream(args[++i]);
} else if (args[i].equalsIgnoreCase("-r")) { steeringFile = new String(args[++i]); } else if (args[i].equalsIgnoreCase("-d")) {
diff -u -r1.1 -r1.2 --- HPSSVTRawTrackerHitMaker.java 25 Apr 2012 05:06:46 -0000 1.1 +++ HPSSVTRawTrackerHitMaker.java 27 Apr 2012 23:08:02 -0000 1.2 @@ -17,114 +17,120 @@
import org.lcsim.hps.util.Pair; //--- Constants ---//
-import static org.lcsim.hps.recon.tracking.HPSSVTConstants.TOTAL_STRIPS_PER_SENSOR;
import static org.lcsim.hps.recon.tracking.HPSSVTConstants.TOTAL_APV25_CHANNELS;
+import static org.lcsim.hps.recon.tracking.HPSSVTConstants.TOTAL_APV25_PER_HYBRID;
- -/** - *
+/** + *
* @author Omar Moreno <[log in to unmask]>
- * @version $Id: HPSSVTRawTrackerHitMaker.java,v 1.1 2012/04/25 05:06:46 omoreno Exp $
+ * @version $Id: HPSSVTRawTrackerHitMaker.java,v 1.1 2012/04/25 05:06:46 omoreno + * Exp $
*/ public class HPSSVTRawTrackerHitMaker extends Driver {
-
+
String svtDataCollectionName = "SVTData"; String svtRawTrackerHitCollectionName = "SVTRawTrackerHits"; String readoutName = "TrackerHits";
- - public HPSSVTRawTrackerHitMaker(){} -
+ + public HPSSVTRawTrackerHitMaker() { + } +
/**
- *
+ *
*/
- public void process(EventHeader event) - { -
+ public void process(EventHeader event) { +
// If the SVT data collection does not exist skip the event
- if(!event.hasCollection(HPSSVTData.class, svtDataCollectionName)){
+ if (!event.hasCollection(HPSSVTData.class, svtDataCollectionName)) {
System.out.println(this.getClass().getSimpleName() + ": " + svtDataCollectionName + " does not exist; skipping event!"); return; }
-
+
// If the SVT data collection is empty skip the event List<HPSSVTData> svtData = event.get(HPSSVTData.class, svtDataCollectionName);
- if(svtData.isEmpty()){
+ if (svtData.isEmpty()) {
System.out.println(this.getClass().getSimpleName() + ": " + svtDataCollectionName + " is empty; skipping event!"); return; }
-
+
// Create RawTrackerHits List<RawTrackerHit> rawHits = this.makeRawTrackerHits(svtData);
-
+
// Turn on 64-bit cell ID
- int flag = LCIOUtil.bitSet(0, 31, true); -
+ int flag = LCIOUtil.bitSet(0, 31, true); +
// Place the RawTrackerHits collection into the event event.put(svtRawTrackerHitCollectionName, rawHits, RawTrackerHit.class, flag, readoutName); System.out.println("Created " + rawHits.size() + " RawTrackerHits"); }
-
+
/** * Converts a list of HPSSVTData to a list of RawTrackerHits
- *
+ *
* @param svtData : List of HPSSVTData to be converted
- *
+ *
* @return List of RawTrackerHits */
- public List<RawTrackerHit> makeRawTrackerHits(List<HPSSVTData> svtData) - {
+ public List<RawTrackerHit> makeRawTrackerHits(List<HPSSVTData> svtData) {
// Lost of RawTrackerHits List<RawTrackerHit> rawHits = new ArrayList<RawTrackerHit>();
- - for(HPSSVTData svtDatum : svtData){ -
+ + for (HPSSVTData svtDatum : svtData) { +
// Get the sensor associated with this hit
- Pair<Integer, Integer> daqPair - = new Pair<Integer, Integer>(svtDatum.getHybridNumber(), svtDatum.getFPGAAddress());
+ Pair<Integer, Integer> daqPair = new Pair<Integer, Integer>(svtDatum.getHybridNumber(), svtDatum.getFPGAAddress());
SiSensor sensor = HPSSVTDAQMaps.daqPairToSensor.get(daqPair);
-
+ if (sensor == null) { + throw new RuntimeException("Unexpected DAQ address: FPGA " + svtDatum.getFPGAAddress() + ", hybrid " + svtDatum.getHybridNumber()); + } +
// Get the physical channel
- int physicalChannel - = this.getPhysicalChannel(svtDatum.getAPVNumber(), svtDatum.getChannelNumber()); - if(physicalChannel < 0 || physicalChannel > 638) - throw new RuntimeException("Channel " + physicalChannel + " is outside of invalid range!"); -
+ int physicalChannel = this.getPhysicalChannel(svtDatum.getAPVNumber(), svtDatum.getChannelNumber()); + if (physicalChannel < 0 || physicalChannel > TOTAL_APV25_PER_HYBRID * TOTAL_APV25_CHANNELS) { + throw new RuntimeException("Channel " + physicalChannel + " is outside of valid range!"); + } + + if (physicalChannel >= HPSSVTConstants.TOTAL_STRIPS_PER_SENSOR) { + continue; //strip 639 exists as an APV channel but not as a sensor strip; drop it + } +
// Get all shaper signal samples associated with this hit short data[] = svtDatum.getAllSamples();
-
+
// Get the hit time
- int hitTime = svtDatum.getHitTime();
+ int hitTime = svtDatum.getHitTime();
// System.out.println("Channel: " + svtDatum.getChannelNumber() + ": APV: " + svtDatum.getAPVNumber()); // System.out.println(this.getClass().getSimpleName() + ": Charge: " + ChargeCarrier.HOLE.charge()); // System.out.println(this.getClass().getSimpleName() + ": " + sensor.hasElectrodesOnSide(ChargeCarrier.HOLE));
-
+
// Find the side number int sideNumber;
- if(sensor.hasElectrodesOnSide(ChargeCarrier.HOLE)) sideNumber = ChargeCarrier.HOLE.charge(); - else sideNumber = ChargeCarrier.ELECTRON.charge(); -
+ if (sensor.hasElectrodesOnSide(ChargeCarrier.HOLE)) { + sideNumber = ChargeCarrier.HOLE.charge(); + } else { + sideNumber = ChargeCarrier.ELECTRON.charge(); + } +
// Get cell ID long cellID = sensor.makeStripId(physicalChannel, sideNumber).getValue();
-
+
// Create a RawTrackerHit rawHits.add(new BaseRawTrackerHit(hitTime, cellID, data, null, sensor)); }
-
+
return rawHits; }
-
+
/** * Get the physical channel corresponding to a raw chip channel
- *
+ *
* @param apv : APV25 chip number * @param channel : APV25 raw channel number
- *
+ *
* @return physical channel number */
- public int getPhysicalChannel(int apv, int channel) - { - return TOTAL_STRIPS_PER_SENSOR - (apv*TOTAL_APV25_CHANNELS - + (TOTAL_APV25_CHANNELS - 1) - channel);
+ public int getPhysicalChannel(int apv, int channel) { + return (TOTAL_APV25_PER_HYBRID - apv - 1) * TOTAL_APV25_CHANNELS + channel;
} }
diff -u -r1.3 -r1.4 --- TrackerHitDriver.java 17 Apr 2012 18:14:01 -0000 1.3 +++ TrackerHitDriver.java 27 Apr 2012 23:08:02 -0000 1.4 @@ -31,7 +31,7 @@
* algorithm like Seed Tracker. * * @author jeremym
- * @version $Id: TrackerHitDriver.java,v 1.3 2012/04/17 18:14:01 jeremy Exp $
+ * @version $Id: TrackerHitDriver.java,v 1.4 2012/04/27 23:08:02 meeg Exp $
*/ public class TrackerHitDriver extends Driver {
@@ -249,7 +249,7 @@
processDEs.add(deDetector); }
- for (IDetectorElement detectorElement : processDEs) {
+ for (IDetectorElement detectorElement : processDEs) {
processSensors.addAll(detectorElement.findDescendants(SiSensor.class)); processModules.addAll(detectorElement.findDescendants(SiTrackerModule.class)); // FIXME Is this redundant? }
diff -u -r1.5 -r1.6 --- EcalMonitoringPlots.java 27 Apr 2012 22:13:53 -0000 1.5 +++ EcalMonitoringPlots.java 27 Apr 2012 23:08:02 -0000 1.6 @@ -49,7 +49,7 @@
dec = detector.getSubdetector(ecalName).getReadout().getIDDecoder(); // Setup the plotter.
- plotter = aida.analysisFactory().createPlotterFactory().create("HPS ECal Plots");
+ plotter = aida.analysisFactory().createPlotterFactory().create("HPS ECal Monitoring Plots");
// Setup plots. aida.tree().cd("/");
diff -u -r1.3 -r1.4 --- EcalWindowPlots.java 27 Apr 2012 22:13:53 -0000 1.3 +++ EcalWindowPlots.java 27 Apr 2012 23:08:02 -0000 1.4 @@ -100,7 +100,7 @@
aida = AIDA.defaultInstance(); aida.tree().cd("/");
- plotter = aida.analysisFactory().createPlotterFactory().create("HPS ECAL DAQ Plots");
+ plotter = aida.analysisFactory().createPlotterFactory().create("HPS ECAL Window Plots");
plotterFrame = new AIDAFrame(plotter); plotterFrame.setVisible(true);
diff -u -r1.2 -r1.3 --- EcalWindowPlotsXY.java 27 Apr 2012 22:13:53 -0000 1.2 +++ EcalWindowPlotsXY.java 27 Apr 2012 23:08:02 -0000 1.3 @@ -98,7 +98,7 @@
aida = AIDA.defaultInstance(); aida.tree().cd("/");
- plotter = aida.analysisFactory().createPlotterFactory().create("HPS ECAL DAQ Plots");
+ plotter = aida.analysisFactory().createPlotterFactory().create("HPS ECAL Window Plots");
plotterFrame = new AIDAFrame(plotter); plotterFrame.setVisible(true);
diff -u -r1.2 -r1.3 --- EcalPedestalPlots.java 27 Apr 2012 22:13:53 -0000 1.2 +++ EcalPedestalPlots.java 27 Apr 2012 23:08:02 -0000 1.3 @@ -90,7 +90,7 @@
private void setupPlots() { // Setup the plotter.
- plotter = aida.analysisFactory().createPlotterFactory().create("HPS ECal Plots");
+ plotter = aida.analysisFactory().createPlotterFactory().create("HPS ECal Pedestal Plots");
plotterFrame = new AIDAFrame(plotter); plotterFrame.setVisible(true);
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