hps-java/src/main/java/org/lcsim/hps/users/omoreno
diff -u -r1.3 -r1.4
--- SvtQA.java 28 Jul 2012 01:27:49 -0000 1.3
+++ SvtQA.java 30 Jul 2012 04:20:31 -0000 1.4
@@ -38,7 +38,7 @@
* SVT Quality Assurance Driver
*
* @author Omar Moreno <[log in to unmask]>
- * @version $Id: SvtQA.java,v 1.3 2012/07/28 01:27:49 omoreno Exp $
+ * @version $Id: SvtQA.java,v 1.4 2012/07/30 04:20:31 omoreno Exp $
*/
public class SvtQA extends Driver {
@@ -65,6 +65,8 @@
boolean enableStereoHitOccupancy = false;
boolean enableChannelPlots = false;
boolean enableAPVPlots = false;
+ boolean enableChiSquaredvsChannel = false;
+ boolean enableSamples = false;
// Collection Names
private String trackCollectionName = "MatchedTracks";
@@ -113,6 +115,20 @@
}
/**
+ * Enable/disable Chi Squared of fit to samples vs Channel plots
+ */
+ public void setEnableChiSquaredvsChannelPlots(boolean enableChiSquaredvsChannel){
+ this.enableChiSquaredvsChannel = enableChiSquaredvsChannel;
+ }
+
+ /**
+ * Enable/disable plots of the APV samples
+ */
+ public void setEnableSamplesPlots(boolean enableSamples){
+ this.enableSamples = enableSamples;
+ }
+
+ /**
* Set the channel number of interest
*/
public void setChannelNumber(int channelNumber){
@@ -220,7 +236,7 @@
}
//--- Stereo Hit Occupancy ---//
- //-----------------//
+ //----------------------------//
if(enableStereoHitOccupancy){
plotters.add(PlotUtils.setupPlotter("Stereo Hit Occupancy", 5, 4));
for(SiSensor sensor : sensors){
@@ -260,6 +276,19 @@
}
}
+ //--- Chi Squared vs Channel ---//
+ //------------------------------//
+ if(enableChiSquaredvsChannel){
+ title = sensorName + " - Chi Squared vs Channel #";
+ plotters.add(PlotUtils.setupPlotter(title, 0, 0));
+ histo2D = aida.histogram2D(title, 640, 0, 639, 300, 0, 100);
+ histos2D.add(histo2D);
+ PlotUtils.setup2DRegion(plotters.get(plotterIndex), title, 0, "Channel #", "Chi Squared", histo2D);
+ frames.get(1).addPlotter(plotters.get(plotterIndex));
+ plotterIndex++;
+ }
+
+
//--- Single Channel Plots ---//
//----------------------------//
if(enableChannelPlots){
@@ -308,6 +337,24 @@
plotterIndex++;
}
+ //--- Samples Amplitude vs Sample Number ---//
+ //------------------------------------------//
+ if(enableSamples){
+ title = "APV Sample Number vs Sample Amplitude";
+ plotters.add(PlotUtils.setupPlotter(title, 1, 2));
+ plotters.get(plotterIndex).style().zAxisStyle().setParameter("scale", "log");
+ title = "APV Sample Number vs Sample Amplitude - Top";
+ histo2D = aida.histogram2D(title, 6, 1, 7, 400, 0, 4000);
+ histos2D.add(histo2D);
+ PlotUtils.setup2DRegion(plotters.get(plotterIndex), title, 0, "Sample Number", "Amplitude [ADC Counts]", histo2D);
+ title = "APV Sample Number vs Sample Amplitude - Bottom";
+ histo2D = aida.histogram2D(title, 6, 1, 7, 400, 0, 4000);
+ histos2D.add(histo2D);
+ PlotUtils.setup2DRegion(plotters.get(plotterIndex), title, 1, "Sample Number", "Amplitude [ADC Counts]", histo2D);
+ frames.get(1).addPlotter(plotters.get(plotterIndex));
+ plotterIndex++;
+ }
+
for(AIDAFrame frame : frames){
frame.pack();
frame.setVisible(true);
@@ -359,10 +406,33 @@
// Get the channel number
int channel = rawHit.getIdentifierFieldValue("strip");
+ // Get the constants associated with this channel
+ ChannelConstants constants = HPSSVTCalibrationConstants.getChannelConstants(sensor, channel);
+
+ // Fit the samples associated with the RawTrackerHit
+ HPSShapeFitParameters fit = shaperFitter.fitShape(rawHit, constants);
+
+ // Get the shaper signal samples
+ short[] samples = rawHit.getADCValues();
+
if(enableStereoHitOccupancy){
title = SvtUtils.getInstance().getDescription(sensor) + " - Stereo Hit Occupancy";
sensorToStereoOccupancy.get(SvtUtils.getInstance().getDescription(sensor))[channel] += 1;
}
+
+ // Fill Sample Plots
+ if(enableSamples){
+ if(fit.getAmp() > 2000 && fit.getAmp() < 6000){
+ for(int sampleN = 1; sampleN <= samples.length; sampleN++){
+ if((sampleN == 1 && totalNumberEvents%5 != 0) || (sampleN == 2 && totalNumberEvents%5 != 0) || (sampleN == 3 && totalNumberEvents%3 != 0)) continue;
+ if(SvtUtils.getInstance().isTopLayer(sensor))
+ aida.histogram2D("APV Sample Number vs Sample Amplitude - Top").fill(sampleN, samples[sampleN-1] - constants.getPedestal());
+ else
+ aida.histogram2D("APV Sample Number vs Sample Amplitude - Bottom").fill(sampleN, samples[sampleN-1] - constants.getPedestal());
+
+ }
+ }
+ }
}
}
}
@@ -383,11 +453,11 @@
// Get the APV number
int apv = this.getAPVNumber(channel);
- // Get the constants associated with this channel
- ChannelConstants constants = HPSSVTCalibrationConstants.getChannelConstants(sensor, channel);
+ // Get the constants associated with this channel
+ ChannelConstants constants = HPSSVTCalibrationConstants.getChannelConstants(sensor, channel);
- // Fit the samples associated with the RawTrackerHit
- HPSShapeFitParameters fit = shaperFitter.fitShape(rawHit, constants);
+ // Fit the samples associated with the RawTrackerHit
+ HPSShapeFitParameters fit = shaperFitter.fitShape(rawHit, constants);
// Fill the occupancy plots
if(enableOccupancy){
@@ -407,7 +477,13 @@
aida.histogram2D(title).fill(channel, sample);
}
}
-
+
+ // Fill Chi Squared vs Channel # plots
+ if(enableChiSquaredvsChannel && SvtUtils.getInstance().getDescription(sensor).equals(sensorName)){
+ title = sensorName + " - Chi Squared vs Channel #";
+ aida.histogram2D(title).fill(channel, fit.getChiSq());
+ }
+
//
if(enableChannelPlots && SvtUtils.getInstance().getDescription(sensor).equals(sensorName) && channel == channelNumber){
title = "ADC Counts";