Commit in hps-java/src/main/java/org/lcsim/hps/users/omoreno on MAIN | |||
SvtPerformance.java | +35 | -7 | 1.3 -> 1.4 |
SvtQA.java | +121 | -11 | 1.1 -> 1.2 |
+156 | -18 |
Changes to analysis code
diff -u -r1.3 -r1.4 --- SvtPerformance.java 26 Jul 2012 12:29:14 -0000 1.3 +++ SvtPerformance.java 27 Jul 2012 19:02:07 -0000 1.4 @@ -28,7 +28,7 @@
* Svt Performance Plots * * @author Omar Moreno <[log in to unmask]>
- * @version $Id: SvtPerformance.java,v 1.3 2012/07/26 12:29:14 omoreno Exp $
+ * @version $Id: SvtPerformance.java,v 1.4 2012/07/27 19:02:07 omoreno Exp $
*/ public class SvtPerformance extends Driver {
@@ -51,6 +51,10 @@
double totalTracksWith5LayersHit = 0; int plotterIndex = 0;
+ double totalEvents = 0; + double totalTracks = 0; + double totalTwoTrackEvents = 0; +
double[] topLayers; double[] bottomLayers;
@@ -96,6 +100,7 @@
String title = null; IHistogram2D histo2D = null;
+ IHistogram1D histo1D = null;
//--- Hit Positions ---// //---------------------//
@@ -114,6 +119,11 @@
// } frames.get(0).addPlotter(plotters.get(plotterIndex)); plotterIndex++;
+ plotters.add(PlotUtils.setupPlotter("Chi Squared", 0, 0)); + title = "ChiSquared"; + histo1D = aida.histogram1D("ChiSquared", 50, 0, 50); + PlotUtils.setup1DRegion(plotters.get(plotterIndex), title, 0, "Chi Squared", histo1D); + frames.get(0).addPlotter(plotters.get(plotterIndex));
}
@@ -124,10 +134,16 @@
} public void process(EventHeader event){
-
+ + totalEvents++; +
// Get the list of tracks in the event List<SeedTrack> tracks = event.get(SeedTrack.class, trackCollectionName);
+ totalTracks += tracks.size(); + + if(tracks.size() == 2) totalTwoTrackEvents++; +
// For now, only look at event which have less than a single track if(tracks.size() >= 2){ if(debug)
@@ -239,22 +255,31 @@
if(track.getTrackerHits().size() == 4 && !ecalClusters.isEmpty()){ // Get the position of the track at the last Layer
- Hep3Vector trkPositionAtLayer5 = extrapolator.extrapolateTrack(707.5 /* mm */);
+ Hep3Vector trkPositionAtLayer5 = extrapolator.extrapolateTrack(696.1715 /* mm */);
if(debug) System.out.println(this.getClass().getSimpleName() + ": Track Position at Layer 5: " + trkPositionAtLayer5.toString());
- if(trkPositionAtLayer5.y() < 80 && trkPositionAtLayer5.y() > -10 && trkPositionAtLayer5.z() > 32 && trkPositionAtLayer5.z() < 72){
+ if(trkPositionAtLayer5.y() < 67/*69.89656*/ && trkPositionAtLayer5.y() > -27/*-28.73156*/ && trkPositionAtLayer5.z() > 11/*12.59405*/ && trkPositionAtLayer5.z() < 47/*50.93395*/){
- if(trkUtil.getZ0() > 0) totalFourHitTracks++; - if(trkUtil.getZ0() > 0 && topLayers[4] > 0){
+ if(trkUtil.getZ0() > 0 && track.getChi2() < 10){ + for(HPSEcalCluster ecalCluster : ecalClusters){ + if(ecalCluster.getPosition()[1] > 0){ + totalFourHitTracks++; + if(topLayers[4] > 0) totalTracksWith5LayersHit++; + break; + } + } + } + /* + if(trkUtil.getZ0() > 0 && topLayers[4] > 0 && track.getChi2() < 10){
for(HPSEcalCluster ecalCluster : ecalClusters){ if(ecalCluster.getPosition()[1] > 0){ totalTracksWith5LayersHit++; break; } }
- }
+ } */
else if(trkUtil.getZ0() > 0 && topLayers[4] == 0){ for(TrackerHit hit : track.getTrackerHits()){ HelicalTrackHit hth = (HelicalTrackHit) hit;
@@ -266,6 +291,7 @@
title = "Hit Positions - YZ"; aida.histogram2D(title).fill(arrayPosition + 1, hth.getCorrectedPosition().z()); }
+ aida.histogram1D("ChiSquared").fill(track.getChi2());
} else if(trkUtil.getZ0() < 0 && bottomLayers[4] > 0 ){ for(HPSEcalCluster ecalCluster : ecalClusters){
@@ -306,6 +332,8 @@
System.out.println("Total Bottom Track Reconstruction Efficiency: " + (totalBottomTracksFound/possibleBottomTracks)*100 + "%"); System.out.println("Percentage of 4 hit tracks: " + (totalFourHitTracks/totalTracksFound)*100 + "%" ); System.out.println("Hit Efficiency: " + (totalTracksWith5LayersHit/totalFourHitTracks)*100 + "%");
+ System.out.println("Percentage of Tracks Found: " + (totalTracks/totalEvents)*100 + "%"); + System.out.println("Percentage of Two Track Events: " + (totalTwoTrackEvents/totalEvents)*100 + "%");
System.out.println("%===================================================================% \n"); }
diff -u -r1.1 -r1.2 --- SvtQA.java 23 Jul 2012 18:05:04 -0000 1.1 +++ SvtQA.java 27 Jul 2012 19:02:07 -0000 1.2 @@ -17,6 +17,7 @@
import org.lcsim.detector.tracker.silicon.SiSensor; import org.lcsim.event.EventHeader; import org.lcsim.event.RawTrackerHit;
+import org.lcsim.fit.helicaltrack.HelicalTrackHit;
import org.lcsim.geometry.Detector; import org.lcsim.util.Driver; import org.lcsim.util.aida.AIDA;
@@ -37,7 +38,7 @@
* SVT Quality Assurance Driver * * @author Omar Moreno <[log in to unmask]>
- * @version $Id: SvtQA.java,v 1.1 2012/07/23 18:05:04 omoreno Exp $
+ * @version $Id: SvtQA.java,v 1.2 2012/07/27 19:02:07 omoreno Exp $
*/ public class SvtQA extends Driver {
@@ -53,18 +54,22 @@
int apvNumber = 0; String sensorName = null; Map<String, double[]> sensorToOccupancy = new HashMap<String, double[]>();
+ Map<String, double[]> sensorToStereoOccupancy = new HashMap<String, double[]>();
int totalNumberEvents = 0; double maxOccupancy = 1.0;
+ double maxOccupancyVariation = 1000; // %
// Plot flags boolean enableADCvsChannel = false; boolean enableOccupancy = false;
+ boolean enableStereoHitOccupancy = false;
boolean enableChannelPlots = false; boolean enableAPVPlots = false; // Collection Names private String trackCollectionName = "MatchedTracks"; private String rawTrackerHitCollectionName = "SVTRawTrackerHits";
+ private String stereoHitCollectionName = "RotatedHelicalTrackHits";
public SvtQA(){}
@@ -80,6 +85,13 @@
} /**
+ * Enable/disable stereo hit occupancy plots + */ + public void setEnableStereoHitOccupancyPlots(boolean enableStereoHitOccupancy){ + this.enableStereoHitOccupancy = enableStereoHitOccupancy; + } + + /**
* Enable/disable ADC counts vs Channel plots */ public void setEnableADCvsChannelPlots(boolean enableADCvsChannel){
@@ -122,16 +134,26 @@
} /**
+ * Set the maximum occupancy a channel may have + */ + public void setMaxOccupancy(double maxOccupancy){ + this.maxOccupancy = maxOccupancy; + } + + /** + * Set the maximum channel to channel occupancy variation + */ + public void setMaxOccupancyVariation(double maxOccupancyVariation){ + this.maxOccupancyVariation = maxOccupancyVariation; + } + + /**
* */ public void setOutputFileName(String outputFile){ this.outputFile = outputFile; }
- public void setMaxOccupancy(double maxOccupancy){ - this.maxOccupancy = maxOccupancy; - } -
/** * */
@@ -197,6 +219,21 @@
plotterIndex++; }
+ //--- Stereo Hit Occupancy ---// + //-----------------// + if(enableStereoHitOccupancy){ + plotters.add(PlotUtils.setupPlotter("Stereo Hit Occupancy", 5, 4)); + for(SiSensor sensor : sensors){ + sensorToStereoOccupancy.put(SvtUtils.getInstance().getDescription(sensor), new double[640]); + title = SvtUtils.getInstance().getDescription(sensor) + " - Stereo Hit Occupancy"; + histo1D = aida.histogram1D(title, 640, 0, 639); + histos1D.add(histo1D); + PlotUtils.setup1DRegion(plotters.get(plotterIndex), title, this.getPlotterRegion(sensor), "Channel #", histo1D); + } + frames.get(0).addPlotter(plotters.get(plotterIndex)); + plotterIndex++; + } +
//--- ADC Counts vs Channel ---// //-----------------------------// if(enableADCvsChannel){
@@ -230,15 +267,15 @@
title = sensorName + " - Channel: " + channelNumber; plotters.add(PlotUtils.setupPlotter(title, 2, 2)); title = "ADC Counts";
- histo1D = aida.histogram1D(title, 300, 4000, 10000);
+ histo1D = aida.histogram1D(title, 300, 4000, 7000);
histos1D.add(histo1D); PlotUtils.setup1DRegion(plotters.get(plotterIndex),title , 0, "ADC Counts", histo1D); title = "Shaper Signal Amplitude";
- histo1D = aida.histogram1D(title, 300, 0, 6000);
+ histo1D = aida.histogram1D(title, 300, 0, 3000);
histos1D.add(histo1D); PlotUtils.setup1DRegion(plotters.get(plotterIndex), title, 1, "Amplitude [ADC Counts]", histo1D); title = "t0";
- histo1D = aida.histogram1D(title, 25, -50, 100);
+ histo1D = aida.histogram1D(title, 100, -150, 100);
histos1D.add(histo1D); PlotUtils.setup1DRegion(plotters.get(plotterIndex), title, 2, "t0 [ns]", histo1D); frames.get(1).addPlotter(plotters.get(plotterIndex));
@@ -297,14 +334,41 @@
public void process(EventHeader event){ totalNumberEvents++;
+ String title;
// If the event doesn't contain RawTrackerHits then skip it if(!event.hasCollection(RawTrackerHit.class, rawTrackerHitCollectionName )) return; // Get the RawTrackerHits from the event List<RawTrackerHit> rawHits = event.get(RawTrackerHit.class, rawTrackerHitCollectionName);
+ + // If the event does not contain stereo hits, skip the event + if(event.hasCollection(HelicalTrackHit.class, stereoHitCollectionName)){ + + // Get the list of HelicalTrackHits + List<HelicalTrackHit> stereoHits =event.get(HelicalTrackHit.class, stereoHitCollectionName); + + for(HelicalTrackHit stereoHit : stereoHits){ + + for(Object hit : stereoHit.getRawHits()){ + + RawTrackerHit rawHit = (RawTrackerHit) hit; + + SiSensor sensor = (SiSensor) rawHit.getDetectorElement(); + + // Get the channel number + int channel = rawHit.getIdentifierFieldValue("strip"); + + if(enableStereoHitOccupancy){ + title = SvtUtils.getInstance().getDescription(sensor) + " - Stereo Hit Occupancy"; + sensorToStereoOccupancy.get(SvtUtils.getInstance().getDescription(sensor))[channel] += 1; + } + } + } + } + +
- String title;
for(RawTrackerHit rawHit : rawHits){ // Get the sensor on which this hit occurred
@@ -384,6 +448,16 @@
} }
+ if(enableStereoHitOccupancy){ + for(SiSensor sensor : SvtUtils.getInstance().getSensors()){ + title = SvtUtils.getInstance().getDescription(sensor) + " - Stereo Hit Occupancy"; + aida.histogram1D(title).reset(); + for(int index = 0; index < 640; index++){ + aida.histogram1D(title).fill(index, sensorToStereoOccupancy.get(SvtUtils.getInstance().getDescription(sensor))[index]/event.getEventNumber()); + } + } + } +
}
@@ -391,17 +465,53 @@
@Override public void endOfData(){
+ System.out.println("Total Bad Channels: " + HPSSVTCalibrationConstants.getTotalBadChannels() + "\n"); +
if(enableOccupancy){
+ System.out.println("%===================================================================% \n");
for(SiSensor sensor : SvtUtils.getInstance().getSensors()){
+ System.out.println(SvtUtils.getInstance().getDescription(sensor) + " Bad Channels");
Pair<Integer, Integer> daqPair = SvtUtils.getInstance().getDaqPair(sensor); for(int index = 0; index < 640; index++){ double occupancy = sensorToOccupancy.get(SvtUtils.getInstance().getDescription(sensor))[index]/totalNumberEvents;
+ double leftNeighborOccupancy = 0; + double rightNeighborOccupancy = 0; + double leftDiff = 0; + double rightDiff = 0; + if(index != 0){ + leftNeighborOccupancy = sensorToOccupancy.get(SvtUtils.getInstance().getDescription(sensor))[index - 1]/totalNumberEvents; + leftDiff = Math.abs(leftNeighborOccupancy - occupancy)/leftNeighborOccupancy; + } + if(index != 639){ + rightNeighborOccupancy = sensorToOccupancy.get(SvtUtils.getInstance().getDescription(sensor))[index + 1]/totalNumberEvents; + rightDiff = Math.abs(rightNeighborOccupancy - occupancy)/rightNeighborOccupancy; + } +
if(occupancy > maxOccupancy){
- - System.out.println(" " + index + " : " + daqPair.getSecondElement() + " " + daqPair.getFirstElement());
+ System.out.println(" Channel: " + index + " FPGA: " + daqPair.getSecondElement() + " Hybrid: " + daqPair.getFirstElement() + " Occupancy: " + occupancy); + } else if( leftDiff > maxOccupancyVariation || rightDiff > maxOccupancyVariation){ + System.out.println(" Channel: " + index + " FPGA: " + daqPair.getSecondElement() + " Hybrid: " + daqPair.getFirstElement() + + " Left Difference: " + leftDiff + " Right Difference: " + rightDiff);
} } }
+ System.out.println("%===================================================================% \n"); + } + + if(enableStereoHitOccupancy){ + System.out.println("%===================================================================% \n"); + for(SiSensor sensor : SvtUtils.getInstance().getSensors()){ + System.out.println(SvtUtils.getInstance().getDescription(sensor) + " Bad Channels"); + Pair<Integer, Integer> daqPair = SvtUtils.getInstance().getDaqPair(sensor); + for(int index = 0; index < 640; index++){ + double occupancy = sensorToStereoOccupancy.get(SvtUtils.getInstance().getDescription(sensor))[index]/totalNumberEvents; + occupancy *= 1000; + if(occupancy == 0){ + System.out.println(" Channel: " + index + " FPGA: " + daqPair.getSecondElement() + " Hybrid: " + daqPair.getFirstElement() + " Occupancy: " + occupancy); + } + } + } + System.out.println("%===================================================================% \n");
} if(outputFile != null){
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