Commit in hps-java/src/main/java/org/lcsim/hps/users/omoreno on MAIN | |||
TestRunTrackReconEfficiency.java | +54 | -6 | 1.2 -> 1.3 |
Add single cluster efficiency calculation
diff -u -r1.2 -r1.3 --- TestRunTrackReconEfficiency.java 30 Apr 2013 08:08:29 -0000 1.2 +++ TestRunTrackReconEfficiency.java 1 May 2013 04:39:34 -0000 1.3 @@ -29,7 +29,7 @@
* method. * * @author Omar Moreno <[log in to unmask]>
- * @version $Id: TestRunTrackReconEfficiency.java,v 1.2 2013/04/30 08:08:29 omoreno Exp $
+ * @version $Id: TestRunTrackReconEfficiency.java,v 1.3 2013/05/01 04:39:34 omoreno Exp $
*/ public class TestRunTrackReconEfficiency extends Driver {
@@ -50,6 +50,12 @@
double nTrigClusterTrackMatch = 0; double findableTracks, findableTopTracks,findableBottomTracks; double totalTracks, totalTopTracks, totalBottomTracks;
+ double findableSingleTracks; + double findableSingleTracksQuad1, findableSingleTracksQuad2; + double findableSingleTracksQuad3, findableSingleTracksQuad4; + double foundSingleTracks; + double foundSingleTracksQuad1, foundSingleTracksQuad2; + double foundSingleTracksQuad3, foundSingleTracksQuad4;
double thresholdEnergy = 0; double energyDifference = 0;
@@ -145,6 +151,35 @@
// Get the list of Ecal clusters in the event List<HPSEcalCluster> ecalClusters = event.get(HPSEcalCluster.class, ecalClustersCollectionName);
+ + // Get the list of tracks from the event + List<Track> tracks = event.get(Track.class, trackCollectionName); + + // If the event has a single Ecal cluster satisfying the threshold cut, + // check if there is a track that is well matched to the cluster + if(ecalClusters.size() == 1){ + HPSEcalCluster ecalCluster = ecalClusters.get(0); + + // If the cluster is above the energy threshold, then the track should + // be findable + if(!isClusterAboveEnergyThreshold(ecalCluster)) return; + findableSingleTracks++; + + double[] clusterPosition = ecalCluster.getPosition(); + + if(clusterPosition[0] > 0 && clusterPosition[1] > 0) findableSingleTracksQuad1++; + else if(clusterPosition[0] < 0 && clusterPosition[1] > 0) findableSingleTracksQuad2++; + else if(clusterPosition[0] < 0 && clusterPosition[1] < 0) findableSingleTracksQuad3++; + else if(clusterPosition[0] > 0 && clusterPosition[1] < 0) findableSingleTracksQuad4++; + + if(!isClusterMatchedToTrack(ecalCluster, tracks)) return; + foundSingleTracks++; + + if(clusterPosition[0] > 0 && clusterPosition[1] > 0) foundSingleTracksQuad1++; + else if(clusterPosition[0] < 0 && clusterPosition[1] > 0) foundSingleTracksQuad2++; + else if(clusterPosition[0] < 0 && clusterPosition[1] < 0) foundSingleTracksQuad3++; + else if(clusterPosition[0] > 0 && clusterPosition[1] < 0) foundSingleTracksQuad4++; + }
// Only look at events which have two Ecal cluster if(ecalClusters.size() != 2) return;
@@ -188,8 +223,6 @@
return; }
- // Get the list of tracks from the event - List<Track> tracks = event.get(Track.class, trackCollectionName);
// If there are no tracks in the collection, move on to the next event. if(tracks.isEmpty()){
@@ -344,14 +377,29 @@
@Override public void endOfData(){ System.out.println("%===================================================================% \n");
+ if(findableSingleTracks > 0){ + System.out.println("% Total single track efficiency: " + foundSingleTracks + " / " + findableSingleTracks + " = " + (foundSingleTracks/findableSingleTracks)*100 + "%"); + } + if(findableSingleTracksQuad1 > 0){ + System.out.println("% Total single track efficiency - Quad 1: " + foundSingleTracksQuad1 + " / " + findableSingleTracksQuad1 + " = " + (foundSingleTracksQuad1/findableSingleTracksQuad1)*100 + "%"); + } + if(findableSingleTracksQuad2 > 0){ + System.out.println("% Total single track efficiency - Quad 2: " + foundSingleTracksQuad2 + " / " + findableSingleTracksQuad2 + " = " + (foundSingleTracksQuad2/findableSingleTracksQuad2)*100 + "%"); + } + if(findableSingleTracksQuad3 > 0){ + System.out.println("% Total single track efficiency - Quad 3: " + foundSingleTracksQuad3 + " / " + findableSingleTracksQuad3 + " = " + (foundSingleTracksQuad3/findableSingleTracksQuad3)*100 + "%"); + } + if(findableSingleTracksQuad4 > 0){ + System.out.println("% Total single track efficiency - Quad 4: " + foundSingleTracksQuad4 + " / " + findableSingleTracksQuad4 + " = " + (foundSingleTracksQuad4/findableSingleTracksQuad4)*100 + "%"); + }
if(nOppositeVolume > 0){
- System.out.println("Total events passing opposite volume requirement: " + nOppositeVolume + " / " + eventNumber + " = " + (nOppositeVolume/eventNumber)*100 + "%");
+ System.out.println("% Total events passing opposite volume requirement: " + nOppositeVolume + " / " + eventNumber + " = " + (nOppositeVolume/eventNumber)*100 + "%");
} if(nAboveThreshold > 0){
- System.out.println("Total events with both clusters above energy threshold: " + nAboveThreshold + " / " + eventNumber + " = " + (nAboveThreshold/eventNumber)*100 + "%");
+ System.out.println("% Total events with both clusters above energy threshold: " + nAboveThreshold + " / " + eventNumber + " = " + (nAboveThreshold/eventNumber)*100 + "%");
} if(nTrigClusterTrackMatch > 0){
- System.out.println("Total events with a trigger cluster-track match: " + nTrigClusterTrackMatch + " / " + eventNumber + " = " + (nTrigClusterTrackMatch/eventNumber)*100 + "%");
+ System.out.println("% Total events with a trigger cluster-track match: " + nTrigClusterTrackMatch + " / " + eventNumber + " = " + (nTrigClusterTrackMatch/eventNumber)*100 + "%");
} if(findableTracks > 0){ System.out.println("% Total Track Reconstruction Efficiency: " + totalTracks + " / " + findableTracks + " = " + (totalTracks / findableTracks) * 100 + "%");
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