hps-java/src/main/java/org/lcsim/hps/recon/tracking
diff -u -r1.20 -r1.21
--- HPSSVTCalibrationConstants.java 21 Sep 2012 23:22:17 -0000 1.20
+++ HPSSVTCalibrationConstants.java 21 Nov 2012 08:33:18 -0000 1.21
@@ -14,18 +14,18 @@
/**
*
* @author Mathew Graham <[log in to unmask]>
- * $Id: HPSSVTCalibrationConstants.java,v 1.20 2012/09/21 23:22:17 meeg Exp $
+ * $Id: HPSSVTCalibrationConstants.java,v 1.21 2012/11/21 08:33:18 omoreno Exp $
*/
public class HPSSVTCalibrationConstants {
- // TODO: Change all pairs such that FPGA is the fist value
// TODO: Change all map keys to type SiSensor?
- private static Map<Pair<Integer /* Hybrid */, Integer /* FPGA */>, double[] /* constants */> noiseMap = new HashMap<Pair<Integer, Integer>, double[]>();
- private static Map<Pair<Integer /* Hybrid */, Integer /* FPGA */>, double[] /* constants */> pedestalMap = new HashMap<Pair<Integer, Integer>, double[]>();
- private static Map<Pair<Integer /* Hybrid */, Integer /* FPGA */>, double[] /* constants */> tpMap = new HashMap<Pair<Integer, Integer>, double[]>();
- private static Map<Pair<Integer /* Hybrid */, Integer /* FPGA */>, Set<Integer> /* Bad channels */> badChannelMap = new HashMap<Pair<Integer, Integer>, Set<Integer>>();
- private static Map<Pair<Integer /* Hybrid */, Integer /* FPGA */>, List<Double> /* channels */> gainMap = new HashMap<Pair<Integer, Integer>, List<Double>>();
- private static Map<Pair<Integer /* Hybrid */, Integer /* FPGA */>, List<Double> /* channels */> offsetMap = new HashMap<Pair<Integer, Integer>, List<Double>>();
+ // TODO: Update everything to make it compatible new version of SVT Utils
+ private static Map<Pair<Integer /* FPGA */, Integer /* Hybrid */>, double[] /* constants */> noiseMap = new HashMap<Pair<Integer, Integer>, double[]>();
+ private static Map<Pair<Integer /* FPGA */, Integer /* Hybrid */>, double[] /* constants */> pedestalMap = new HashMap<Pair<Integer, Integer>, double[]>();
+ private static Map<Pair<Integer /* FPGA */, Integer /* Hybrid */>, double[] /* constants */> tpMap = new HashMap<Pair<Integer, Integer>, double[]>();
+ private static Map<Pair<Integer /* FPGA */, Integer /* Hybrid */>, Set<Integer> /* Bad channels */> badChannelMap = new HashMap<Pair<Integer, Integer>, Set<Integer>>();
+ private static Map<Pair<Integer /* FPGA */, Integer /* Hybrid */>, List<Double> /* channels */> gainMap = new HashMap<Pair<Integer, Integer>, List<Double>>();
+ private static Map<Pair<Integer /* FPGA */, Integer /* Hybrid */>, List<Double> /* channels */> offsetMap = new HashMap<Pair<Integer, Integer>, List<Double>>();
private static boolean pedestalLoaded = false;
private static boolean tpLoaded = false;
private static int totalBadChannels = 0;
@@ -36,10 +36,6 @@
private HPSSVTCalibrationConstants() {
}
-// public static void loadCalibrationConstants() {
-// loadCalibrationConstants(-1);
-// }
-//
public static void loadCalibration(int runNumber) {
loadCalibrationConstants(runNumber);
loadBadChannels(runNumber);
@@ -109,7 +105,7 @@
double pedestal = Double.valueOf(lineTok.nextToken());
double noise = Double.valueOf(lineTok.nextToken());
- Pair<Integer, Integer> daqPair = new Pair<Integer, Integer>(hybrid, fpga);
+ Pair<Integer, Integer> daqPair = new Pair<Integer, Integer>(fpga, hybrid);
double[] pedestals = pedestalMap.get(daqPair);
if (pedestals == null) {
@@ -165,7 +161,7 @@
double tp = Double.valueOf(lineTok.nextToken()) * 24.0 / 25.0; //FIXME: this is a hack to compensate for the calibrations we have that assumed 25 ns APV clock
double chisq = Double.valueOf(lineTok.nextToken());
- Pair<Integer, Integer> daqPair = new Pair<Integer, Integer>(hybrid, fpga);
+ Pair<Integer, Integer> daqPair = new Pair<Integer, Integer>(fpga, hybrid);
double[] tps = tpMap.get(daqPair);
if (tps == null) {
@@ -243,7 +239,7 @@
int badChannel = Integer.valueOf(stringTok.nextToken());
int fpga = Integer.valueOf(stringTok.nextToken());
int hybrid = Integer.valueOf(stringTok.nextToken());
- Pair<Integer, Integer> daqPair = new Pair<Integer, Integer>(hybrid, fpga);
+ Pair<Integer, Integer> daqPair = new Pair<Integer, Integer>(fpga, hybrid);
if (!badChannelMap.containsKey(daqPair)) {
badChannelMap.put(daqPair, new HashSet<Integer>());
}
@@ -281,7 +277,7 @@
int channel = Integer.valueOf(stringTok.nextToken());
double gain = Double.valueOf(stringTok.nextToken());
double offset = Double.valueOf(stringTok.nextToken());
- Pair<Integer, Integer> daqPair = new Pair<Integer, Integer>(hybrid, fpga);
+ Pair<Integer, Integer> daqPair = new Pair<Integer, Integer>(fpga, hybrid);
if (!gainMap.containsKey(daqPair)) {
gainMap.put(daqPair, new ArrayList<Double>());
}
@@ -455,7 +451,7 @@
/**
* Checks if a channel has been tagged as bad
*
- * @param daqPair : a Hybrid/FPGA pair defining which sensor the
+ * @param daqPair : a FPGA/Hybrid pair defining which sensor the
* channels in located on
* @param channel : The channel to be checked
* @return true if the channel is bad, false otherwise
hps-java/src/main/java/org/lcsim/hps/evio
diff -u -r1.1 -r1.2
--- SVTEvioReader_RTH.java 14 Aug 2012 00:58:03 -0000 1.1
+++ SVTEvioReader_RTH.java 21 Nov 2012 08:33:18 -0000 1.2
@@ -30,7 +30,7 @@
/**
*
* @author Omar Moreno <[log in to unmask]>
- * @version $Id: SVTEvioReader_RTH.java,v 1.1 2012/08/14 00:58:03 meeg Exp $
+ * @version $Id: SVTEvioReader_RTH.java,v 1.2 2012/11/21 08:33:18 omoreno Exp $
*/
public class SVTEvioReader_RTH extends EvioReader {
@@ -152,7 +152,7 @@
private static RawTrackerHit makeHit(int[] data) {
int hitTime = 0;
- Pair<Integer, Integer> daqPair = new Pair<Integer, Integer>(HPSSVTData.getHybridNumber(data), HPSSVTData.getFPGAAddress(data));
+ Pair<Integer, Integer> daqPair = new Pair<Integer, Integer>(HPSSVTData.getFPGAAddress(data), HPSSVTData.getHybridNumber(data));
SiSensor sensor = SvtUtils.getInstance().getSensor(daqPair);
// Find the side number (is 1)
hps-java/src/main/java/org/lcsim/hps/users/omoreno
diff -u -r1.6 -r1.7
--- SvtTrackRecoEfficiency.java 18 Oct 2012 02:43:31 -0000 1.6
+++ SvtTrackRecoEfficiency.java 21 Nov 2012 08:33:18 -0000 1.7
@@ -51,7 +51,7 @@
/**
*
* @author Omar Moreno <[log in to unmask]>
- * @version $Id: SvtTrackRecoEfficiency.java,v 1.6 2012/10/18 02:43:31 omoreno Exp $
+ * @version $Id: SvtTrackRecoEfficiency.java,v 1.7 2012/11/21 08:33:18 omoreno Exp $
*/
public class SvtTrackRecoEfficiency extends Driver {
@@ -260,9 +260,9 @@
this.printDebug("Event " + eventNumber + " contains " + simTrackerHits.size() + " SimTrackerHits");
// Add the SimTrackerHits to its respective sensor readout
- for(SimTrackerHit simHitTrackerHit : simTrackerHits){
+ /*for(SimTrackerHit simHitTrackerHit : simTrackerHits){
((SiSensor) simHitTrackerHit.getDetectorElement()).getReadout().addHit(simHitTrackerHit);
- }
+ }*/
// Get the list of RawTrackerHits and add them to the sensor readout
List<RawTrackerHit> rawHits = event.get(RawTrackerHit.class, rawTrackerHitCollectionName);
@@ -360,6 +360,12 @@
Set<SimTrackerHit> simHits = findable.getSimTrackerHits(mcParticle);
boolean[] planesHit = new boolean[10];
+ // Clear the sensor readout's and then add the SimTrackerHits from the MC particles to them
+ for(SiSensor sensor : SvtUtils.getInstance().getSensors()) sensor.getReadout().clear();
+ for(SimTrackerHit simHitTrackerHit : simHits){
+ ((SiSensor) simHitTrackerHit.getDetectorElement()).getReadout().addHit(simHitTrackerHit);
+ }
+
// Clear all previously stored simTrackerHits
for(int index = 0; index < 10; index++){
topSimTrackerHitsList.get(index+1).clear();
@@ -412,8 +418,20 @@
String title = null;
for(int index = 0; index < layerHit.length; index++){
if(isTopTrack){
- axialSensor = SvtUtils.getInstance().getTopSensor(2*index + 1);
- stereoSensor = SvtUtils.getInstance().getTopSensor(2*index + 2);
+ axialSensor = SvtUtils.getInstance().getTopSensor(2*index + 1, 0);
+ stereoSensor = SvtUtils.getInstance().getTopSensor(2*index + 2, 0);
+
+ if(axialSensor.getReadout().getHits(SimTrackerHit.class).isEmpty()
+ || stereoSensor.getReadout().getHits(SimTrackerHit.class).isEmpty()){
+ this.printDebug("One of the sensors does not have a SimTrackerHit associated with it; moving on to next layer");
+ continue;
+ }
+
+ this.printDebug(SvtUtils.getInstance().getDescription(axialSensor) + ": SimTrackerHit: " + axialSensor.getReadout().getHits(SimTrackerHit.class).size());
+ this.printDebug(SvtUtils.getInstance().getDescription(stereoSensor) + ": SimTrackerHit: " + stereoSensor.getReadout().getHits(SimTrackerHit.class).size());
+ if(layerHit[index]){
+ this.printDebug("Top Layer " + (index+1) + " was hit");
+ }
for(SimTrackerHit simHit : axialSensor.getReadout().getHits(SimTrackerHit.class)){
if(layerHit[index] && !topStereoLayerHit[index]){
@@ -455,9 +473,21 @@
}
} else {
- axialSensor = SvtUtils.getInstance().getBottomSensor(2*index + 2);
- stereoSensor = SvtUtils.getInstance().getBottomSensor(2*index + 1);
+ axialSensor = SvtUtils.getInstance().getBottomSensor(2*index + 2, 0);
+ stereoSensor = SvtUtils.getInstance().getBottomSensor(2*index + 1, 0);
+
+ if(axialSensor.getReadout().getHits(SimTrackerHit.class).isEmpty()
+ || stereoSensor.getReadout().getHits(SimTrackerHit.class).isEmpty()){
+ this.printDebug("One of the sensors does not have a SimTrackerHit associated with it; moving on to next layer");
+ continue;
+ }
+ this.printDebug(SvtUtils.getInstance().getDescription(axialSensor) + ": SimTrackerHit: " + axialSensor.getReadout().getHits(SimTrackerHit.class).size());
+ this.printDebug(SvtUtils.getInstance().getDescription(stereoSensor) + ": SimTrackerHit: " + stereoSensor.getReadout().getHits(SimTrackerHit.class).size());
+ if(layerHit[index]){
+ this.printDebug("Bottom Layer " + (index+1) + " was hit");
+ }
+
for(SimTrackerHit simHit : axialSensor.getReadout().getHits(SimTrackerHit.class)){
if(debug)
this.printDebug(SvtUtils.getInstance().getDescription(axialSensor) + ": Position: " + simHit.getPositionVec().toString());