hps-java/src/main/java/org/lcsim/hps/users/omoreno
diff -u -r1.4 -r1.5
--- SvtPerformance.java 27 Jul 2012 19:02:07 -0000 1.4
+++ SvtPerformance.java 30 Jul 2012 06:29:32 -0000 1.5
@@ -6,7 +6,9 @@
import hep.physics.vec.Hep3Vector;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.lcsim.detector.tracker.silicon.SiSensor;
import org.lcsim.event.EventHeader;
@@ -28,313 +30,350 @@
* Svt Performance Plots
*
* @author Omar Moreno <[log in to unmask]>
- * @version $Id: SvtPerformance.java,v 1.4 2012/07/27 19:02:07 omoreno Exp $
+ * @version $Id: SvtPerformance.java,v 1.5 2012/07/30 06:29:32 omoreno Exp $
*/
public class SvtPerformance extends Driver {
-
- private AIDA aida;
- private List<AIDAFrame> frames = new ArrayList<AIDAFrame>();
- private List<IHistogram1D> histos1D = new ArrayList<IHistogram1D>();
- private List<IHistogram2D> histos2D = new ArrayList<IHistogram2D>();
- private List<IPlotter> plotters = new ArrayList<IPlotter>();
- TrackUtils trkUtil = new TrackUtils();
- SvtTrackExtrapolator extrapolator = new SvtTrackExtrapolator();
-
- double totalTracksFound = 0;
- double totalTopTracksFound = 0;
- double totalBottomTracksFound = 0;
- double totalNumberEvents = 0;
- double possibleTracks = 0;
- double possibleTopTracks = 0;
- double possibleBottomTracks = 0;
- double totalFourHitTracks = 0;
- double totalTracksWith5LayersHit = 0;
- int plotterIndex = 0;
-
- double totalEvents = 0;
- double totalTracks = 0;
- double totalTwoTrackEvents = 0;
-
- double[] topLayers;
- double[] bottomLayers;
-
- boolean debug = true;
- boolean enableHitPositionPlots = false;
-
-
- // Plot flags
-
- // Collection Names
- private String stereoHitCollectionName = "RotatedHelicalTrackHits";
- private String trackCollectionName = "MatchedTracks";
+
+ private AIDA aida;
+ private List<AIDAFrame> frames = new ArrayList<AIDAFrame>();
+ private List<IHistogram1D> histos1D = new ArrayList<IHistogram1D>();
+ private List<IHistogram2D> histos2D = new ArrayList<IHistogram2D>();
+ private List<IPlotter> plotters = new ArrayList<IPlotter>();
+ TrackUtils trkUtil = new TrackUtils();
+ SvtTrackExtrapolator extrapolator = new SvtTrackExtrapolator();
+
+ double totalTracksFound = 0;
+ double totalTopTracksFound = 0;
+ double totalBottomTracksFound = 0;
+ double totalNumberEvents = 0;
+ double totalNumberSingleTrkEvents = 0;
+ double possibleTracks = 0;
+ double possibleTopTracks = 0;
+ double possibleBottomTracks = 0;
+ double totalFourHitTracks = 0;
+ double totalTracksWith5LayersHit = 0;
+ int plotterIndex = 0;
+
+ double totalTracks = 0;
+ double totalTwoTrackEvents = 0;
+
+ double[] topLayers;
+ double[] bottomLayers;
+ Map<Integer, List<HelicalTrackHit>> topLayerMap = new HashMap<Integer, List<HelicalTrackHit>>();
+ Map<Integer, List<HelicalTrackHit>> bottomLayerMap = new HashMap<Integer, List<HelicalTrackHit>>();
+
+ boolean debug = true;
+ boolean enableHitPositionPlots = false;
+
+ // Plot flags
+
+ // Collection Names
+ private String stereoHitCollectionName = "HelicalTrackHits";
+ private String trackCollectionName = "MatchedTracks";
private String ecalClustersCollectionName = "EcalClusters";
-
- public SvtPerformance(){}
- //--- Setters ---//
- //---------------//
-
- /**
- * Enable/disble debug mode
- */
- public void setEnableDebug(boolean debug){
- this.debug = debug;
- }
-
- public void setEnableHitPositionPlots(boolean enableHitPositionPlots){
- this.enableHitPositionPlots = enableHitPositionPlots;
- }
-
-
- protected void detectorChanged(Detector detector){
-
- // setup AIDA
- aida = AIDA.defaultInstance();
- aida.tree().cd("/");
-
- // Create AIDA Frames
- for(int index = 0; index < 2; index++) frames.add(new AIDAFrame());
-
- // Set frame titles
- frames.get(0).setTitle("Stereo Hit Positions");
-
- String title = null;
- IHistogram2D histo2D = null;
- IHistogram1D histo1D = null;
-
- //--- Hit Positions ---//
- //---------------------//
- if(enableHitPositionPlots){
- plotters.add(PlotUtils.setupPlotter("Hit Positions", 1, 2));
-// for(int layer = 0; layer < 5; layer++){
-// title = "Hit Positions - Layer " + String.valueOf(layer+1);
- title = "Hit Positions - XZ";
- histo2D = aida.histogram2D(title, 5, 1, 6, 200, -100, 100);
- histos2D.add(histo2D);
- PlotUtils.setup2DRegion(plotters.get(plotterIndex), title, 0, "Layer #", "x [mm]", histo2D);
- title = "Hit Positions - YZ";
- histo2D = aida.histogram2D(title, 5, 1, 6, 200, -100, 100);
- PlotUtils.setup2DRegion(plotters.get(plotterIndex), title, 1, "Layer #", "y [mm]", histo2D);
-
-// }
- 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));
- }
-
-
- for(AIDAFrame frame : frames){
- frame.pack();
- frame.setVisible(true);
- }
- }
-
- public void process(EventHeader event){
-
- totalEvents++;
-
+ public SvtPerformance() {
+ }
+
+ // --- Setters ---//
+ // ---------------//
+
+ /**
+ * Enable/disble debug mode
+ */
+ public void setEnableDebug(boolean debug) {
+ this.debug = debug;
+ }
+
+ public void setEnableHitPositionPlots(boolean enableHitPositionPlots) {
+ this.enableHitPositionPlots = enableHitPositionPlots;
+ }
+
+ protected void detectorChanged(Detector detector) {
+
+ // Initialize all maps
+ for(int layer = 1; layer < 6; layer++){
+ topLayerMap.put(layer, new ArrayList<HelicalTrackHit>());
+ bottomLayerMap.put(layer, new ArrayList<HelicalTrackHit>());
+ }
+
+ // setup AIDA
+ aida = AIDA.defaultInstance();
+ aida.tree().cd("/");
+
+ // Create AIDA Frames
+ for (int index = 0; index < 2; index++)
+ frames.add(new AIDAFrame());
+
+ // Set frame titles
+ frames.get(0).setTitle("Stereo Hit Positions");
+
+ String title = null;
+ IHistogram2D histo2D = null;
+ IHistogram1D histo1D = null;
+
+ // --- Hit Positions ---//
+ // ---------------------//
+ if (enableHitPositionPlots) {
+ plotters.add(PlotUtils.setupPlotter("Hit Positions", 1, 2));
+ title = "Hit Positions - XZ";
+ histo2D = aida.histogram2D(title, 5, 1, 6, 200, -100, 100);
+ histos2D.add(histo2D);
+ PlotUtils.setup2DRegion(plotters.get(plotterIndex), title, 0, "Layer #", "x [mm]", histo2D);
+ title = "Hit Positions - YZ";
+ histo2D = aida.histogram2D(title, 5, 1, 6, 200, -100, 100);
+ PlotUtils.setup2DRegion(plotters.get(plotterIndex), title, 1, "Layer #", "y [mm]", histo2D);
+
+ 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));
+ }
+
+ for (AIDAFrame frame : frames) {
+ frame.pack();
+ frame.setVisible(true);
+ }
+ }
+
+ public void process(EventHeader event) {
+ totalNumberEvents++;
+
// 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)
- System.out.println(this.getClass().getSimpleName() + ": Two track event found! Skipping ...!");
- return;
- }
-
- // Increment the event number
- totalNumberEvents++;
- topLayers = new double[5];
- bottomLayers = new double[5];
-
- if(event.hasCollection(HelicalTrackHit.class, stereoHitCollectionName)){
-
- // Get the list of HelicalTrackHits
- List<HelicalTrackHit> stereoHits =event.get(HelicalTrackHit.class, stereoHitCollectionName);
-
- for(HelicalTrackHit stereoHit : stereoHits){
-
- if(debug)
- System.out.println(this.getClass().getSimpleName() + " : Stereo Hit position = [" + stereoHit.x()
- + ", " + stereoHit.y() + ", " + stereoHit.z() + "]");
-
- // Get the layer associated with the stereoHit
- int layer = stereoHit.Layer();
- int arrayPosition = (layer - 1)/2;
-
- // Find the detector volume the hit corresponds to - Top or Bottom.
- // Then "add" the hit to the corresponding layer
- if(stereoHit.z() > 0){
- topLayers[arrayPosition]++;
- if(debug)
- System.out.println(this.getClass().getSimpleName() + " : Found Top Hit!");
- }
- else if(stereoHit.z() < 0){
- bottomLayers[arrayPosition]++;
- if(debug)
- System.out.println(this.getClass().getSimpleName() + " : Found Bottom Hit!");
- }
- else throw new RuntimeException("Invalid hit position - y = " + stereoHit.y());
- }
- }
-
- // Get the list of Ecal Clusters
- List<HPSEcalCluster> ecalClusters = event.get(HPSEcalCluster.class, ecalClustersCollectionName);
+ 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)
+ System.out.println(this.getClass().getSimpleName() + ": Two track event found! Skipping ...!");
+ return;
+ }
+
+ // Increment the event number
+ totalNumberSingleTrkEvents++;
+ this.clearLayers();
- // Check if there are four consencutive hits on either volume and
+ // Loop through all HelicalTrackHits and arrange them by layer
+ if (!event.hasCollection(HelicalTrackHit.class, stereoHitCollectionName)){
+ if(tracks.size() != 0) System.out.println("This event has a track but the HelicalTrackHit collection is empty");
+ return;
+ }
+
+ // Get the list of HelicalTrackHits
+ List<HelicalTrackHit> stereoHits = event.get(HelicalTrackHit.class, stereoHitCollectionName);
+
+ for (HelicalTrackHit stereoHit : stereoHits) {
+ if (debug)
+ System.out.println(this.getClass().getSimpleName() + " : Stereo Hit position = " + stereoHit.getCorrectedPosition().toString());
+
+ // Get the layer associated with the stereoHit
+ int layer = stereoHit.Layer();
+ int mapPosition = ((layer - 1)/2) + 1;
+
+ // Find the detector volume the hit corresponds to - Top or Bottom.
+ // Then "add" the hit to the corresponding layer
+ if (stereoHit.getCorrectedPosition().y() > 0) {
+ topLayerMap.get(mapPosition).add(stereoHit);
+ if (debug){
+ System.out.println(this.getClass().getSimpleName() + " : Found Top Hit!");
+ System.out.println(this.getClass().getSimpleName() + " : Layer " + stereoHit.Layer());
+ }
+
+ } else if (stereoHit.getCorrectedPosition().y() < 0) {
+ bottomLayerMap.get(mapPosition).add(stereoHit);
+ if (debug){
+ System.out.println(this.getClass().getSimpleName() + " : Found Bottom Hit!");
+ System.out.println(this.getClass().getSimpleName() + " : Layer " + stereoHit.Layer());
+ System.out.println(this.getClass().getSimpleName() + " : Layer Size: " + bottomLayerMap.get(mapPosition).size());
+ }
+ } else throw new RuntimeException("Invalid hit position - y = " + stereoHit.y());
+ }
+
+ // Get the list of Ecal Clusters
+ List<HPSEcalCluster> ecalClusters = event.get(HPSEcalCluster.class, ecalClustersCollectionName);
+
+ // Check if there are four consencutive hits on either volume and
// that there is an Ecal cluster in the same volume
- if(this.hasConsecutiveHits(topLayers) && !ecalClusters.isEmpty()){
+ if(!ecalClusters.isEmpty()){
+ if(debug) System.out.println(this.getClass().getSimpleName() + " Ecal Cluster size: " + ecalClusters.size());
for(HPSEcalCluster ecalCluster : ecalClusters){
- if(ecalCluster.getPosition()[1] > 0){
- possibleTracks++;
+ if(debug) System.out.println(this.getClass().getSimpleName() + " Cluster Position: [" + ecalCluster.getPosition()[0] + ", " + ecalCluster.getPosition()[1] + ", " + ecalCluster.getPosition()[2]);
+ if(ecalCluster.getPosition()[1] > 0 && this.topHasConsecutiveHits()){
+ if(debug) System.out.println(this.getClass().getSimpleName() + " : Found Possible Top Track!");
possibleTopTracks++;
- if(debug){
- System.out.println(this.getClass().getSimpleName() + " : Found Possible Top Track!");
- if(tracks.isEmpty())
- System.out.println(this.getClass().getSimpleName() + " : No Track Associated with this Possible Track!");
- }
+ possibleTracks++;
break;
+ } else if(ecalCluster.getPosition()[1] < 0 && this.bottomHasConsecutiveHits()){
+ if(debug) System.out.println(this.getClass().getSimpleName() + " : Found Possible Bottom Track!");
+ possibleBottomTracks++;
+ possibleTracks++;
+ break;
+ } else if(ecalCluster.getPosition()[1] < 0 && this.topHasConsecutiveHits()){
+ return;
+ }
+ else if(ecalCluster.getPosition()[1] > 0 && this.bottomHasConsecutiveHits()){
+ return;
}
}
+ } else if(ecalClusters.isEmpty()){
+ if(debug) System.out.println(this.getClass().getName() + " : No Ecal Clusters Found!");
}
-
- if(this.hasConsecutiveHits(bottomLayers) && !ecalClusters.isEmpty()){
- for(HPSEcalCluster ecalCluster : ecalClusters){
- if(ecalCluster.getPosition()[1] < 0){
- possibleTracks++;
- possibleBottomTracks++;
- if(debug){
- System.out.println(this.getClass().getSimpleName() + " : Found Possible Bottom Track!");
- if(tracks.isEmpty())
- System.out.println(this.getClass().getSimpleName() + " : No Track Associated with this Possible Track!");
+
+ // Only continue if an event has a track
+ if (tracks.isEmpty()) {
+ if (debug) System.out.println(this.getClass().getSimpleName() + ": No Tracks Were Found!");
+ return;
+ }
+
+ if (debug) System.out.println(this.getClass().getSimpleName() + ": Number of Tracks: " + tracks.size());
+
+ if(this.topHasConsecutiveHits() || this.bottomHasConsecutiveHits()){
+ totalTracksFound += tracks.size();
+ } else {
+ if(debug) System.out.println(this.getClass().getName() + ": Track has no helical track associated with it!");
+ }
+
+ for (SeedTrack track : tracks) {
+ trkUtil.setTrack(track);
+ extrapolator.setTrack(track);
+
+ // Check which volume the track corresponds to
+ if (trkUtil.getZ0() > 0 ) {
+ totalTopTracksFound++;
+ if (debug) System.out.println(this.getClass().getSimpleName() + " : Found Top Track!");
+ } else if (trkUtil.getZ0() < 0 ) {
+ totalBottomTracksFound++;
+ if (debug) System.out.println(this.getClass().getSimpleName() + " : Found Bottom Track!");
+ }
+
+ // Check if the track has four hits associated with it. This should
+ // be the case when
+ // only four hits are used to fit the track
+
+ if (track.getTrackerHits().size() == 4 && !ecalClusters.isEmpty()) {
+
+ // Get the position of the track at the last Layer
+ 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() < 67/* 69.89656 */&& trkPositionAtLayer5.y() > -27/*-28.73156*/
+ && trkPositionAtLayer5.z() > 11/* 12.59405 */&& trkPositionAtLayer5.z() < 47/* 50.93395 */) {
+
+ if (trkUtil.getZ0() > 0 && track.getChi2() < 10) {
+ for (HPSEcalCluster ecalCluster : ecalClusters) {
+ if (ecalCluster.getPosition()[1] > 0) {
+ totalFourHitTracks++;
+ // if (topLayers[4] > 0)
+ // totalTracksWith5LayersHit++;
+ // break;
+ }
+ }
}
- 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;
+// int arrayPosition = (hth.Layer() - 1) / 2;
+ // String title = "Hit Positions - Layer " +
+ // String.valueOf(arrayPosition+1);
+ // String title = "Hit Positions - XZ";
+ // System.out.println(title);
+ // aida.histogram2D(title).fill(arrayPosition + 1,
+ // hth.getCorrectedPosition().y());
+ // 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) {
+// if (ecalCluster.getPosition()[1] < 0) {
+ // totalTracksWith5LayersHit++;
+// break;
+// }
+// }
+// }
}
}
}
-
- // Only continue if an event has a track
- if(tracks.isEmpty()){
- if(debug)
- System.out.println(this.getClass().getSimpleName() + ": No Tracks Were Found!");
- return;
- }
-
- if(debug)
- System.out.println(this.getClass().getSimpleName() + ": Number of Tracks: " + tracks.size());
-
- totalTracksFound += tracks.size();
-
- for(SeedTrack track : tracks){
- trkUtil.setTrack(track);
- extrapolator.setTrack(track);
-
- // Check which volume the track corresponds to
- if(trkUtil.getZ0() > 0){
- totalTopTracksFound++;
- if(debug)
- System.out.println(this.getClass().getSimpleName() + " : Found Top Track!");
- }
- else if(trkUtil.getZ0() < 0){
- totalBottomTracksFound++;
- if(debug)
- System.out.println(this.getClass().getSimpleName() + " : Found Bottom Track!");
- }
-
- // Check if the track has four hits associated with it. This should be the case when
- // only four hits are used to fit the track
- if(track.getTrackerHits().size() == 4 && !ecalClusters.isEmpty()){
-
- // Get the position of the track at the last Layer
- 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() < 67/*69.89656*/ && trkPositionAtLayer5.y() > -27/*-28.73156*/ && trkPositionAtLayer5.z() > 11/*12.59405*/ && trkPositionAtLayer5.z() < 47/*50.93395*/){
-
- 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;
- int arrayPosition = (hth.Layer() - 1)/2;
-// String title = "Hit Positions - Layer " + String.valueOf(arrayPosition+1);
- String title = "Hit Positions - XZ";
- System.out.println(title);
- aida.histogram2D(title).fill(arrayPosition + 1, hth.getCorrectedPosition().y());
- 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){
- if(ecalCluster.getPosition()[1] < 0){
-// totalTracksWith5LayersHit++;
- break;
- }
- }
- }
- }
- }
- }
-
- if(debug){
- System.out.println("Number of tracks per event: " + (totalTracksFound/totalNumberEvents) );
- System.out.println("Total Track Reconstruction Efficiency: " + (totalTracksFound/possibleTracks));
- System.out.println("Total Top Track Reconstruction Efficiency " + (totalTopTracksFound/possibleTopTracks));
- System.out.println("Total Bottom Track Reconstruction Efficiency" + (totalBottomTracksFound/possibleBottomTracks));
- }
- }
-
- private boolean hasConsecutiveHits(double[] layers){
- for(int index = 0; index < 2; index++){
- if(layers[index] > 0 && layers[index + 1] > 0 && layers[index + 2] > 0 && layers[index + 3] > 0){
- return true;
- }
- }
-
- return false;
- }
-
- @Override
- public void endOfData(){
- System.out.println("%===================================================================% \n");
- System.out.println("Number of tracks per event: " + (totalTracksFound/totalNumberEvents) );
- System.out.println("Total Track Reconstruction Efficiency: " + (totalTracksFound/possibleTracks)*100 + "%");
- System.out.println("Total Top Track Reconstruction Efficiency: " + (totalTopTracksFound/possibleTopTracks)*100 + "%");
- 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");
+ }
+
+ private boolean hasConsecutiveHits(double[] layers) {
+ for (int index = 0; index < 2; index++) {
+ if (layers[index] > 0 && layers[index + 1] > 0 && layers[index + 2] > 0 && layers[index + 3] > 0) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private boolean topHasConsecutiveHits(){
+ for(int index = 1; index < 3; index++){
+ if(this.getNumberTopLayerHits(index) > 0 &&
+ this.getNumberTopLayerHits(index + 1) > 0 &&
+ this.getNumberTopLayerHits(index + 2) > 0 &&
+ this.getNumberTopLayerHits(index + 3) > 0 ){
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean bottomHasConsecutiveHits(){
+ for(int index = 1; index < 3; index++){
+ if(this.getNumberBottomLayerHits(index) > 0 &&
+ this.getNumberBottomLayerHits(index + 1) > 0 &&
+ this.getNumberBottomLayerHits(index + 2) > 0 &&
+ this.getNumberBottomLayerHits(index + 3) > 0){
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void clearLayers(){
+ for(int layer = 1; layer < 6; layer++){
+ topLayerMap.get(layer).clear();
+ bottomLayerMap.get(layer).clear();
+ }
+ }
+
+ private int getNumberTopLayerHits(int layer){
+ return topLayerMap.get(layer).size();
+ }
+
+ private int getNumberBottomLayerHits(int layer){
+ return bottomLayerMap.get(layer).size();
+ }
+
+ @Override
+ public void endOfData() {
+ System.out.println("%===================================================================% \n");
+ System.out.println("Number of tracks per event: " + (totalTracks/ totalNumberEvents));
+ System.out.println("Number of events with two tracks per event: " + (totalTwoTrackEvents/totalNumberEvents));
+ System.out.println("Total Track Reconstruction Efficiency: " + totalTracksFound + " / " + possibleTracks + " = " + (totalTracksFound / possibleTracks) * 100 + "%");
+ System.out.println("Total Top Track Reconstruction Efficiency: " + totalTopTracksFound + " / " + possibleTopTracks + " = " + (totalTopTracksFound / possibleTopTracks)* 100 + "%");
+ System.out.println("Total Bottom Track Reconstruction Efficiency: " + totalBottomTracksFound + " / " + possibleBottomTracks + " = " + (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 Two Track Events: " + (totalTwoTrackEvents / totalEvents) * 100 + "%");
+ System.out.println("%===================================================================% \n");
- }
+ }
}