hps-java/src/main/java/org/lcsim/hps/users/omoreno
diff -u -r1.1 -r1.2
--- TestRunTrackReconEfficiency.java 25 Apr 2013 21:03:40 -0000 1.1
+++ TestRunTrackReconEfficiency.java 30 Apr 2013 08:08:29 -0000 1.2
@@ -29,7 +29,7 @@
* method.
*
* @author Omar Moreno <[log in to unmask]>
- * @version $Id: TestRunTrackReconEfficiency.java,v 1.1 2013/04/25 21:03:40 omoreno Exp $
+ * @version $Id: TestRunTrackReconEfficiency.java,v 1.2 2013/04/30 08:08:29 omoreno Exp $
*/
public class TestRunTrackReconEfficiency extends Driver {
@@ -41,6 +41,8 @@
List<Track> botTracks;
SvtTrackExtrapolator extrapolator = new SvtTrackExtrapolator();
+ int plotterIndex = 0;
+
double eventNumber = 0;
double nOppositeVolume = 0;
double nWithinWindow = 0;
@@ -48,18 +50,27 @@
double nTrigClusterTrackMatch = 0;
double findableTracks, findableTopTracks,findableBottomTracks;
double totalTracks, totalTopTracks, totalBottomTracks;
- double thresholdEnergy = 0;
+ double thresholdEnergy = 0;
+ double energyDifference = 0;
boolean debug = false;
boolean topTrackIsFindable, bottomTrackIsFindable;
boolean topTrigger = false;
// Collection Names
- String stereoHitCollectionName = "HelicalTrackHits";
- String trackCollectionName = "MatchedTracks";
- String ecalClustersCollectionName = "EcalClusters";
- String triggerDataCollectionName = "TriggerBank";
-
+ String stereoHitCollectionName = "HelicalTrackHits";
+ String trackCollectionName = "MatchedTracks";
+ String ecalClustersCollectionName = "EcalClusters";
+ String triggerDataCollectionName = "TriggerBank";
+
+ // Plots
+ IHistogram1D findableTrackMomentum;
+ IHistogram1D totalTrackMomentum;
+ IHistogram1D xPositionResidual;
+ IHistogram1D yPositionResidual;
+ IHistogram1D zPositionResidual;
+ IHistogram1D r;
+
/**
* Dflt Ctor
*/
@@ -78,12 +89,47 @@
public void setThresholdEnergy(double thresholdEnergy){
this.thresholdEnergy = thresholdEnergy;
}
+
+ public void setClusterEnergyDifference(double energyDifference){
+ this.energyDifference = energyDifference;
+ }
/**
*
*/
protected void detectorChanged(Detector detector){
super.detectorChanged(detector);
+
+ // setup AIDA
+ aida = AIDA.defaultInstance();
+ aida.tree().cd("/");
+
+ // Open the output file stream
+
+ // Create plots of track reconstruction effiency vs momentum
+ plotters.add(PlotUtils.setupPlotter("Track Momentum", 0, 0));
+ findableTrackMomentum = aida.histogram1D("Momentum - Findable Tracks", 14, 0, 5.6);
+ PlotUtils.setup1DRegion(plotters.get(plotterIndex), "Momentum - Findable Tracks", 0, "Momentum [GeV]", findableTrackMomentum);
+ totalTrackMomentum = aida.histogram1D("Momentum - Reconstructed Tracks", 14, 0, 5.6);
+ PlotUtils.setup1DRegion(plotters.get(plotterIndex), "Momentum - Reconstructed Tracks", 0, "Momentum [GeV]", totalTrackMomentum);
+ plotterIndex++;
+
+ // Create plot for diffence in track and cluster position
+ plotters.add(PlotUtils.setupPlotter("Track-Cluster Position Residual", 2, 2));
+ xPositionResidual = aida.histogram1D("x Residual", 100, -100, 100);
+ yPositionResidual = aida.histogram1D("y Residual", 100, -100, 100);
+ zPositionResidual = aida.histogram1D("z Residual", 100, -100, 100);
+ r = aida.histogram1D("r", 100, -100, 100);
+ PlotUtils.setup1DRegion(plotters.get(plotterIndex), "x Residual", 0, "delta x [mm]", xPositionResidual);
+ PlotUtils.setup1DRegion(plotters.get(plotterIndex), "y Residual", 1, "delta y [mm]", yPositionResidual);
+ PlotUtils.setup1DRegion(plotters.get(plotterIndex), "z Residual", 2, "delta z [mm]", zPositionResidual);
+ PlotUtils.setup1DRegion(plotters.get(plotterIndex), "r", 3, "r [mm]", r);
+ plotterIndex++;
+
+ // Show all of the plotters
+ //for(IPlotter plotter : plotters) plotter.show();
+
+
}
/**
@@ -129,6 +175,11 @@
// Check that the difference between the Ecal cluster energies is
// reasonable
+ double energyDiff = Math.abs(ecalClusters.get(0).getEnergy() - ecalClusters.get(1).getEnergy());
+ if(energyDiff > energyDifference){
+ this.printDebug("The energy difference between the two clusters is too great.");
+ return;
+ }
// Check if the event contains a collection of tracks. If it doesn't,
// move on to the next event.