Print

Print


Commit in java/trunk/users/src on MAIN
main/java/org/hps/users/gcharles/FADCSignalAnalysis.java+1-1373 -> 383
main/java/org/hps/users/homer/HPSTrackerEvent.java+1-1373 -> 383
                             /HPSTrackerSample.java+1-1373 -> 383
main/java/org/hps/users/meeg/FilterMCBunches.java+1-1373 -> 383
                            /HPSEcalAnalogPrintDriver.java+1-1373 -> 383
                            /HPSEcalDigitalPrintDriver.java+1-1373 -> 383
                            /HPSEcalPrintDriver.java+1-1373 -> 383
                            /HPSEcalRawTrackerHitPrintDriver.java+1-1373 -> 383
                            /HPSGenericRawTrackerHitPrintDriver.java+1-1373 -> 383
                            /HitTimePrintDriver.java+1-1373 -> 383
                            /KinkAnalysisDriver.java+1-1373 -> 383
                            /LCIOTrackAnalysis.java+1-1373 -> 383
                            /MergeMCBunches.java+1-1373 -> 383
main/java/org/hps/users/mgraham/alignment/AlignmentParameters.java+1-1373 -> 383
                                         /HPSStrips.java+1-1373 -> 383
                                         /RunAlignment.java+1-1373 -> 383
                                         /SiTrackerSpectrometerSensorSetup.java+1-1373 -> 383
main/java/org/hps/users/mgraham/jlabrotation/DetailedAnalysisDriver.java+1-1373 -> 383
main/java/org/hps/users/ngraf/NearestNeighborCluster.java+1-1373 -> 383
                             /NearestNeighborClusterDriver.java+1-1373 -> 383
main/java/org/hps/users/omoreno/EcalHitPosition.java+1-1373 -> 383
                               /EventDataDriver.java+1-1373 -> 383
                               /LheToStdhep.java+1-1373 -> 383
                               /PlotUtils.java+1-1373 -> 383
                               /ReconstructedParticleChecker.java+1-1373 -> 383
                               /SimpleSvtTrigger.java+1-1373 -> 383
                               /SvtHitCorrelations.java+1-1373 -> 383
                               /SvtHitEfficiency.java+1-1373 -> 383
                               /SvtPerformance.java+1-1373 -> 383
                               /SvtQA.java+1-1373 -> 383
                               /SvtTrackAnalysis.java+1-1373 -> 383
                               /SvtTrackRecoEfficiency.java+1-1373 -> 383
                               /SvtTrackingPerformance.java+1-1373 -> 383
                               /TestRunTrackReconEfficiency.java+1-1373 -> 383
main/java/org/hps/users/phansson/AlignmentUtils.java+1-1373 -> 383
                                /BeamCurrentData.java+1-1373 -> 383
                                /CmpGenToFittedTracksDriver.java+1-1373 -> 383
                                /Count.java+1-1373 -> 383
                                /DAQDeadTimeData.java+1-1373 -> 383
                                /DumpAIDATextFiles.java+1-1373 -> 383
                                /ECalGainDriver.java+1-1373 -> 383
                                /ECalHitMapPlots.java+1-1373 -> 383
                                /FastTrack.java+1-1373 -> 383
                                /FastTrackResidualDriver.java+1-1373 -> 383
                                /GlobalParameter.java+1-1373 -> 383
                                /GlobalParameters.java+1-1373 -> 383
                                /MPAlignmentInputCalculator.java+2-2373 -> 383
                                /ModuleMPAlignmentInput.java+1-1373 -> 383
                                /MultScatAnalysis.java+1-1373 -> 383
                                /ParticleHelixProducer.java+1-1373 -> 383
                                /PolarCount.java+1-1373 -> 383
                                /ROOTFlatTupleDriver.java+1-1373 -> 383
                                /ResLimit.java+1-1373 -> 383
                                /RunMPAlignment.java+1-1373 -> 383
                                /SimpleHPSConditions.java+1-1373 -> 383
                                /SimpleResiduals.java+1-1373 -> 383
                                /StripMPAlignmentInput.java+1-1373 -> 383
                                /TestSort.java+1-1373 -> 383
                                /TrigRateAna.java+1-1373 -> 383
                                /TrigRateDriver.java+1-1373 -> 383
                                /TriggerTurnOnAnalysis.java+1-1373 -> 383
                                /TruthMomentumResolutionDriver.java+1-1373 -> 383
                                /WTrack.java+1-1373 -> 383
                                /dataMCPlots.java+1-1373 -> 383
                                /ecalGainAna.java+1-1373 -> 383
                                /ecalPlots.java+1-1373 -> 383
                                /mergeSimpleAIDA.java+1-1373 -> 383
                                /trigRate.java+1-1373 -> 383
main/java/org/hps/users/sarah/ExamplePlotter.java+1-1373 -> 383
main/java/org/hps/users/spaul/HitrateHistograms.java+1-1373 -> 383
main/java/org/lcsim/hps/users/mgraham/DetailedAnalysisDriver.java-1597382 removed
                                     /ElwinsTrackingRecon.java-1571382 removed
                                     /ExamplePlotter.java-113382 removed
                                     /FastTrackAnalysisDriver.java-936382 removed
                                     /HPSTrackerHit.java-43382 removed
                                     /HelicalTrackHitResidualsDriver.java-333382 removed
                                     /HitTimePlotter.java-490382 removed
                                     /JasAnalysisDriver.java-1017382 removed
                                     /KalmanFilterDriver.java-249382 removed
                                     /KalmanGeom.java-564382 removed
                                     /MainJASDriver.java-57382 removed
                                     /MyLCIOWriterDriver.java-91382 removed
                                     /PropXYXY_Test.java-530382 removed
                                     /SingleSensorHelicalTrackHitDriver.java-384382 removed
                                     /SingleSensorTrackerReconDriver.java-173382 removed
                                     /TestAnalysisDriver.java-135382 removed
                                     /TrackExtrapolationAnalysis.java-475382 removed
                                     /TwoTrackAnalysis.java-989382 removed
test/java/org/lcsim/hps/users/ngraf/NearestNeighborClusterDriverTest.java+4382 -> 383
+75-9818
18 removed + 71 modified, total 89 files
Move users packages to org.hps naming scheme.

java/trunk/users/src/main/java/org/hps/users/gcharles
FADCSignalAnalysis.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/gcharles/FADCSignalAnalysis.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/gcharles/FADCSignalAnalysis.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.gcharles;
+package org.hps.users.gcharles;
 
 import hep.aida.IHistogram1D;
 import hep.aida.IHistogram2D;

java/trunk/users/src/main/java/org/hps/users/homer
HPSTrackerEvent.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/homer/HPSTrackerEvent.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/homer/HPSTrackerEvent.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -23,7 +23,7 @@
  *   Tail = 1 x 32-bits
  *       Should be zero
  */
-package org.lcsim.hps.users.homer;
+package org.hps.users.homer;
 
 /**
  *

java/trunk/users/src/main/java/org/hps/users/homer
HPSTrackerSample.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/homer/HPSTrackerSample.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/homer/HPSTrackerSample.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -8,7 +8,7 @@
  *    Sample[3] = Z[1:0], Sample5[13:0]], Z[1:0], Sample4[13:0]
  * 
  */
-package org.lcsim.hps.users.homer;
+package org.hps.users.homer;
 
 /**
  *

java/trunk/users/src/main/java/org/hps/users/meeg
FilterMCBunches.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/meeg/FilterMCBunches.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/meeg/FilterMCBunches.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.meeg;
+package org.hps.users.meeg;
 
 import java.io.*;
 import java.util.ArrayList;

java/trunk/users/src/main/java/org/hps/users/meeg
HPSEcalAnalogPrintDriver.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/meeg/HPSEcalAnalogPrintDriver.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/meeg/HPSEcalAnalogPrintDriver.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -2,7 +2,7 @@
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
-package org.lcsim.hps.users.meeg;
+package org.hps.users.meeg;
 
 import java.io.IOException;
 import java.io.PrintWriter;

java/trunk/users/src/main/java/org/hps/users/meeg
HPSEcalDigitalPrintDriver.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/meeg/HPSEcalDigitalPrintDriver.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/meeg/HPSEcalDigitalPrintDriver.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -2,7 +2,7 @@
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
-package org.lcsim.hps.users.meeg;
+package org.hps.users.meeg;
 
 import java.io.IOException;
 import java.io.PrintWriter;

java/trunk/users/src/main/java/org/hps/users/meeg
HPSEcalPrintDriver.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/meeg/HPSEcalPrintDriver.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/meeg/HPSEcalPrintDriver.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.meeg;
+package org.hps.users.meeg;
 
 import java.io.IOException;
 import java.io.PrintWriter;

java/trunk/users/src/main/java/org/hps/users/meeg
HPSEcalRawTrackerHitPrintDriver.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/meeg/HPSEcalRawTrackerHitPrintDriver.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/meeg/HPSEcalRawTrackerHitPrintDriver.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -2,7 +2,7 @@
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
-package org.lcsim.hps.users.meeg;
+package org.hps.users.meeg;
 
 import java.io.IOException;
 import java.io.PrintWriter;

java/trunk/users/src/main/java/org/hps/users/meeg
HPSGenericRawTrackerHitPrintDriver.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/meeg/HPSGenericRawTrackerHitPrintDriver.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/meeg/HPSGenericRawTrackerHitPrintDriver.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -2,7 +2,7 @@
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
-package org.lcsim.hps.users.meeg;
+package org.hps.users.meeg;
 
 import java.io.IOException;
 import java.io.PrintWriter;

java/trunk/users/src/main/java/org/hps/users/meeg
HitTimePrintDriver.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/meeg/HitTimePrintDriver.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/meeg/HitTimePrintDriver.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.meeg;
+package org.hps.users.meeg;
 
 import java.util.List;
 

java/trunk/users/src/main/java/org/hps/users/meeg
KinkAnalysisDriver.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/meeg/KinkAnalysisDriver.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/meeg/KinkAnalysisDriver.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.meeg;
+package org.hps.users.meeg;
 
 import hep.aida.IHistogram1D;
 import hep.aida.IHistogram2D;

java/trunk/users/src/main/java/org/hps/users/meeg
LCIOTrackAnalysis.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/meeg/LCIOTrackAnalysis.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/meeg/LCIOTrackAnalysis.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.meeg;
+package org.hps.users.meeg;
 
 import hep.physics.vec.BasicHep3Vector;
 import hep.physics.vec.Hep3Vector;

java/trunk/users/src/main/java/org/hps/users/meeg
MergeMCBunches.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/meeg/MergeMCBunches.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/meeg/MergeMCBunches.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.meeg;
+package org.hps.users.meeg;
 
 import hep.physics.event.generator.MCEvent;
 import java.io.*;

java/trunk/users/src/main/java/org/hps/users/mgraham/alignment
AlignmentParameters.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/alignment/AlignmentParameters.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/mgraham/alignment/AlignmentParameters.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.mgraham.alignment;
+package org.hps.users.mgraham.alignment;
 
 import hep.physics.matrix.BasicMatrix;
 import hep.physics.matrix.MatrixOp;

java/trunk/users/src/main/java/org/hps/users/mgraham/alignment
HPSStrips.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/alignment/HPSStrips.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/mgraham/alignment/HPSStrips.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.mgraham.alignment;
+package org.hps.users.mgraham.alignment;
 /*
  * SiStrips.java
  *

java/trunk/users/src/main/java/org/hps/users/mgraham/alignment
RunAlignment.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/alignment/RunAlignment.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/mgraham/alignment/RunAlignment.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.mgraham.alignment;
+package org.hps.users.mgraham.alignment;
 
 import java.io.IOException;
 import java.util.List;

java/trunk/users/src/main/java/org/hps/users/mgraham/alignment
SiTrackerSpectrometerSensorSetup.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/alignment/SiTrackerSpectrometerSensorSetup.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/mgraham/alignment/SiTrackerSpectrometerSensorSetup.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.mgraham.alignment;
+package org.hps.users.mgraham.alignment;
 
 import hep.physics.matrix.BasicMatrix;
 import hep.physics.vec.BasicHep3Vector;

java/trunk/users/src/main/java/org/hps/users/mgraham/jlabrotation
DetailedAnalysisDriver.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/jlabrotation/DetailedAnalysisDriver.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/mgraham/jlabrotation/DetailedAnalysisDriver.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -2,7 +2,7 @@
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
-package org.lcsim.hps.users.mgraham.jlabrotation;
+package org.hps.users.mgraham.jlabrotation;
 
 import hep.aida.IAnalysisFactory;
 import hep.aida.IHistogram1D;

java/trunk/users/src/main/java/org/hps/users/ngraf
NearestNeighborCluster.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/ngraf/NearestNeighborCluster.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/ngraf/NearestNeighborCluster.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.ngraf;
+package org.hps.users.ngraf;
 
 import java.util.Map;
 import java.util.Set;

java/trunk/users/src/main/java/org/hps/users/ngraf
NearestNeighborClusterDriver.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/ngraf/NearestNeighborClusterDriver.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/ngraf/NearestNeighborClusterDriver.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.ngraf;
+package org.hps.users.ngraf;
 
 import java.util.ArrayList;
 import java.util.HashMap;

java/trunk/users/src/main/java/org/hps/users/omoreno
EcalHitPosition.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/omoreno/EcalHitPosition.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/omoreno/EcalHitPosition.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.omoreno;
+package org.hps.users.omoreno;
 
 //--- lcsim ---//
 import org.lcsim.event.GenericObject;

java/trunk/users/src/main/java/org/hps/users/omoreno
EventDataDriver.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/omoreno/EventDataDriver.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/omoreno/EventDataDriver.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.omoreno;
+package org.hps.users.omoreno;
 
 import java.util.ArrayList;
 import java.util.List;

java/trunk/users/src/main/java/org/hps/users/omoreno
LheToStdhep.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/omoreno/LheToStdhep.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/omoreno/LheToStdhep.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.omoreno;
+package org.hps.users.omoreno;
 
 
 import java.io.File;

java/trunk/users/src/main/java/org/hps/users/omoreno
PlotUtils.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/omoreno/PlotUtils.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/omoreno/PlotUtils.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.omoreno;
+package org.hps.users.omoreno;
 
 import hep.aida.ICloud2D;
 //--- hep ---//

java/trunk/users/src/main/java/org/hps/users/omoreno
ReconstructedParticleChecker.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/omoreno/ReconstructedParticleChecker.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/omoreno/ReconstructedParticleChecker.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.omoreno;
+package org.hps.users.omoreno;
 
 //--- java ---//
 //--- hep ---//

java/trunk/users/src/main/java/org/hps/users/omoreno
SimpleSvtTrigger.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/omoreno/SimpleSvtTrigger.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/omoreno/SimpleSvtTrigger.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.omoreno;
+package org.hps.users.omoreno;
 
 //--- java ---//
 import java.util.Iterator;

java/trunk/users/src/main/java/org/hps/users/omoreno
SvtHitCorrelations.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/omoreno/SvtHitCorrelations.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/omoreno/SvtHitCorrelations.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.omoreno;
+package org.hps.users.omoreno;
 
 //--- java ---//
 //--- aida ---//

java/trunk/users/src/main/java/org/hps/users/omoreno
SvtHitEfficiency.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/omoreno/SvtHitEfficiency.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/omoreno/SvtHitEfficiency.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.omoreno;
+package org.hps.users.omoreno;
 
 
 //--- java ---//

java/trunk/users/src/main/java/org/hps/users/omoreno
SvtPerformance.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/omoreno/SvtPerformance.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/omoreno/SvtPerformance.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.omoreno;
+package org.hps.users.omoreno;
 
 
 import hep.aida.IHistogram1D;

java/trunk/users/src/main/java/org/hps/users/omoreno
SvtQA.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/omoreno/SvtQA.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/omoreno/SvtQA.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.omoreno;
+package org.hps.users.omoreno;
 
 //--- HEP ---//
 import hep.aida.IHistogram1D;

java/trunk/users/src/main/java/org/hps/users/omoreno
SvtTrackAnalysis.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/omoreno/SvtTrackAnalysis.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/omoreno/SvtTrackAnalysis.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.omoreno;
+package org.hps.users.omoreno;
 
 //--- java ---//
 //--- hep ---//

java/trunk/users/src/main/java/org/hps/users/omoreno
SvtTrackRecoEfficiency.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/omoreno/SvtTrackRecoEfficiency.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/omoreno/SvtTrackRecoEfficiency.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.omoreno;
+package org.hps.users.omoreno;
 
 //--- java ---//
 //--- aida ---//

java/trunk/users/src/main/java/org/hps/users/omoreno
SvtTrackingPerformance.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/omoreno/SvtTrackingPerformance.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/omoreno/SvtTrackingPerformance.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.omoreno;
+package org.hps.users.omoreno;
 
 //--- java ---//
 import java.util.ArrayList;

java/trunk/users/src/main/java/org/hps/users/omoreno
TestRunTrackReconEfficiency.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/omoreno/TestRunTrackReconEfficiency.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/omoreno/TestRunTrackReconEfficiency.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.omoreno;
+package org.hps.users.omoreno;
 
 //--- java ---//
 //--- hep ---//

java/trunk/users/src/main/java/org/hps/users/phansson
AlignmentUtils.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/AlignmentUtils.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/AlignmentUtils.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -2,7 +2,7 @@
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 import hep.physics.matrix.BasicMatrix;
 import hep.physics.matrix.MatrixOp;

java/trunk/users/src/main/java/org/hps/users/phansson
BeamCurrentData.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/BeamCurrentData.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/BeamCurrentData.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -2,7 +2,7 @@
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 /**
  *

java/trunk/users/src/main/java/org/hps/users/phansson
CmpGenToFittedTracksDriver.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/CmpGenToFittedTracksDriver.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/CmpGenToFittedTracksDriver.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 import hep.aida.ICloud1D;
 import hep.aida.ICloud2D;

java/trunk/users/src/main/java/org/hps/users/phansson
Count.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/Count.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/Count.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -2,7 +2,7 @@
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 /**
  *

java/trunk/users/src/main/java/org/hps/users/phansson
DAQDeadTimeData.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/DAQDeadTimeData.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/DAQDeadTimeData.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -2,7 +2,7 @@
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 /**
  *

java/trunk/users/src/main/java/org/hps/users/phansson
DumpAIDATextFiles.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/DumpAIDATextFiles.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/DumpAIDATextFiles.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 import hep.aida.IAnalysisFactory;
 import hep.aida.IHistogram1D;

java/trunk/users/src/main/java/org/hps/users/phansson
ECalGainDriver.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/ECalGainDriver.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/ECalGainDriver.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 import hep.aida.IAnalysisFactory;
 import hep.aida.IHistogram1D;

java/trunk/users/src/main/java/org/hps/users/phansson
ECalHitMapPlots.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/ECalHitMapPlots.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/ECalHitMapPlots.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -2,7 +2,7 @@
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 import hep.aida.IAnalysisFactory;
 import hep.aida.IHistogram1D;

java/trunk/users/src/main/java/org/hps/users/phansson
FastTrack.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/FastTrack.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/FastTrack.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -2,7 +2,7 @@
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 import hep.physics.vec.BasicHep3Vector;
 import hep.physics.vec.Hep3Vector;

java/trunk/users/src/main/java/org/hps/users/phansson
FastTrackResidualDriver.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/FastTrackResidualDriver.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/FastTrackResidualDriver.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -2,7 +2,7 @@
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 import hep.aida.IAnalysisFactory;
 import hep.aida.IHistogram1D;

java/trunk/users/src/main/java/org/hps/users/phansson
GlobalParameter.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/GlobalParameter.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/GlobalParameter.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -2,7 +2,7 @@
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 import hep.physics.matrix.BasicMatrix;
 import hep.physics.vec.Hep3Matrix;

java/trunk/users/src/main/java/org/hps/users/phansson
GlobalParameters.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/GlobalParameters.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/GlobalParameters.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -2,7 +2,7 @@
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 import java.util.ArrayList;
 import java.util.List;

java/trunk/users/src/main/java/org/hps/users/phansson
MPAlignmentInputCalculator.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/MPAlignmentInputCalculator.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/MPAlignmentInputCalculator.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -2,7 +2,7 @@
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 import hep.aida.IAnalysisFactory;
 import hep.physics.matrix.BasicMatrix;
@@ -18,9 +18,9 @@
 import java.util.logging.Logger;
 
 import org.hps.recon.tracking.TrackerHitUtils;
+import org.hps.users.mgraham.alignment.RunAlignment;
 import org.lcsim.event.Track;
 import org.lcsim.fit.helicaltrack.HelicalTrackFit;
-import org.lcsim.hps.users.mgraham.alignment.RunAlignment;
 import org.lcsim.util.aida.AIDA;
 
 /**

java/trunk/users/src/main/java/org/hps/users/phansson
ModuleMPAlignmentInput.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/ModuleMPAlignmentInput.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/ModuleMPAlignmentInput.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 import hep.aida.ICloud1D;
 import hep.aida.IDataPointSet;

java/trunk/users/src/main/java/org/hps/users/phansson
MultScatAnalysis.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/MultScatAnalysis.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/MultScatAnalysis.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 import hep.aida.IAnalysisFactory;
 import hep.aida.IHistogram;

java/trunk/users/src/main/java/org/hps/users/phansson
ParticleHelixProducer.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/ParticleHelixProducer.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/ParticleHelixProducer.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 import hep.aida.ICloud1D;
 import hep.aida.IPlotter;

java/trunk/users/src/main/java/org/hps/users/phansson
PolarCount.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/PolarCount.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/PolarCount.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -2,7 +2,7 @@
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 
 

java/trunk/users/src/main/java/org/hps/users/phansson
ROOTFlatTupleDriver.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/ROOTFlatTupleDriver.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/ROOTFlatTupleDriver.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 import hep.aida.IHistogram1D;
 import hep.aida.IHistogram2D;

java/trunk/users/src/main/java/org/hps/users/phansson
ResLimit.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/ResLimit.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/ResLimit.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -2,7 +2,7 @@
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 import java.util.HashMap;
 import java.util.Iterator;

java/trunk/users/src/main/java/org/hps/users/phansson
RunMPAlignment.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/RunMPAlignment.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/RunMPAlignment.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 import hep.physics.vec.BasicHep3Vector;
 

java/trunk/users/src/main/java/org/hps/users/phansson
SimpleHPSConditions.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/SimpleHPSConditions.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/SimpleHPSConditions.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -2,7 +2,7 @@
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 import java.io.BufferedReader;
 import java.io.FileNotFoundException;

java/trunk/users/src/main/java/org/hps/users/phansson
SimpleResiduals.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/SimpleResiduals.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/SimpleResiduals.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -2,7 +2,7 @@
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 import hep.aida.IAnalysisFactory;
 import hep.aida.IHistogram1D;

java/trunk/users/src/main/java/org/hps/users/phansson
StripMPAlignmentInput.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/StripMPAlignmentInput.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/StripMPAlignmentInput.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 import hep.aida.ICloud1D;
 import hep.aida.IDataPointSet;

java/trunk/users/src/main/java/org/hps/users/phansson
TestSort.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/TestSort.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/TestSort.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -2,7 +2,7 @@
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 import java.util.ArrayList;
 import java.util.Collections;

java/trunk/users/src/main/java/org/hps/users/phansson
TrigRateAna.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/TrigRateAna.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/TrigRateAna.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -2,7 +2,7 @@
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 import hep.aida.IAnalysisFactory;
 import hep.aida.IDataPointSet;

java/trunk/users/src/main/java/org/hps/users/phansson
TrigRateDriver.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/TrigRateDriver.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/TrigRateDriver.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -2,7 +2,7 @@
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 import hep.aida.IAnalysisFactory;
 import hep.aida.IHistogram;

java/trunk/users/src/main/java/org/hps/users/phansson
TriggerTurnOnAnalysis.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/TriggerTurnOnAnalysis.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/TriggerTurnOnAnalysis.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -2,7 +2,7 @@
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 import hep.aida.IAnalysisFactory;
 import hep.aida.IHistogram1D;

java/trunk/users/src/main/java/org/hps/users/phansson
TruthMomentumResolutionDriver.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/TruthMomentumResolutionDriver.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/TruthMomentumResolutionDriver.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 import hep.aida.IAnalysisFactory;
 import hep.aida.ICloud1D;

java/trunk/users/src/main/java/org/hps/users/phansson
WTrack.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/WTrack.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/WTrack.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -2,7 +2,7 @@
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 import hep.physics.vec.BasicHep3Vector;
 import hep.physics.vec.Hep3Vector;

java/trunk/users/src/main/java/org/hps/users/phansson
dataMCPlots.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/dataMCPlots.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/dataMCPlots.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -2,7 +2,7 @@
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 import hep.aida.*;
 import hep.aida.ref.plotter.Plotter;

java/trunk/users/src/main/java/org/hps/users/phansson
ecalGainAna.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/ecalGainAna.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/ecalGainAna.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 import hep.aida.IAnalysisFactory;
 import hep.aida.IDataPointSet;

java/trunk/users/src/main/java/org/hps/users/phansson
ecalPlots.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/ecalPlots.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/ecalPlots.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -2,7 +2,7 @@
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 import hep.aida.IAnalysisFactory;
 import hep.aida.IHistogram1D;

java/trunk/users/src/main/java/org/hps/users/phansson
mergeSimpleAIDA.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/mergeSimpleAIDA.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/mergeSimpleAIDA.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 import hep.aida.*;
 import java.io.File;

java/trunk/users/src/main/java/org/hps/users/phansson
trigRate.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/phansson/trigRate.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/trigRate.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -2,7 +2,7 @@
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
-package org.lcsim.hps.users.phansson;
+package org.hps.users.phansson;
 
 import hep.aida.IAnalysisFactory;
 import hep.aida.ITree;

java/trunk/users/src/main/java/org/hps/users/sarah
ExamplePlotter.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/sarah/ExamplePlotter.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/sarah/ExamplePlotter.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.sarah;
+package org.hps.users.sarah;
 
 import hep.aida.IAnalysisFactory;
 import hep.aida.IHistogram1D;

java/trunk/users/src/main/java/org/hps/users/spaul
HitrateHistograms.java 373 -> 383
--- java/trunk/users/src/main/java/org/lcsim/hps/users/spaul/HitrateHistograms.java	2014-03-26 04:40:56 UTC (rev 373)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/HitrateHistograms.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,4 +1,4 @@
-package org.lcsim.hps.users.spaul;
+package org.hps.users.spaul;
 
 import hep.aida.IAnalysisFactory;
 import hep.aida.IHistogram2D;

java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham
DetailedAnalysisDriver.java removed after 382
--- java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/DetailedAnalysisDriver.java	2014-03-26 05:43:58 UTC (rev 382)
+++ java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/DetailedAnalysisDriver.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,1597 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.lcsim.hps.users.mgraham;
-
-import hep.aida.IAnalysisFactory;
-import hep.aida.IHistogram1D;
-import hep.aida.IHistogramFactory;
-import hep.aida.IProfile1D;
-import hep.physics.matrix.SymmetricMatrix;
-import hep.physics.vec.BasicHep3Vector;
-import hep.physics.vec.Hep3Vector;
-import hep.physics.vec.VecOp;
-
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.hps.recon.tracking.FindableTrack;
-import org.hps.recon.tracking.StraightLineTrack;
-import org.hps.recon.tracking.TrackAnalysis;
-import org.hps.recon.vertexing.BilliorTrack;
-import org.hps.recon.vertexing.BilliorVertex;
-import org.hps.recon.vertexing.BilliorVertexer;
-import org.lcsim.detector.IDetectorElement;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.LCRelation;
-import org.lcsim.event.MCParticle;
-import org.lcsim.event.RawTrackerHit;
-import org.lcsim.event.RelationalTable;
-import org.lcsim.event.SimTrackerHit;
-import org.lcsim.event.Track;
-import org.lcsim.event.TrackerHit;
-import org.lcsim.event.base.BaseRelationalTable;
-import org.lcsim.fit.helicaltrack.HelicalTrackCross;
-import org.lcsim.fit.helicaltrack.HelicalTrackFit;
-import org.lcsim.fit.helicaltrack.HelicalTrackHit;
-import org.lcsim.fit.helicaltrack.HelicalTrackStrip;
-import org.lcsim.fit.helicaltrack.HelixParamCalculator;
-import org.lcsim.fit.helicaltrack.HelixUtils;
-import org.lcsim.fit.helicaltrack.TrackDirection;
-import org.lcsim.geometry.Detector;
-import org.lcsim.recon.tracking.digitization.sisim.SiTrackerHitStrip1D;
-import org.lcsim.recon.tracking.seedtracker.SeedCandidate;
-import org.lcsim.recon.tracking.seedtracker.SeedTrack;
-import org.lcsim.util.Driver;
-import org.lcsim.util.aida.AIDA;
-
-/**
- *
- * @author mgraham
- */
-public class DetailedAnalysisDriver extends Driver {
-
-    private AIDA aida = AIDA.defaultInstance();
-    private IAnalysisFactory af = aida.analysisFactory();
-    private IProfile1D phifake;
-    private IProfile1D pfake;
-    private IProfile1D cthfake;
-    private IProfile1D peffFindable;
-    private IProfile1D thetaeffFindable;
-    private IProfile1D phieffFindable;
-    private IProfile1D ctheffFindable;
-    private IProfile1D d0effFindable;
-    private IProfile1D z0effFindable;
-    private IProfile1D peffElectrons;
-    private IProfile1D thetaeffElectrons;
-    private IProfile1D phieffElectrons;
-    private IProfile1D ctheffElectrons;
-    private IProfile1D d0effElectrons;
-    private IProfile1D z0effElectrons;
-    private IProfile1D peffAxial;
-    private IProfile1D thetaeffAxial;
-    private IProfile1D phieffAxial;
-    private IProfile1D ctheffAxial;
-    private IProfile1D d0effAxial;
-    private IProfile1D z0effAxial;
-    private IHistogram1D fakes;
-    private IHistogram1D nfakes;
-    private IProfile1D HitEffdEdX;
-    private IProfile1D ClHitEffdEdX;
-    private IProfile1D ClHitEffY;
-    private IProfile1D ClHitEffZ;
-    private IProfile1D STdEdXY;
-    private IProfile1D STdEdXZ;
-    private IProfile1D frdEdXY;
-    private IProfile1D VxEff;
-    private IProfile1D VyEff;
-    private IProfile1D VzEff;
-    private IProfile1D VxEffFindable;
-    private IProfile1D VyEffFindable;
-    private IProfile1D VzEffFindable;
-    public String outputPlots = "myplots.aida";
-    Map<String, IProfile1D> clsizeMap = new HashMap<String, IProfile1D>();
-    String[] detNames = {"Tracker"};
-    Integer[] nlayers = {12};
-    int trk_count = 0;
-    int nevt = 0;
-    int _nmcTrk = 0;
-    double _nrecTrk = 0;
-    double phiTrkCut = 0.3;
-    double cosThTrkCutMax = 0.2;
-    double cosThTrkCutMin = 0.05;
-    double pTrkCut = 0.5; //GeV
-    double d0TrkCut = 2.0; //mm
-    double z0TrkCut = 2.0; //mm
-    double etaTrkCut = 2.5;
-    int totelectrons = 0;
-    double foundelectrons = 0;
-    int findableelectrons = 0;
-    int findableTracks = 0;
-    double foundTracks = 0;
-    double beamP = 2.2;
-    public String outputTextName = "myevents.txt";
-    FileWriter fw;
-    PrintWriter pw;
-    double[] beamsize = {0.001, 0.02, 0.02};
-    int flipsign = 1;
-    public String _rawHitsName = "SVTRawTrackerHits";
-
-    public DetailedAnalysisDriver(int layers) {
-//        nlayers[0] = layers;
-        //  Define the efficiency histograms
-        IHistogramFactory hf = aida.histogramFactory();
-
-
-        peffFindable = hf.createProfile1D("Findable Efficiency vs p", "", 20, 0., beamP);
-        thetaeffFindable = hf.createProfile1D("Findable Efficiency vs theta", "", 20, 80, 100);
-        phieffFindable = hf.createProfile1D("Findable Efficiency vs phi", "", 25, -0.25, 0.25);
-        ctheffFindable = hf.createProfile1D("Findable Efficiency vs cos(theta)", "", 25, -0.25, 0.25);
-        d0effFindable = hf.createProfile1D("Findable Efficiency vs d0", "", 50, -2., 2.);
-        z0effFindable = hf.createProfile1D("Findable Efficiency vs z0", "", 50, -2., 2.);
-
-        peffElectrons = hf.createProfile1D("Electrons Efficiency vs p", "", 20, 0., beamP);
-        thetaeffElectrons = hf.createProfile1D("Electrons Efficiency vs theta", "", 20, 80, 100);
-        phieffElectrons = hf.createProfile1D("Electrons Efficiency vs phi", "", 25, -0.25, 0.25);
-        ctheffElectrons = hf.createProfile1D("Electrons Efficiency vs cos(theta)", "", 25, -0.25, 0.25);
-        d0effElectrons = hf.createProfile1D("Electrons Efficiency vs d0", "", 20, -1., 1.);
-        z0effElectrons = hf.createProfile1D("Electrons Efficiency vs z0", "", 20, -1., 1.);
-        /*
-         * peffAxial = hf.createProfile1D("Axial Efficiency vs p", "", 20, 0.,
-         * beamP); thetaeffAxial = hf.createProfile1D("Axial Efficiency vs
-         * theta", "", 20, 80, 100); phieffAxial = hf.createProfile1D("Axial
-         * Efficiency vs phi", "", 25, -0.25, 0.25); ctheffAxial =
-         * hf.createProfile1D("Axial Efficiency vs cos(theta)", "", 25, -0.25,
-         * 0.25); d0effAxial = hf.createProfile1D("Axial Efficiency vs d0", "",
-         * 20, -1., 1.); z0effAxial = hf.createProfile1D("Axial Efficiency vs
-         * z0", "", 20, -1., 1.);
-         */
-        cthfake = hf.createProfile1D("Fake rate vs  cos(theta)", "", 25, -0.25, 0.25);
-        phifake = hf.createProfile1D("Fake rate vs phi", "", 25, -0.25, 0.25);
-        pfake = hf.createProfile1D("Fake rate vs p", "", 20, 0, 6);
-
-        fakes = hf.createHistogram1D("Number of mis-matched hits (unnormalized)", "", 10, 0., 10.);
-        nfakes = hf.createHistogram1D("Number of mis-matched hits (normalized)", "", 10, 0., 10.);
-
-        HitEffdEdX = hf.createProfile1D("Strip Hit Efficiency vs dEdX", "", 50, 0, 0.3);
-        ClHitEffdEdX = hf.createProfile1D("Cluster Hit Efficiency vs dEdX", "", 50, 0, 0.3);
-        ClHitEffY = hf.createProfile1D("Cluster Hit Efficiency vs y", "", 50, -100, 100);
-        ClHitEffZ = hf.createProfile1D("Cluster Hit Efficiency vs z", "", 50, -100, 100);
-        STdEdXY = hf.createProfile1D("SimTHit dEdX vs y", "", 50, -100, 100);
-        frdEdXY = hf.createProfile1D("fractional dEdX vs y", "", 50, -100, 100);
-        STdEdXZ = hf.createProfile1D("SimTHit dEdX vs z", "", 50, -100, 100);
-
-        VxEff = hf.createProfile1D("Aprime Efficiency vs Vx", "", 25, 0., 50.);
-        VyEff = hf.createProfile1D("Aprime Efficiency vs Vy", "", 40, -0.2, 0.2);
-        VzEff = hf.createProfile1D("Aprime Efficiency vs Vz", "", 40, -0.2, 0.2);
-
-        VxEffFindable = hf.createProfile1D("Aprime Efficiency vs Vx: Findable", "", 25, 0., 50.);
-        VyEffFindable = hf.createProfile1D("Aprime Efficiency vs Vy: Findable", "", 40, -0.2, 0.2);
-        VzEffFindable = hf.createProfile1D("Aprime Efficiency vs Vz: Findable", "", 40, -0.2, 0.2);
-
-        int i, j;
-        for (i = 0; i < 1; i++) {
-            for (j = 0; j < nlayers[i]; j++) {
-                int laynum = j + 1;
-                String profname = detNames[i] + "_layer" + laynum + " cluster size vs y";
-                String key = detNames[i] + "_layer" + laynum;
-                clsizeMap.put(key, hf.createProfile1D(profname, 20, -15, 15));
-            }
-        }
-    }
-
-    @Override
-    public void detectorChanged(Detector detector) {
-        // Setup default stereo pairings, which should work for even number of
-        // modules.
-        nlayers[0] = detector.getSubdetector("Tracker").getLayering().getLayers().getNumberOfLayers();
-        System.out.println("Setting nlayers to " + nlayers[0]);
-    }
-
-    public void setRawHitsName(String rhname) {
-        _rawHitsName = rhname;
-    }
-
-    @Override
-    public void process(
-            EventHeader event) {
-        if (nevt == 0) {
-            try {
-//open things up
-                fw = new FileWriter(outputTextName);
-                pw = new PrintWriter(fw);
-            } catch (IOException ex) {
-                Logger.getLogger(DetailedAnalysisDriver.class.getName()).log(Level.SEVERE, null, ex);
-            }
-        }
-        //  Increment the event counter
-        nevt++;
-        String resDir = "residualsPlots/";
-        String resDirBar = "residualsBarrelPlots/";
-        String resDirEC = "residualsEndcapPlots/";
-        String simDir = "STHitPlots/";
-        String debugDir = "debugPlots/";
-        String occDir = "occupancyPlots/";
-        //  Get the magnetic field
-        Hep3Vector IP = new BasicHep3Vector(0., 0., 1.);
-        double bfield = event.getDetector().getFieldMap().getField(IP).y();
-//        System.out.println("bfield = " + bfield);
-        if (bfield < 0) {
-//            System.out.println("Flipping signs of reconstructed tracks!");
-            flipsign = -1;
-        }
-
-        List<RawTrackerHit> rawHits = event.get(RawTrackerHit.class, _rawHitsName);
-        List<SiTrackerHitStrip1D> stripHits = event.get(SiTrackerHitStrip1D.class, "StripClusterer_SiTrackerHitStrip1D");
-        //for (SiTrackerHitStrip1D cluster : stripHits) {
-        //    Hep3Vector measPos = cluster.getPositionAsVector();
-        //    double measdedx = cluster.getdEdx() * 1000.0;
-        //    Set<SimTrackerHit> SthFromRth = cluster.getSimHits();
-        //    if (SthFromRth.size() > 0) {
-        //        Hep3Vector mcPos = SthFromRth.iterator()
-        //then do somthing with mcPos & measPos...
-        //    }            
-        //}
-        System.out.println("RawHits Size = " + rawHits.size());
-
-        // dump SThit information      
-        String[] input_hit_collections = {"TrackerHits"};
-        for (String input : input_hit_collections) {
-            List<SimTrackerHit> sthits = event.getSimTrackerHits(input);
-            int[] nhits = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
-            for (SimTrackerHit st : sthits) {
-                String detector = st.getDetectorElement().getName();
-                int layer = st.getLayerNumber();
-                double[] hp = st.getPoint();
-                Hep3Vector hitPos = new BasicHep3Vector(hp[0], hp[1], hp[2]);
-                double r = Math.sqrt(hp[0] * hp[0] + hp[1] * hp[1]);
-                double theta = Math.atan2(r, hp[2]);
-                double eta = -Math.log(Math.tan(theta / 2));
-                double phi = Math.atan2(hp[1], hp[0]);
-                nhits[layer]++;
-                double hitwgt = 0;
-                double clhitwgt = 0;
-
-                for (RawTrackerHit rth : rawHits) {
-                    List<SimTrackerHit> SthFromRth = rth.getSimTrackerHits();
-                    if (SthFromRth != null && SthFromRth.contains(st)) {
-                        hitwgt = 1.0;
-                    }
-                }
-                for (SiTrackerHitStrip1D cluster : stripHits) {
-                    double measdedx = cluster.getdEdx() * 1000.0;
-
-                    List<RawTrackerHit> RthFromSith = cluster.getRawHits();
-
-                    for (RawTrackerHit rth : RthFromSith) {
-                        List<SimTrackerHit> SthFromRth = rth.getSimTrackerHits();
-                        if (SthFromRth != null && SthFromRth.contains(st)) {
-                            clhitwgt = 1.0;
-                            double totdedx = 0;
-                            for (SimTrackerHit sthtemp : SthFromRth) {
-                                totdedx = totdedx + sthtemp.getdEdx() * 1000.0;
-                            }
-                            aida.histogram1D(simDir + "delta dEdX", 50, -0.2, 0.2).fill(measdedx - totdedx);
-                            aida.histogram1D(simDir + "fractional dEdX", 50, -1, 1.).fill((measdedx - totdedx) / totdedx);
-                            aida.cloud1D(simDir + "fractional dEdX Cloud").fill((measdedx - totdedx) / totdedx);
-                            //          if (Math.abs((measdedx - dedx) / dedx) < 1)
-                            frdEdXY.fill(hp[1], (measdedx - totdedx) / totdedx);
-                            //          if (dedx == 0)
-                            //              System.out.println("*****************         dedx==0    ********");
-                        }
-                    }
-                }
-                //HitEffdEdX.fill(dedx, hitwgt);
-                //ClHitEffdEdX.fill(dedx, clhitwgt);
-                ClHitEffY.fill(hp[1], clhitwgt);
-                ClHitEffZ.fill(hp[2], clhitwgt);
-                //STdEdXY.fill(hp[1], dedx);
-                //STdEdXZ.fill(hp[2], dedx);
-                //aida.histogram1D(simDir + " dedx", 50, 0, 0.3).fill(dedx);
-//                if (hitwgt == 0) {
-//                    System.out.println("TrackAnalysis:  found an inefficiency hit:  " + dedx);
-//                }
-
-                //aida.cloud1D(simDir + input + " layer " + layer + " STHit p").fill(mom);
-                aida.cloud1D(simDir + input + " layer " + layer + " STHit y").fill(hp[1]);
-                aida.cloud1D(simDir + input + " layer " + layer + " STHit z").fill(hp[2]);
-                aida.cloud2D(simDir + input + " layer " + layer + " STHit y vs z").fill(hp[2], hp[1]);
-                aida.histogram2D(simDir + input + " layer " + layer + " STHit y vs z occupancy", 100, -15, 15, 500, -15, 15).fill(hp[2], hp[1]);
-
-            }
-            int i = 0;
-            while (i < nlayers[0]) {
-                if (nhits[i] > 0) {
-                    aida.cloud1D(simDir + input + "layer " + i + " number of ST hits").fill(nhits[i]);
-                }
-                i++;
-            }
-        }
-
-
-//        List<HelicalTrackHit> hthits = event.get(HelicalTrackHit.class, "MatchedHTHits");
-        List<HelicalTrackHit> NonRotatedHits = event.get(HelicalTrackHit.class, "HelicalTrackHits");
-        List<HelicalTrackHit> toththits = event.get(HelicalTrackHit.class, "RotatedHelicalTrackHits");
-        //    List<HelicalTrackHit> axialhits = event.get(HelicalTrackHit.class, "AxialTrackHits");
-
-//        int nAxialHitsTotal = axialhits.size();
-        int nL1Hits = 0;
-//        for (HelicalTrackHit hth : axialhits)
-//            if (hth.Layer() == 1)
-//                nL1Hits++;
-
-        Map<String, Integer> occupancyMap = new HashMap<String, Integer>();
-        for (RawTrackerHit rh : rawHits) {
-            IDetectorElement rhDetE = rh.getDetectorElement();
-
-            String rhDetName = rhDetE.getName();
-            int rhLayer = rh.getLayerNumber();
-
-            for (String myname : detNames) {
-                if (rhDetName.contains(myname)) {
-                    String detlayer = myname + "_" + rhLayer;
-                    Integer myint = occupancyMap.get(detlayer);
-                    if (myint == null) {
-                        myint = 1;
-                    }
-                    myint++;
-                    occupancyMap.put(detlayer, myint);
-                }
-            }
-        }
-        Set<String> mykeyset = (Set<String>) occupancyMap.keySet();
-        for (String keys : mykeyset) {
-            aida.cloud1D(occDir + keys + " # of hits").fill(occupancyMap.get(keys));
-        }
-
-        for (SiTrackerHitStrip1D stripCluster : stripHits) {
-            Hep3Vector strCluPos = stripCluster.getPositionAsVector();
-            stripCluster.getMeasuredCoordinate();
-            Hep3Vector measVec = stripCluster.getMeasuredCoordinate();
-            double umeas = VecOp.dot(strCluPos, measVec);
-
-            double yHit = strCluPos.y();
-            Set<MCParticle> mcparts = stripCluster.getMCParticles();
-            aida.cloud1D(occDir + "associated MC Particles").fill(mcparts.size());
-            List<RawTrackerHit> rthList = stripCluster.getRawHits();
-            int nhits = rthList.size();
-            String detlayer = "Foobar";
-            Hep3Vector sthPos = new BasicHep3Vector();
-            for (RawTrackerHit rth : rthList) {
-                List<SimTrackerHit> sth = rth.getSimTrackerHits();
-                if (sth != null && sth.size() > 0) {
-                    sthPos = sth.get(0).getPositionVec();
-                }
-                IDetectorElement rhDetE = rth.getDetectorElement();
-                String rhDetName = rhDetE.getName();
-                int rhLayer = rth.getLayerNumber();
-                for (String myname : detNames) {
-                    if (rhDetName.contains(myname)) {
-                        detlayer = myname + "_layer" + rhLayer;
-                    }
-                }
-            }
-            Hep3Vector resid = VecOp.sub(strCluPos, sthPos);
-            double magResid = resid.magnitude();
-            clsizeMap.get(detlayer).fill(yHit, nhits);
-            aida.cloud1D(occDir + detlayer + "associated MC Particles").fill(mcparts.size());
-            aida.cloud1D(occDir + detlayer + " cluster size").fill(nhits);
-        }
-
-        //  Create a relational table that maps TrackerHits to MCParticles
-        RelationalTable hittomc = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
-        // List<LCRelation> mcrelations = event.get(LCRelation.class, "HelicalTrackMCRelations");
-        List<LCRelation> mcrelations = event.get(LCRelation.class, "RotatedHelicalTrackMCRelations");
-
-        for (LCRelation relation : mcrelations) {
-            if (relation != null && relation.getFrom() != null && relation.getTo() != null) {
-                hittomc.add(relation.getFrom(), relation.getTo());
-            }
-        }
-
-//        RelationalTable hittomcAxial = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
-////        List<LCRelation> mcrelations = event.get(LCRelation.class, "HelicalTrackMCRelations");
-//        List<LCRelation> mcrelationsAxial = event.get(LCRelation.class, "AxialTrackMCRelations");
-//        for (LCRelation relation : mcrelationsAxial)
-//            if (relation != null && relation.getFrom() != null && relation.getTo() != null)
-//                hittomcAxial.add(relation.getFrom(), relation.getTo());
-
-        //  Instantiate the class that determines if a track is "findable"
-        FindableTrack findable = new FindableTrack(event);
-
-        //  Create a map between tracks and the associated MCParticle
-        List<Track> tracklist = event.get(Track.class, "MatchedTracks");
-        //   List<Track> axialtracklist = event.get(Track.class, "AxialTracks");
-
-        aida.cloud1D("Matched Tracks per Event").fill(tracklist.size());
-        //       aida.cloud1D("Axial Tracks per Event").fill(axialtracklist.size());
-        aida.cloud1D("HelicalTrackHits per Event").fill(toththits.size());
-        RelationalTable trktomc = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
-        RelationalTable trktomcAxial = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
-
-        int _nchRec = 0;
-        int _neleRec = 0;
-        int _nposRec = 0;
-        int _neleTru = 0;
-        int _nposTru = 0;
-        int _neleFake = 0;
-        int _nposFake = 0;
-
-        RelationalTable mcHittomcP = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
-
-        //  Get the collections of SimTrackerHits
-        List<List<SimTrackerHit>> simcols = event.get(SimTrackerHit.class);
-
-        //  Loop over the SimTrackerHits and fill in the relational table
-        for (List<SimTrackerHit> simlist : simcols) {
-            for (SimTrackerHit simhit : simlist) {
-                if (simhit.getMCParticle() != null) {
-                    mcHittomcP.add(simhit, simhit.getMCParticle());
-                }
-            }
-        }
-
-        Map<Track, TrackAnalysis> tkanalMap = new HashMap<Track, TrackAnalysis>();
-        RelationalTable nearestHitToTrack = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
-        Map<Track, Double> l1Isolation = new HashMap<Track, Double>();
-        Map<Track, Double> l1DeltaZ = new HashMap<Track, Double>();
-        Map<Track, BilliorTrack> btMap = new HashMap<Track, BilliorTrack>();
-//        String atrackdir = "TrackInfoAxial/";
-//        //  Analyze the tracks in the event
-//        for (Track atrack : axialtracklist) {
-//            double apx = atrack.getPX();
-//            aida.cloud1D(atrackdir + "pX").fill(apx);
-//        }
-        String trackdir = "TrackInfo/";
-        //  Analyze the tracks in the event
-        for (Track track : tracklist) {
-            //  Calculate the track pT and cos(theta)
-            double d0 = track.getTrackParameter(HelicalTrackFit.dcaIndex);
-            double z0 = track.getTrackParameter(HelicalTrackFit.z0Index);
-            double phi0 = track.getTrackParameter(HelicalTrackFit.phi0Index);
-            double slope = track.getTrackParameter(HelicalTrackFit.slopeIndex);
-            double curve = track.getTrackParameter(HelicalTrackFit.curvatureIndex);
-            double d0Err = Math.sqrt(track.getErrorMatrix().e(HelicalTrackFit.dcaIndex, HelicalTrackFit.dcaIndex));
-            double z0Err = Math.sqrt(track.getErrorMatrix().e(HelicalTrackFit.z0Index, HelicalTrackFit.z0Index));
-            double phi0Err = Math.sqrt(track.getErrorMatrix().e(HelicalTrackFit.phi0Index, HelicalTrackFit.phi0Index));
-            double slopeErr = Math.sqrt(track.getErrorMatrix().e(HelicalTrackFit.slopeIndex, HelicalTrackFit.slopeIndex));
-            double curveErr = Math.sqrt(track.getErrorMatrix().e(HelicalTrackFit.curvatureIndex, HelicalTrackFit.curvatureIndex));
-            _nchRec++;
-            if (track.getCharge() * flipsign < 0) {
-                _neleRec++;
-            }
-            if (track.getCharge() * flipsign > 0) {
-                _nposRec++;
-            }
-
-            SeedTrack stEle = (SeedTrack) track;
-            SeedCandidate seedEle = stEle.getSeedCandidate();
-            HelicalTrackFit ht = seedEle.getHelix();
-            TrackAnalysis tkanal = new TrackAnalysis(track, hittomc);
-
-            tkanalMap.put(track, tkanal);
-            BilliorTrack bt = new BilliorTrack(ht);
-
-            btMap.put(track, bt);
-            double xoca = ht.x0();
-            double yoca = ht.y0();
-            double[] poca = {xoca, yoca, z0};
-            double mom[] = track.getMomentum();
-            double px = mom[0];
-            double py = mom[1];
-            double pz = mom[2];
-            double pperp = Math.sqrt(py * py + pz * pz);
-            double pt = Math.sqrt(px * px + py * py);
-            double p = Math.sqrt(pt * pt + pz * pz);
-            double phi = Math.atan2(py, px);
-            double cth = pz / Math.sqrt(pt * pt + pz * pz);
-            double sth = pt / Math.sqrt(pt * pt + pz * pz);
-            double th = Math.atan2(pt, pz);
-            double eta = -Math.log(Math.tan(th / 2));
-
-
-
-            double s = HelixUtils.PathLength(ht, (HelicalTrackHit) track.getTrackerHits().get(0));
-            double y1 = HelixUtils.PointOnHelix(ht, s).y();
-            double z1 = HelixUtils.PointOnHelix(ht, s).z();
-
-            int nhits = tkanal.getNHitsNew();
-            double purity = tkanal.getPurityNew();
-            int nbad = tkanal.getNBadHitsNew();
-            //  int nbadAxial = tkanal.getNBadAxialHits();
-            int nbadZ = tkanal.getNBadZHits();
-            // int nAxial = tkanal.getNAxialHits();
-            int nZ = tkanal.getNZHits();
-            List<Integer> badLayers = tkanal.getBadHitList();
-            Integer badLayerEle = encodeBadHitList(badLayers);
-            if (badLayers.size() > 0) {
-//                System.out.println(badLayers.toString());
-//                System.out.println("Bad Layer code:  " + badLayerEle);
-            }
-            aida.cloud1D(trackdir + "Mis-matched hits for all tracks").fill(nbad);
-            aida.cloud1D(trackdir + "purityNew for all tracks").fill(purity);
-            // aida.cloud1D(trackdir + "Bad Axial hits for all tracks").fill(nbadAxial);
-            aida.cloud1D(trackdir + "Bad Z hits for all tracks").fill(nbadZ);
-            //  aida.cloud1D(trackdir + "Number of Axial hits for all tracks").fill(nAxial);
-            aida.cloud1D(trackdir + "Number of Z hits for all tracks").fill(nZ);
-
-            for (Integer bhit : badLayers) {
-                aida.histogram1D(trackdir + "Layer of Bad Hit", nlayers[0], 1, nlayers[0] + 1).fill(bhit);
-            }
-
-            //  Generate a normalized histogram after 1000 events
-            trk_count++;
-            if (nevt <= 1000) {
-                fakes.fill(nbad);
-            }
-
-            //  Make plots for fake, non-fake, and all tracks
-            if (purity < 0.5) {
-                if (track.getCharge() * flipsign < 0) {
-                    _neleFake++;
-                }
-                if (track.getCharge() * flipsign > 0) {
-                    _nposFake++;
-                }
-                cthfake.fill(cth, 1.0);
-                phifake.fill(phi, 1.0);
-                pfake.fill(p, 1.0);
-
-                fillTrackInfo(trackdir, "fake tracks", track.getChi2(), nhits, p, pperp, px, py, pz, phi, cth, d0, xoca, yoca, z0);
-
-            } else {
-                if (track.getCharge() * flipsign < 0) {
-                    _neleTru++;
-                }
-                if (track.getCharge() * flipsign > 0) {
-                    _nposTru++;
-                }
-                cthfake.fill(cth, 0.0);
-                phifake.fill(phi, 0.0);
-                pfake.fill(p, 0.0);
-
-                fillTrackInfo(trackdir, "non-fake tracks", track.getChi2(), nhits, p, pperp, px, py, pz, phi, cth, d0, xoca, yoca, z0);
-
-
-
-            }
-            fillTrackInfo(trackdir, "all tracks", track.getChi2(), nhits, p, pperp, px, py, pz, phi, cth, d0, xoca, yoca, z0);
-            if (nbadZ == 3) {
-                fillTrackInfo(trackdir, "3 Bad Z-hits", track.getChi2(), nhits, p, pperp, px, py, pz, phi, cth, d0, xoca, yoca, z0);
-            }
-
-//            System.out.println("Track info :");
-//            System.out.println("\t charge = " + track.getCharge() * flipsign);
-//            System.out.println("\t d0 = " + d0);
-//            System.out.println("\t z0 = " + z0);
-//            System.out.println("\t phi0 = " + phi0);
-//            System.out.println("\t slope = " + slope);
-//            System.out.println("\t curve = " + curve);
-            //  Now analyze MC Particles on this track
-            MCParticle mcp = tkanal.getMCParticleNew();
-            if (mcp != null) {
-
-                //  Create a map between the tracks found and the assigned MC particle
-                trktomc.add(track, tkanal.getMCParticleNew());
-
-                //  Calculate the MC momentum and polar angle
-                Hep3Vector Pmc = mcp.getMomentum();
-                double pxmc = Pmc.x();
-                double pymc = Pmc.y();
-                double pzmc = Pmc.z();
-                double ptmc = Math.sqrt(pxmc * pxmc + pymc * pymc);
-                double pmc = Math.sqrt(ptmc * ptmc + pzmc * pzmc);
-                double pxtk = track.getPX();
-                double pytk = track.getPY();
-                double pztk = track.getPZ();
-                double pttk = Math.sqrt(pxtk * pxtk + pytk * pytk);
-                double ptk = Math.sqrt(pttk * pttk + pztk * pztk);
-
-                //  Calculate the helix parameters for this MC particle and pulls in pT, d0
-                HelixParamCalculator helix = new HelixParamCalculator(mcp, bfield);
-                double d0mc = helix.getDCA();
-                double z0mc = helix.getZ0();
-                double phi0mc = helix.getPhi0();
-                double slopemc = helix.getSlopeSZPlane();
-                double curvemc = 1 / helix.getRadius();
-                double pinvresid = (1 / ptk - 1 / pmc);
-                double presid = (ptk - pmc);
-                double z0newMC = z0mc;
-                double y0newMC = d0mc;
-                aida.histogram1D(trackdir + "d0 Pull", 200, -8, 8).fill((d0 - d0mc) / d0Err);
-                aida.histogram1D(trackdir + "z0 Pull", 200, -8, 8).fill((z0 - z0mc) / z0Err);
-                aida.histogram1D(trackdir + "phi0 Pull", 200, -8, 8).fill((phi0 - phi0mc) / phi0Err);
-                aida.histogram1D(trackdir + "slope Pull", 200, -8, 8).fill((slope - slopemc) / slopeErr);
-                aida.histogram1D(trackdir + "curvature Pull", 200, -8, 8).fill((curve - curvemc) / curveErr);
-//                System.out.println("MC Particle info :");
-//                System.out.println("\t PDGID = " + mcp.getPDGID());
-//                if (mcp.getParents().size() > 0)
-//                    System.out.println("\t mother = " + mcp.getParents().get(0).getPDGID());
-//                System.out.println("\t charge = " + mcp.getCharge());
-//                System.out.println("\t d0 = " + d0mc);
-//                System.out.println("\t z0 = " + z0mc);
-//                System.out.println("\t phi0 = " + phi0mc);
-//                System.out.println("\t slope = " + slopemc);
-//                System.out.println("\t curve = " + curvemc);
-
-
-                BasicHep3Vector axial = new BasicHep3Vector();
-                axial.setV(0, 1, 0);
-                String hitdir = "HitsOnTrack/";
-                List<TrackerHit> hitsOnTrack = track.getTrackerHits();
-                MCParticle bestmcp = tkanal.getMCParticleNew();
-
-                String tkresid = "TrackResiduals/";
-
-                int ndaug = 0;
-                if (bestmcp != null) {
-                    ndaug = bestmcp.getDaughters().size();
-                }
-
-                double mcmom = 0;
-                double prevmom = 0;
-                double mytotchi2 = 0;
-
-                for (TrackerHit hit : hitsOnTrack) {
-
-                    int iplane = 0;
-                    HelicalTrackHit htc = (HelicalTrackHit) hit;
-                    List<MCParticle> mcpsHTH = htc.getMCParticles();
-                    int isbad = 0;
-                    if (mcpsHTH.isEmpty() || mcpsHTH.size() > 1 || !mcpsHTH.contains(bestmcp)) {
-                        isbad = 1;
-                    }
-                    double sHit = ht.PathMap().get(htc);
-                    Hep3Vector posonhelix = HelixUtils.PointOnHelix(ht, sHit);
-                    double yTr = posonhelix.y();
-                    double zTr = posonhelix.z();
-                    HelicalTrackCross cross = (HelicalTrackCross) htc;
-                    List<HelicalTrackStrip> clusterlist = cross.getStrips();
-                    TrackDirection trkdir = HelixUtils.CalculateTrackDirection(ht, sHit);
-                    cross.setTrackDirection(trkdir, ht.covariance());
-                    double y = cross.y();
-                    double z = cross.z();
-                    double yerr = Math.sqrt(cross.getCorrectedCovMatrix().e(1, 1));
-                    double zerr = Math.sqrt(cross.getCorrectedCovMatrix().e(2, 2));
-
-                    mytotchi2 += Math.pow((y - yTr) / yerr, 2);
-                    mytotchi2 += Math.pow((z - zTr) / zerr, 2);
-
-                    int htlayer = htc.Layer();
-                    if (htlayer == 1) {
-                        l1DeltaZ.put(track, z - zTr);
-                    }
-
-                    if (purity == 1 && track.getCharge() * flipsign > 0 && nhits == 10) {
-                        if (clusterlist.get(0).rawhits().size() == 1 && clusterlist.get(1).rawhits().size() == 1) {
-                            aida.cloud1D(hitdir + tkresid + "SingleStrip--Track delta y:  Layer " + htlayer).fill(y - yTr);
-                            aida.cloud1D(hitdir + tkresid + "SingleStrip--Track delta z:  Layer " + htlayer).fill(z - zTr);
-                        }
-                        aida.cloud1D(hitdir + tkresid + " Measured y:  Layer " + htlayer).fill(y);
-                        aida.cloud1D(hitdir + tkresid + " Track y:  Layer " + htlayer).fill(yTr);
-                        aida.cloud1D(hitdir + tkresid + " Measured z:  Layer " + htlayer).fill(z);
-                        aida.cloud1D(hitdir + tkresid + " Track z:  Layer " + htlayer).fill(zTr);
-                        aida.cloud1D(hitdir + tkresid + " Measured y ").fill(y);
-                        aida.cloud1D(hitdir + tkresid + " Track delta y:  Layer " + htlayer + "; ndaug=" + ndaug).fill(y - yTr);
-                        aida.cloud1D(hitdir + tkresid + " Track delta z:  Layer " + htlayer + "; ndaug=" + ndaug).fill(z - zTr);
-                        aida.cloud2D(hitdir + tkresid + " Track deltay vs delta z:  Layer " + htlayer).fill(z - zTr, y - yTr);
-                        if (htlayer == 1) {
-                            aida.cloud2D(hitdir + tkresid + " Layer 1 deltay vs xoca").fill(poca[0], y - yTr);
-                            aida.cloud2D(hitdir + tkresid + " Layer 1 deltay vs yoca").fill(poca[1], y - yTr);
-                            aida.cloud2D(hitdir + tkresid + " Layer 1 deltay vs zoca").fill(poca[2], y - yTr);
-                            aida.cloud2D(hitdir + tkresid + " Layer 1 deltaz vs xoca").fill(poca[0], z - zTr);
-                            aida.cloud2D(hitdir + tkresid + " Layer 1 deltaz vs yoca").fill(poca[1], z - zTr);
-                            aida.cloud2D(hitdir + tkresid + " Layer 1 deltaz vs zoca").fill(poca[2], z - zTr);
-                        }
-                        aida.cloud2D(hitdir + tkresid + " Track vs measured y:  Layer " + htlayer).fill(y, yTr);
-                        aida.cloud2D(hitdir + tkresid + " Track vs measured z:  Layer " + htlayer).fill(z, zTr);
-                        aida.cloud2D(hitdir + tkresid + " Track deltay vs S ").fill(sHit, y - yTr);
-                        aida.cloud2D(hitdir + tkresid + " Track deltaz vs S ").fill(sHit, z - zTr);
-                        aida.histogram1D(hitdir + tkresid + " Track pull y:  Layer " + htlayer, 200, -8, 8).fill((y - yTr) / yerr);
-                        aida.histogram1D(hitdir + tkresid + " Track pull z:  Layer " + htlayer, 200, -8, 8).fill((z - zTr) / zerr);
-                        aida.histogram2D(hitdir + tkresid + " Track pull y vs p:  Layer " + htlayer, 200, -8, 8, 200, 0, 5).fill((y - yTr) / yerr, pmc);
-                        aida.histogram2D(hitdir + tkresid + " Track pull z vs p:  Layer " + htlayer, 200, -8, 8, 200, 0, 5).fill((z - zTr) / zerr, pmc);
-
-
-                    }
-                    for (HelicalTrackStrip cl : clusterlist) {
-                        int ilayer = 0;
-                        List<MCParticle> mcps = cl.MCParticles();
-
-                        Hep3Vector corigin = cl.origin();
-                        Hep3Vector u = cl.u();
-                        double umeas = cl.umeas();
-                        Hep3Vector uvec = VecOp.mult(umeas, u);
-                        Hep3Vector clvec = VecOp.add(corigin, uvec);
-                        int layer = cl.layer();
-                        HelicalTrackStrip nearest = getNearestHit(cl, toththits);
-                        if (layer == 1) {
-                            Double l1Dist = getNearestDistance(cl, toththits);
-                            if (l1Dist != null) {
-                                l1Isolation.put(track, l1Dist);
-                            }
-                        }
-                        if (nearest != null) {
-                            nearestHitToTrack.add(track, nearest);
-                        }
-
-                        int badCl = 0;
-                        if (mcps.isEmpty() || mcps.size() > 1 || !mcps.contains(bestmcp)) {
-                            badCl = 1;
-                        }
-                        if (badCl == 1) {
-                            if (mcps.size() > 0 && mcps.get(0) != null) {
-                                MCParticle tmpmc = mcps.get(0);
-                                aida.cloud1D(hitdir + layer + " Momentum of bad hit ").fill(tmpmc.getMomentum().magnitude());
-                                aida.cloud1D(hitdir + layer + " PDGID of bad hit ").fill(tmpmc.getPDGID());
-                                for (MCParticle mymc : tmpmc.getParents()) {
-                                    aida.cloud1D(hitdir + layer + " PDGID of bad hit mother ").fill(mymc.getPDGID());
-                                }
-                            }
-                        }
-                        String label = "False hit";
-                        if (badCl == 0) {
-                            label = "True Hit ";
-                        }
-
-                        SimTrackerHit mcbesthit;
-                        Set<SimTrackerHit> mchitlist = mcHittomcP.allTo(bestmcp);
-
-                        double ymc = 0, zmc = 0;
-                        for (SimTrackerHit sthbest : mchitlist) {
-                            int slayer = sthbest.getLayer();
-                            if (layer == slayer) {
-                                mcbesthit = sthbest;
-                                ymc = mcbesthit.getPoint()[1];
-                                zmc = mcbesthit.getPoint()[2];
-                                mcmom = getMag(mcbesthit.getMomentum());
-                                if (prevmom > 0 && badCl == 0) {
-                                    aida.histogram1D(hitdir + layer + " MC energy difference ", 100, -0.005, 0.0).fill(mcmom - prevmom);
-                                    aida.histogram1D(hitdir + " MC energy difference ", 100, -0.005, 0.0).fill(mcmom - prevmom);
-                                }
-                                prevmom = mcmom;
-
-                            }
-                        }
-
-                        double axdotu = VecOp.dot(cl.u(), axial);
-                        boolean isAxial = false;
-                        if (axdotu > 0.5) {
-                            isAxial = true;
-                        }
-//                    aida.cloud2D(hitdir + layer + " y vs z " + label).fill(z, y);
-                        if (isAxial) {
-                            aida.cloud1D(hitdir + layer + " y " + label).fill(clvec.y());
-                            aida.cloud1D(hitdir + layer + " deltay " + label).fill(clvec.y() - ymc);
-                            aida.cloud2D(hitdir + layer + " y vs yMC " + label).fill(ymc, clvec.y());
-                        } else {
-                            aida.cloud1D(hitdir + layer + " z " + label).fill(clvec.z());
-                            aida.cloud1D(hitdir + layer + " deltaz " + label).fill(clvec.z() - zmc);
-                            aida.cloud2D(hitdir + layer + " z vs zMC " + label).fill(zmc, clvec.z());
-                        }
-                        Set<MCParticle> mclist = hittomc.allFrom(hit);
-                        aida.cloud1D(hitdir + layer + " Associated MC particles").fill(mclist.size());
-
-
-                    }
-                }
-                aida.histogram2D(hitdir + "trkChi2 vs my chi2", 100, 0, 100, 100, 0, 100).fill(track.getChi2(), mytotchi2);
-
-            }
-        }
-
-        //  Make the normalized fake plot after the specified number of events
-        if (nevt == 1000) {
-            double wgt = 1. / trk_count;
-            for (int i = 0; i < 10; i++) {
-                System.out.println(" Entries: " + fakes.binEntries(i) + " for mismatches: " + i);
-                for (int j = 0; j < fakes.binHeight(i); j++) {
-                    nfakes.fill(i, wgt);
-                }
-            }
-            System.out.println("Normalization: " + nfakes.sumAllBinHeights() + " after ntrk = " + trk_count);
-        }
-
-//analyze the axial only tracks
-//        for (Track track : axialtracklist) {
-//            TrackAnalysis tkanal = new TrackAnalysis(track, hittomcAxial);
-//            MCParticle mcp = tkanal.getMCParticle();
-//            if (mcp != null)
-//                //  Create a map between the tracks found and the assigned MC particle
-//                trktomcAxial.add(track, tkanal.getMCParticle());
-//
-//        }
-//        for (HelicalTrackHit hit : toththits) {
-        for (HelicalTrackHit hit : NonRotatedHits) {
-
-            int nAssHits = hit.getRawHits().size();
-            aida.cloud1D(debugDir + hit.Detector() + " nAssHits").fill(nAssHits);
-            Hep3Vector HTHPos = hit.getCorrectedPosition();
-            double rHit = Math.sqrt(HTHPos.x() * HTHPos.x() + HTHPos.y() * HTHPos.y());
-            double zHit = HTHPos.z();
-            double etaHit = -Math.log(Math.tan(Math.atan2(rHit, zHit) / 2));
-            double hitchisq = hit.chisq();
-
-            if (hit instanceof HelicalTrackCross) {
-                HelicalTrackCross cross = (HelicalTrackCross) hit;
-                List<HelicalTrackStrip> clusterlist = cross.getStrips();
-                double du_stereo = 0;
-                double du_axial = 0;
-                for (HelicalTrackStrip cluster : clusterlist) {
-
-                    int nstrips = cluster.rawhits().size();
-                    aida.cloud1D(debugDir + hit.Detector() + " nStrips-per-layer").fill(nstrips);
-                    Hep3Vector corigin = cluster.origin();
-                    Hep3Vector u = cluster.u();
-                    List<RawTrackerHit> rawhits = cluster.rawhits();
-                    double umc = -999999;
-                    double stenergy = -999999;
-                    String stripdir = "axial";
-                    double umeas = cluster.umeas();
-                    double charge = cluster.dEdx() * 1000.0;
-                    int layer = cluster.layer();
-                    for (RawTrackerHit rhit : rawhits) {
-
-                        String deName = rhit.getDetectorElement().getName();
-                        if (deName.contains("sensor1")) {
-                            stripdir = "stereo";
-                        }
-                        //                           System.out.println("Layer number  " + rhit.getLayerNumber() + "  " + deName);
-                        List<SimTrackerHit> sthits = rhit.getSimTrackerHits();
-                        if (sthits != null) {
-                            int nsthits = sthits.size();
-                            aida.cloud1D(debugDir + hit.Detector() + " associated ST hits").fill(nsthits);
-                            aida.cloud1D(debugDir + hit.Detector() + " layer" + stripdir + " associated ST hits").fill(nsthits);
-                            if (nsthits == 1) {
-                                double[] sthitD = sthits.get(0).getPoint();
-                                BasicHep3Vector sthit = new BasicHep3Vector(sthitD);
-                                stenergy = sthits.get(0).getdEdx();
-                                Hep3Vector vdiff = VecOp.sub(sthit, corigin);
-                                umc = VecOp.dot(vdiff, u);
-                            }
-                        }
-                    }
-
-
-                    //                        System.out.println("filling...");
-                    if (umc != -999999) {
-                        aida.histogram1D(debugDir + hit.Detector() + "dedx", 50, 0, 0.3).fill(charge);
-                        if (umc < 1 && umc > -1) {
-                            aida.cloud2D(debugDir + hit.Detector() + "cluster reco vs cluster mc").fill(umeas - umc, umc);
-                        }
-                        aida.cloud2D(debugDir + hit.Detector() + "cluster vs STHit dedx").fill(stenergy, charge);
-                        aida.cloud2D(debugDir + hit.Detector() + "cluster dedx vs delte(u)").fill(umeas - umc, charge);
-                        if (stripdir.contains("stereo")) {
-                            du_stereo = umeas - umc;
-                        }
-                        if (stripdir.contains("axial")) {
-                            du_axial = umeas - umc;
-                        }
-                        aida.histogram1D(debugDir + "layer=" + layer + " delta(u)", 50, -0.03, 0.03).fill(umeas - umc);
-                        aida.histogram1D(debugDir + hit.Detector() + " delta(u)", 50, -0.03, 0.03).fill(umeas - umc);
-                        if (nstrips == 1) {
-                            aida.histogram1D(debugDir + "layer=" + layer + " delta(u)--1 strip", 50, -0.03, 0.03).fill(umeas - umc);
-                            aida.histogram1D(debugDir + hit.Detector() + " delta(u)--1 strip", 50, -0.03, 0.03).fill(umeas - umc);
-                        }
-                        if (nstrips == 2) {
-                            aida.histogram1D(debugDir + "layer=" + layer + " delta(u)--2 strip", 50, -0.03, 0.03).fill(umeas - umc);
-                            aida.histogram1D(debugDir + hit.Detector() + " delta(u)--2 strip", 50, -0.03, 0.03).fill(umeas - umc);
-                        }
-                        if (nstrips == 3) {
-                            aida.histogram1D(debugDir + "layer=" + layer + " delta(u)--3 strip", 50, -0.03, 0.03).fill(umeas - umc);
-                            aida.histogram1D(debugDir + hit.Detector() + " delta(u)--3 strip", 50, -0.03, 0.03).fill(umeas - umc);
-                        }
-                    }
-
-                }
-                aida.cloud2D(debugDir + hit.Detector() + " delta(u) stereo v axial").fill(du_stereo, du_axial);
-            }
-        }
-
-        //analyze the event
-        int ApCand = 0;
-        String apdir = "Aprime/";
-        Track eleID = null;
-        Track posID = null;
-        MCParticle eleMC = null;
-        MCParticle posMC = null;
-        for (Track track : tracklist) {
-
-            TrackAnalysis tkanal = tkanalMap.get(track);
-            //  Calculate purity and make appropriate plots
-            MCParticle mcp = tkanal.getMCParticleNew();
-            if (mcp == null) {
-                continue;
-            }
-            if (mcp.getParents().size() == 1 && mcp.getParents().get(0).getPDGID() == 622) {
-                int nhits = tkanal.getNHitsNew();
-                double px = track.getPX();
-                double py = track.getPY();
-                double pz = track.getPZ();
-                double pt = Math.sqrt(px * px + py * py);
-                double pperp = Math.sqrt(py * py + pz * pz);
-                double p = Math.sqrt(pt * pt + pz * pz);
-                double phi = Math.atan2(py, px);
-                double cth = pz / Math.sqrt(pt * pt + pz * pz);
-
-                SeedTrack stEle = (SeedTrack) track;
-                SeedCandidate seedEle = stEle.getSeedCandidate();
-                HelicalTrackFit ht = seedEle.getHelix();
-                double doca = ht.dca();
-                double[] poca = {ht.x0(), ht.y0(), ht.z0()};
-                if (mcp.getCharge() > 0) {
-                    posID = track;
-                    posMC = mcp;
-                    fillTrackInfo(apdir, "positron", track.getChi2(), nhits, p, pperp, px, py, pz, phi, cth, doca, poca[0], poca[1], poca[2]);
-
-                } else {
-                    eleID = track;
-                    eleMC = mcp;
-                    fillTrackInfo(apdir, "electron", track.getChi2(), nhits, p, pperp, px, py, pz, phi, cth, doca, poca[0], poca[1], poca[2]);
-                }
-            }
-
-        }
-        String vertex = "Vertexing/";
-        String selected = "Selection/";
-        String nhitsTotal = "NumberOfHits/";
-        List<BilliorTrack> btlist = new ArrayList<BilliorTrack>();
-        for (Track track1 : tracklist) {
-            Track ele = null;
-            Track pos = null;
-            int ch1 = track1.getCharge() * flipsign;
-            int index = tracklist.indexOf(track1);
-            List<Track> subtracklist = tracklist.subList(index, tracklist.size());
-            for (Track track2 : subtracklist) {
-                int ch2 = track2.getCharge() * flipsign;
-                if (track1 != track2 && ch1 == -ch2) {
-                    ele = track1;
-                    pos = track2;
-//                    System.out.println("Found two oppositely charged tracks!  Lets look at them");
-                    if (ch1 > 0) {
-                        ele = track2;
-                        pos = track1;
-                    }
-                    ApCand++;
-                    int nElectron = ele.getTrackerHits().size();
-                    int nPositron = pos.getTrackerHits().size();
-                    BilliorTrack btEle = btMap.get(ele);
-                    BilliorTrack btPos = btMap.get(pos);
-                    btlist.clear();
-                    btlist.add(btEle);
-                    btlist.add(btPos);
-
-
-
-
-                    BilliorVertexer bvertexerUC = new BilliorVertexer(bfield);
-                    BilliorVertex bvertexUC = bvertexerUC.fitVertex(btlist);
-//                    bvertexUC.fitVertex(btlist);
-                    Hep3Vector bvtxPosUC =  bvertexUC.getPosition();
-                    SymmetricMatrix bvtxCovUC = bvertexUC.getCovMatrix();
-                    double invMassUC = bvertexUC.getParameters().get("invMass");
-//                    System.out.println("UnConstrained");
-//                    System.out.println("Vertex Position:  " + bvtxPosUC.toString());
-//                    System.out.println("chisq :  " + bvertexUC.getChiSq());
-                    aida.histogram1D("BilliorVertex X  -- UnConstrained", 100, -10, 20).fill(bvtxPosUC.x());
-                    aida.histogram1D("BilliorVertex Y -- UnConstrained", 100, -0.4, 0.4).fill(bvtxPosUC.y());
-                    aida.histogram1D("BilliorVertex Z -- UnConstrained", 100, -0.4, 0.4).fill(bvtxPosUC.z());
-                    aida.histogram1D("BilliorVertex ChiSq -- UnConstrained", 100, 0, 50).fill(bvertexUC.getChi2());
-                    aida.histogram1D("BilliorVertex X Pull -- UnConstrained", 100, -4, 4).fill(bvtxPosUC.x() / Math.sqrt(bvtxCovUC.e(0, 0)));
-                    aida.histogram1D("BilliorVertex Y Pull-- UnConstrained", 100, -4, 4).fill(bvtxPosUC.y() / Math.sqrt(bvtxCovUC.e(1, 1)));
-                    aida.histogram1D("BilliorVertex Z Pull-- UnConstrained", 100, -4, 4).fill(bvtxPosUC.z() / Math.sqrt(bvtxCovUC.e(2, 2)));
-
-
-                    aida.cloud1D(apdir + "e+e- Invariant Mass").fill(invMassUC);
-                    if (eleMC != null && posMC != null && ele == eleID && pos == posID) {
-                        aida.cloud1D(apdir + "Matched A' Invariant Mass").fill(invMassUC);
-                    }
[truncated at 1000 lines; 600 more skipped]

java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham
ElwinsTrackingRecon.java removed after 382
--- java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/ElwinsTrackingRecon.java	2014-03-26 05:43:58 UTC (rev 382)
+++ java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/ElwinsTrackingRecon.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,1571 +0,0 @@
-package org.lcsim.hps.users.mgraham;
-
-import hep.aida.IAnalysisFactory;
-import hep.aida.IHistogram1D;
-import hep.aida.IHistogram2D;
-import hep.aida.IPlotter;
-import hep.aida.IPlotterStyle;
-import hep.physics.matrix.SymmetricMatrix;
-import hep.physics.vec.Hep3Vector;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.hps.conditions.deprecated.BeamlineConstants;
-import org.hps.conditions.deprecated.SvtUtils;
-import org.hps.recon.ecal.HPSEcalCluster;
-import org.hps.recon.tracking.DumbShaperFit;
-import org.hps.recon.tracking.HPSShaperFitAlgorithm;
-import org.hps.recon.tracking.HPSTrack;
-import org.hps.recon.tracking.HelixConverter;
-import org.hps.recon.tracking.StraightLineTrack;
-import org.hps.util.AIDAFrame;
-import org.hps.util.Resettable;
-import org.lcsim.detector.tracker.silicon.SiSensor;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.RawTrackerHit;
-import org.lcsim.event.Track;
-import org.lcsim.event.TrackerHit;
-import org.lcsim.fit.helicaltrack.HelicalTrackCross;
-import org.lcsim.fit.helicaltrack.HelicalTrackFit;
-import org.lcsim.fit.helicaltrack.HelicalTrackHit;
-import org.lcsim.geometry.Detector;
-import org.lcsim.geometry.IDDecoder;
-import org.lcsim.recon.tracking.seedtracker.SeedCandidate;
-import org.lcsim.recon.tracking.seedtracker.SeedTrack;
-import org.lcsim.util.Driver;
-import org.lcsim.util.aida.AIDA;
-
-import Jama.Matrix;
-import Jama.SingularValueDecomposition;
-
-/**
- *
- * @author elwinm
- */
-public class ElwinsTrackingRecon extends Driver implements Resettable {
-
-    private AIDAFrame plotterFrame;
-    private AIDAFrame topFrame;
-    private AIDAFrame bottomFrame;
-    private AIDAFrame chargeFrame;
-    private AIDAFrame twotrackFrame;
-    private AIDA aida = AIDA.defaultInstance();
-    private String rawTrackerHitCollectionName = "SVTRawTrackerHits";
-    private String fittedTrackerHitCollectionName = "SVTFittedRawTrackerHits";
-    private String trackerHitCollectionName = "StripClusterer_SiTrackerHitStrip1D";
-    private String helicalTrackHitCollectionName = "HelicalTrackHits";
-    private String rotatedTrackHitCollectionName = "RotatedHelicalTrackHits";
-    private String helicalTrackHitRelationsCollectionName = "HelicalTrackHitRelations";
-    private String trackCollectionName = "MatchedTracks";
-    private String trackerName = "Tracker";
-    String ecalSubdetectorName = "Ecal";
-    String ecalCollectionName = "EcalClusters";
-    private Detector detector = null;
-    IDDecoder dec;
-    private int eventCount;
-    private List<SiSensor> sensors;
-    private String outputPlots = null;
-    IPlotter plotter;
-    IPlotter plotter2;
-    IPlotter plotter22;
-    IPlotter plotter222;
-    IPlotter plotter3;
-    IPlotter plotter3_1;
-    IPlotter plotter3_2;
-    IPlotter plotter4;
-    IPlotter plotter5;
-    IPlotter plotter5_1;
-    IPlotter plotter55;
-    IPlotter plotter6;
-    IPlotter plotter7;
-    IPlotter plotter9000;
-    IPlotter plotter9001;
-    IPlotter plotter9002;
-    IPlotter plotter9003;
-    IPlotter plotter9004;
-    IPlotter plotter9005;
-    IPlotter plotter9006;
-    IPlotter plotter9007;
-    IPlotter plotter9008;
-    IPlotter plotter9009;
-    IPlotter plotter9010;
-    IPlotter plotter9011;
-    IPlotter plotter9012;
-    IPlotter plotter9013;
-    IPlotter plotter9014;
-    IPlotter plotter9015;
-    IPlotter plotter9016;
-    IPlotter plotter9017;
-    IPlotter twotrkextra;
-    IPlotter twotrkextra2;
-    IPlotter threetrack;
-    IPlotter top1;
-    IPlotter top2;
-    IPlotter top3;
-    IPlotter top4;
-    IPlotter bot1;
-    IPlotter bot2;
-    IPlotter bot3;
-    IPlotter charge;
-    IPlotter bot4;
-    double zEcal = 1500;
-    double zAtDownStrPairSpec = 914.0; //mm
-    double zAtColl = -1500;
-    IHistogram1D trkPx;
-    IHistogram1D nTracks;
-    HPSShaperFitAlgorithm _shaper = new DumbShaperFit();
-
-    protected void detectorChanged(Detector detector) {
-        this.detector = detector;
-        aida.tree().cd("/");
-        plotterFrame = new AIDAFrame();
-        plotterFrame.setTitle("HPS Tracking Plots");
-
-        twotrackFrame = new AIDAFrame();
-        twotrackFrame.setTitle("Two Track Plots");
-
-        sensors = detector.getSubdetector(trackerName).getDetectorElement().findDescendants(SiSensor.class);
-
-        IAnalysisFactory fac = aida.analysisFactory();
-        plotter = fac.createPlotterFactory().create("HPS Tracking Plots");
-        plotter.setTitle("Momentum");
-        IPlotterStyle style = plotter.style();
-        style.dataStyle().fillStyle().setColor("yellow");
-        style.dataStyle().errorBarStyle().setVisible(false);
-        plotter.createRegions(2, 2);
-        plotterFrame.addPlotter(plotter);
-
-        trkPx = aida.histogram1D("Track X Momentum", 25, -0.25, 0.25);
-        IHistogram1D trkPy = aida.histogram1D("Track Y Momentum", 25, -0.1, 0.1);
-        IHistogram1D trkPz = aida.histogram1D("Track Z Momentum", 25, 0, 3.5);
-        IHistogram1D trkChi2 = aida.histogram1D("Track Chi2", 25, 0, 25.0);
-
-        plotter.region(0).plot(trkPx);
-        plotter.region(1).plot(trkPy);
-        plotter.region(2).plot(trkPz);
-        plotter.region(3).plot(trkChi2);
-
-
-        plotter2 = fac.createPlotterFactory().create("HPS Tracking Plots");
-        plotter2.setTitle("Track extrapolation");
-        plotterFrame.addPlotter(plotter2);
-        IPlotterStyle style2 = plotter2.style();
-        style2.dataStyle().fillStyle().setColor("yellow");
-        style2.dataStyle().errorBarStyle().setVisible(false);
-        plotter2.createRegions(2, 4);
-        IHistogram1D xAtConverter = aida.histogram1D("X (mm) @ Z=-60cm", 50, -50, 50);
-        IHistogram1D yAtConverter = aida.histogram1D("Y (mm) @ Z=-60cm", 50, -20, 20);
-        IHistogram1D xAtColl = aida.histogram1D("X (mm) @ Z=-150cm", 50, -200, 200);
-        IHistogram1D yAtColl = aida.histogram1D("Y (mm) @ Z=-150cm", 50, -200, 200);
-        IHistogram1D xAtEcal = aida.histogram1D("X (mm) @ ECAL", 50, -500, 500);
-        IHistogram1D yAtEcal = aida.histogram1D("Y (mm) @ ECAL", 50, -100, 100);
-        IHistogram1D xAtConvert = aida.histogram1D("X (mm) @ Converter", 50, -50, 50);
-        IHistogram1D yAtConvert = aida.histogram1D("Y (mm) @ Converter", 50, -20, 20);
-
-        plotter2.region(0).plot(xAtConverter);
-        plotter2.region(4).plot(yAtConverter);
-        plotter2.region(1).plot(xAtColl);
-        plotter2.region(5).plot(yAtColl);
-        plotter2.region(2).plot(xAtEcal);
-        plotter2.region(6).plot(yAtEcal);
-        plotter2.region(3).plot(xAtConvert);
-        plotter2.region(7).plot(yAtConvert);
-
-        twotrkextra = fac.createPlotterFactory().create("Two Trk Extrapolation");
-        twotrkextra.setTitle("Stuff");
-        plotterFrame.addPlotter(twotrkextra);
-        IPlotterStyle styletwo = twotrkextra.style();
-        styletwo.dataStyle().fillStyle().setColor("blue");
-        styletwo.dataStyle().errorBarStyle().setVisible(false);
-        twotrkextra.createRegions(3, 2);
-        IHistogram1D x1AtTarget = aida.histogram1D("Trk1 X @ Target", 50, 0, 50);
-        IHistogram1D y1AtTarget = aida.histogram1D("Trk1 Y @ Target", 50, -5, 5);
-        IHistogram1D x2AtTarget = aida.histogram1D("Trk2 X @ Target", 50, 0, 50);
-        IHistogram1D y2AtTarget = aida.histogram1D("Trk2 Y @ Target", 50, -5, 5);
-        IHistogram1D distatt = aida.histogram1D("Distance btwn Trks @ Target", 40, 0, 40);
-        IHistogram1D zdiff = aida.histogram1D("Z Diff", 40, -.1, .1);
-
-        twotrkextra.region(0).plot(x1AtTarget);
-        twotrkextra.region(1).plot(y1AtTarget);
-        twotrkextra.region(2).plot(x2AtTarget);
-        twotrkextra.region(3).plot(y2AtTarget);
-        twotrkextra.region(4).plot(distatt);
-        twotrkextra.region(5).plot(zdiff);
-
-
-        plotter222 = fac.createPlotterFactory().create("HPS Tracking Plots");
-        plotter222.setTitle("Other");
-        plotterFrame.addPlotter(plotter222);
-        IPlotterStyle style222 = plotter222.style();
-        style222.dataStyle().fillStyle().setColor("yellow");
-        style222.dataStyle().errorBarStyle().setVisible(false);
-        plotter222.createRegions(2, 3);
-
-        IHistogram1D nHits = aida.histogram1D("Hits per Track", 2, 4, 6);
-        IHistogram1D amp = aida.histogram1D("Amp (HitOnTrack)", 50, 0, 5000);
-        IHistogram1D ampcl = aida.histogram1D("Amp (CluOnTrack)", 50, 0, 5000);
-        IHistogram1D amp2 = aida.histogram1D("Amp Pz>1000 (HitOnTrack)", 50, 0, 5000);
-        IHistogram1D ampcl2 = aida.histogram1D("Amp Pz>1000 (CluOnTrack)", 50, 0, 5000);
-        nTracks = aida.histogram1D("Tracks per Event", 3, 0, 3);
-
-        plotter222.region(0).plot(nHits);
-        plotter222.region(3).plot(nTracks);
-        plotter222.region(1).plot(amp);
-        plotter222.region(4).plot(amp2);
-        plotter222.region(2).plot(ampcl);
-        plotter222.region(5).plot(ampcl2);
-
-
-        plotterFrame.pack();
-        plotterFrame.setVisible(true);
-
-
-        twotrkextra2 = fac.createPlotterFactory().create("Two Trk Uncertainties");
-        twotrkextra2.setTitle("Uncertainties");
-        plotter9000 = fac.createPlotterFactory().create("Two Track Plots");
-        plotter9000.setTitle("Two Track Plots Test");
-        IPlotterStyle TwoTracks = plotter9000.style();
-        plotter9001 = fac.createPlotterFactory().create("Two Track Plots 2");
-        plotter9001.setTitle("Two Track Plots Test 2");
-        IPlotterStyle TwoTracks1 = plotter9001.style();
-        plotter9002 = fac.createPlotterFactory().create("Two Track Plots");
-        plotter9002.setTitle("Two Track Plots Test");
-        IPlotterStyle TwoTracks2 = plotter9002.style();
-        plotter9003 = fac.createPlotterFactory().create("Two Track Plots");
-        plotter9003.setTitle("Two Track Plots Test");
-        IPlotterStyle TwoTracks3 = plotter9003.style();
-        plotter9004 = fac.createPlotterFactory().create("Two Track Plots");
-        plotter9004.setTitle("Two Track Plots Test");
-        IPlotterStyle TwoTracks4 = plotter9004.style();
-        plotter9005 = fac.createPlotterFactory().create("Two Track Plots");
-        plotter9005.setTitle("Two Track Plots Test");
-        IPlotterStyle TwoTracks5 = plotter9005.style();
-        plotter9006 = fac.createPlotterFactory().create("Two Track Versus");
-        plotter9006.setTitle("Two Track Versus");
-        IPlotterStyle TwoTracks6 = plotter9006.style();
-        plotter9007 = fac.createPlotterFactory().create("Two Track Plots");
-        plotter9007.setTitle("Two Track Plots Test");
-        IPlotterStyle TwoTracks7 = plotter9007.style();
-        plotter9008 = fac.createPlotterFactory().create("Two Track Plots");
-        plotter9008.setTitle("Two Track Plots Test");
-        IPlotterStyle TwoTracks8 = plotter9000.style();
-        plotter9009 = fac.createPlotterFactory().create("Two Track Plots");
-        plotter9009.setTitle("Two Track Plots Test");
-        IPlotterStyle TwoTracks9 = plotter9000.style();
-        plotter9010 = fac.createPlotterFactory().create("Two Track Plots");
-        plotter9010.setTitle("Two Track Plots Test");
-        IPlotterStyle TwoTracks10 = plotter9010.style();
-        plotter9011 = fac.createPlotterFactory().create("Two Track Plots");
-        plotter9011.setTitle("Two Track Plots Test");
-        IPlotterStyle TwoTracks11 = plotter9011.style();
-        plotter9012 = fac.createPlotterFactory().create("Two Track Plotz");
-        plotter9012.setTitle("Two Track Plotz Test");
-        IPlotterStyle TwoTracks12 = plotter9012.style();
-        plotter9013 = fac.createPlotterFactory().create("Two Track Plotz");
-        plotter9013.setTitle("Two Track Plotz Test");
-        IPlotterStyle TwoTracks13 = plotter9013.style();
-        plotter9014 = fac.createPlotterFactory().create("Two Track Plotz");
-        plotter9014.setTitle("Two Track Plotz Test");
-        IPlotterStyle TwoTracks14 = plotter9014.style();
-        plotter9015 = fac.createPlotterFactory().create("Two Track Plots");
-        plotter9015.setTitle("Two Track Plots Test");
-        IPlotterStyle TwoTracks15 = plotter9015.style();
-        plotter9016 = fac.createPlotterFactory().create("Two Track Plots");
-        plotter9016.setTitle("Test");
-        IPlotterStyle TwoTracks16 = plotter9016.style();
-        plotter9017 = fac.createPlotterFactory().create("Two Track Plots");
-        plotter9017.setTitle("Residuals");
-        IPlotterStyle TwoTracks17 = plotter9017.style();
-        threetrack = fac.createPlotterFactory().create("Three Track Plots");
-        threetrack.setTitle("Invariant Mass");
-
-
-        TwoTracks.dataStyle().fillStyle().setColor("green");
-        TwoTracks.dataStyle().errorBarStyle().setVisible(false);
-        TwoTracks.setParameter("hist2DStyle", "colorMap");
-        TwoTracks.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-        TwoTracks1.dataStyle().fillStyle().setColor("green");
-        TwoTracks1.dataStyle().errorBarStyle().setVisible(false);
-        TwoTracks1.setParameter("hist2DStyle", "colorMap");
-        TwoTracks1.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-        TwoTracks2.dataStyle().fillStyle().setColor("green");
-        TwoTracks2.dataStyle().errorBarStyle().setVisible(false);
-        TwoTracks2.setParameter("hist2DStyle", "colorMap");
-        TwoTracks2.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-        TwoTracks3.dataStyle().fillStyle().setColor("green");
-        TwoTracks3.dataStyle().errorBarStyle().setVisible(false);
-        TwoTracks3.setParameter("hist2DStyle", "colorMap");
-        TwoTracks3.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-        TwoTracks4.dataStyle().fillStyle().setColor("green");
-        TwoTracks4.dataStyle().errorBarStyle().setVisible(false);
-        TwoTracks4.setParameter("hist2DStyle", "colorMap");
-        TwoTracks4.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-        TwoTracks5.dataStyle().fillStyle().setColor("green");
-        TwoTracks5.dataStyle().errorBarStyle().setVisible(false);
-        TwoTracks5.setParameter("hist2DStyle", "colorMap");
-        TwoTracks5.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-        TwoTracks6.dataStyle().fillStyle().setColor("green");
-        TwoTracks6.dataStyle().errorBarStyle().setVisible(false);
-        TwoTracks6.setParameter("hist2DStyle", "colorMap");
-        TwoTracks6.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-        TwoTracks7.dataStyle().fillStyle().setColor("green");
-        TwoTracks7.dataStyle().errorBarStyle().setVisible(false);
-        TwoTracks7.setParameter("hist2DStyle", "colorMap");
-        TwoTracks7.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-        TwoTracks8.dataStyle().fillStyle().setColor("green");
-        TwoTracks8.dataStyle().errorBarStyle().setVisible(false);
-        TwoTracks8.setParameter("hist2DStyle", "colorMap");
-        TwoTracks8.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-        TwoTracks9.dataStyle().fillStyle().setColor("green");
-        TwoTracks9.dataStyle().errorBarStyle().setVisible(false);
-        TwoTracks9.setParameter("hist2DStyle", "colorMap");
-        TwoTracks9.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-        TwoTracks10.dataStyle().fillStyle().setColor("green");
-        TwoTracks10.dataStyle().errorBarStyle().setVisible(false);
-        TwoTracks10.setParameter("hist2DStyle", "colorMap");
-        TwoTracks10.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-        TwoTracks11.dataStyle().fillStyle().setColor("green");
-        TwoTracks11.dataStyle().errorBarStyle().setVisible(false);
-        TwoTracks11.setParameter("hist2DStyle", "colorMap");
-        TwoTracks11.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-        TwoTracks12.dataStyle().fillStyle().setColor("green");
-        TwoTracks12.dataStyle().errorBarStyle().setVisible(false);
-        TwoTracks13.dataStyle().fillStyle().setColor("green");
-        TwoTracks13.dataStyle().errorBarStyle().setVisible(false);
-        TwoTracks14.dataStyle().fillStyle().setColor("green");
-        TwoTracks14.dataStyle().errorBarStyle().setVisible(false);
-        TwoTracks15.dataStyle().fillStyle().setColor("green");
-        TwoTracks15.dataStyle().errorBarStyle().setVisible(false);
-        TwoTracks15.setParameter("hist2DStyle", "colorMap");
-        TwoTracks15.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-        TwoTracks16.dataStyle().fillStyle().setColor("green");
-        TwoTracks16.dataStyle().errorBarStyle().setVisible(false);
-        TwoTracks16.setParameter("hist2DStyle", "colorMap");
-        TwoTracks16.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-        IPlotterStyle styletwotwo = twotrkextra2.style();
-        styletwotwo.dataStyle().fillStyle().setColor("blue");
-        styletwotwo.dataStyle().errorBarStyle().setVisible(false);
-
-        IPlotterStyle threesty = threetrack.style();
-        threesty.dataStyle().fillStyle().setColor("blue");
-        threesty.dataStyle().errorBarStyle().setVisible(false);
-
-
-
-        twotrkextra2.createRegions(3, 2);
-        plotter9000.createRegion();
-        plotter9001.createRegion();
-        plotter9002.createRegions(2, 1);
-        plotter9003.createRegion();
-        plotter9004.createRegion();
-        plotter9005.createRegion();
-        plotter9006.createRegions(1, 3);
-        plotter9007.createRegions(2, 3);
-        plotter9008.createRegions(2, 2);
-        plotter9009.createRegions(2, 2);
-        plotter9010.createRegions(2, 2);
-        plotter9011.createRegions(2, 2);
-        plotter9012.createRegions(2, 2);
-        //   plotter9013.createRegions(2, 2);
-        //    plotter9014.createRegions(2, 2);
-        plotter9015.createRegions(2, 2);
-        plotter9016.createRegions(2, 2);
-        plotter9017.createRegions(2, 2);
-        threetrack.createRegion();
-
-        twotrackFrame.addPlotter(plotter9000);
-        twotrackFrame.addPlotter(plotter9001);
-        twotrackFrame.addPlotter(plotter9002);
-        twotrackFrame.addPlotter(plotter9003);
-        twotrackFrame.addPlotter(plotter9004);
-        twotrackFrame.addPlotter(plotter9005);
-        twotrackFrame.addPlotter(plotter9006);
-        twotrackFrame.addPlotter(plotter9007);
-        twotrackFrame.addPlotter(plotter9008);
-        twotrackFrame.addPlotter(plotter9009);
-        twotrackFrame.addPlotter(plotter9010);
-        twotrackFrame.addPlotter(plotter9011);
-        twotrackFrame.addPlotter(plotter9012);
-        //   twotrackFrame.addPlotter(plotter9013);
-        //  twotrackFrame.addPlotter(plotter9014);
-        twotrackFrame.addPlotter(plotter9015);
-        twotrackFrame.addPlotter(plotter9016);
-        twotrackFrame.addPlotter(plotter9017);
-        twotrackFrame.addPlotter(twotrkextra2);
-        twotrackFrame.addPlotter(threetrack);
-
-        IHistogram1D trkbins = aida.histogram1D("Track Distributions", 5, -2, 3);
-        IHistogram2D twtrkptot = aida.histogram2D("Total P+ vs. P-", 60, 0, 4, 60, 0, 4);
-        IHistogram1D sumtrks = aida.histogram1D("Sum of Track's Momentums", 100, -1, 7);
-        IHistogram1D invarmass = aida.histogram1D("Invariant Mass", 50, 0, .2);
-        IHistogram1D perptrks = aida.histogram1D("Perpendicular Momentum", 100, 0, .1);
-        IHistogram2D pyppm = aida.histogram2D("Py+ vs. Py-", 60, -.1, .1, 60, -.1, .1);
-        IHistogram2D pzppm = aida.histogram2D("Pz+ vs. Pz-", 60, -.1, .1, 60, -.1, .1);
-        IHistogram1D px = aida.histogram1D("Two Track X Momentum", 40, 0, 4);
-        IHistogram1D py = aida.histogram1D("Two Track Y Momentum", 40, -.1, .1);
-        IHistogram1D pz = aida.histogram1D("Two Track Z Momentum", 40, -.1, .1);
-        IHistogram1D chi2 = aida.histogram1D("Tracks Chi2", 25, 0, 25.0);
-        IHistogram1D bbpx = aida.histogram1D("Big Bump Track Momenta (Px)", 40, 0, 4);
-        IHistogram1D bbpy = aida.histogram1D("Big Bump Track Momenta (Py)", 40, -.1, .1);
-        IHistogram1D bbpz = aida.histogram1D("Big Bump Track Momenta (Pz)", 40, -.1, .1);
-        IHistogram1D bbchi2 = aida.histogram1D("Big Bump Tracks Chi2", 25, 0, 25.0);
-        IHistogram1D spx = aida.histogram1D("Split Track Momenta (Px)", 40, 0, 4);
-        IHistogram1D spy = aida.histogram1D("Split Track Momenta (Py)", 40, -.1, .1);
-        IHistogram1D spz = aida.histogram1D("Split Track Momenta (Pz)", 40, -.1, .1);
-        IHistogram1D schi2 = aida.histogram1D("Split Tracks Chi2", 25, 0, 25.0);
-        IHistogram1D bbsumtrks = aida.histogram1D("Big Bump Sum of Track's Momentums", 50, -1, 7);
-        IHistogram2D bbpppm = aida.histogram2D("Big Bump P+ vs. P-", 50, 0, 4, 50, 0, 4);
-        IHistogram2D lbpppm = aida.histogram2D("Little Bump P+ vs. P-", 50, 0, 4, 50, 0, 4);
-        IHistogram1D lbsumtrks = aida.histogram1D("Little Bump Sum of Track's Momentums", 50, -1, 7);
-        IHistogram1D lbpx = aida.histogram1D("Little Bump Track Momenta (Px)", 40, 0, 4);
-        IHistogram1D lbpy = aida.histogram1D("Little Bump Track Momenta (Py)", 40, -.1, .1);
-        IHistogram1D lbpz = aida.histogram1D("Little Bump Track Momenta (Pz)", 40, -.1, .1);
-        IHistogram1D lbchi2 = aida.histogram1D("Little Bump Tracks Chi2", 25, 0, 25.0);
-        //     IHistogram1D q0spx = aida.histogram1D("Net Charge 0 Split Track Momenta (Px)", 40, 0, 4);
-        //     IHistogram1D q0spy = aida.histogram1D("Net Charge 0 Split Track Momenta (Py)", 40, -.1, .1);
-        //     IHistogram1D q0spz = aida.histogram1D("Net Charge 0 Split Track Momenta (Pz)", 40, -.1, .1);
-        //     IHistogram1D q0schi2 = aida.histogram1D("Net Charge 0 Split Tracks Chi2", 25, 0, 25.0);
-        IHistogram2D xyemt = aida.histogram2D("X v Y - e- Top", 50, -30, 50, 50, -35, 30);
-        IHistogram2D xzemt = aida.histogram2D("X v Z - e- Top", 50, -30, 50, 50, -800, -450);
-        IHistogram2D yzemt = aida.histogram2D("Y v Z - e- Top", 50, -35, 30, 50, -800, -450);
-        IHistogram1D qbins = aida.histogram1D("Charge Distributions", 5, -2, 3);
-        IHistogram1D lbtp = aida.histogram1D("Little Bump Track Parity", 7, 0, 7);
-        IHistogram1D bbtp = aida.histogram1D("Big Bump Track Parity", 7, 0, 7);
-        IHistogram1D xvert = aida.histogram1D("XVertex", 40, -30, 50);
-        IHistogram1D yvert = aida.histogram1D("YVertex", 40, -35, 30);
-        IHistogram1D zvert = aida.histogram1D("ZVertex", 40, -800, -450);
-        IHistogram1D dist = aida.histogram1D("Distance btwn Trks @ Solution", 40, 0, 20);
-        IHistogram1D xres = aida.histogram1D("X Res Trk1", 40, -0.25, 0.25);
-        IHistogram1D yres = aida.histogram1D("Y Res Trk1", 40, -0.25, 0.25);
-        IHistogram1D xres2 = aida.histogram1D("X Res Trk2", 40, -0.25, 0.25);
-        IHistogram1D yres2 = aida.histogram1D("Y Res Trk2", 40, -0.25, 0.25);
-        IHistogram1D unx1 = aida.histogram1D("Uncert X Trk 1", 50, 0, 10);
-        IHistogram1D uny1 = aida.histogram1D("Uncert Y Trk 1", 50, 0, 10);
-        IHistogram1D unz1 = aida.histogram1D("Uncert Z Trk 1", 50, 0, 40);
-        IHistogram1D unx2 = aida.histogram1D("Uncert X Trk 2", 50, 0, 10);
-        IHistogram1D uny2 = aida.histogram1D("Uncert Y Trk 2", 50, 0, 10);
-        IHistogram1D unz2 = aida.histogram1D("Uncert Z Trk 2", 50, 0, 40);
-        IHistogram2D xy = aida.histogram2D("X v Y", 50, -30, 50, 50, -35, 30);
-        IHistogram2D xz = aida.histogram2D("X v Z", 50, -30, 50, 50, -800, -450);
-        IHistogram2D yz = aida.histogram2D("Y v Z", 50, -35, 30, 50, -800, -450);
-        IHistogram2D xyept = aida.histogram2D("X v Y - e+ Top", 50, -30, 50, 50, -35, 30);
-        IHistogram2D xzept = aida.histogram2D("X v Z - e+ Top", 50, -30, 50, 50, -800, -450);
-        IHistogram2D yzept = aida.histogram2D("Y v Z - e+ Top", 50, -35, 30, 50, -800, -450);
-        IHistogram1D three = aida.histogram1D("Three Track Invariant Mass", 50, 0, .4);
-
-        twotrackFrame.pack();
-        twotrackFrame.setVisible(true);
-
-        plotter9000.region(0).plot(trkbins);
-        plotter9001.region(0).plot(twtrkptot);
-        plotter9002.region(0).plot(sumtrks);
-        plotter9002.region(1).plot(invarmass);
-        plotter9003.region(0).plot(perptrks);
-        plotter9004.region(0).plot(pyppm);
-        plotter9005.region(0).plot(pzppm);
-        plotter9006.region(0).plot(xy);
-        plotter9006.region(1).plot(xz);
-        plotter9006.region(2).plot(yz);
-        plotter9007.region(0).plot(xyemt);
-        plotter9007.region(1).plot(xzemt);
-        plotter9007.region(2).plot(yzemt);
-        plotter9007.region(3).plot(xyept);
-        plotter9007.region(4).plot(xzept);
-        plotter9007.region(5).plot(yzept);
-        plotter9008.region(0).plot(px);
-        plotter9008.region(1).plot(py);
-        plotter9008.region(2).plot(pz);
-        plotter9008.region(3).plot(chi2);
-        plotter9009.region(0).plot(bbpx);
-        plotter9009.region(1).plot(bbpy);
-        plotter9009.region(2).plot(bbpz);
-        plotter9009.region(3).plot(bbchi2);
-        plotter9010.region(0).plot(spx);
-        plotter9010.region(1).plot(spy);
-        plotter9010.region(2).plot(spz);
-        plotter9010.region(3).plot(schi2);
-        plotter9011.region(0).plot(bbsumtrks);
-        plotter9011.region(1).plot(bbpppm);
-        plotter9011.region(2).plot(lbpppm);
-        plotter9011.region(3).plot(lbsumtrks);
-        plotter9012.region(0).plot(lbpx);
-        plotter9012.region(1).plot(lbpy);
-        plotter9012.region(2).plot(lbpz);
-        plotter9012.region(3).plot(lbchi2);
-        //    plotter9013.region(0).plot(q0spx);
-        //    plotter9013.region(1).plot(q0spy);
-        //    plotter9013.region(2).plot(q0spz);
-        //    plotter9013.region(3).plot(q0schi2);
-        plotter9015.region(0).plot(qbins);
-        plotter9015.region(1).plot(lbtp);
-        plotter9015.region(2).plot(bbtp);
-        plotter9016.region(0).plot(xvert);
-        plotter9016.region(1).plot(yvert);
-        plotter9016.region(2).plot(zvert);
-        plotter9016.region(3).plot(dist);
-        plotter9017.region(0).plot(xres);
-        plotter9017.region(1).plot(yres);
-        plotter9017.region(2).plot(xres2);
-        plotter9017.region(3).plot(yres2);
-
-        twotrkextra2.region(0).plot(unx1);
-        twotrkextra2.region(1).plot(uny1);
-        twotrkextra2.region(2).plot(unz1);
-        twotrkextra2.region(3).plot(unx2);
-        twotrkextra2.region(4).plot(uny2);
-        twotrkextra2.region(5).plot(unz2);
-        threetrack.region(0).plot(three);
-
-
-
-    }
-
-    public ElwinsTrackingRecon() {
-    }
-
-    public void setOutputPlots(String output) {
-        this.outputPlots = output;
-    }
-
-    public void setRawTrackerHitCollectionName(String rawTrackerHitCollectionName) {
-        this.rawTrackerHitCollectionName = rawTrackerHitCollectionName;
-    }
-
-    public void setFittedTrackerHitCollectionName(String fittedTrackerHitCollectionName) {
-        this.fittedTrackerHitCollectionName = fittedTrackerHitCollectionName;
-    }
-
-    public void setTrackerHitCollectionName(String trackerHitCollectionName) {
-        this.trackerHitCollectionName = trackerHitCollectionName;
-    }
-
-    public void setHelicalTrackHitCollectionName(String helicalTrackHitCollectionName) {
-        this.helicalTrackHitCollectionName = helicalTrackHitCollectionName;
-    }
-
-    public void setTrackCollectionName(String trackCollectionName) {
-        this.trackCollectionName = trackCollectionName;
-    }
-
-    public void process(EventHeader event) {
-        aida.tree().cd("/");
-        if (!event.hasCollection(HelicalTrackHit.class, helicalTrackHitCollectionName)) {
-            //       System.out.println(helicalTrackHitCollectionName + " does not exist; skipping event");
-            return;
-        }
-        if (event.get(Track.class, trackCollectionName).size() < 2) {
-            //    System.out.println(trackCollectionName + " has less than two tracks; skipping event");
-            return;
-        }
-
-        List<HelicalTrackHit> rotList = event.get(HelicalTrackHit.class, rotatedTrackHitCollectionName);
-        for (HelicalTrackHit hth : rotList) {
-            HelicalTrackCross htc = (HelicalTrackCross) hth;
-//            System.out.println("TrackingReconstructionPlots::original helical track position = "+hth.getPosition()[0]+","+hth.getPosition()[1]+","+hth.getPosition()[2]);
-//            System.out.println("TrackingReconstructionPlots::corrected helical track position = "+htc.getCorrectedPosition().toString());
-        }
-
-        List<HelicalTrackHit> hthList = event.get(HelicalTrackHit.class, helicalTrackHitCollectionName);
-        int[] layersTop = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
-        int[] layersBot = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
-        for (HelicalTrackHit hth : hthList) {
-            HelicalTrackCross htc = (HelicalTrackCross) hth;
-//            System.out.println("TrackingReconstructionPlots::original helical track position = "+hth.getPosition()[0]+","+hth.getPosition()[1]+","+hth.getPosition()[2]);
-//            System.out.println("TrackingReconstructionPlots::corrected helical track position = "+htc.getCorrectedPosition().toString());
-            //These Helical Track Hits are in the JLAB frame
-//            htc.resetTrackDirection();
-            double x = htc.getPosition()[0];
-            double y = htc.getPosition()[1];
-            SiSensor sensor = ((SiSensor) ((RawTrackerHit) htc.getRawHits().get(0)).getDetectorElement());
-            if (SvtUtils.getInstance().isTopLayer(sensor)) {
-                layersTop[htc.Layer() - 1]++;
-                Hep3Vector sensorPos = ((SiSensor) ((RawTrackerHit) htc.getRawHits().get(0)).getDetectorElement()).getGeometry().getPosition();
-                if (htc.Layer() == 1) {
-//                    System.out.println(sensorPos.toString());
-//                    System.out.println("Hit X = " + x + "; Hit Y = " + y);
-//                    aida.histogram2D("Layer 1 HTH Position:  Top").fill(x - sensorPos.x(), y - sensorPos.y());
-                }
-//                if (htc.Layer() == 7)
-//                    aida.histogram2D("Layer 7 HTH Position:  Top").fill(x - sensorPos.x(), y - sensorPos.y());
-            } else {
-                layersBot[htc.Layer() - 1]++;
-                Hep3Vector sensorPos = ((SiSensor) ((RawTrackerHit) htc.getRawHits().get(0)).getDetectorElement()).getGeometry().getPosition();
-                if (htc.Layer() == 1) {
-//                    System.out.println(sensorPos.toString());
-//                    System.out.println("Hit X = " + x + "; Hit Y = " + y);
-//                    aida.histogram2D("Layer 1 HTH Position:  Bottom").fill(x - sensorPos.x(), y - sensorPos.y());
-                }
-//                if (htc.Layer() == 7)
-//                    aida.histogram2D("Layer 7 HTH Position:  Bottom").fill(x - sensorPos.x(), y - sensorPos.y());
-            }
-        }
-
-        if (!event.hasCollection(Track.class, trackCollectionName)) {
-//            System.out.println(trackCollectionName + " does not exist; skipping event");
-            //      aida.histogram1D("Number Tracks/Event").fill(0);
-            return;
-        }
-
-
-        List<Track> tracks = event.get(Track.class, trackCollectionName);
-        nTracks.fill(tracks.size());
-
-
-        if (tracks.size() == 2) { //uncert can be used here  && (Ytrue || Ytrue2) && (Xtrue || Xtrue2)
-
-            Track trk1 = tracks.get(0);
-            Track trk2 = tracks.get(1);
-            int isTrk1Top = -1;
-            if (trk1.getTrackerHits().get(0).getPosition()[2] > 0) {
-                isTrk1Top = 1;
-            }
-            int isTrk2Top = -1;
-            if (trk2.getTrackerHits().get(0).getPosition()[2] > 0) {
-                isTrk2Top = 1;
-            }
-            boolean topbot = false;
-            if ((isTrk1Top + isTrk2Top) == 0) {
-                topbot = true;
-            }
-
-            SeedTrack stEle1 = (SeedTrack) trk1;
-            SeedCandidate seedEle1 = stEle1.getSeedCandidate();
-            HelicalTrackFit ht1 = seedEle1.getHelix();
-            HelixConverter converter1 = new HelixConverter(0);
-            StraightLineTrack slt1 = converter1.Convert(ht1);
-
-            SeedTrack stEle2 = (SeedTrack) trk2;
-            SeedCandidate seedEle2 = stEle2.getSeedCandidate();
-            HelicalTrackFit ht2 = seedEle2.getHelix();
-            HelixConverter converter2 = new HelixConverter(0);
-            StraightLineTrack slt2 = converter2.Convert(ht2);
-
-            HPSTrack hpstrack1 = new HPSTrack(ht1);
-            Hep3Vector[] trkatconver1 = hpstrack1.getPositionAtZMap(100, BeamlineConstants.HARP_POSITION_TESTRUN, 1);
-            HPSTrack hpstrack2 = new HPSTrack(ht2);
-            Hep3Vector[] trkatconver2 = hpstrack2.getPositionAtZMap(100, BeamlineConstants.HARP_POSITION_TESTRUN, 1);
-
-
-
-            List<TrackerHit> hitsOnTrack1 = trk1.getTrackerHits();
-            int layer1;
-            double y1 = 0;
-            double y2 = 0;
-            double z1 = 0;
-            double z2 = 0;
-            double dely1 = 0;
-            double dely2 = 0;
-            for (TrackerHit hit : hitsOnTrack1) {
-                HelicalTrackHit htc1 = (HelicalTrackHit) hit;
-                layer1 = htc1.Layer();
-                int y1layer = 0;
-                int y2layer = 0;
-                if (y1 == 0) {
-                    y1 = htc1.getPosition()[2]; //
-                    z1 = htc1.getPosition()[0]; // z1 is jlab but the get position refers to hps-tracking
-                    y1layer = layer1;
-                    SymmetricMatrix ErrorHitOne = htc1.getCorrectedCovMatrix();
-                    dely1 = Math.sqrt(ErrorHitOne.diagonal(2)); //y in jlab is z in hps
-                } else {
-
-                    if ((layer1 > y1layer) && (y2layer == 0)) {
-                        y2 = htc1.getPosition()[2]; //
-                        z2 = htc1.getPosition()[0]; // see above comments!
-                        y2layer = layer1;
-                        SymmetricMatrix ErrorHitTwo = htc1.getCorrectedCovMatrix();
-                        dely2 = Math.sqrt(ErrorHitTwo.diagonal(2));
-                    }
-
-                }
-
-            }
-            List<TrackerHit> hitsOnTrack2 = trk2.getTrackerHits();
-
-            double my1 = 0;
-            double my2 = 0;
-            double mz1 = 0;
-            double mz2 = 0;
-            double delymy1 = 0;
-            double delymy2 = 0;
-            int layer2;
-            for (TrackerHit hit : hitsOnTrack2) {
-                HelicalTrackHit htc2 = (HelicalTrackHit) hit;
-//            if (htc.getPosition()[2] < 0) {
-
-                layer2 = htc2.Layer();
-                int my1layer = 0;
-                int my2layer = 0;
-                if (my1 == 0) {
-                    my1 = htc2.getPosition()[2]; //see above comments
-                    mz1 = htc2.getPosition()[0];
-                    my1layer = layer2;
-                    SymmetricMatrix ErrorHitOne = htc2.getCorrectedCovMatrix();
-                    delymy1 = Math.sqrt(ErrorHitOne.diagonal(2));
-                } else {
-                    if ((layer2 > my1layer) && (my2layer == 0)) {
-                        my2 = htc2.getPosition()[2];
-                        mz2 = htc2.getPosition()[0];
-                        my2layer = layer2;
-                        SymmetricMatrix ErrorHitTwo = htc2.getCorrectedCovMatrix();
-                        delymy2 = Math.sqrt(ErrorHitTwo.diagonal(2));
-                    }
-                }
-            }
-            //   double dely = .00001; //mm
-            double b1;
-            double m1;
-            double b2;
-            double m2;
-            boolean check1 = true;
-            if (y1 == 0) {
-                check1 = false;
-            }
-            boolean check2 = true;
-            if (my1 == 0) {
-                check2 = false;
-            }
-            boolean check3 = true;
-            if (my2 == 0) {
-                check3 = false;
-            }
-
-
-
-
-            double X1 = slt1.getYZAtX(BeamlineConstants.HARP_POSITION_TESTRUN)[0];
-            double Y1 = slt1.getYZAtX(BeamlineConstants.HARP_POSITION_TESTRUN)[1];
-
-            //   boolean Y1top = false;
-            //    boolean X1plus = false;
-            //     boolean Y1bot = false;
-            //      boolean X1minus = false;
-            boolean X1cent = false;
-            boolean Y1cent = false; //for simulation
-
-            if (11 < X1 && X1 < 29) {
-                X1cent = true;
-            }
-            if (-3.5 < Y1 && Y1 < 3.5) {
-                Y1cent = true;
-            }
-
-            //    if (1 < Y1 && Y1 < 6) { //1 < Y1 && Y1 < 6 +-2.5
-            //       Y1top = true;
-            //  }
-            //     if (11 < X1 && X1 < 29) { // 4 < X1 && X1 < 16 +-6
-            //           X1minus = true;
-            //      }
-            //        if (-5 < Y1 && Y1 < 0) { // -5 < Y1 && Y1 < 0 +-2.5
-            //           Y1bot = true;
-            //      }
-            //       if (11 < X1 && X1 < 29) { // 24 < X1 && X1 < 36 +-6
-            //          X1plus = true;
-            //     }
-            double X2 = slt2.getYZAtX(BeamlineConstants.HARP_POSITION_TESTRUN)[0];
-            double Y2 = slt2.getYZAtX(BeamlineConstants.HARP_POSITION_TESTRUN)[1];
-
-            //      boolean Y2top = false; //for data
-            //     boolean X2plus = false;
-            //    boolean Y2bot = false; //in general
-            //      boolean X2minus = false;
-            boolean X2cent = false;
-            boolean Y2cent = false; //for simulation
-            if (11 < X2 && X2 < 29) {
-                X2cent = true;
-            }
-            if (-3.5 < Y2 && Y2 < 3.5) {
-                Y2cent = true;
-            }
-            //       if (1 < Y2 && Y2 < 6) {
-            //          Y2top = true;
-            //     }
-            //      if (11 < X2 && X2 < 29) {
-            //           X2minus = true;
-            //      }
-            //   if (-5 < Y2 && Y2 < 0) {
-            //      Y2bot = true;
-            // }
-            //       if (11 < X2 && X2 < 29) {
-            //           X2plus = true;
-            //       }
-
-
-            //      boolean Trk1Top = false;
-            //     boolean Trk2Top = false;
-            //    boolean Trk1Bot = false;
-            //   boolean Trk2Bot = false;
-            //  if (isTrk1Top == 1) {
-            //             Trk1Top = true;
-            //       }
-            //     if (isTrk2Top == 1) {
-            //       Trk2Top = true;
-            //         }
-            //       if (isTrk1Top == -1) {
-            //         Trk1Bot = true;
-            //   }
-            //  if (isTrk2Top == -1) {
-            //    Trk2Bot = true;
-            //      }
-            //  boolean Trk1goodTop = false;
-            //   boolean Trk2goodTop = false;
-            // boolean Trk1goodBot = false;
-            //   boolean Trk2goodBot = false;
-            //      if (Trk1Top && Y1top) {
-            //         Trk1goodTop = true;
-            //    }
-            //   if (Trk2Top && Y2top) {
-            //            Trk2goodTop = true;
-            //   }
-            //   if (Trk1Bot && Y1bot) {
-            //      Trk1goodBot = true;
-            //   }
-            //   if (Trk2Bot && Y2bot) {
-            //      Trk2goodBot = true;
-            //  }
-
-            int qtrk1 = trk1.getCharge();
-            int qtrk2 = trk2.getCharge();
-            boolean pm = false;
-            if ((qtrk1 + qtrk2) == 0) {
-                pm = true;
-            }
-
-            //   boolean Trk1Plus = false;
-            //    boolean Trk2Plus = false;
-            //      boolean Trk1Minus = false;
-            //       boolean Trk2Minus = false;
-            //       if (qtrk1 > 0) {
-            //           Trk1Plus = true;
-            //        } else {
-            //             Trk1Minus = true;
-            //        }
-            //       if (qtrk2 > 0) {
-            //           Trk2Plus = true;
-            //      } else {
-            //          Trk2Minus = true;
-            //     }
-
-            //    boolean Trk1goodPlus = false;
-            //     boolean Trk2goodPlus = false;
-            //     boolean Trk1goodMinus = false;
-            //    boolean Trk2goodMinus = false;
-
-            //       if (Trk1Plus && X1plus) {
-            //          Trk1goodPlus = true;
-            //       }
-            //       if (Trk2Plus && X2plus) {
-            //           Trk2goodPlus = true;
-            //        }
-            //       if (Trk1Minus && X1minus) {
-            //        Trk1goodMinus = true;
-            //       }
-            //        if (Trk2Minus && X2minus) {
-            //          Trk2goodMinus = true;
-            //       }
-            if (topbot && pm) {
-
-                double b1p;
-                double b2p;
-                double m1p;
-                double m2p;
-
-                if (check1 && check2 && check3) {
-                    if (isTrk1Top == 1) {
-                        double zc = -1 * z1 / (z2 - z1);
-                        b1 = (zc * (y2 - y1 + .5 * (dely2 + dely1))) + y1 - (.5 * dely1);
-                        m1 = (y2 - y1 + .5 * (dely2 + dely1)) / (z2 - z1);
-                        m1p = (y2 - y1 - .5 * (dely2 + dely1)) / (z2 - z1);
-                        b1p = y1 - (m1p * z1) + (.5 * dely1);
-                    } else {
-                        double zc = -1 * z1 / (z2 - z1);
-                        b1 = (zc * (y2 - y1 - .5 * (dely2 + dely1))) + y1 + (.5 * dely1);
-                        m1 = (y2 - y1 - .5 * (dely2 + dely1)) / (z2 - z1);
-                        m1p = (y2 - y1 + .5 * (dely2 + dely1)) / (z2 - z1);
-                        b1p = y1 - (m1p * z1) - (.5 * dely1);
-                    }
-
-                    if (isTrk2Top == 1) {
-                        double zc = -1 * mz1 / (mz2 - mz1);
-                        b2 = (zc * (my2 - my1 + .5 * (delymy2 + delymy1))) + my1 - (.5 * delymy1);
-                        m2 = (my2 - my1 + .5 * (delymy2 + delymy1)) / (mz2 - mz1);
-                        m2p = (my2 - my1 - .5 * (delymy2 + delymy1)) / (mz2 - mz1);
-                        b2p = my1 - (m2p * mz1) + (.5 * delymy1);
-                    } else {
-                        double zc = -1 * mz1 / (mz2 - mz1);
-                        b2 = (zc * (my2 - my1 - .5 * (delymy2 + delymy1))) + my1 + (.5 * delymy1);
-                        m2 = (my2 - my1 - .5 * (delymy2 + delymy1)) / (mz2 - mz1);
-                        m2p = (my2 - my1 + .5 * (delymy2 + delymy1)) / (mz2 - mz1);
-                        b2p = my1 - (m2p * mz1) - (.5 * delymy1);
-                    }
-                    //    System.out.println("y1 = " + y1);
-                    //    System.out.println("y2 = " + y2);
-                    //    System.out.println("y'1 = " + my1);
-                    //    System.out.println("y'2 = " + my2);
-                    double zi = (b2 - b1) / (m1 - m2);
-                    double zr = Math.abs(zi - BeamlineConstants.HARP_POSITION_TESTRUN);
-                    double zs = 2 * zr / 100;
-                    //      System.out.println("Closest Possible Z to Tracker");
-                    //      System.out.println(zi);
-
-
-                    List<double[]> Trk1 = new ArrayList<double[]>();
-                    for (int i = 0; i < 100; i++) {
-                        double z = BeamlineConstants.HARP_POSITION_TESTRUN - zr + (zs * i);
-                        double[] posvec = new double[3];
-                        Hep3Vector[] trk1atz = hpstrack1.getPositionAtZMap(100, z, 1);
-                        posvec[0] = trk1atz[0].x();
-                        posvec[1] = trk1atz[0].y();
-                        posvec[2] = z;
-
-                        Trk1.add(posvec);
-                    }
-                    //  System.out.println("Vectors ");
-
-                    //  System.out.println(Trk1);
-
-                    double xbar = 0;
-                    double ybar = 0;
-                    double zbar = 0;
-                    double xsqbar = 0;
-                    double ysqbar = 0;
-                    double zsqbar = 0;
-                    int n = 0;
-                    for (double[] inttrk : Trk1) {
-                        //      System.out.println(inttrk[0]);
-                        //    System.out.println(inttrk[1]);
-                        //    System.out.println(inttrk[2]);
-                        xbar = xbar + inttrk[0];
-                        ybar = ybar + inttrk[1];
-                        zbar = zbar + inttrk[2];
-                        n = n + 1;
-                    }
-                    //   System.out.println("n " + n);
-                    xbar = xbar / n;
-                    ybar = ybar / n;
-                    zbar = zbar / n;
-                    //    System.out.println("Xbar is " + xbar);
-                    //    System.out.println("Ybar is " + ybar);
-                    //    System.out.println("Zbar is " + zbar);
-                    Matrix d;
-                    Matrix A = Matrix.random(n, 3);
-                    int j1 = 0;
-                    for (double[] inttrk : Trk1) {
-                        A.set(j1, 0, inttrk[0] - xbar);
-                        A.set(j1, 1, inttrk[1] - ybar);
-                        A.set(j1, 2, inttrk[2] - zbar);
-                        j1++;
-                    }
-
-                    //           System.out.println("Matrix A");
-                    //           A.print(9, 6);
-                    A.svd();
-                    SingularValueDecomposition s = A.svd();
-                    Matrix S = s.getS();
-                    //         System.out.println("S Matrix");
-                    //         S.print(9, 6);
-                    Matrix V = s.getV();
-                    //         System.out.println("V Matrix");
-                    //         V.print(9, 6);
-                    d = V.getMatrix(0, 2, 0, 0);
-                    double[] dd;
-                    dd = new double[3];
-
-                    dd[0] = d.get(0, 0);
-                    dd[1] = d.get(1, 0);
-                    dd[2] = d.get(2, 0);
-                    double nd = Math.sqrt((Math.pow(dd[0], 2)) + (Math.pow(dd[1], 2)) + (Math.pow(dd[2], 2)));
-
-                    for (double[] inttrk : Trk1) {
-                        double t1 = (inttrk[2] - zbar) / dd[2];
-                        double restrk1[];
-                        restrk1 = new double[3];
-                        restrk1[0] = xbar + (t1) * dd[0] - inttrk[0];
-                        restrk1[1] = ybar + (t1) * dd[1] - inttrk[1];
-                        restrk1[2] = zbar + (t1) * dd[2] - inttrk[2];
-                        aida.histogram1D("X Res Trk1").fill(restrk1[0]);
-                        aida.histogram1D("Y Res Trk1").fill(restrk1[1]);
-                    }
-
-                    List<double[]> Trk2 = new ArrayList<double[]>();
-                    for (int i = 0; i < 100; i++) {
-                        double z = BeamlineConstants.HARP_POSITION_TESTRUN - zr + (zs * i);
-                        double[] posvec2 = new double[3];
-                        Hep3Vector[] trk2atz = hpstrack2.getPositionAtZMap(100, z, 1);
[truncated at 1000 lines; 574 more skipped]

java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham
ExamplePlotter.java removed after 382
--- java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/ExamplePlotter.java	2014-03-26 05:43:58 UTC (rev 382)
+++ java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/ExamplePlotter.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,113 +0,0 @@
-package org.lcsim.hps.users.mgraham;
-
-import hep.aida.IAnalysisFactory;
-import hep.aida.IHistogram1D;
-import hep.aida.IPlotter;
-import hep.aida.IPlotterStyle;
-import hep.physics.vec.Hep3Vector;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.hps.conditions.deprecated.BeamlineConstants;
-import org.hps.recon.tracking.HPSTrack;
-import org.hps.recon.tracking.HelixConverter;
-import org.hps.recon.tracking.StraightLineTrack;
-import org.hps.util.AIDAFrame;
-import org.hps.util.Resettable;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.Track;
-import org.lcsim.fit.helicaltrack.HelicalTrackFit;
-import org.lcsim.geometry.Detector;
-import org.lcsim.recon.tracking.seedtracker.SeedCandidate;
-import org.lcsim.recon.tracking.seedtracker.SeedTrack;
-import org.lcsim.util.Driver;
-import org.lcsim.util.aida.AIDA;
-
-/**
-
- @author mgraham
- */
-public class ExamplePlotter extends Driver implements Resettable {
-
-    private AIDAFrame plotterFrame;
-    private AIDA aida = AIDA.defaultInstance();
-    IPlotter plotter;
-    IAnalysisFactory fac = aida.analysisFactory();
-    private String trackCollectionName = "MatchedTracks";
-    private String outputPlots = null;
-
-    protected void detectorChanged(Detector detector) {
-        aida.tree().cd("/");
-        plotterFrame = new AIDAFrame();
-        plotterFrame.setTitle("HPS Tracking Plots");
-
-        plotter = fac.createPlotterFactory().create("HPS Tracking Plots");
-        plotter.setTitle("Momentum");
-        IPlotterStyle style = plotter.style();
-        style.dataStyle().fillStyle().setColor("yellow");
-        style.dataStyle().errorBarStyle().setVisible(false);
-        plotter.createRegions(2, 3);
-        plotterFrame.addPlotter(plotter);
-
-        IHistogram1D trkPx = aida.histogram1D("Track Momentum (Px)", 25, -0.25, 0.25);
-        IHistogram1D trkPy = aida.histogram1D("Track Momentum (Py)", 25, -0.1, 0.1);
-        IHistogram1D trkPz = aida.histogram1D("Track Momentum (Pz)", 25, 0, 3.5);
-        IHistogram1D trkChi2 = aida.histogram1D("Track Chi2", 25, 0, 25.0);
-        IHistogram1D xAtConvert = aida.histogram1D("X (mm) @ Converter", 50, -50, 50);
-        IHistogram1D yAtConvert = aida.histogram1D("Y (mm) @ Converter", 50, -20, 20);
-        plotter.region(0).plot(trkPx);
-        plotter.region(1).plot(trkPy);
-        plotter.region(2).plot(trkPz);
-        plotter.region(3).plot(trkChi2);
-        plotter.region(4).plot(xAtConvert);
-        plotter.region(5).plot(yAtConvert);
-
-        plotterFrame.pack();
-        plotterFrame.setVisible(true);
-    }
-
-    public void process(EventHeader event) {
-        aida.tree().cd("/");
-        List<Track> tracks = event.get(Track.class, trackCollectionName);
-        for (Track trk : tracks) {
-            aida.histogram1D("Track Momentum (Px)").fill(trk.getPY());
-            aida.histogram1D("Track Momentum (Py)").fill(trk.getPZ());
-            aida.histogram1D("Track Momentum (Pz)").fill(trk.getPX());
-            aida.histogram1D("Track Chi2").fill(trk.getChi2());
-
-            SeedTrack stEle = (SeedTrack) trk;
-            SeedCandidate seedEle = stEle.getSeedCandidate();
-            HelicalTrackFit ht = seedEle.getHelix();
-            HelixConverter converter = new HelixConverter(0);
-            StraightLineTrack slt = converter.Convert(ht);
-            HPSTrack hpstrack = new HPSTrack(ht);
-            Hep3Vector[] trkatconver = hpstrack.getPositionAtZMap(100, BeamlineConstants.HARP_POSITION_TESTRUN, 1);
-            aida.histogram1D("X (mm) @ Converter").fill(trkatconver[0].x()); // y tracker frame?
-            aida.histogram1D("Y (mm) @ Converter").fill(trkatconver[0].y()); // z tracker frame?
-
-        }
-    }
-
-    @Override
-    public void reset() {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-
-    public void setOutputPlots(String output) {
-        this.outputPlots = output;
-    }
-
-    public void endOfData() {
-        System.out.println("Output");
-        if (outputPlots != null) {
-            try {
-                aida.saveAs(outputPlots);
-            } catch (IOException ex) {
-                Logger.getLogger(ElwinsTrackingRecon.class.getName()).log(Level.SEVERE, null, ex);
-            }
-        }
-    }
-}

java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham
FastTrackAnalysisDriver.java removed after 382
--- java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/FastTrackAnalysisDriver.java	2014-03-26 05:43:58 UTC (rev 382)
+++ java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/FastTrackAnalysisDriver.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,936 +0,0 @@
-package org.lcsim.hps.users.mgraham;
-
-import hep.aida.IAnalysisFactory;
-import hep.physics.matrix.SymmetricMatrix;
-import hep.physics.vec.BasicHep3Vector;
-import hep.physics.vec.Hep3Vector;
-import hep.physics.vec.VecOp;
-
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.hps.recon.tracking.FindableTrack;
-import org.hps.recon.tracking.StraightLineTrack;
-import org.hps.recon.tracking.TrackAnalysis;
-import org.hps.recon.vertexing.BilliorTrack;
-import org.hps.recon.vertexing.BilliorVertex;
-import org.hps.recon.vertexing.BilliorVertexer;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.LCRelation;
-import org.lcsim.event.MCParticle;
-import org.lcsim.event.RawTrackerHit;
-import org.lcsim.event.RelationalTable;
-import org.lcsim.event.SimTrackerHit;
-import org.lcsim.event.Track;
-import org.lcsim.event.TrackerHit;
-import org.lcsim.event.base.BaseRelationalTable;
-import org.lcsim.fit.helicaltrack.HelicalTrackCross;
-import org.lcsim.fit.helicaltrack.HelicalTrackFit;
-import org.lcsim.fit.helicaltrack.HelicalTrackHit;
-import org.lcsim.fit.helicaltrack.HelicalTrackStrip;
-import org.lcsim.fit.helicaltrack.HelixUtils;
-import org.lcsim.fit.helicaltrack.TrackDirection;
-import org.lcsim.recon.tracking.digitization.sisim.SiTrackerHitStrip1D;
-import org.lcsim.recon.tracking.seedtracker.SeedCandidate;
-import org.lcsim.recon.tracking.seedtracker.SeedTrack;
-import org.lcsim.util.Driver;
-import org.lcsim.util.aida.AIDA;
-
-/**
-
- @author mgraham
- */
-public class FastTrackAnalysisDriver extends Driver {
-
-    String[] detNames = {"Tracker"};
-    Integer _minLayers = 10;
-    Integer[] nlayers = {12};
-    int nevt = 0;
-    double xref = 50.0; //mm
-    public String outputTextName = "myevents.txt";
-    FileWriter fw;
-    PrintWriter pw;
-    double[] beamsize = {0.001, 0.2, 0.02};
-    String _config = "Test";
-// flipSign is a kludge...
-//  HelicalTrackFitter doesn't deal with B-fields in -ive Z correctly
-//  so we set the B-field in +iveZ and flip signs of fitted tracks
-//  note:  this should be -1 for Test configurations and +1 for Full (v3.X and lower) configurations
-//  this is set by the _config variable (detType in HeavyPhotonDriver)
-    int flipSign = 1;
-    boolean makePlots = true;
-    private AIDA aida = AIDA.defaultInstance();
-    private IAnalysisFactory af = aida.analysisFactory();
-
-    public FastTrackAnalysisDriver(int trackerLayers, int mintrkLayers, String config) {
-        nlayers[0] = trackerLayers;
-        _minLayers = mintrkLayers;
-        _config = config;
-    }
-
-    public FastTrackAnalysisDriver() {
-    }
-
-    public void setNLayers(int trackerLayers) {
-        nlayers[0] = trackerLayers;
-    }
-
-    public void setMinLayers(int mintrkLayers) {
-        _minLayers = mintrkLayers;
-    }
-
-
-    public void setBeamSigmaX(double sigma){
-        beamsize[1]=sigma;  //the beamsize[] array is in tracking frame
-    }
-    
-     public void setBeamSigmaY(double sigma){
-        beamsize[2]=sigma;   //the beamsize[] array is in tracking frame
-    }
-      
-
-    public void process(
-            EventHeader event) {
-        if (nevt == 0) {
-            try {
-//open things up
-                fw = new FileWriter(outputTextName);
-                pw = new PrintWriter(fw);
-            } catch (IOException ex) {
-                Logger.getLogger(FastTrackAnalysisDriver.class.getName()).log(Level.SEVERE, null, ex);
-            }
-        }
-        //  Increment the event counter
-        nevt++;
-
-
-
-        Hep3Vector IP = new BasicHep3Vector(0., 0., 1.);
-        double bfield = event.getDetector().getFieldMap().getField(IP).y();
-        if (bfield < 0) {
-            flipSign = -1;
-        }
-
-        List<RawTrackerHit> rawHits = event.get(RawTrackerHit.class, "RawTrackerHitMaker_RawTrackerHits");
-        List<SiTrackerHitStrip1D> stripHits = event.get(SiTrackerHitStrip1D.class, "StripClusterer_SiTrackerHitStrip1D");
-        List<HelicalTrackHit> toththits = event.get(HelicalTrackHit.class, "RotatedHelicalTrackHits");
-//        List<HelicalTrackHit> toththits = event.get(HelicalTrackHit.class, "HelicalTrackHits");
-//        List<HelicalTrackHit> axialhits = event.get(HelicalTrackHit.class, "AxialTrackHits");
-
-        int nAxialHitsTotal = stripHits.size();
-        int nL1Hits = 0;
-        for (SiTrackerHitStrip1D str : stripHits) {
-            if (str.getRawHits().get(0).getLayerNumber() == 1) {
-                nL1Hits++;
-            }
-        }
-
-
-        //  Create a relational table that maps TrackerHits to MCParticles
-        RelationalTable hittomc = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
-        List<LCRelation> mcrelations = event.get(LCRelation.class, "RotatedHelicalTrackMCRelations");
-
-        for (LCRelation relation : mcrelations) {
-            if (relation != null && relation.getFrom() != null && relation.getTo() != null) {
-                hittomc.add(relation.getFrom(), relation.getTo());
-            }
-        }
-        /*
-         RelationalTable hittomcAxial = new
-         BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY,
-         RelationalTable.Weighting.UNWEIGHTED); // List<LCRelation> mcrelations
-         = event.get(LCRelation.class, "HelicalTrackMCRelations");
-         List<LCRelation> mcrelationsAxial = event.get(LCRelation.class,
-         "AxialTrackMCRelations"); for (LCRelation relation : mcrelationsAxial)
-         { if (relation != null && relation.getFrom() != null &&
-         relation.getTo() != null) { hittomcAxial.add(relation.getFrom(),
-         relation.getTo()); } }
-         */
-        //  Instantiate the class that determines if a track is "findable"
-        FindableTrack findable = new FindableTrack(event);
-
-        //  Create a map between tracks and the associated MCParticle
-        List<Track> tracklist = event.get(Track.class, "MatchedTracks");
-//        List<Track> lltracklist = event.get(Track.class, "LLTracks");
-//        List<Track> axialtracklist = event.get(Track.class, "AxialTracks");
-//        tracklist.addAll(lltracklist);
-
-        RelationalTable trktomc = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
-
-        RelationalTable mcHittomcP = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
-
-        //  Get the collections of SimTrackerHits
-        List<List<SimTrackerHit>> simcols = event.get(SimTrackerHit.class);
-
-        //  Loop over the SimTrackerHits and fill in the relational table
-        for (List<SimTrackerHit> simlist : simcols) {
-            for (SimTrackerHit simhit : simlist) {
-                if (simhit.getMCParticle() != null) {
-                    mcHittomcP.add(simhit, simhit.getMCParticle());
-                }
-            }
-        }
-
-        Map<Track, TrackAnalysis> tkanalMap = new HashMap<Track, TrackAnalysis>();
-        Map<Track, BilliorTrack> btMap = new HashMap<Track, BilliorTrack>();
-        RelationalTable nearestHitToTrack = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
-        Map<Track, Double> l1Isolation = new HashMap<Track, Double>();
-        Map<Track, Double> l1DeltaZ = new HashMap<Track, Double>();
-        Map<Track, Double> l123KinkAngle = new HashMap<Track, Double>();
-        int _neleRec = 0;
-        int _nposRec = 0;
-        //  Analyze the tracks in the event
-        for (Track track : tracklist) {
-            if (track.getCharge() < 0) {
-                _neleRec++;
-            }
-            if (track.getCharge() > 0) {
-                _nposRec++;
-            }
-            //extrapolate straight back...
-            SeedTrack stEle = (SeedTrack) track;
-            SeedCandidate seedEle = stEle.getSeedCandidate();
-            HelicalTrackFit ht = seedEle.getHelix();
-
-            BilliorTrack bt = new BilliorTrack(ht);
-
-            TrackAnalysis tkanal = new TrackAnalysis(track, hittomc);
-
-            tkanalMap.put(track, tkanal);
-            btMap.put(track, bt);
-
-
-            //  Now analyze MC Particles on this track
-            MCParticle mcp = tkanal.getMCParticleNew();
-            if (mcp != null) //  Create a map between the tracks found and the assigned MC particle
-            {
-                trktomc.add(track, tkanal.getMCParticleNew());
-            }
-            BasicHep3Vector axial = new BasicHep3Vector();
-            axial.setV(0, 1, 0);
-            List<TrackerHit> hitsOnTrack = track.getTrackerHits();
-            double[] zlist = {0, 0, 0};
-            for (TrackerHit hit : hitsOnTrack) {
-                HelicalTrackHit htc = (HelicalTrackHit) hit;
-                List<MCParticle> mcpsHTH = htc.getMCParticles();
-                double sHit = ht.PathMap().get(htc);
-                Hep3Vector posonhelix = HelixUtils.PointOnHelix(ht, sHit);
-                double yTr = posonhelix.y();
-                double zTr = posonhelix.z();
-                HelicalTrackCross cross = (HelicalTrackCross) htc;
-                List<HelicalTrackStrip> clusterlist = cross.getStrips();
-                TrackDirection trkdir = HelixUtils.CalculateTrackDirection(ht, sHit);
-                cross.setTrackDirection(trkdir, ht.covariance());
-                double y = cross.y();
-                double z = cross.z();
-                double yerr = Math.sqrt(cross.getCorrectedCovMatrix().e(1, 1));
-                double zerr = Math.sqrt(cross.getCorrectedCovMatrix().e(2, 2));
-
-                int htlayer = htc.Layer();
-                if (htlayer == 1) {
-                    zlist[0] = z;
-                }
-                if (htlayer == 3) {
-                    zlist[1] = z;
-                }
-                if (htlayer == 5) {
-                    zlist[2] = z;
-                }
-                if (htlayer == 1) {
-                    l1DeltaZ.put(track, z - zTr);
-                }
-                for (HelicalTrackStrip cl : clusterlist) {
-                    int layer = cl.layer();
-                    HelicalTrackStrip nearest = getNearestHit(cl, toththits);
-                    if (layer == 1) {
-                        Double l1Dist = getNearestDistance(cl, toththits);
-                        if (l1Dist != null) {
-                            l1Isolation.put(track, l1Dist);
-                        }
-                    }
-                    if (nearest != null) {
-                        nearestHitToTrack.add(track, nearest);
-                    }
-                }
-            }
-            double layerDist = 10;//cm
-            double theta12 = Math.atan2(zlist[1] - zlist[0], layerDist);
-            double theta13 = Math.atan2(zlist[2] - zlist[0], 2 * layerDist);
-            double theta23 = Math.atan2(zlist[2] - zlist[1], layerDist);
-            l123KinkAngle.put(track, theta23 - theta12);
-        }
-
-
-
-
-        //analyze the event
-        int ApCand = 0;
-        Track eleID = null;
-        Track posID = null;
-        MCParticle eleMC = null;
-        MCParticle posMC = null;
-        for (Track track : tracklist) {
-
-            TrackAnalysis tkanal = tkanalMap.get(track);
-            BilliorTrack bt = btMap.get(track);
-            //  Calculate purity and make appropriate plots
-            MCParticle mcp = tkanal.getMCParticleNew();
-            if (mcp == null) {
-                continue;
-            }
-            if (mcp.getParents().size() == 1 && mcp.getParents().get(0).getPDGID() == 622) {
-                int nhits = tkanal.getNHitsNew();
-                double px = track.getPX();
-                double py = track.getPY();
-                double pz = track.getPZ();
-                double pt = Math.sqrt(px * px + py * py);
-                double pperp = Math.sqrt(py * py + pz * pz);
-                double p = Math.sqrt(pt * pt + pz * pz);
-                double phi = Math.atan2(py, px);
-                double cth = pz / Math.sqrt(pt * pt + pz * pz);
-
-//                double doca = slt.Doca();
-//                double[] poca = slt.Poca();
-
-                if (mcp.getCharge() > 0) {
-                    posID = track;
-                    posMC = mcp;
-
-                } else {
-                    eleID = track;
-                    eleMC = mcp;
-                }
-            }
-
-        }
-        for (Track track1 : tracklist) {
-            Track ele = null;
-            Track pos = null;
-            int ch1 = track1.getCharge() * flipSign;
-            int index = tracklist.indexOf(track1);
-            List<Track> subtracklist = tracklist.subList(index, tracklist.size());
-            for (Track track2 : subtracklist) {
-                int ch2 = track2.getCharge() * flipSign;
-                if (track1 != track2 && ch1 == -ch2) {
-                    ele = track1;
-                    pos = track2;
-//                    System.out.println("Found two oppositely charged tracks!  Lets look at them");
-                    if (ch1 > 0) {
-                        ele = track2;
-                        pos = track1;
-                    }
-                    ApCand++;
-                    // int nElectron = ele.getTrackerHits().size();
-                    // int nPositron = pos.getTrackerHits().size();
-
-                    SeedTrack stEle = (SeedTrack) ele;
-                    SeedCandidate seedEle = stEle.getSeedCandidate();
-                    HelicalTrackFit htEle = seedEle.getHelix();
-
-                    SeedTrack stPos = (SeedTrack) pos;
-                    SeedCandidate seedPos = stPos.getSeedCandidate();
-                    HelicalTrackFit htPos = seedPos.getHelix();
-
-                    double d0E = htEle.dca();
-                    double z0E = htEle.z0();
-                    double phi0E = htEle.phi0();
-                    double RE = htEle.R();
-                    double slopeE = htEle.slope();
-                    double d0P = htPos.dca();
-                    double z0P = htPos.z0();
-                    double phi0P = htPos.phi0();
-                    double RP = htPos.R();
-                    double slopeP = htPos.slope();
-
-                    double pxE = ele.getPX();
-                    double pyE = ele.getPY();
-                    double pzE = ele.getPZ();
-                    double pxP = pos.getPX();
-                    double pyP = pos.getPY();
-                    double pzP = pos.getPZ();
-
-                    List<BilliorTrack> btlist = new ArrayList<BilliorTrack>();
-
-                    BilliorTrack btEle = btMap.get(ele);
-                    BilliorTrack btPos = btMap.get(pos);
-
-                    btlist.add(btEle);
-                    btlist.add(btPos);
-
-
-
-                   BilliorVertexer vtxfitter = new BilliorVertexer(bfield);
-                    vtxfitter.doBeamSpotConstraint(false);
-                    vtxfitter.setBeamSize(beamsize);
-
-                    BilliorVertexer vtxfitterCon = new BilliorVertexer(bfield);
-                    vtxfitterCon.doBeamSpotConstraint(true);
-                    vtxfitterCon.setBeamSize(beamsize);
-
-                    BilliorVertexer vtxfitterBSCon = new BilliorVertexer(bfield);
-                    vtxfitterBSCon.doTargetConstraint(true);
-                    vtxfitterBSCon.setBeamSize(beamsize);
-
-
-                    BilliorVertex vtxfit = vtxfitter.fitVertex(btlist);
-                    Map<String, Double> vtxMap = vtxfit.getParameters();
-
-                    double vtxpxE = vtxMap.get("p1X");
-                    double vtxpyE = vtxMap.get("p1Y");
-                    double vtxpzE = vtxMap.get("p1Z");
-                    double vtxpxP = vtxMap.get("p2X");
-                    double vtxpyP = vtxMap.get("p2Y");
-                    double vtxpzP = vtxMap.get("p2Z");
-                    double chisq = vtxfit.getChi2();
-                    Hep3Vector vtx =  vtxfit.getPosition();
-                    SymmetricMatrix vtxcov = vtxfit.getCovMatrix();
-                    double chisqE = ele.getChi2();
-                    double chisqP = pos.getChi2();
-
-                    BilliorVertex confit = vtxfitterCon.fitVertex(btlist);
-                    Map<String, Double> conMap = confit.getParameters();
-                    double conpxE = conMap.get("p1X");
-                    double conpyE = conMap.get("p1Y");
-                    double conpzE = conMap.get("p1Z");
-                    double conpxP = conMap.get("p2X");
-                    double conpyP = conMap.get("p2Y");
-                    double conpzP = conMap.get("p2Z");
-                    double conchisq = confit.getChi2();
-                    Hep3Vector conVtx =  confit.getPosition();
-                    SymmetricMatrix conVtxCov = confit.getCovMatrix();
-
-                    BilliorVertex bsconfit = vtxfitterBSCon.fitVertex(btlist);
-                    Map<String, Double> bsconMap = bsconfit.getParameters();
-                    double bsconpxE = bsconMap.get("p1X");
-                    double bsconpyE = bsconMap.get("p1Y");
-                    double bsconpzE = bsconMap.get("p1Z");
-                    double bsconpxP = bsconMap.get("p2X");
-                    double bsconpyP = bsconMap.get("p2Y");
-                    double bsconpzP = bsconMap.get("p2Z");
-                    double bsconchisq = bsconfit.getChi2();
-                    Hep3Vector bsconVtx =  bsconfit.getPosition();
-                    SymmetricMatrix bsconVtxCov =  bsconfit.getCovMatrix();
-
-                    double l1minE = -99;
-                    double l1minP = -99;
-                    if (l1Isolation.get(ele) != null) {
-                        l1minE = l1Isolation.get(ele);
-                    }
-                    if (l1Isolation.get(pos) != null) {
-                        l1minP = l1Isolation.get(pos);
-                    }
-
-                    TrackAnalysis tkanalEle = tkanalMap.get(ele);
-                    TrackAnalysis tkanalPos = tkanalMap.get(pos);
-//                    Integer nElectron = tkanalEle.getNHitsNew();
-//                    Integer nPositron = tkanalPos.getNHitsNew();                    
-                    List<Integer> layersEle = tkanalEle.getTrackLayerList();
-                    List<Integer> layersPos = tkanalPos.getTrackLayerList();
-                    Integer nElectron = encodeLayers(layersEle);
-                    Integer nPositron = encodeLayers(layersPos);
-                    List<Integer> badhitsEle = tkanalEle.getBadHitList();
-                    List<Integer> badhitsPos = tkanalPos.getBadHitList();
-                    Integer badLayerEle = encodeLayers(badhitsEle);
-                    Integer badLayerPos = encodeLayers(badhitsPos);
-//                        int nMCL1Ele = tkanalEle.getNumberOfMCParticles(1);
-//                       int nMCL1Pos = tkanalPos.getNumberOfMCParticles(1);
-                    List<Integer> sharedhitsEle = tkanalEle.getSharedHitList();
-                    List<Integer> sharedhitsPos = tkanalPos.getSharedHitList();
-                    Integer sharedLayerEle = encodeLayers(sharedhitsEle);
-                    Integer sharedLayerPos = encodeLayers(sharedhitsPos);
-                    int nStripsL1Ele = -99;
-                    int nStripsL1Pos = -99;
-                    Integer l1 = 1;
-                    double zvalEle = -99;
-                    double zvalPos = -99;
-                    if (tkanalEle.hasLayerOne()) {
-                        zvalEle = tkanalEle.getClusterPosition(l1).z();
-                        nStripsL1Ele = tkanalEle.getNumberOfStripHits(1);
-                    }
-                    if (tkanalPos.hasLayerOne()) {
-                        zvalPos = tkanalPos.getClusterPosition(l1).z();
-                        nStripsL1Pos = tkanalPos.getNumberOfStripHits(1);
-                    }
-
-                    int eleFromAp = 0;
-                    int posFromAp = 0;
-                    if (eleMC != null && ele == eleID) {
-                        eleFromAp = 1;
-                    }
-                    if (posMC != null && pos == posID) {
-                        posFromAp = 1;
-                    }
-                    MCParticle mcEle = tkanalEle.getMCParticleNew();
-                    MCParticle mcPos = tkanalPos.getMCParticleNew();
-                    double[] pmcEle = {-99, -99, -99};
-                    double[] pmcPos = {-99, -99, -99};
-                    double[] pocamcE = {-99, -99, -99};
-                    double[] pocamcP = {-99, -99, -99};
-                    if (mcEle != null && mcPos != null) {
-                        pmcEle[0] = mcEle.getPX();
-                        pmcEle[1] = mcEle.getPY();
-                        pmcEle[2] = mcEle.getPZ();
-                        pmcPos[0] = mcPos.getPX();
-                        pmcPos[1] = mcPos.getPY();
-                        pmcPos[2] = mcPos.getPZ();
-                    }
-                    double[] ApVertexMC = {-99, -99, -99};
-                    if (eleFromAp == 1 && posFromAp == 1) {
-                        ApVertexMC[0] = eleMC.getOriginX();
-                        ApVertexMC[1] = eleMC.getOriginY();
-                        ApVertexMC[2] = eleMC.getOriginZ();
-                    }
-
-
-                    //print out the vertex;
-                    double l1dzE = -99;
-                    double l1dzP = -99;
-                    if (l1DeltaZ.get(ele) != null) {
-                        l1dzE = l1DeltaZ.get(ele);
-                    }
-                    if (l1DeltaZ.get(pos) != null) {
-                        l1dzP = l1DeltaZ.get(pos);
-                    }
-                    double l123KinkE = -99;
-                    double l123KinkP = -99;
-                    if (l123KinkAngle.get(ele) != null) {
-                        l123KinkE = l123KinkAngle.get(ele);
-                    }
-                    if (l123KinkAngle.get(pos) != null) {
-                        l123KinkP = l123KinkAngle.get(pos);
-                    }
-//                    
-//                    if (!tkanalEle.hasLayerOne()) {
-//                        nElectron = -nElectron;
-//                    }
-//                    if (!tkanalPos.hasLayerOne()) {
-//                        nPositron = -nPositron;
-//                    }
-                    pw.format("%d %5.5f %5.5f %5.5f ", nevt, pxE, pyE, pzE);
-                    pw.format("%5.5f  %5.5f %5.5f %5.5f  %5.5f ", d0E, z0E, slopeE, phi0E, RE);
-                    pw.format("%5.5f  %5.5f %5.5f %5.5f ", chisqE, l1minE, l1dzE, l123KinkE);
-                    pw.format("%d %d  %5.5f ", sharedLayerEle, nStripsL1Ele, zvalEle);
-                    pw.format("%d %d %d ", nElectron, badLayerEle, eleFromAp);
-                    pw.format("%5.5f %5.5f %5.5f ", pxP, pyP, pzP);
-                    pw.format("%5.5f  %5.5f %5.5f %5.5f  %5.5f ", d0P, z0P, slopeP, phi0P, RP);
-                    pw.format("%5.5f  %5.5f %5.5f %5.5f ", chisqP, l1minP, l1dzP, l123KinkP);
-                    pw.format("%d %d  %5.5f ", sharedLayerPos, nStripsL1Pos, zvalPos);
-                    pw.format("%d %d %d ", nPositron, badLayerPos, posFromAp);
-                    pw.format("%5.5f %5.5f %5.5f ", vtxpxE, vtxpyE, vtxpzE);
-                    pw.format("%5.5f %5.5f %5.5f ", vtxpxP, vtxpyP, vtxpzP);
-                    pw.format("%5.5f %5.5f %5.5f %5.5f %5.5f %5.5f ", vtx.x(), Math.sqrt(vtxcov.e(0, 0)), vtx.y(), Math.sqrt(vtxcov.e(1, 1)), vtx.z(), Math.sqrt(vtxcov.e(2, 2)));
-                    pw.format("%5.5f ", chisq);
-                    pw.format("%5.5f %5.5f %5.5f ", conpxE, conpyE, conpzE);
-                    pw.format("%5.5f %5.5f %5.5f ", conpxP, conpyP, conpzP);
-
-                    //   get the errors on the constrained vertex an make sure they aren't NaN
-                    //   there must be something wrong in the constraint...hopefully just the error calc
-                    double conErrX = getErr(conVtxCov.e(0, 0));
-                    double conErrY = getErr(conVtxCov.e(1, 1));
-                    double conErrZ = getErr(conVtxCov.e(2, 2));
-
-                    pw.format("%5.5f %5.5f %5.5f %5.5f %5.5f %5.5f ", conVtx.x(), conErrX, conVtx.y(), conErrY, conVtx.z(), conErrZ);
-                    pw.format("%5.5f ", conchisq);
-
-                    pw.format("%5.5f %5.5f %5.5f ", bsconpxE, bsconpyE, bsconpzE);
-                    pw.format("%5.5f %5.5f %5.5f ", bsconpxP, bsconpyP, bsconpzP);
-
-                    //   get the errors on the bsconstrained vertex an make sure they aren't NaN
-                    //   there must be somethihhhhfang wrong in the bsconstraint...hopefully just the error calc
-                    double bsconErrX = getErr(bsconVtxCov.e(0, 0));
-                    double bsconErrY = getErr(bsconVtxCov.e(1, 1));
-                    double bsconErrZ = getErr(bsconVtxCov.e(2, 2));
-
-                    pw.format("%5.5f %5.5f %5.5f %5.5f %5.5f %5.5f ", bsconVtx.x(), bsconErrX, bsconVtx.y(), bsconErrY, bsconVtx.z(), bsconErrZ);
-                    pw.format("%5.5f ", bsconchisq);
-
-
-//  print out MC information
-                    pw.format("%5.5f %5.5f %5.5f ", pmcEle[0], pmcEle[1], pmcEle[2]);
-                    pw.format("%5.5f %5.5f %5.5f ", pocamcE[0], pocamcE[1], pocamcE[2]);
-                    pw.format("%5.5f %5.5f %5.5f ", pmcPos[0], pmcPos[1], pmcPos[2]);
-                    pw.format("%5.5f %5.5f %5.5f ", pocamcP[0], pocamcP[1], pocamcP[2]);
-                    pw.format("%5.5f %5.5f %5.5f ", ApVertexMC[0], ApVertexMC[1], ApVertexMC[2]);
-//  print out some event information
-                    pw.format("%d %d %d %d", _neleRec, _nposRec, nAxialHitsTotal, nL1Hits);
-                    pw.println();
-                    if (makePlots) {
-                        aida.histogram1D("Event Number", 50, 0, 100000).fill(nevt);
-                        aida.histogram1D("pxE", 50, 0, 2.5).fill(pxE);
-                        aida.histogram1D("pyE", 50, -0.1, 0.1).fill(pyE);
-                        aida.histogram1D("pzE", 50, -0.1, 0.1).fill(pzE);
-                        aida.histogram1D("d0E", 50, -1.0, 1.0).fill(d0E);
-                        aida.histogram1D("z0E", 50, -1.0, 1.0).fill(z0E);
-                        aida.histogram1D("slopeE", 50, -0.1, 0.1).fill(slopeE);
-                        aida.histogram1D("sin(phi0E)", 50, -0.2, 0.2).fill(Math.sin(phi0E));
-                        aida.histogram1D("RE", 50, 0, 20000).fill(RE);
-                        aida.histogram1D("chisqE", 50, 0, 25).fill(chisqE);
-                        aida.histogram1D("l1minE", 50, -10, 10).fill(l1minE);
-                        aida.histogram1D("l1dzE", 50, -0.1, 0.1).fill(l1dzE);
-                        aida.histogram1D("l123KinkE", 50, -0.1, 0.1).fill(l123KinkE);
-                        aida.histogram1D("eleFromAp", 2, 0, 2).fill(eleFromAp);
-                        
-                        
-                        aida.histogram1D("pxP", 50, 0, 2.5).fill(pxP);
-                        aida.histogram1D("pyP", 50, -0.1, 0.1).fill(pyP);
-                        aida.histogram1D("pzP", 50, -0.1, 0.1).fill(pzP);
-                        aida.histogram1D("d0P", 50, -1.0, 1.0).fill(d0P);
-                        aida.histogram1D("z0P", 50, -1.0, 1.0).fill(z0P);
-                        aida.histogram1D("slopeP", 50, -0.1, 0.1).fill(slopeP);
-                        aida.histogram1D("sin(phi0P)", 50, -0.2, 0.2).fill(Math.sin(phi0P));
-                        aida.histogram1D("RP", 50, 0, 20000).fill(RP);
-                        aida.histogram1D("chisqP", 50, 0, 25).fill(chisqP);
-                        aida.histogram1D("l1minP", 50, -10, 10).fill(l1minP);
-                        aida.histogram1D("l1dzP", 50, -10, 10).fill(l1dzP);
-                        aida.histogram1D("l123KinkP", 50, -0.1, 0.1).fill(l123KinkP);
-                        aida.histogram1D("posFromAp", 2, 0, 2).fill(posFromAp);
-
-                        aida.histogram1D("vtxpxE", 50, 0, 2.5).fill(vtxpxE);
-                        aida.histogram1D("vtxpyE", 50, -0.1, 0.1).fill(vtxpyE);
-                        aida.histogram1D("vtxpzE", 50, -0.1, 0.1).fill(vtxpzE);
-                        aida.histogram1D("vtxpxP", 50, 0, 2.5).fill(vtxpxP);
-                        aida.histogram1D("vtxpyP", 50, -0.1, 0.1).fill(vtxpyP);
-                        aida.histogram1D("vtxpzP", 50, -0.1, 0.1).fill(vtxpzP);
-
-                        aida.histogram1D("vtxX", 50, -20, 20).fill(vtx.x());
-                        aida.histogram1D("vtxY", 50, -0.5, 0.5).fill(vtx.y());
-                        aida.histogram1D("vtxZ", 50, -0.5, 0.5).fill(vtx.z());
-
-                        aida.histogram1D("pxmcE", 50, 0, 2.5).fill(pmcEle[0]);
-                        aida.histogram1D("pymcE", 50, -0.1, 0.1).fill(pmcEle[1]);
-                        aida.histogram1D("pzmcE", 50, -0.1, 0.1).fill(pmcEle[2]);
-                    }
-
-                }
-            }
-        }
-
-//ok, fill MC Aprime info
-        List<MCParticle> mclist = event.getMCParticles();
-        MCParticle mcEle = null;
-        MCParticle mcPos = null;
-        MCParticle mcApr = null;
-        for (MCParticle mcp : mclist) {
-//            System.out.print("PDG ID = "+mcp.getPDGID());
-            if (mcp.getPDGID() == 622) {
-                mcApr = mcp;
-            }
-            if (mcp.getParents().size() == 1 && mcp.getParents().get(0).getPDGID() == 622) {
-                if (mcp.getPDGID() == -11) {
-                    mcPos = mcp;
-                }
-                if (mcp.getPDGID() == 11) {
-                    mcEle = mcp;
-                }
-            }
-        }
-//should probably check that each MC particles are found, but they should be...
-        double pxMCE = -99;
-        double pyMCE = -99;
-        double pzMCE = -99;
-        double pxMCP = -99;
-        double pyMCP = -99;
-        double pzMCP = -99;
-        double pxMCA = -99;
-        double pyMCA = -99;
-        double pzMCA = -99;
-        double mMCA = -99;
-        Hep3Vector decayMCA = new BasicHep3Vector();
-        int findableE = 0;
-        int findableP = 0;
-        int foundE = 0;
-        int foundP = 0;
-        if (mcEle != null) {
-            pxMCE = mcEle.getPX();
-            pyMCE = mcEle.getPY();
-            pzMCE = mcEle.getPZ();
-            if (findable.InnerTrackerIsFindable(mcEle, _minLayers)) {
-                findableE = 1;
-            }
-            Set<Track> trklistE = trktomc.allTo(mcEle);
-            foundE = trklistE.size();//can be greater than 1 if more than 1 track shares hits
-        } else {
-            System.out.println("!!!!!   WHAT, no mcEle      !!!!!!!!!");
-        }
-        if (mcPos != null) {
-            pxMCP = mcPos.getPX();
-            pyMCP = mcPos.getPY();
-            pzMCP = mcPos.getPZ();
-            if (findable.InnerTrackerIsFindable(mcPos, _minLayers)) {
-                findableP = 1;
-            }
-            Set<Track> trklistP = trktomc.allTo(mcPos);
-            foundP = trklistP.size();//can be greater than 1 if more than 1 track shares hits
-        } else {
-            System.out.println("!!!!!   WHAT, no mcPos      !!!!!!!!!");
-        }
-        if (mcApr != null) {
-            pxMCA = mcApr.getPX();
-            pyMCA = mcApr.getPY();
-            pzMCA = mcApr.getPZ();
-            mMCA = mcApr.getMass();
-            decayMCA = mcApr.getEndPoint();
-        } else {
-            System.out.println("!!!!!   WHAT, no mvApr      !!!!!!!!!");
-        }
-        pw.format(
-                "%d %5.5f %5.5f %5.5f %d %d ", -666, pxMCE, pyMCE, pzMCE, findableE, foundE);
-        pw.format(
-                "%5.5f %5.5f %5.5f %d %d ", pxMCP, pyMCP, pzMCP, findableP, foundP);
-        pw.format(
-                "%5.5f %5.5f %5.5f %5.5f %5.5f %5.5f %5.5f", pxMCA, pyMCA, pzMCA, mMCA, decayMCA.x(), decayMCA.y(), decayMCA.z());
-        pw.println();
-
-
-
-
-        return;
-
-    }
-
-    public void endOfData() {
-
-        pw.close();
-        try {
-            fw.close();
-        } catch (IOException ex) {
-            Logger.getLogger(FastTrackAnalysisDriver.class.getName()).log(Level.SEVERE, null, ex);
-        }
-    }
-
-    public void setOutputPlots(String output) {
-    }
-
-    public void setOutputText(String output) {
-        this.outputTextName = output;
-    }
-
-    private double getInvMass(Track track1, StraightLineTrack slt1, Track track2, StraightLineTrack slt2) {
-        double esum = 0.;
-        double pxsum = 0.;
-        double pysum = 0.;
-        double pzsum = 0.;
-        double chargesum = 0.;
-        double me = 0.000511;
-        // Loop over jets
-
-        double p1x = track1.getPX();
-        double p1y = track1.getPY();
-        double p1z = track1.getPZ();
-        double p1mag2 = p1x * p1x + p1y * p1y + p1z * p1z;
-        double e1 = Math.sqrt(p1mag2 + me * me);
-        double dydx1 = slt1.dydx();
-        double dzdx1 = slt1.dzdx();
-        double s1sq = 1 + 1 / (dydx1 * dydx1) + (dzdx1 * dzdx1) / (dydx1 * dydx1);
-        double truep1y = Math.sqrt(p1mag2 / s1sq);
-        if (dydx1 < 0) {
-            truep1y = -truep1y;
-        }
-        double truep1x = truep1y / dydx1;
-        double truep1z = dzdx1 * truep1x;
-
-        double p2x = track2.getPX();
-        double p2y = track2.getPY();
-        double p2z = track2.getPZ();
-        double p2mag2 = p2x * p2x + p2y * p2y + p2z * p2z;
-        double e2 = Math.sqrt(p2mag2 + me * me);
-
-        double dydx2 = slt2.dydx();
-        double dzdx2 = slt2.dzdx();
-        double s2sq = 1 + 1 / (dydx2 * dydx2) + (dzdx2 * dzdx2) / (dydx2 * dydx2);
-        double truep2y = Math.sqrt(p2mag2 / s2sq);
-        if (dydx2 < 0) {
-            truep2y = -truep2y;
-        }
-        double truep2x = truep2y / dydx2;
-        double truep2z = dzdx2 * truep2x;
-
-        pxsum =
-                truep1x + truep2x;
-        pysum =
-                truep1y + truep2y;
-        pzsum =
-                truep1z + truep2z;
-
-        esum =
-                e1 + e2;
-//        double p1dotp2 = p1x * p2x + p1y * p2y + p1z * p2z;
-        double p1dotp2 = truep1x * truep2x + truep1y * truep2y + truep1z * truep2z;
-        double e1e2 = e1 * e2;
-        double invmass = Math.sqrt(2 * me * me + 2 * (e1e2 - p1dotp2));
-        // Compute total momentum and hence event mass
-        double psum = Math.sqrt(pxsum * pxsum + pysum * pysum + pzsum * pzsum);
-        double evtmass = Math.sqrt(esum * esum - psum * psum);
-//        System.out.println("invmass= " + invmass + "; evtmass=" + evtmass);
-        return invmass;
-    }
-
-//find the DOCA to the beamline extrpolating linearly from the reference point
-    private double findDoca(double y, double z, double px, double py, double pz) {
-        double xoca = 0;
-        double sy = py / px;
-        double sz = pz / px;
-        xoca =
-                -(y * sy + z * sz) / (sy * sy + sz + sz);
-        double doca = Math.sqrt(Math.pow(y + sy * xoca, 2) + Math.pow(z + sz * xoca, 2));
-        return doca;
-    }
-
-//find the XOCA to the beamline extrpolating linearly from the reference point
-    private double findXoca(double y, double z, double px, double py, double pz) {
-        double xoca = 0;
-        double sy = py / px;
-        double sz = pz / px;
-        xoca =
-                -(y * sy + z * sz) / (sy * sy + sz + sz);
-        return xoca;
-    }
-
-    private double[] findPoca(double y, double z, double px, double py, double pz) {
-        double poca[] = {0, 0, 0};
-        double sy = py / px;
-        double sz = pz / px;
-        poca[0] = -(y * sy + z * sz) / (sy * sy + sz * sz);
-        poca[1] = y + sy * poca[0];
-        poca[2] = z + sz * poca[0];
-        return poca;
-    }
-
-    private Hep3Vector getV0Momentum(Track track1, StraightLineTrack slt1, Track track2, StraightLineTrack slt2) {
-
-
-        Hep3Vector p1 = getTrueMomentum(track1, slt1);
-        Hep3Vector p2 = getTrueMomentum(track2, slt2);
-        Hep3Vector pV0 = VecOp.add(p1, p2);
-
-        return pV0;
-
-    }
-
-    private double getV0OpeningAngle(Track track1, StraightLineTrack slt1, Track track2, StraightLineTrack slt2) {
-
-        Hep3Vector p1 = getTrueMomentum(track1, slt1);
-        Hep3Vector p2 = getTrueMomentum(track2, slt2);
-
-        return VecOp.dot(p1, p2) / (p1.magnitude() * p2.magnitude());
-
-    }
-
-    private Hep3Vector getTrueMomentum(Track track1, StraightLineTrack slt1) {
-        double[] truep = {0, 0, 0};
-        double me = 0.000511;
-        double p1x = track1.getPX();
-        double p1y = track1.getPY();
-        double p1z = track1.getPZ();
-        double p1mag2 = p1x * p1x + p1y * p1y + p1z * p1z;
-        double e1 = Math.sqrt(p1mag2 + me * me);
-        double dydx1 = slt1.dydx();
-        double dzdx1 = slt1.dzdx();
-        double s1sq = 1 + 1 / (dydx1 * dydx1) + (dzdx1 * dzdx1) / (dydx1 * dydx1);
-        truep[1] = Math.sqrt(p1mag2 / s1sq);
-        if (dydx1 < 0) {
-            truep[1] = -truep[1];
-        }
-        truep[0] = truep[1] / dydx1;
-        truep[2] = dzdx1 * truep[0];
-        return new BasicHep3Vector(truep[0], truep[1], truep[2]);
-    }
-
-    private double getCosAlpha(Hep3Vector vertex, Hep3Vector pV0) {
-        return VecOp.dot(vertex, pV0) / (vertex.magnitude() * pV0.magnitude());
-    }
-
-    private double getMag(double[] vec) {
-        return Math.sqrt(vec[0] * vec[0] + vec[1] * vec[1] + vec[2] * vec[2]);
-    }
-
-    private HelicalTrackStrip getNearestHit(HelicalTrackStrip cl, List<HelicalTrackHit> toththits) {
-        Hep3Vector corigin = cl.origin();
-        Hep3Vector u = cl.u();
-        double umeas = cl.umeas();
-        Hep3Vector uvec = VecOp.mult(umeas, u);
-        Hep3Vector clvec = VecOp.add(corigin, uvec);
-        int layer = cl.layer();
-        HelicalTrackStrip nearest = null;
-        double mindist = 99999999;
-        for (HelicalTrackHit hth : toththits) {
-            HelicalTrackCross cross = (HelicalTrackCross) hth;
-            for (HelicalTrackStrip str : cross.getStrips()) {
-                if (str != cl) {
-                    Hep3Vector strorigin = str.origin();
-                    Hep3Vector stru = str.u();
-                    double strumeas = str.umeas();
-                    Hep3Vector struvec = VecOp.mult(strumeas, stru);
-                    Hep3Vector strvec = VecOp.add(strorigin, struvec);
-                    int strlayer = cl.layer();
-                    if (layer == strlayer && VecOp.sub(clvec, strvec).magnitude() < mindist) {
-                        mindist = VecOp.sub(clvec, strvec).magnitude();
-                        nearest =
-                                str;
-                    }
-
-                }
-            }
-        }
-
-        return nearest;
-    }
-
-    private Double getNearestDistance(HelicalTrackStrip cl, List<HelicalTrackHit> toththits) {
-        Hep3Vector corigin = cl.origin();
-        Hep3Vector u = cl.u();
-        double umeas = cl.umeas();
-        Hep3Vector uvec = VecOp.mult(umeas, u);
-        Hep3Vector clvec = VecOp.add(corigin, uvec);
-        int layer = cl.layer();
-        HelicalTrackStrip nearest = null;
-        Double mindist = 99999999.0;
-        for (HelicalTrackHit hth : toththits) {
-            HelicalTrackCross cross = (HelicalTrackCross) hth;
-            for (HelicalTrackStrip str : cross.getStrips()) {
-                if (str != cl) {
-                    Hep3Vector strorigin = str.origin();
-                    Hep3Vector stru = str.u();
-                    double strumeas = str.umeas();
-                    Hep3Vector struvec = VecOp.mult(strumeas, stru);
-                    Hep3Vector strvec = VecOp.add(strorigin, struvec);
-                    int strlayer = str.layer();
-                    //for some reason (str!=cl) not working anymore...so make sure the distance between hits isn't 0
-                    if (layer == strlayer && VecOp.sub(clvec, strvec).magnitude() < Math.abs(mindist) && VecOp.sub(clvec, strvec).magnitude() != 0) {
-                        mindist = VecOp.sub(clvec, strvec).magnitude();
-                        if (Math.abs(clvec.z()) > Math.abs(strvec.z())) {
-                            mindist = -mindist;
-                        }
-                        nearest = str;
-                    }
-
-                }
-            }
-        }
-        return mindist;
-    }
-
-    private Integer encodeLayers(List<Integer> trackLayers) {
-        Integer hitsEncoded = 0;
-        for (Integer layer : trackLayers) {
-            hitsEncoded += (int) Math.pow(2, layer - 1);
-        }
-        return hitsEncoded;
-    }
-
-    private double getErr(double errSquared) {
-        if (errSquared > 0) {
-            return Math.sqrt(errSquared);
-        } else {
-            return -99;
-        }
-    }
-}

java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham
HPSTrackerHit.java removed after 382
--- java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/HPSTrackerHit.java	2014-03-26 05:43:58 UTC (rev 382)
+++ java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/HPSTrackerHit.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,43 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.lcsim.hps.users.mgraham;
-
-import org.lcsim.detector.identifier.Identifier;
-import org.lcsim.event.RawTrackerHit;
-import org.lcsim.event.base.BaseRawTrackerHit;
-
-/**
- *
- * @author mgraham
- */
-public class HPSTrackerHit extends BaseRawTrackerHit{
-        double t0;
-        double amp;                
-      public HPSTrackerHit(
-    		long id,
-    		int time,
-    		short[] adcValues, double t0, double Amp) {
-    	this.cellId = id;
-    	this.compactId = new Identifier(id);
-    	this.time = time;
-    	this.adcValues = adcValues;
-        this.t0=t0;
-        this.amp=Amp;        
-    }
-      
-      public HPSTrackerHit(
-    		RawTrackerHit rth, double t0, double Amp) {
-    	this.cellId = rth.getCellID();
-    	this.compactId = new Identifier(rth.getCellID());
-    	this.time = rth.getTime();
-    	this.adcValues = rth.getADCValues();
-        this.t0=t0;
-        this.amp=Amp;        
-    }
-      
-      public double getT0(){return t0;}
-       public double getAmp(){return amp;}               
-    
-}

java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham
HelicalTrackHitResidualsDriver.java removed after 382
--- java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/HelicalTrackHitResidualsDriver.java	2014-03-26 05:43:58 UTC (rev 382)
+++ java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/HelicalTrackHitResidualsDriver.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,333 +0,0 @@
-package org.lcsim.hps.users.mgraham;
-
-import hep.aida.IDataPointSet;
-import hep.aida.IDataPointSetFactory;
-import hep.aida.IHistogram1D;
-import hep.aida.IPlotter;
-import hep.aida.ref.plotter.PlotterRegion;
-import hep.physics.vec.BasicHep3Vector;
-import hep.physics.vec.Hep3Vector;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.hps.conditions.deprecated.SvtUtils;
-import org.hps.recon.tracking.EventQuality;
-import org.hps.recon.tracking.TrackUtils;
-import org.hps.util.AIDAFrame;
-import org.lcsim.detector.tracker.silicon.SiSensor;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.RawTrackerHit;
-import org.lcsim.event.Track;
-import org.lcsim.event.TrackerHit;
-import org.lcsim.fit.helicaltrack.HelicalTrackFit;
-import org.lcsim.fit.helicaltrack.HelicalTrackHit;
-import org.lcsim.geometry.Detector;
-import org.lcsim.hps.users.phansson.TrigRateDriver;
-import org.lcsim.recon.tracking.seedtracker.SeedCandidate;
-import org.lcsim.recon.tracking.seedtracker.SeedTrack;
-import org.lcsim.util.Driver;
-import org.lcsim.util.aida.AIDA;
-
-/**
- *
- * @author mgraham
- */
-public class HelicalTrackHitResidualsDriver extends Driver {
-
-    private AIDA aida = AIDA.defaultInstance();
-    private int totalTracks=0;
-    private int totalTracksProcessed=0;
-    private String outputPlotFileName="";
-    private String trackCollectionName="MatchedTracks";
-    private boolean hideFrame = false;
-    private boolean _debug = false;
-    private boolean _includeMS = true;
-    
-    private AIDAFrame plotterFrame;
-//    ICloud1D[] _h_resz_track_top = new ICloud1D[5];
-//    ICloud1D[] _h_resz_track_bottom = new ICloud1D[5];
-//    ICloud1D[] _h_resy_track_top = new ICloud1D[5];
-//    ICloud1D[] _h_resy_track_bottom = new ICloud1D[5];
-    private IHistogram1D[] _h_resz_track_top = new IHistogram1D[5];
-    private IHistogram1D[] _h_resz_track_bottom = new IHistogram1D[5];
-    private IHistogram1D[] _h_resy_track_top = new IHistogram1D[5];
-    private IHistogram1D[] _h_resy_track_bottom = new IHistogram1D[5];
-    private IDataPointSet dps_hth_y_b;
-    private IDataPointSet dps_hth_y_t;
-    private IDataPointSet dps_hth_z_b;
-    private IDataPointSet dps_hth_z_t;
-    private IPlotter _plotter_resz_top;
-    private IPlotter _plotter_resy_top;
-    private IPlotter _plotter_resz_bottom;
-    private IPlotter _plotter_resy_bottom;
-    private IPlotter _plotter_mean_res;
-    
-       
-    
-    
-    public void setDebug(boolean v) {
-        this._debug = v;
-    }
-    
-    public void setTrackCollectionName(String trackCollectionName) {
-        this.trackCollectionName = trackCollectionName;
-    }
-
-    public void setOutputPlotFileName(String filename) {
-        outputPlotFileName = filename;
-    }
-    
-    public void setHideFrame(boolean hide) {
-        hideFrame = hide;
-    }
-    
-    public void setIncludeMS(boolean inc) {
-        this._includeMS = inc;
-    }
-    
-    public HelicalTrackHitResidualsDriver() {
-    
-    }
-    
-
-    
-    @Override
-    public void detectorChanged(Detector detector) {
-        
-        Hep3Vector IP = new BasicHep3Vector(0., 0., 1.);
-        Hep3Vector _bfield = new BasicHep3Vector(0,0,detector.getFieldMap().getField(IP).y());
-
-        makePlots();
-       
-        
-    }
-    
-   
-
-    
-    @Override
-    public void process(EventHeader event) {
-
-        List<Track> tracklist = new ArrayList<Track>();
-        if(event.hasCollection(Track.class,this.trackCollectionName)) {        
-            tracklist = event.get(Track.class, this.trackCollectionName);
-             if(_debug) {
-                System.out.println(this.getClass().getSimpleName() + ": Number of Tracks = " + tracklist.size());
-             }
-        }
-
-        
-        
-        for (Track track : tracklist) {
-            
-            if(!TrackUtils.isGoodTrack(track, tracklist, EventQuality.Quality.MEDIUM)) {
-                continue;
-            }
-            
-            SeedTrack st = (SeedTrack) track;
-            SeedCandidate seed = st.getSeedCandidate();
-            HelicalTrackFit trk = seed.getHelix();
-            List<TrackerHit> hitsOnTrack = track.getTrackerHits();
-            for(TrackerHit hit : hitsOnTrack) {
-                HelicalTrackHit hth = (HelicalTrackHit) hit;
-                //HelicalTrackCross htc = (HelicalTrackCross) hth;
-                //System.out.printf("%s: getHitMap: hth position before trkdir: (%.3f,%.3f,%.3f)\n",this.getClass().getSimpleName(),hth.x(),hth.y(),hth.z());
-                //htc.setTrackDirection(trk);
-                Map<String,Double> res_track = TrackUtils.calculateTrackHitResidual(hth, trk, this._includeMS);
-                boolean isTop = false;
-                if(SvtUtils.getInstance().isTopLayer((SiSensor)((RawTrackerHit)hth.getRawHits().get(0)).getDetectorElement())) {
-                    isTop = true;
-                }
-                int layer = hth.Layer();
-                if(_debug) System.out.println(this.getClass().getSimpleName() + ": residual for hit at " + hth.toString() + " and layer " + layer);
-                if(layer%2==0) {
-                    System.out.println(this.getClass().getSimpleName() + ": HTH layer is not odd!" + layer);
-                    System.exit(1);
-                }
-                int layer_idx = (layer-1)/2;
-                if(isTop) {
-                    this._h_resz_track_top[layer_idx].fill(res_track.get("resz"));
-                    this._h_resy_track_top[layer_idx].fill(res_track.get("resy"));
-                } else {
-                    this._h_resz_track_bottom[layer_idx].fill(res_track.get("resz"));
-                    this._h_resy_track_bottom[layer_idx].fill(res_track.get("resy"));
-                }
-
-//                if(Math.abs(res_track.get("resy"))>0.02) {
-//                    System.out.println(this.getClass().getSimpleName() + ": this has large y res = " + res_track.get("resy"));
-//                    System.exit(1);
-//                }
-                
-            }
-            
-        }
-        totalTracks++;
-        totalTracksProcessed++;
-
-        
-
-        if(totalTracks%50==0) this.updatePlots();
-
-        
-        
-    }
-
-    public void endOfData() {
-        this.updatePlots();
-        //try {
-            System.out.println(this.getClass().getSimpleName() + ": Total Number of Tracks Found = "+totalTracks);
-            System.out.println(this.getClass().getSimpleName() + ": Total Number of Tracks Processed = "+totalTracksProcessed);
-//        } catch (IOException ex) {
-//            Logger.getLogger(CmpGenToFittedTracksDriver.class.getName()).log(Level.SEVERE, null, ex);
-//        }
-        if (!"".equals(outputPlotFileName))
-        try {
-            aida.saveAs(outputPlotFileName);
-        } catch (IOException ex) {
-            Logger.getLogger(TrigRateDriver.class.getName()).log(Level.SEVERE, "Couldn't save aida plots to file " + outputPlotFileName, ex);
-        }
-        
-    }
-    
-   
-    private void makePlots() {
-        
-        int nbins = 50;
-        double bins_resz_min[] = {-0.15,-0.4,-0.6,-1.0,-1.5};
-        double bins_resz_max[] = {0.15,0.4,0.6,1.0,1.5};
-        double bins_resy_min[] = {-0.4,-0.6,-1.0,-1.5,-1.8};
-        double bins_resy_max[] = {0.4,0.6,1.0,1.5,1.8};
-        
-        
-        _plotter_resz_top = aida.analysisFactory().createPlotterFactory().create();
-        _plotter_resz_top.setTitle("res z top");
-        _plotter_resz_top.createRegions(5,1);
-        _plotter_resy_top = aida.analysisFactory().createPlotterFactory().create();
-        _plotter_resy_top.setTitle("res y top");
-        _plotter_resy_top.createRegions(5,1);
-        for(int i=1;i<6;++i) {
-//            _h_resz_track_top[i-1] = aida.cloud1D("h_resz_track_top_layer"+i);
-//            _h_resy_track_top[i-1] = aida.cloud1D("h_resy_track_top_layer"+i);
-            _h_resz_track_top[i-1] = aida.histogram1D("h_resz_track_top_layer"+i,nbins,bins_resz_min[i-1],bins_resz_max[i-1]);
-            _h_resy_track_top[i-1] = aida.histogram1D("h_resy_track_top_layer"+i,nbins,bins_resy_min[i-1],bins_resy_max[i-1]);
-            _plotter_resz_top.region(i-1).plot(_h_resz_track_top[i-1]);
-            _plotter_resy_top.region(i-1).plot(_h_resy_track_top[i-1]);
-        }
-        
-        _plotter_resz_bottom = aida.analysisFactory().createPlotterFactory().create();
-        _plotter_resz_bottom.setTitle("res z bottom");
-        _plotter_resz_bottom.createRegions(5,1);
-        _plotter_resy_bottom = aida.analysisFactory().createPlotterFactory().create();
-        _plotter_resy_bottom.setTitle("res y bottom");
-        _plotter_resy_bottom.createRegions(5,1);
-        for(int i=1;i<6;++i) {
-            _h_resz_track_bottom[i-1] = aida.histogram1D("h_resz_track_bottom_layer"+i,nbins,bins_resz_min[i-1],bins_resz_max[i-1]);
-            _h_resy_track_bottom[i-1] = aida.histogram1D("h_resy_track_bottom_layer"+i,nbins,bins_resy_min[i-1],bins_resy_max[i-1]);
-//            _h_resz_track_bottom[i-1] = aida.cloud1D("h_resz_track_bottom_layer"+i);
-//            _h_resy_track_bottom[i-1] = aida.cloud1D("h_resy_track_bottom_layer"+i);
-            _plotter_resz_bottom.region(i-1).plot(_h_resz_track_bottom[i-1]);
-            _plotter_resy_bottom.region(i-1).plot(_h_resy_track_bottom[i-1]);
-        
-        }
-        
-        _plotter_mean_res = aida.analysisFactory().createPlotterFactory().create();
-        _plotter_mean_res.setTitle("Mean res y");
-        _plotter_mean_res.createRegions(2,2);
-        
-        IDataPointSetFactory dpsf = aida.analysisFactory().createDataPointSetFactory(null);
-        
-        dps_hth_y_b = dpsf.create("dps_hth_y_b", "Mean of y residual bottom",2);
-        dps_hth_y_t = dpsf.create("dps_hth_y_t", "Mean of y residual top",2);
-        _plotter_mean_res.region(1).plot(dps_hth_y_b);
-        _plotter_mean_res.region(0).plot(dps_hth_y_t);
-
-        dps_hth_z_b = dpsf.create("dps_hth_z_b", "Mean of z residual bottom",2);
-        dps_hth_z_t = dpsf.create("dps_hth_z_t", "Mean of z residual top",2);
-        _plotter_mean_res.region(3).plot(dps_hth_z_b);
-        _plotter_mean_res.region(2).plot(dps_hth_z_t);
-
-        ((PlotterRegion)_plotter_mean_res.region(0)).getPlot().setAllowUserInteraction(true);
-        ((PlotterRegion) _plotter_mean_res.region(0)).getPlot().setAllowPopupMenus(true);
-        ((PlotterRegion)_plotter_mean_res.region(1)).getPlot().setAllowUserInteraction(true);
-        ((PlotterRegion) _plotter_mean_res.region(1)).getPlot().setAllowPopupMenus(true);
-        
-        
-        plotterFrame = new AIDAFrame();
-        plotterFrame.setTitle("HTH Residuals");
-        plotterFrame.addPlotter(_plotter_resz_top);
-        plotterFrame.addPlotter(_plotter_resz_bottom);
-        plotterFrame.addPlotter(_plotter_resy_top);
-        plotterFrame.addPlotter(_plotter_resy_bottom);
-        plotterFrame.addPlotter(_plotter_mean_res);
-        plotterFrame.pack();
-        plotterFrame.setVisible(!hideFrame);
-        
-    }
-    
-    
-    void updatePlots() {
-        dps_hth_y_t.clear();
-        dps_hth_z_t.clear();
-        dps_hth_z_b.clear();
-        dps_hth_z_t.clear();
-        
-         for(int i=1;i<6;++i) {
-                
-            double mean = this._h_resy_track_bottom[i-1].mean();
-            double stddev = this._h_resy_track_bottom[i-1].rms();
-            double N =  this._h_resy_track_bottom[i-1].entries();
-            double error = N >0 ? stddev/Math.sqrt(N) : 0; 
-            dps_hth_y_b.addPoint();
-            dps_hth_y_b.point(i-1).coordinate(1).setValue(mean);
-            dps_hth_y_b.point(i-1).coordinate(1).setErrorPlus(error);
-            dps_hth_y_b.point(i-1).coordinate(0).setValue(i);
-            dps_hth_y_b.point(i-1).coordinate(0).setErrorPlus(0);
-            
-            mean = this._h_resy_track_top[i-1].mean();
-            stddev = this._h_resy_track_top[i-1].rms();
-            N =  this._h_resy_track_top[i-1].entries();
-            error = N >0 ? stddev/Math.sqrt(N) : 0; 
-            dps_hth_y_t.addPoint();
-            dps_hth_y_t.point(i-1).coordinate(1).setValue(mean);
-            dps_hth_y_t.point(i-1).coordinate(1).setErrorPlus(error);
-            dps_hth_y_t.point(i-1).coordinate(0).setValue(i);
-            dps_hth_y_t.point(i-1).coordinate(0).setErrorPlus(0);
-            
-            mean = this._h_resz_track_top[i-1].mean();
-            stddev = this._h_resz_track_top[i-1].rms();
-            N =  this._h_resz_track_top[i-1].entries();
-            error = N >0 ? stddev/Math.sqrt(N) : 0; 
-            dps_hth_z_t.addPoint();
-            dps_hth_z_t.point(i-1).coordinate(1).setValue(mean);
-            dps_hth_z_t.point(i-1).coordinate(1).setErrorPlus(error);
-            dps_hth_z_t.point(i-1).coordinate(0).setValue(i);
-            dps_hth_z_t.point(i-1).coordinate(0).setErrorPlus(0);
-
-            mean = this._h_resz_track_bottom[i-1].mean();
-            stddev = this._h_resz_track_bottom[i-1].rms();
-            N =  this._h_resz_track_bottom[i-1].entries();
-            error = N >0 ? stddev/Math.sqrt(N) : 0; 
-            dps_hth_z_b.addPoint();
-            dps_hth_z_b.point(i-1).coordinate(1).setValue(mean);
-            dps_hth_z_b.point(i-1).coordinate(1).setErrorPlus(error);
-            dps_hth_z_b.point(i-1).coordinate(0).setValue(i);
-            dps_hth_z_b.point(i-1).coordinate(0).setErrorPlus(0);
-            
-            
-           
-            
-
-         }
-        
-        
-        
-        
-    }
-    
-    
-}

java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham
HitTimePlotter.java removed after 382
--- java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/HitTimePlotter.java	2014-03-26 05:43:58 UTC (rev 382)
+++ java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/HitTimePlotter.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,490 +0,0 @@
-package org.lcsim.hps.users.mgraham;
-
-import hep.aida.IAnalysisFactory;
-import hep.aida.IFitFactory;
-import hep.aida.IFitResult;
-import hep.aida.IFitter;
-import hep.aida.IHistogram1D;
-import hep.aida.IPlotter;
-import hep.aida.IPlotterStyle;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.hps.readout.ecal.ReadoutTimestamp;
-import org.hps.util.AIDAFrame;
-import org.hps.util.Resettable;
-import org.lcsim.detector.identifier.IIdentifier;
-import org.lcsim.detector.identifier.IIdentifierHelper;
-import org.lcsim.detector.tracker.silicon.SiSensor;
-import org.lcsim.event.CalorimeterHit;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.RawTrackerHit;
-import org.lcsim.event.Track;
-import org.lcsim.event.TrackerHit;
-import org.lcsim.fit.helicaltrack.HelicalTrackHit;
-import org.lcsim.geometry.Detector;
-import org.lcsim.util.Driver;
-import org.lcsim.util.aida.AIDA;
-
-/**
- *
- * @author mgraham
- */
-public class HitTimePlotter extends Driver implements Resettable {
-
-    private AIDAFrame plotterFrame;
-    private AIDA aida = AIDA.defaultInstance();
-    IPlotter plotter;
-    IPlotter plotter2;
-    IPlotter plotter3;
-    IPlotter plotter4;
-    IPlotter plotter5;
-    IPlotter plotter6;
-    IPlotter plotter7;
-    IAnalysisFactory fac = aida.analysisFactory();
-    private String trackCollectionName = "MatchedTracks";
-    private String outputPlots = null;
-    private Map<String, Integer> sensorRegionMap;
-    private String trackerName = "Tracker";
-    private List<SiSensor> sensors;
-
-    protected void detectorChanged(Detector detector) {
-        aida.tree().cd("/");
-        plotterFrame = new AIDAFrame();
-        plotterFrame.setTitle("HPS Tracking Plots");
-        sensors = detector.getSubdetector(trackerName).getDetectorElement().findDescendants(SiSensor.class);
-        sensorRegionMap = new HashMap<String, Integer>();
-        for (SiSensor sensor : sensors) {
-            int region = computePlotterRegion(sensor);
-            sensorRegionMap.put(sensor.getName(), region);
-        }
-
-        plotter = fac.createPlotterFactory().create("HPS Tracking Plots");
-        plotter.setTitle("Hit Times");
-        IPlotterStyle style = plotter.style();
-        style.dataStyle().fillStyle().setColor("yellow");
-        style.dataStyle().errorBarStyle().setVisible(false);
-        plotter.createRegions(3, 2);
-        plotterFrame.addPlotter(plotter);
-
-        IHistogram1D ecalHT = aida.histogram1D("ECAL Hit Time", 100, 0, 400);
-        IHistogram1D svtHT = aida.histogram1D("SVT Hit Time", 125, -50, 75);
-        IHistogram1D svtHTCorrected = aida.histogram1D("Trigger Corrected SVT Hit Time", 120, -240, -120);
-        IHistogram1D svtHTModCorrected = aida.histogram1D("Module Corrected SVT Hit Time", 120, -50, 70);
-        IHistogram1D svtHTCorrectedZoom = aida.histogram1D("Trigger Corrected SVT Hit Time Zoom", 80, -206, -166);
-        IHistogram1D svtHTModCorrectedZoom = aida.histogram1D("Module Corrected SVT Hit Time Zoom", 80, -20, 20);
-        plotter.region(0).plot(ecalHT);
-        plotter.region(1).plot(svtHT);
-        plotter.region(2).plot(svtHTCorrected);
-        plotter.region(3).plot(svtHTModCorrected);
-            plotter.region(4).plot(svtHTCorrectedZoom);
-        plotter.region(5).plot(svtHTModCorrectedZoom);
-        /*
-         * plotter.setTitle("Momentum"); IPlotterStyle style = plotter.style();
-         * style.dataStyle().fillStyle().setColor("yellow");
-         * style.dataStyle().errorBarStyle().setVisible(false);
-         * plotter.createRegions(2, 3); plotterFrame.addPlotter(plotter);
-         *
-         * IHistogram1D trkPx = aida.histogram1D("Track Momentum (Px)", 25,
-         * -0.25, 0.25); IHistogram1D trkPy = aida.histogram1D("Track Momentum
-         * (Py)", 25, -0.1, 0.1); IHistogram1D trkPz = aida.histogram1D("Track
-         * Momentum (Pz)", 25, 0, 3.5); IHistogram1D trkChi2 =
-         * aida.histogram1D("Track Chi2", 25, 0, 25.0); IHistogram1D xAtConvert
-         * = aida.histogram1D("X (mm) @ Converter", 50, -50, 50); IHistogram1D
-         * yAtConvert = aida.histogram1D("Y (mm) @ Converter", 50, -20, 20);
-         * plotter.region(0).plot(trkPx); plotter.region(1).plot(trkPy);
-         * plotter.region(2).plot(trkPz); plotter.region(3).plot(trkChi2);
-         * plotter.region(4).plot(xAtConvert);
-         * plotter.region(5).plot(yAtConvert);
-         */
-
-        plotter2 = fac.createPlotterFactory().create("HPS Tracking Plots");
-        plotter2.setTitle("Inner Tracker");
-        IPlotterStyle style2 = plotter2.style();
-        style2.dataStyle().fillStyle().setColor("yellow");
-        style2.dataStyle().errorBarStyle().setVisible(false);
-        plotter2.createRegions(6, 2);
-        plotterFrame.addPlotter(plotter2);
-
-        plotter3 = fac.createPlotterFactory().create("HPS Tracking Plots");
-        plotter3.setTitle("Outer Tracker");
-        plotter3.setStyle(style2);
-        plotter3.createRegions(6, 4);
-        plotterFrame.addPlotter(plotter3);
-
-        plotter4 = fac.createPlotterFactory().create("HPS Tracking Plots");
-        plotter4.setTitle("Corrected Times:  Inner Tracker");
-        IPlotterStyle style4 = plotter4.style();
-        style4.dataStyle().fillStyle().setColor("yellow");
-        style4.dataStyle().errorBarStyle().setVisible(false);
-        plotter4.createRegions(6, 2);
-        plotterFrame.addPlotter(plotter4);
-
-        plotter5 = fac.createPlotterFactory().create("HPS Tracking Plots");
-        plotter5.setTitle("Outer Tracker");
-        plotter5.setStyle(style2);
-        plotter5.createRegions(6, 4);
-        plotterFrame.addPlotter(plotter5);
-
-
-        int region = 0;
-        for (SiSensor sensor : sensors) {
-            IHistogram1D svtTimePlot = aida.histogram1D(sensor.getName() + "_Time", 60, -200, -170);
-            IHistogram1D svtCorTimePlot = aida.histogram1D(sensor.getName() + "_CorrectedTime", 100, -100, 100);
-//            int region = sensorRegionMap.get(sensor.getName());  // this doesn't work anymore...
-            IIdentifierHelper helper = sensor.getIdentifierHelper();
-            IIdentifier id = sensor.getIdentifier();
-
-            int layer = helper.getValue(id, "layer"); // 1-12; axial layers are odd layers; stereo layers are even
-            int module = helper.getValue(id, "module");
-
-            svtTimePlot.setTitle("Layer " + layer + " Module " + module);
-            if (region < 12) {
-                plotter2.region(region).plot(svtTimePlot);
-                plotter4.region(region).plot(svtCorTimePlot);
-                region++;
-            } else {
-                plotter3.region(region - 12).plot(svtTimePlot);
-                plotter5.region(region - 12).plot(svtCorTimePlot);
-                region++;
-            }
-        }
-
-
-        plotter6 = fac.createPlotterFactory().create("HPS Tracking Plots");
-        plotter6.setTitle("Tracks");
-        plotter6.setStyle(style2);
-        plotter6.createRegions(2, 2);
-        plotterFrame.addPlotter(plotter6);
-        IHistogram1D px = aida.histogram1D("Track Momentum(Px)", 50, -0.2, 0.2);
-        IHistogram1D py = aida.histogram1D("Track Momentum(Py)", 50, -0.2, 0.2);
-        IHistogram1D pz = aida.histogram1D("Track Momentum(Pz)", 50, 0, 2.2);
-        IHistogram1D chi2 = aida.histogram1D("TrackChi2", 50, 0, 25);
-        plotter6.region(0).plot(px);
-        plotter6.region(1).plot(py);
-        plotter6.region(2).plot(pz);
-        plotter6.region(3).plot(chi2);
-
-
-        plotter7 = fac.createPlotterFactory().create("HPS Tracking Plots");
-        plotter7.setTitle("Per Event");
-        plotter7.setStyle(style2);
-        plotter7.createRegions(2, 2);
-        plotterFrame.addPlotter(plotter7);
-
-        IHistogram1D nclus = aida.histogram1D("Strip Clusters per Event", 100, 0, 99);
-        IHistogram1D nhth = aida.histogram1D("Stereo Hits per Event", 100, 0, 99);
-        IHistogram1D ntrk = aida.histogram1D("Tracks per Event", 40, 0, 39);
-
-        plotter7.region(0).plot(nclus);
-        plotter7.region(1).plot(nhth);
-        plotter7.region(2).plot(ntrk);
-
-
-
-        plotterFrame.pack();
-        plotterFrame.setVisible(true);
-    }
-
-    public void process(EventHeader event) {
-        aida.tree().cd("/");
-
-        List<TrackerHit> trackerHits = event.get(TrackerHit.class, "StripClusterer_SiTrackerHitStrip1D");
-        List<CalorimeterHit> ecalHits = event.get(CalorimeterHit.class, "EcalCalHits");
-
-
-        List<HelicalTrackHit> hth = event.get(HelicalTrackHit.class, "HelicalTrackHits");
-        //        System.out.println("Event with ECal timestamp " + ReadoutTimestamp.getTimestamp(ReadoutTimestamp.SYSTEM_ECAL, event)
-//                + ", SVT timestamp " + ReadoutTimestamp.getTimestamp(ReadoutTimestamp.SYSTEM_TRACKER, event)
-//                + ", Trigger timestamp " + ReadoutTimestamp.getTimestamp(ReadoutTimestamp.SYSTEM_TRIGGER, event));
-        double t0Ecal = ReadoutTimestamp.getTimestamp(ReadoutTimestamp.SYSTEM_ECAL, event);
-        double t0Svt = ReadoutTimestamp.getTimestamp(ReadoutTimestamp.SYSTEM_TRACKER, event);
-        double t0Trig = ReadoutTimestamp.getTimestamp(ReadoutTimestamp.SYSTEM_TRIGGER, event);
-        for (CalorimeterHit hit : ecalHits) {
-            double cor = hit.getTime() + (t0Ecal - t0Trig);
-            aida.histogram1D("ECAL Hit Time").fill(hit.getTime());
-//            aida.histogram1D("Trigger Corrected ECAL Hit Time").fill(cor);
-//            System.out.println("Ecal: " + (hit.getTime()) + ";  Corrected = " + cor);
-        }
-        for (TrackerHit hit : trackerHits) {
-
-            IIdentifierHelper helper = ((RawTrackerHit) hit.getRawHits().get(0)).getIdentifierHelper();
-            IIdentifier id = ((RawTrackerHit) hit.getRawHits().get(0)).getIdentifier();
-            int layer = helper.getValue(id, "layer"); // 1-10; axial layers are odd layers; stereo layers are even
-            int module = helper.getValue(id, "module"); // 0-1; module number is top or bottom
-
-            String sensorName = ((RawTrackerHit) hit.getRawHits().get(0)).getDetectorElement().getName();
-            double cor = hit.getTime() + (t0Svt - t0Trig);
-            double corMod = cor - getT0Shift(layer, module);
-            aida.histogram1D("SVT Hit Time").fill(hit.getTime());
-            aida.histogram1D("Trigger Corrected SVT Hit Time").fill(cor);
-            aida.histogram1D("Module Corrected SVT Hit Time").fill(corMod);
-             aida.histogram1D("Trigger Corrected SVT Hit Time Zoom").fill(cor);
-            aida.histogram1D("Module Corrected SVT Hit Time Zoom").fill(corMod);
-            aida.histogram1D(sensorName + "_Time").fill(cor);
-            aida.histogram1D(sensorName + "_CorrectedTime").fill(corMod);
-
-            //System.out.println("Svt: " + (hit.getTime()) + ";  Corrected = " + cor+";  Module Corrected = " + corMod);
-        }
-        if (!event.hasCollection(Track.class, trackCollectionName)) {
-            return;
-        }
-        List<Track> tracks = event.get(Track.class, trackCollectionName);
-
-        for (Track trk : tracks) {
-            aida.histogram1D("Track Momentum(Px)").fill(trk.getPY());
-            aida.histogram1D("Track Momentum(Py)").fill(trk.getPZ());
-            aida.histogram1D("Track Momentum(Pz)").fill(trk.getPX());
-            aida.histogram1D("TrackChi2").fill(trk.getChi2());
-        }
-
-        aida.histogram1D("Strip Clusters per Event").fill(trackerHits.size());
-        aida.histogram1D("Stereo Hits per Event").fill(hth.size());
-        aida.histogram1D("Tracks per Event").fill(tracks.size());
-
-    }
-
-    private int computePlotterRegion(SiSensor sensor) {
-
-        IIdentifierHelper helper = sensor.getIdentifierHelper();
-        IIdentifier id = sensor.getIdentifier();
-
-        int layer = helper.getValue(id, "layer"); // 1-12; axial layers are odd layers; stereo layers are even
-        int module = helper.getValue(id, "module"); // 0-1; module number is top (evens) or bottom (odds)
-        int region = -99;
-        // Compute the sensor's x and y grid coordinates and then translate to region number.
-        int ix, iy;
-        if (layer < 7) {
-            ix = (layer - 1) / 2;
-            iy = 0;
-            if (module > 0) {
-                iy += 2;
-            }
-            if (layer % 2 == 0) {
-                iy += 1;
-            }
-            region = ix * 2 + iy;
-        } else {
-            ix = (layer - 7) / 2;
-            iy = module;
-
-            region = ix * 4 + iy;
-            region += 100;
-        }
-        System.out.println(sensor.getName() + "; lyr=" + layer + "; mod=" + module + " -> xy[" + ix + "][" + iy + "] -> reg=" + region);
-
-        return region;
-    }
-
-    @Override
-    public void reset() {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-
-    public void setOutputPlots(String output) {
-        this.outputPlots = output;
-    }
-
-    public void endOfData() {
-        System.out.println("Output");
-        IFitFactory fitFactory = fac.createFitFactory();
-        IFitter fitter = fitFactory.createFitter("chi2");
-
-        for (SiSensor sensor : sensors) {
-            IHistogram1D svtTimePlot = aida.histogram1D(sensor.getName() + "_Time", 150, -250, -100);
-            IHistogram1D svtCorTimePlot = aida.histogram1D(sensor.getName() + "_CorrectedTime", 100, -100, 100);
-//            int region = sensorRegionMap.get(sensor.getName());  // this doesn't work anymore...
-            IIdentifierHelper helper = sensor.getIdentifierHelper();
-            IIdentifier id = sensor.getIdentifier();
-
-            int layer = helper.getValue(id, "layer"); // 1-12; axial layers are odd layers; stereo layers are even
-            int module = helper.getValue(id, "module");
-            IHistogram1D hist = aida.histogram1D(sensor.getName() + "_Time");
-            System.out.println("Number of entries = " + hist.allEntries());
-            IFitResult result = fitter.fit(hist, "g");
-
-//            System.out.println(sensor.getName() + " Peak Position = " + getPeakPosition(aida.histogram1D(sensor.getName() + "_Time")));
-            System.out.println(sensor.getName() + " " + result.fittedParameterNames()[0] + " = " + result.fittedParameters()[0] + " +/- " + result.errors()[0]);
-            System.out.println(sensor.getName() + " " + result.fittedParameterNames()[1] + " = " + result.fittedParameters()[1] + " +/- " + result.errors()[1]);
-            System.out.println(sensor.getName() + " " + result.fittedParameterNames()[2] + " = " + result.fittedParameters()[2] + " +/- " + result.errors()[2]);
-
-        }
-        
-          IHistogram1D hist = aida.histogram1D("Trigger Corrected SVT Hit Time Zoom");
-           System.out.println("Number of entries = " + hist.allEntries());
-            IFitResult result = fitter.fit(hist, "g");
-
-//            System.out.println(sensor.getName() + " Peak Position = " + getPeakPosition(aida.histogram1D(sensor.getName() + "_Time")));
-            System.out.println("Trigger Corrected SVT Hit Time Zoom "  + result.fittedParameterNames()[0] + " = " + result.fittedParameters()[0] + " +/- " + result.errors()[0]);
-            System.out.println("Trigger Corrected SVT Hit Time Zoom "  + result.fittedParameterNames()[1] + " = " + result.fittedParameters()[1] + " +/- " + result.errors()[1]);
-            System.out.println("Trigger Corrected SVT Hit Time Zoom "  + result.fittedParameterNames()[2] + " = " + result.fittedParameters()[2] + " +/- " + result.errors()[2]);
-
-           hist = aida.histogram1D("Module Corrected SVT Hit Time Zoom");
-           System.out.println("Number of entries = " + hist.allEntries());
-             result = fitter.fit(hist, "g");
-
-//            System.out.println(sensor.getName() + " Peak Position = " + getPeakPosition(aida.histogram1D(sensor.getName() + "_Time")));
-            System.out.println("Module Corrected SVT Hit Time Zoom "  + result.fittedParameterNames()[0] + " = " + result.fittedParameters()[0] + " +/- " + result.errors()[0]);
-            System.out.println("Module Corrected SVT Hit Time Zoom "  + result.fittedParameterNames()[1] + " = " + result.fittedParameters()[1] + " +/- " + result.errors()[1]);
-            System.out.println("Module Corrected SVT Hit Time Zoom "  + result.fittedParameterNames()[2] + " = " + result.fittedParameters()[2] + " +/- " + result.errors()[2]);
-
-        
-        if (outputPlots != null) {
-            try {
-                aida.saveAs(outputPlots);
-            } catch (IOException ex) {
-                Logger.getLogger(HitTimePlotter.class.getName()).log(Level.SEVERE, null, ex);
-            }
-        }
-    }
-
-    private double getPeakPosition(IHistogram1D hist) {
-        int nbins = hist.axis().bins();
-        int maxBin = -99;
-        int max = -99;
-        for (int i = 0; i < nbins; i++) {
-            if (hist.binEntries(i) > max) {
-                maxBin = i;
-                max = hist.binEntries(i);
-            }
-        }
-        return hist.binMean(maxBin);
-
-    }
-
-    private double getT0Shift(int layer, int module) {
-        double value = 0;
-        switch (module) {
-            case 0:
-                switch (layer) {
-                    case 1:
-                        value = -186.1;
-                        break;
-                    case 2:
-                        value = -186.1;
-                        break;
-                    case 3:
-                        value = -185.8;
-                        break;
-                    case 4:
-                        value = -185.9;
-                        break;
-                    case 5:
-                        value = -185.8;
-                        break;
-                    case 6:
-                        value = -185.8;
-                        break;
-                    case 7:
-                        value = -185.8;
-                        break;
-                    case 8:
-                        value = -185.9;
-                        break;
-                    case 9:
-                        value = -185.8;
-                        break;
-                    case 10:
-                        value = -185.8;
-                        break;
-                    case 11:
-                        value = -185.6;
-                        break;
-                    case 12:
-                        value = -186.0;
-                        break;
-                }
-                break;
-            case 1:
-                switch (layer) {
-                    case 1:
-                        value = -185.6;
-                        break;
-                    case 2:
-                        value = -185.3;
-                        break;
-                    case 3:
-                        value = -185.9;
-                        break;
-                    case 4:
-                        value = -185.7;
-                        break;
-                    case 5:
-                        value = -185.6;
-                        break;
-                    case 6:
-                        value = -185.9;
-                        break;
-                    case 7:
-                        value = -185.8;
-                        break;
-                    case 8:
-                        value = -186.1;
-                        break;
-                    case 9:
-                        value = -186.0;
-                        break;
-                    case 10:
-                        value = -185.9;
-                        break;
-                    case 11:
-                        value = -185.9;
-                        break;
-                    case 12:
-                        value = -186.1;
-                        break;
-                }
-                break;
-            case 2:
-                switch (layer) {
-                    case 7:
-                        value = -185.7;
-                        break;
-                    case 8:
-                        value = -185.7;
-                        break;
-                    case 9:
-                        value = -185.9;
-                        break;
-                    case 10:
-                        value = -186.0;
-                        break;
-                    case 11:
-                        value = -185.8;
-                        break;
-                    case 12:
-                        value = -185.9;
-                        break;
-                }
-                break;
-            case 3:
-                switch (layer) {
-                    case 7:
-                        value = -185.5;
-                        break;
-                    case 8:
-                        value = -185.6;
-                        break;
-                    case 9:
-                        value = -185.5;
-                        break;
-                    case 10:
-                        value = -185.5;
-                        break;
-                    case 11:
-                        value = -186.6;
-                        break;
-                    case 12:
-                        value = -186.7;
-                        break;
-                }
-                break;
-        }
-        return value;
-    }
-}

java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham
JasAnalysisDriver.java removed after 382
--- java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/JasAnalysisDriver.java	2014-03-26 05:43:58 UTC (rev 382)
+++ java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/JasAnalysisDriver.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,1017 +0,0 @@
-package org.lcsim.hps.users.mgraham;
-
-import hep.aida.IAnalysisFactory;
-import hep.aida.IHistogramFactory;
-import hep.aida.IProfile1D;
-import hep.physics.matrix.BasicMatrix;
-import hep.physics.matrix.SymmetricMatrix;
-import hep.physics.vec.BasicHep3Vector;
-import hep.physics.vec.Hep3Vector;
-import hep.physics.vec.VecOp;
-
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.hps.recon.tracking.FindableTrack;
-import org.hps.recon.tracking.StraightLineTrack;
-import org.hps.recon.tracking.TrackAnalysis;
-import org.hps.recon.vertexing.BFitter;
-import org.hps.recon.vertexing.BilliorTrack;
-import org.hps.recon.vertexing.BilliorVertex;
-import org.hps.recon.vertexing.BilliorVertexer;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.LCRelation;
-import org.lcsim.event.MCParticle;
-import org.lcsim.event.RawTrackerHit;
-import org.lcsim.event.RelationalTable;
-import org.lcsim.event.SimTrackerHit;
-import org.lcsim.event.Track;
-import org.lcsim.event.TrackerHit;
-import org.lcsim.event.base.BaseRelationalTable;
-import org.lcsim.fit.helicaltrack.HelicalTrackCross;
-import org.lcsim.fit.helicaltrack.HelicalTrackFit;
-import org.lcsim.fit.helicaltrack.HelicalTrackHit;
-import org.lcsim.fit.helicaltrack.HelixParamCalculator;
-import org.lcsim.fit.helicaltrack.HelixUtils;
-import org.lcsim.recon.tracking.digitization.sisim.SiTrackerHitStrip1D;
-import org.lcsim.recon.tracking.seedtracker.SeedCandidate;
-import org.lcsim.recon.tracking.seedtracker.SeedTrack;
-import org.lcsim.spacegeom.SpacePoint;
-import org.lcsim.util.Driver;
-import org.lcsim.util.aida.AIDA;
-
-/**
-
- @author partridge
- */
-public class JasAnalysisDriver extends Driver {
-
-    private AIDA aida = AIDA.defaultInstance();
-    private IAnalysisFactory af = aida.analysisFactory();
-    private IProfile1D peffFindable;
-    private IProfile1D thetaeffFindable;
-    private IProfile1D phieffFindable;
-    private IProfile1D ctheffFindable;
-    private IProfile1D d0effFindable;
-    private IProfile1D z0effFindable;
-    private IProfile1D peffElectrons;
-    private IProfile1D thetaeffElectrons;
-    private IProfile1D phieffElectrons;
-    private IProfile1D ctheffElectrons;
-    private IProfile1D d0effElectrons;
-    private IProfile1D z0effElectrons;
-    private IProfile1D peffAxial;
-    private IProfile1D thetaeffAxial;
-    private IProfile1D phieffAxial;
-    private IProfile1D ctheffAxial;
-    private IProfile1D d0effAxial;
-    private IProfile1D z0effAxial;
-    private IProfile1D VxEff;
-    private IProfile1D VyEff;
-    private IProfile1D VzEff;
-    private IProfile1D VxEffFindable;
-    private IProfile1D VyEffFindable;
-    private IProfile1D VzEffFindable;
-    public String outputPlots = "myplots.aida";
-    Map<String, IProfile1D> clsizeMap = new HashMap<String, IProfile1D>();
-    String[] detNames = {"Tracker"};
-    Integer[] nlayers = {8};
-    int trk_count = 0;
-    int nevt = 0;
-    int _nmcTrk = 0;
-    double _nrecTrk = 0;
-    double phiTrkCut = 0.3;
-    double cosThTrkCutMax = 0.2;
-    double cosThTrkCutMin = 0.05;
-    double pTrkCut = 0.5; //GeV
-    double d0TrkCut = 2.0; //mm
-    double z0TrkCut = 2.0; //mm
-    double etaTrkCut = 2.5;
-    int totelectrons = 0;
-    double foundelectrons = 0;
-    int findableelectrons = 0;
-    int findableTracks = 0;
-    double foundTracks = 0;
-    double xref = 0.0; //mm
-    public String outputTextName = "myevents.txt";
-    FileWriter fw;
-    PrintWriter pw;
-    boolean isBeamConstrain = false;
-    double[] beamsize = {0.001, 0.02, 0.02};
-
-    public JasAnalysisDriver(int layers) {
-        //  Define the efficiency histograms
-        IHistogramFactory hf = aida.histogramFactory();
-
-
-        peffFindable = hf.createProfile1D("Findable Efficiency vs p", "", 50, 0., 2.2);
-        thetaeffFindable = hf.createProfile1D("Findable Efficiency vs theta", "", 20, 80, 100);
-        phieffFindable = hf.createProfile1D("Findable Efficiency vs phi", "", 25, -0.25, 0.25);
-        ctheffFindable = hf.createProfile1D("Findable Efficiency vs cos(theta)", "", 25, -0.25, 0.25);
-        d0effFindable = hf.createProfile1D("Findable Efficiency vs d0", "", 50, -2., 2.);
-        z0effFindable = hf.createProfile1D("Findable Efficiency vs z0", "", 50, -2., 2.);
-
-        peffElectrons = hf.createProfile1D("Electrons Efficiency vs p", "", 50, 0., 2.2);
-        thetaeffElectrons = hf.createProfile1D("Electrons Efficiency vs theta", "", 20, 80, 100);
-        phieffElectrons = hf.createProfile1D("Electrons Efficiency vs phi", "", 25, -0.25, 0.25);
-        ctheffElectrons = hf.createProfile1D("Electrons Efficiency vs cos(theta)", "", 25, -0.25, 0.25);
-        d0effElectrons = hf.createProfile1D("Electrons Efficiency vs d0", "", 20, -1., 1.);
-        z0effElectrons = hf.createProfile1D("Electrons Efficiency vs z0", "", 20, -1., 1.);
-
-        peffAxial = hf.createProfile1D("Axial Efficiency vs p", "", 50, 0., 2.2);
-        thetaeffAxial = hf.createProfile1D("Axial Efficiency vs theta", "", 20, 80, 100);
-        phieffAxial = hf.createProfile1D("Axial Efficiency vs phi", "", 25, -0.25, 0.25);
-        ctheffAxial = hf.createProfile1D("Axial Efficiency vs cos(theta)", "", 25, -0.25, 0.25);
-        d0effAxial = hf.createProfile1D("Axial Efficiency vs d0", "", 20, -1., 1.);
-        z0effAxial = hf.createProfile1D("Axial Efficiency vs z0", "", 20, -1., 1.);
-
-        VxEff = hf.createProfile1D("Aprime Efficiency vs Vx", "", 25, 0., 50.);
-        VyEff = hf.createProfile1D("Aprime Efficiency vs Vy", "", 40, -0.2, 0.2);
-        VzEff = hf.createProfile1D("Aprime Efficiency vs Vz", "", 40, -0.2, 0.2);
-
-        VxEffFindable = hf.createProfile1D("Aprime Efficiency vs Vx: Findable", "", 25, 0., 50.);
-        VyEffFindable = hf.createProfile1D("Aprime Efficiency vs Vy: Findable", "", 40, -0.2, 0.2);
-        VzEffFindable = hf.createProfile1D("Aprime Efficiency vs Vz: Findable", "", 40, -0.2, 0.2);
-        nlayers[0] = layers;
-    }
-
-    public void process(
-            EventHeader event) {
-        if (nevt == 0)
-            try {
-//open things up
-                fw = new FileWriter(outputTextName);
-                pw = new PrintWriter(fw);
-            } catch (IOException ex) {
-                Logger.getLogger(FastTrackAnalysisDriver.class.getName()).log(Level.SEVERE, null, ex);
-            }
-        //  Increment the event counter
-        nevt++;
-        List<RawTrackerHit> rawHits = event.get(RawTrackerHit.class, "RawTrackerHitMaker_RawTrackerHits");
-        List<SiTrackerHitStrip1D> stripHits = event.get(SiTrackerHitStrip1D.class, "StripClusterer_SiTrackerHitStrip1D");
-
-
-        Hep3Vector IP = new BasicHep3Vector(0., 0., 0.);
-
-        //  Get the magnetic field
-//        double bfield = event.getDetector().getFieldMap().getField(IP).z();
-        double bfield = 0.5;
-
-//        List<HelicalTrackHit> hthits = event.get(HelicalTrackHit.class, "MatchedHTHits");
-//        String sfile = StrategyXMLUtils.getDefaultStrategiesPrefix() + "DarkPhoton-Final.xml";
-//        String strategyPrefix = "/nfs/sulky21/g.ec.u12/users/mgraham/AtlasUpgrade/hps-java/src/main/resources/";
-//        String sfile = "DarkPhoton-Final.xml";
-//        List<SeedStrategy> slist = StrategyXMLUtils.getStrategyListFromResource(sfile);
-//        List<SeedStrategy> slist = StrategyXMLUtils.getStrategyListFromFile(new File(strategyPrefix + sfile));
-        List<HelicalTrackHit> toththits = event.get(HelicalTrackHit.class, "HelicalTrackHits");
-//        List<HelicalTrackHit> remaininghits = event.get(HelicalTrackHit.class, "RemainingHits");
-
-        //  Create a relational table that maps TrackerHits to MCParticles
-        RelationalTable hittomc = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
-        List<LCRelation> mcrelations = event.get(LCRelation.class, "HelicalTrackMCRelations");
-
-        for (LCRelation relation : mcrelations) {
-            if (relation != null && relation.getFrom() != null && relation.getTo() != null) {
-                hittomc.add(relation.getFrom(), relation.getTo());
-            }
-        }
-
-//        RelationalTable hittomcRemaining = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
-//        List<LCRelation> mcrelations = event.get(LCRelation.class, "HelicalTrackMCRelations");
-//        List<LCRelation> mcrelationsRemaining = event.get(LCRelation.class, "RemainingMCRelations");
-//        for (LCRelation relation : mcrelationsRemaining)
-//            if (relation != null && relation.getFrom() != null && relation.getTo() != null)
-//                hittomcRemaining.add(relation.getFrom(), relation.getTo());
-
-        //  Instantiate the class that determines if a track is "findable"
-        FindableTrack findable = new FindableTrack(event);
-
-        //  Create a map between tracks and the associated MCParticle
-//        List<Track> tracklist = event.getTracks();
-        List<Track> tracklist = event.get(Track.class, "MatchedTracks");
-        //      List<Track> lltracklist = event.get(Track.class, "LLTracks");
-
-        RelationalTable trktomcAxial = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
-
-        aida.cloud1D("Matched Tracks per Event").fill(tracklist.size());
-//        aida.cloud1D("Long Lived Tracks per Event").fill(lltracklist.size());
-        aida.cloud1D("HelicalTrackHits per Event").fill(toththits.size());
-        RelationalTable trktomc = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
-//        RelationalTable trktomcLL = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
-
-        //       tracklist.addAll(lltracklist);
-
-        RelationalTable mcHittomcP = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
-
-        //  Get the collections of SimTrackerHits
-        List<List<SimTrackerHit>> simcols = event.get(SimTrackerHit.class);
-
-        //  Loop over the SimTrackerHits and fill in the relational table
-        for (List<SimTrackerHit> simlist : simcols) {
-            for (SimTrackerHit simhit : simlist) {
-                if (simhit.getMCParticle() != null) {
-                    mcHittomcP.add(simhit, simhit.getMCParticle());
-                }
-            }
-        }
-
-
-        String occDir = "occupancyPlots/";
-
-        for (SiTrackerHitStrip1D stripCluster : stripHits) {
-
-
-            Set<MCParticle> mcparts = stripCluster.getMCParticles();
-
-            List<RawTrackerHit> rthList = stripCluster.getRawHits();
-            int nhits = rthList.size();
-
-            aida.cloud1D(occDir + "associated MC Particles").fill(mcparts.size());
-            aida.cloud1D(occDir + " cluster size").fill(nhits);
-
-            if (mcparts.size() == 1)
-                aida.cloud1D(occDir + " cluster size MC Particles = 1").fill(nhits);
-            if (mcparts.size() == 2)
-                aida.cloud1D(occDir + " cluster size MC Particles = 2").fill(nhits);
-        }
-
-        Map<Track, TrackAnalysis> tkanalMap = new HashMap<Track, TrackAnalysis>();
-        Map<Track, StraightLineTrack> sltMap = new HashMap<Track, StraightLineTrack>();
-        Map<Track, BilliorTrack> btMap = new HashMap<Track, BilliorTrack>();
-        String trackdir = "TrackInfo/";
-        //  Analyze the tracks in the event
-        aida.histogram1D("number of tracks", 11, 0, 10).fill(tracklist.size());
-        for (Track track : tracklist) {
-
-            //  Calculate the track pT and cos(theta)
-            double d0 = track.getTrackParameter(HelicalTrackFit.dcaIndex);
-            double z0 = track.getTrackParameter(HelicalTrackFit.z0Index);
-            double phi0 = track.getTrackParameter(HelicalTrackFit.phi0Index);
-            double slope = track.getTrackParameter(HelicalTrackFit.slopeIndex);
-            double curve = track.getTrackParameter(HelicalTrackFit.curvatureIndex);
-            double d0Err = Math.sqrt(track.getErrorMatrix().e(HelicalTrackFit.dcaIndex, HelicalTrackFit.dcaIndex));
-            double z0Err = Math.sqrt(track.getErrorMatrix().e(HelicalTrackFit.z0Index, HelicalTrackFit.z0Index));
-            double phi0Err = Math.sqrt(track.getErrorMatrix().e(HelicalTrackFit.phi0Index, HelicalTrackFit.phi0Index));
-            double slopeErr = Math.sqrt(track.getErrorMatrix().e(HelicalTrackFit.slopeIndex, HelicalTrackFit.slopeIndex));
-            double curveErr = Math.sqrt(track.getErrorMatrix().e(HelicalTrackFit.curvatureIndex, HelicalTrackFit.curvatureIndex));
-            double chisq = track.getChi2();
-            //plot the helix parameters
-            aida.cloud1D("d0").fill(d0);
-            aida.cloud1D("z0").fill(z0);
-            aida.cloud1D("phi0").fill(phi0);
-            aida.cloud1D("slope").fill(slope);
-            aida.cloud1D("curve").fill(curve);
-            aida.cloud1D("chi2").fill(chisq);
-
-            double mom[] = track.getMomentum();
-
-            SeedTrack stEle = (SeedTrack) track;
-            SeedCandidate seedEle = stEle.getSeedCandidate();
-            HelicalTrackFit ht = seedEle.getHelix();
-
-            TrackAnalysis tkanal = new TrackAnalysis(track, hittomc);
-            tkanalMap.put(track, tkanal);
-
-            BilliorTrack bt = new BilliorTrack(ht);
-//            System.out.println(bt.toString());
-//            System.out.println(ht.toString());
-            btMap.put(track, bt);
-
-            double eps = bt.eps();
-            double z0B = bt.z0();
-            double phi0B = bt.phi0();
-            double theta = bt.theta();
-            double curveB = bt.curvature();
-            double epsErr = bt.getEpsError();
-            double z0BErr = bt.getZ0Error();
-            double phi0BErr = bt.getPhi0Error();
-            double thetaErr = bt.getThetaError();
-            double curveBErr = bt.getCurveError();
-
-
-            double s = HelixUtils.PathLength(ht, (HelicalTrackHit) track.getTrackerHits().get(0));
-            double y1 = HelixUtils.PointOnHelix(ht, s).y();
-            double z1 = HelixUtils.PointOnHelix(ht, s).z();
-
-            int nhits = tkanal.getNHitsNew();
-            double purity = tkanal.getPurityNew();
-            int nbad = tkanal.getNBadHitsNew();
-            int nbadAxial = tkanal.getNBadAxialHits();
-            int nbadZ = tkanal.getNBadZHits();
-            int nAxial = tkanal.getNAxialHits();
-            int nZ = tkanal.getNZHits();
-            List<Integer> badLayers = tkanal.getBadHitList();
-
-            aida.cloud1D(trackdir + "Mis-matched hits for all tracks").fill(nbad);
-            aida.cloud1D(trackdir + "purityNew for all tracks").fill(purity);
-            aida.cloud1D(trackdir + "Bad Axial hits for all tracks").fill(nbadAxial);
-            aida.cloud1D(trackdir + "Bad Z hits for all tracks").fill(nbadZ);
-            aida.cloud1D(trackdir + "Number of Axial hits for all tracks").fill(nAxial);
-            aida.cloud1D(trackdir + "Number of Z hits for all tracks").fill(nZ);
-
-            for (Integer bhit : badLayers) {
-                aida.histogram1D(trackdir + "Layer of Bad Hit", nlayers[0], 1, nlayers[0] + 1).fill(bhit);
-            }
-
-            //  Generate a normalized histogram after 1000 events
-            trk_count++;
-
-
-            //  Now analyze MC Particles on this track
-            MCParticle mcp = tkanal.getMCParticle();
-            if (mcp != null) {
-
-                //  Create a map between the tracks found and the assigned MC particle
-                trktomc.add(track, tkanal.getMCParticle());
-
-                //  Calculate the MC momentum and polar angle
-                Hep3Vector Pmc = mcp.getMomentum();
-                double pxmc = Pmc.x();
-                double pymc = Pmc.y();
-                double pzmc = Pmc.z();
-                double ptmc = Math.sqrt(pxmc * pxmc + pymc * pymc);
-                double pmc = Math.sqrt(ptmc * ptmc + pzmc * pzmc);
-                double pxtk = track.getPX();
-                double pytk = track.getPY();
-                double pztk = track.getPZ();
-                double pttk = Math.sqrt(pxtk * pxtk + pytk * pytk);
-                double ptk = Math.sqrt(pttk * pttk + pztk * pztk);
-
-
-
-                //  Calculate the helix parameters for this MC particle and pulls in pT, d0
-                HelixParamCalculator helix = new HelixParamCalculator(mcp, bfield);
-
-
-                double d0mc = helix.getDCA();
-                double z0mc = helix.getZ0();
-                double phi0mc = helix.getPhi0();
-                double slopemc = helix.getSlopeSZPlane();
-                double curvemc = 1 / helix.getRadius();
-                double pinvresid = (1 / ptk - 1 / pmc);
-                double presid = (ptk - pmc);
-                double z0newMC = z0mc;
-                double y0newMC = d0mc;
-                aida.histogram1D(trackdir + "d0 Pull", 200, -8, 8).fill((d0 - d0mc) / d0Err);
-                aida.histogram1D(trackdir + "z0 Pull", 200, -8, 8).fill((z0 - z0mc) / z0Err);
-                aida.histogram1D(trackdir + "phi0 Pull", 200, -8, 8).fill((phi0 - phi0mc) / phi0Err);
-                aida.histogram1D(trackdir + "slope Pull", 200, -8, 8).fill((slope - slopemc) / slopeErr);
-                aida.histogram1D(trackdir + "curvature Pull", 200, -8, 8).fill((curve - curvemc) / curveErr);
-
-
-                double epsmc = -d0mc;
-                double thetamc = Math.PI / 2 - Math.atan(slopemc);
-
-
-                aida.histogram1D(trackdir + "Billior eps Pull", 200, -8, 8).fill((eps - epsmc) / epsErr);
-                aida.histogram1D(trackdir + "Billior z0 Pull", 200, -8, 8).fill((z0B - z0mc) / z0BErr);
-                aida.histogram1D(trackdir + "Billior phi0 Pull", 200, -8, 8).fill((phi0B - phi0mc) / phi0BErr);
-                aida.histogram1D(trackdir + "Billior theta Pull", 200, -8, 8).fill((theta - thetamc) / thetaErr);
-                aida.histogram1D(trackdir + "Billior curvature Pull", 200, -8, 8).fill((curveB - curvemc) / curveBErr);
-
-                BasicHep3Vector axial = new BasicHep3Vector();
-                axial.setV(0, 1, 0);
-                String hitdir = "HitsOnTrack/";
-                List<TrackerHit> hitsOnTrack = track.getTrackerHits();
-                MCParticle bestmcp = tkanal.getMCParticleNew();
-
-                String tkresid = "TrackResiduals/";
-
-                int ndaug = 0;
-                if (bestmcp != null) {
-                    ndaug = bestmcp.getDaughters().size();
-                }
-                int imain = 0;
-            }
-        }
-
-
-        // Fitting procedure: Creat BilloirFitter. Pass two matched tracks from track
-        // list into the fitter with the Space Point set as the Interaction Point.
-        // BilloirFitter returns a Vertex object
-
-        BFitter bFit = new BFitter(bfield);
-        SpacePoint SP = new SpacePoint(IP);
-        List<Track> vlist = new ArrayList<Track>();
-        List<BilliorTrack> btlist = new ArrayList<BilliorTrack>();
-        for (Track track1 : tracklist) {
-            for (Track track2 : tracklist) {
-                if (track1 != track2 && track1.getCharge() > 0 && track2.getCharge() < 0) {
-                    /*
-                     vlist.clear(); vlist.add(track1); vlist.add(track2); Vertex
-                     vtx = bFit.fit(vlist, SP, isBeamConstrain);
-                     System.out.println(vtx.toString()); double vtxChi2 =
-                     vtx._chi2; double[] vtxPos = vtx._xyzf;
-                     aida.histogram1D("Vertex Chi2", 100, 0,
-                     1000).fill(vtxChi2); aida.histogram1D("Vertex X", 100, -20,
-                     50).fill(vtxPos[0]); aida.histogram1D("Vertex Y", 100, -1,
-                     1).fill(vtxPos[1]); aida.histogram1D("Vertex Z", 100, -1,
-                     1).fill(vtxPos[2]);
-                     */
-
-
-                    BilliorTrack bt1 = btMap.get(track1);
-                    BilliorTrack bt2 = btMap.get(track2);
-                    btlist.clear();
-                    btlist.add(bt1);
-                    btlist.add(bt2);
-                    /*
-                     BilliorVertex bvertex = new BilliorVertex(1.0);
-                     bvertex.fitVertex(btlist); BasicMatrix bvtxPos =
-                     (BasicMatrix) bvertex.getVertexPosition(); BasicMatrix
-                     bvtxCov = (BasicMatrix) bvertex.getVertexCovariance();
-                     System.out.println("Constrained");
-                     System.out.println("Vertex Position: " +
-                     bvtxPos.toString()); System.out.println("chisq : " +
-                     bvertex.getChiSq());
-
-                     aida.histogram1D("BilliorVertex X -- Constrained", 100,
-                     -10, 20).fill(bvtxPos.e(0, 0));
-                     aida.histogram1D("BilliorVertex Y -- Constrained", 100,
-                     -0.4, 0.4).fill(bvtxPos.e(1, 0));
-                     aida.histogram1D("BilliorVertex Z -- Constrained", 100,
-                     -0.4, 0.4).fill(bvtxPos.e(2, 0));
-                     aida.histogram1D("BilliorVertex ChiSq -- Constrained", 100,
-                     0, 50).fill(bvertex.getChiSq());
-                     aida.histogram1D("BilliorVertex X Pull -- Constrained",
-                     100, -4, 4).fill(bvtxPos.e(0, 0) / Math.sqrt(bvtxCov.e(0,
-                     0))); aida.histogram1D("BilliorVertex Y Pull--
-                     Constrained", 100, -4, 4).fill(bvtxPos.e(1, 0) /
-                     Math.sqrt(bvtxCov.e(1, 1)));
-                     aida.histogram1D("BilliorVertex Z Pull-- Constrained", 100,
-                     -4, 4).fill(bvtxPos.e(2, 0) / Math.sqrt(bvtxCov.e(2, 2)));
-                     */
-                    /*
-                     BilliorVertex bvertexUC = new BilliorVertex(1.0);
-                     bvertexUC.doBeamSpotConstraint(false);
-                     bvertexUC.fitVertex(btlist); BasicMatrix bvtxPosUC =
-                     (BasicMatrix) bvertexUC.getVertexPosition(); BasicMatrix
-                     bvtxCovUC = (BasicMatrix) bvertexUC.getVertexCovariance();
-                     System.out.println("UnConstrained");
-                     System.out.println("Vertex Position: " +
-                     bvtxPosUC.toString()); System.out.println("chisq : " +
-                     bvertexUC.getChiSq()); aida.histogram1D("BilliorVertex X --
-                     UnConstrained", 100, -10, 20).fill(bvtxPosUC.e(0, 0));
-                     aida.histogram1D("BilliorVertex Y -- UnConstrained", 100,
-                     -0.4, 0.4).fill(bvtxPosUC.e(1, 0));
-                     aida.histogram1D("BilliorVertex Z -- UnConstrained", 100,
-                     -0.4, 0.4).fill(bvtxPosUC.e(2, 0));
-                     aida.histogram1D("BilliorVertex ChiSq -- UnConstrained",
-                     100, 0, 50).fill(bvertexUC.getChiSq());
-                     aida.histogram1D("BilliorVertex X Pull -- UnConstrained",
-                     100, -4, 4).fill(bvtxPosUC.e(0, 0) /
-                     Math.sqrt(bvtxCovUC.e(0, 0)));
-                     aida.histogram1D("BilliorVertex Y Pull-- UnConstrained",
-                     100, -4, 4).fill(bvtxPosUC.e(1, 0) /
-                     Math.sqrt(bvtxCovUC.e(1, 1)));
-                     aida.histogram1D("BilliorVertex Z Pull-- UnConstrained",
-                     100, -4, 4).fill(bvtxPosUC.e(2, 0) /
-                     Math.sqrt(bvtxCovUC.e(2, 2)));
-                     */
-                    BilliorVertexer bvertexerUC = new BilliorVertexer(bfield);
-                    BilliorVertex bvertexUC = bvertexerUC.fitVertex(btlist);
-//                    bvertexUC.fitVertex(btlist);
-                    BasicMatrix bvtxPosUC = (BasicMatrix) bvertexUC.getPosition();
-                    SymmetricMatrix bvtxCovUC = bvertexUC.getCovMatrix();
-                    double invMassUC = bvertexUC.getParameters().get("invMass");
-//                    System.out.println("UnConstrained");
-//                    System.out.println("Vertex Position:  " + bvtxPosUC.toString());
-//                    System.out.println("chisq :  " + bvertexUC.getChiSq());
-                    aida.histogram1D("BilliorVertex X  -- UnConstrained", 100, -10, 20).fill(bvtxPosUC.e(0, 0));
-                    aida.histogram1D("BilliorVertex Y -- UnConstrained", 100, -0.4, 0.4).fill(bvtxPosUC.e(1, 0));
-                    aida.histogram1D("BilliorVertex Z -- UnConstrained", 100, -0.4, 0.4).fill(bvtxPosUC.e(2, 0));
-                    aida.histogram1D("BilliorVertex ChiSq -- UnConstrained", 100, 0, 50).fill(bvertexUC.getChi2());
-                    aida.histogram1D("BilliorVertex X Pull -- UnConstrained", 100, -4, 4).fill(bvtxPosUC.e(0, 0) / Math.sqrt(bvtxCovUC.e(0, 0)));
-                    aida.histogram1D("BilliorVertex Y Pull-- UnConstrained", 100, -4, 4).fill(bvtxPosUC.e(1, 0) / Math.sqrt(bvtxCovUC.e(1, 1)));
-                    aida.histogram1D("BilliorVertex Z Pull-- UnConstrained", 100, -4, 4).fill(bvtxPosUC.e(2, 0) / Math.sqrt(bvtxCovUC.e(2, 2)));
-
-
-                    BilliorVertexer bvertexer = new BilliorVertexer(bfield);
-                    bvertexer.setBeamSize(beamsize);
-                    bvertexer.doBeamSpotConstraint(true);
-
-                    BilliorVertex bvertex = bvertexer.fitVertex(btlist);
-                    BasicMatrix bvtxPos = (BasicMatrix) bvertex.getPosition();
-                    SymmetricMatrix bvtxCov = bvertex.getCovMatrix();
-                    double invMass = bvertex.getParameters().get("invMass");
-
-//                    System.out.println("Constrained");
-//                    System.out.println("Vertex Position:  " + bvtxPos.toString());
-//                    System.out.println("chisq :  " + bvertex.getChiSq());
-                    aida.histogram1D("BilliorVertex X  -- Constrained", 100, -10, 20).fill(bvtxPos.e(0, 0));
-                    aida.histogram1D("BilliorVertex Y -- Constrained", 100, -0.4, 0.4).fill(bvtxPos.e(1, 0));
-                    aida.histogram1D("BilliorVertex Z -- Constrained", 100, -0.4, 0.4).fill(bvtxPos.e(2, 0));
-                    aida.histogram1D("BilliorVertex ChiSq -- Constrained", 100, -10, 50).fill(bvertex.getChi2());
-                    aida.histogram1D("BilliorVertex X Pull -- Constrained", 100, -4, 4).fill(bvtxPos.e(0, 0) / Math.sqrt(bvtxCov.e(0, 0)));
-                    aida.histogram1D("BilliorVertex Y Pull-- Constrained", 100, -4, 4).fill(bvtxPos.e(1, 0) / Math.sqrt(bvtxCov.e(1, 1)));
-                    aida.histogram1D("BilliorVertex Z Pull-- Constrained", 100, -4, 4).fill(bvtxPos.e(2, 0) / Math.sqrt(bvtxCov.e(2, 2)));
-
-                    aida.histogram1D("BilliorVertex Mass  -- Constrained", 250, 0.0, 0.25).fill(invMass);
-                    aida.histogram1D("BilliorVertex Mass  -- UnConstrained", 250, 0.0, 0.25).fill(invMassUC);
-
-
-                    BilliorVertexer bconvertexer = new BilliorVertexer(bfield);
-                    bconvertexer.setBeamSize(beamsize);
-                    bconvertexer.doTargetConstraint(true);
-
-                    BilliorVertex bsconfit = bconvertexer.fitVertex(btlist);
-//                    bvertexUC.fitVertex(btlist);
-                    BasicMatrix bsconvtxPos = (BasicMatrix) bsconfit.getPosition();
-                    SymmetricMatrix bsconvtxCov = bsconfit.getCovMatrix();
-                    double invMassBSCon = bsconfit.getParameters().get("invMass");
-
-
-                    aida.histogram1D("BilliorVertex X  -- BS Constrained", 100, -10, 20).fill(bsconvtxPos.e(0, 0));
-                    aida.histogram1D("BilliorVertex Y -- BS Constrained", 100, -0.4, 0.4).fill(bsconvtxPos.e(1, 0));
-                    aida.histogram1D("BilliorVertex Z -- BS Constrained", 100, -0.4, 0.4).fill(bsconvtxPos.e(2, 0));
-                    aida.histogram1D("BilliorVertex ChiSq -- BS Constrained", 100, -10, 50).fill(bsconfit.getChi2());
-                    aida.histogram1D("BilliorVertex X Pull -- BS Constrained", 100, -4, 4).fill(bsconvtxPos.e(0, 0) / Math.sqrt(bsconvtxCov.e(0, 0)));
-                    aida.histogram1D("BilliorVertex Y Pull-- BS Constrained", 100, -4, 4).fill(bsconvtxPos.e(1, 0) / Math.sqrt(bsconvtxCov.e(1, 1)));
-                    aida.histogram1D("BilliorVertex Z Pull-- BS Constrained", 100, -4, 4).fill(bsconvtxPos.e(2, 0) / Math.sqrt(bsconvtxCov.e(2, 2)));
-
-                    aida.histogram1D("BilliorVertex Mass  -- BS Constrained", 100, 0.08, 0.12).fill(invMassBSCon);
-                }
-            }
-        }
-
-
-        //  Now loop over all MC Particles
-        List<MCParticle> mclist = event.getMCParticles();
-        pw.format("%d ", nevt);
-
-        for (MCParticle mcp : mclist) {
-            if (mcp.getParents().size() > 0) {
-                if (mcp.getParents().get(0).getPDGID() == 622) {
-//                    boolean find= findable.InnerTrackerIsFindable(mcp, nlayers[0],true);
-//                    System.out.println("A' Track Findable? "+find+";  nlayers = "+nlayers[0]);
-                    boolean find = findable.InnerTrackerIsFindable(mcp, nlayers[0]);
-                    int ifind = 0;
-                    if (find)
-                        ifind = 1;
-                    double ch = mcp.getCharge();
-                    pw.format("%d  %2.0f ", ifind, ch);
-                    Set<SimTrackerHit> mchitlist = mcHittomcP.allTo(mcp);
-
-                    for (int i = 0; i < 10; i++) {
-                        if (mchitlist.size() > i + 1) {
-                            SimTrackerHit sth = (SimTrackerHit) mchitlist.toArray()[i];
-
-                            if (sth != null)
-                                pw.format("%d %5.5f %5.5f %5.5f ", sth.getLayer(), sth.getPoint()[1], sth.getPoint()[2], sth.getPoint()[0]);
-                            else
-                                pw.format("%d %5.5f %5.5f %5.5f ", 99, -666, -666, -666);
-                        } else {
-                            pw.format("%d %5.5f %5.5f %5.5f ", 99, -666.6, -666.6, -666.6);
-                        }
-                    }
-                }
-            }
-
-        }
-        pw.println();
-        int _nchMCP = 0;
-        int _nchMCPBar = 0;
-        for (MCParticle mcp : mclist) {
-
-            //  Calculate the pT and polar angle of the MC particle
-            double px = mcp.getPX();
-            double py = mcp.getPY();
-            double pz = mcp.getPZ();
-            double pt = Math.sqrt(px * px + py * py);
-            double p = Math.sqrt(pt * pt + pz * pz);
-            double cth = pz / p;
-            double theta = 180. * Math.acos(cth) / Math.PI;
-            double eta = -Math.log(Math.tan(Math.atan2(pt, pz) / 2));
-            double phi = Math.atan2(py, px);
-            int pdgid = mcp.getPDGID();
-            //  Find the number of layers hit by this mc particle
-//            System.out.println("MC pt=" + pt);
-            int nhits = findable.LayersHit(mcp);
-            Set<SimTrackerHit> mchitlist = mcHittomcP.allTo(mcp);
-            boolean isFindable = findable.InnerTrackerIsFindable(mcp, nlayers[0] - 2);
-//            boolean isFindable = findable.InnerTrackerIsFindable(mcp, nlayers[0]);
-            Set<HelicalTrackCross> hitlist = hittomc.allTo(mcp);
-
-            //  Calculate the helix parameters for this MC particle
-            HelixParamCalculator helix = new HelixParamCalculator(mcp, bfield);
-            double d0 = helix.getDCA();
-            double z0 = helix.getZ0();
-
-
-            //  Check cases where we have multiple tracks associated with this MC particle
-            Set<Track> trklist = trktomc.allTo(mcp);
-            int ntrk = trklist.size();
-
-
-            Set<Track> trklistAxial = trktomcAxial.allTo(mcp);
-            int ntrkAxial = trklistAxial.size();
-
-            if (mcp.getPDGID() == 622) {
-                boolean bothreco = true;
-                boolean bothfindable = true;
-                //it's the A'...let's see if we found both tracks.
-                List<MCParticle> daughters = mcp.getDaughters();
-                for (MCParticle d : daughters) {
-                    if (trktomc.allTo(d).size() == 0) {
-                        bothreco = false;
-                    }
-                    if (!findable.InnerTrackerIsFindable(d, nlayers[0] - 2)) {
-//                    if (!findable.InnerTrackerIsFindable(d, nlayers[0])) {
-                        bothfindable = false;
-                    }
-                }
-                double vtxWgt = 0;
-                if (bothreco) {
-                    vtxWgt = 1.0;
-                }
-                VxEff.fill(mcp.getOriginX(), vtxWgt);
-                VyEff.fill(mcp.getOriginY(), vtxWgt);
-                VzEff.fill(mcp.getOriginZ(), vtxWgt);
-                if (bothfindable) {
-                    VxEffFindable.fill(mcp.getOriginX(), vtxWgt);
-                    VyEffFindable.fill(mcp.getOriginY(), vtxWgt);
-                    VzEffFindable.fill(mcp.getOriginZ(), vtxWgt);
-                }
-            }
-
-            if (ntrk > 1) {
-                //  Count tracks where the assigned MC particle has more than 1 hit
-                int nmulthits = 0;
-                for (Track trk : trklist) {
-                    TrackAnalysis tkanal = tkanalMap.get(trk);
-                    if (tkanal.getNBadHits() < tkanal.getNHits() - 1) {
-                        nmulthits++;
-                    }
-                }
-                //  Flag any anomalous cases that we find
-                if (nmulthits > 1) {
-                    System.out.println("2 tracks associated with a single MC Particle");
-                }
-            }
-
-            if (isFindable) {
-                _nchMCP++;
-                findableTracks++;
-                double wgt = 0.;
-                if (ntrk > 0) {
-                    wgt = 1.;
-                }
-                foundTracks += wgt;
-                peffFindable.fill(p, wgt);
-                phieffFindable.fill(phi, wgt);
-                thetaeffFindable.fill(theta, wgt);
-                ctheffFindable.fill(cth, wgt);
-                d0effFindable.fill(d0, wgt);
-                z0effFindable.fill(z0, wgt);
-                //              if (wgt == 0)
-//                    System.out.println("Missed a findable track!");
-
-                double wgtAxial = 0.;
-                if (ntrkAxial > 0) {
-                    wgtAxial = 1.;
-                }
-                peffAxial.fill(p, wgtAxial);
-                phieffAxial.fill(phi, wgtAxial);
-                thetaeffAxial.fill(theta, wgtAxial);
-                ctheffAxial.fill(cth, wgtAxial);
-                d0effAxial.fill(d0, wgtAxial);
-                z0effAxial.fill(z0, wgtAxial);
-
-
-            }
-
-            if (mcp.getParents().size() == 1 && mcp.getParents().get(0).getPDGID() == 622) {
-                totelectrons++;
-
-                if (isFindable) {
-                    findableelectrons++;
-                    double wgt = 0.;
-                    if (ntrk > 0) {
-                        wgt = 1.;
-                    }
-                    foundelectrons += wgt;
-                    peffElectrons.fill(p, wgt);
-                    phieffElectrons.fill(phi, wgt);
-                    thetaeffElectrons.fill(theta, wgt);
-                    ctheffElectrons.fill(cth, wgt);
-                    d0effElectrons.fill(d0, wgt);
-                    z0effElectrons.fill(z0, wgt);
-                    if (wgt == 0 && pdgid > 0) {
-                        System.out.println("Missed a findable ELECTRON!!!!!");
-                    }
-                    if (wgt == 0 && pdgid < 0) {
-                        System.out.println("Missed a findable POSITRON!!!!!");
-                    }
-
-                    double wgtAxial = 0.;
-                    if (ntrkAxial > 0) {
-                        wgtAxial = 1.;
-                    }
-                    peffAxial.fill(p, wgtAxial);
-                    phieffAxial.fill(phi, wgtAxial);
-                    thetaeffAxial.fill(theta, wgtAxial);
-                    ctheffAxial.fill(cth, wgtAxial);
-                    d0effAxial.fill(d0, wgtAxial);
-                    z0effAxial.fill(z0, wgtAxial);
-                }
-            }
-
-
-        }
-
-        return;
-    }
-
-    public void endOfData() {
-        try {
-            aida.saveAs(outputPlots);
-        } catch (IOException ex) {
-            Logger.getLogger(JasAnalysisDriver.class.getName()).log(Level.SEVERE, null, ex);
-        }
-        pw.close();
-        try {
-            fw.close();
-        } catch (IOException ex) {
-            Logger.getLogger(JasAnalysisDriver.class.getName()).log(Level.SEVERE, null, ex);
-        }
-        System.out.println("# of reco tracks = " + foundTracks + "; # of MC tracks = " + findableTracks + "; Efficiency = " + foundTracks / findableTracks);
-        System.out.println("# of reco ele/pos = " + foundelectrons + "; # of findable ele/pos = " + findableelectrons + "; Efficiency = " + foundelectrons / findableelectrons);
-    }
-
-    public void setOutputPlots(String output) {
-        this.outputPlots = output;
-    }
-
-    public void setOutputText(String output) {
-        this.outputTextName = output;
-    }
-
-    private double getr(double x, double y) {
-        return Math.sqrt(x * x + y * y);
-    }
-
-    protected double drcalc(Hep3Vector pos, SymmetricMatrix cov) {
-        double x = pos.x();
-        double y = pos.y();
-        double r2 = x * x + y * y;
-        return Math.sqrt((x * x * cov.e(0, 0) + y * y * cov.e(1, 1) + 2. * x * y * cov.e(0, 1)) / r2);
-    }
-
-    protected double drphicalc(Hep3Vector pos, SymmetricMatrix cov) {
-        double x = pos.x();
-        double y = pos.y();
-        double r2 = x * x + y * y;
-        return Math.sqrt((y * y * cov.e(0, 0) + x * x * cov.e(1, 1) - 2. * x * y * cov.e(0, 1)) / r2);
-    }
-
-    private double getphi(double x, double y) {
-        double phi = Math.atan2(y, x);
-        if (phi < 0.) {
-            phi += 2. * Math.PI;
-        }
-        return phi;
-    }
-
-    private double getdxdy(Hep3Vector hitpos, Hep3Vector posonhelix) {
-        return Math.sqrt(Math.pow(hitpos.x() - posonhelix.x(), 2) + Math.pow(hitpos.y() - posonhelix.y(), 2));
-    }
-
-    private double getdxdyErr(Hep3Vector hitpos, Hep3Vector posonhelix, SymmetricMatrix cov) {
-        double dxdySq = Math.pow(hitpos.x() - posonhelix.x(), 2) + Math.pow(hitpos.y() - posonhelix.y(), 2);
-        double ErrSqDxDySq = 4 * (cov.e(0, 0) * Math.pow(hitpos.x() - posonhelix.x(), 2) + cov.e(1, 1) * Math.pow(hitpos.y() - posonhelix.y(), 2));
-        double error = Math.sqrt(ErrSqDxDySq / dxdySq) / 2;
-        return error;
-    }
-
-    private void fillClouds(String dir, String species, int nhits, double p, double cth, double y0, double z0, double doca, double[] poca, double pinvresid, double presid, double y0resid, double z0resid, double docaresid, double[] pocaresid) {
-        double nbins = 4;
-        double[] pBins = {1, 2, 3, 4, 5};
-
-        aida.cloud1D(dir + "Hits for all " + species).fill(nhits);
-        aida.cloud1D(dir + "p for all " + species).fill(p);
-        aida.cloud1D(dir + "cos(theta) for all " + species).fill(cth);
-        aida.cloud1D(dir + "y0 for all " + species).fill(y0);
-        aida.cloud1D(dir + "z0 for all " + species).fill(z0);
-        aida.cloud1D(dir + "doca for all " + species).fill(doca);
-        aida.cloud1D(dir + "xoca for all " + species).fill(poca[0]);
-        aida.cloud1D(dir + "yoca for all " + species).fill(poca[1]);
-        aida.cloud1D(dir + "zoca for all " + species).fill(poca[2]);
-        aida.histogram1D(dir + "p^-1 Residual for all " + species, 50, -0.1, 0.1).fill(pinvresid);
-        aida.cloud1D(dir + "p Residual for all " + species).fill(presid);
-        aida.histogram1D(dir + "y0 Residual for all " + species, 50, -1, 1).fill(y0resid);
-        aida.histogram1D(dir + "z0 Residual for all " + species, 50, -1, 1).fill(z0resid);
-
-        if (p > pBins[0] && p < pBins[1]) {
-            aida.histogram1D(dir + "doca Residual for 1<p<2 " + species, 50, -0.5, 0.5).fill(docaresid);
-            aida.histogram1D(dir + "xoca Residual for 1<p<2 " + species, 50, -0.5, 0.5).fill(pocaresid[0]);
-            aida.histogram1D(dir + "yoca Residual for 1<p<2 " + species, 50, -0.5, 0.5).fill(pocaresid[1]);
-            aida.histogram1D(dir + "zoca Residual for 1<p<2 " + species, 50, -0.5, 0.5).fill(pocaresid[2]);
-        } else if (p > pBins[1] && p < pBins[2]) {
-            aida.histogram1D(dir + "doca Residual for 2<p<3 " + species, 50, -0.5, 0.5).fill(docaresid);
-            aida.histogram1D(dir + "xoca Residual for 2<p<3 " + species, 50, -0.5, 0.5).fill(pocaresid[0]);
-            aida.histogram1D(dir + "yoca Residual for 2<p<3 " + species, 50, -0.5, 0.5).fill(pocaresid[1]);
-            aida.histogram1D(dir + "zoca Residual for 2<p<3 " + species, 50, -0.5, 0.5).fill(pocaresid[2]);
-        } else if (p > pBins[2] && p < pBins[3]) {
-            aida.histogram1D(dir + "doca Residual for 3<p<4 " + species, 50, -0.5, 0.5).fill(docaresid);
-            aida.histogram1D(dir + "xoca Residual for 3<p<4 " + species, 50, -0.5, 0.5).fill(pocaresid[0]);
-            aida.histogram1D(dir + "yoca Residual for 3<p<4 " + species, 50, -0.5, 0.5).fill(pocaresid[1]);
-            aida.histogram1D(dir + "zoca Residual for 3<p<4 " + species, 50, -0.5, 0.5).fill(pocaresid[2]);
-        } else if (p > pBins[3] && p < pBins[4]) {
-            aida.histogram1D(dir + "doca Residual for 4<p<5 " + species, 50, -0.5, 0.5).fill(docaresid);
-            aida.histogram1D(dir + "xoca Residual for 4<p<5 " + species, 50, -0.5, 0.5).fill(pocaresid[0]);
-            aida.histogram1D(dir + "yoca Residual for 4<p<5 " + species, 50, -0.5, 0.5).fill(pocaresid[1]);
-            aida.histogram1D(dir + "zoca Residual for 4<p<5 " + species, 50, -0.5, 0.5).fill(pocaresid[2]);
-        }
-
-        aida.histogram1D(dir + "doca Residual for all " + species, 50, -0.5, 0.5).fill(docaresid);
-        aida.histogram1D(dir + "xoca Residual for all " + species, 50, -0.5, 0.5).fill(pocaresid[0]);
-        aida.histogram1D(dir + "yoca Residual for all " + species, 50, -0.5, 0.5).fill(pocaresid[1]);
-        aida.histogram1D(dir + "zoca Residual for all " + species, 50, -0.5, 0.5).fill(pocaresid[2]);
-    }
-
-    private void fillTrackInfo(String dir, String species, double chi2, int nhits, double p, double pperp, double px, double py, double pz, double phi, double cth, double doca, double xoca, double yoca, double zoca) {
-        aida.cloud1D(dir + "total chi^2 for  " + species).fill(chi2);
-
-//                aida.cloud1D(trackdir + "circle chi^2 for  " + species).fill(ht.chisq()[0]);
-//                aida.cloud1D(trackdir + "linear chi^2 for  " + species).fill(ht.chisq()[1]
-        aida.cloud1D(dir + "Hits for  " + species).fill(nhits);
-        aida.cloud1D(dir + "p for  " + species).fill(p);
-        aida.cloud1D(dir + "pperp for  " + species).fill(pperp);
-        aida.cloud1D(dir + "px for  " + species).fill(px);
-        aida.cloud1D(dir + "py for  " + species).fill(py);
-        aida.cloud1D(dir + "pz for  " + species).fill(pz);
-        aida.cloud1D(dir + "phi for  " + species).fill(phi);
-        aida.cloud1D(dir + "cos(theta) for  " + species).fill(cth);
-        aida.cloud1D(dir + "DOCA for  " + species).fill(doca);
-        aida.cloud1D(dir + "XOCA for  " + species).fill(xoca);
-        aida.cloud1D(dir + "YOCA for  " + species).fill(yoca);
-        aida.cloud1D(dir + "ZOCA for  " + species).fill(zoca);
-        aida.cloud2D(dir + "doca vs xoca for  " + species).fill(xoca, doca);
-    }
-
-    private void fillVertexInfo(String apdir, String vertex, double chisq, Hep3Vector vtx, SymmetricMatrix vtxcov, double invMass, double deltaPhi, double oAngle, double cosAlpha) {
-        aida.histogram1D(apdir + vertex + " vertex chi^2", 50, 0, 1000).fill(chisq);
-        aida.histogram1D(apdir + vertex + " vertex X", 50, -10, 10).fill(vtx.x());
-        aida.histogram1D(apdir + vertex + " vertex X Wide", 100, -10, 50).fill(vtx.x());
-        aida.histogram1D(apdir + vertex + " vertex sigma X", 50, 0, 1).fill(Math.sqrt(vtxcov.e(0, 0)));
-        aida.histogram1D(apdir + vertex + " vertex signifigance X", 50, -100, 100).fill(vtx.x() / Math.sqrt(vtxcov.e(0, 0)));
-        aida.histogram1D(apdir + vertex + " vertex X Positive Tail", 50, 10, 110).fill(vtx.x());
-        aida.histogram1D(apdir + vertex + " vertex Y", 50, -1, 1).fill(vtx.y());
-        aida.histogram1D(apdir + vertex + " vertex sigma Y", 50, 0, 0.1).fill(Math.sqrt(vtxcov.e(1, 1)));
-        aida.histogram1D(apdir + vertex + " vertex Z", 50, -1, 1).fill(vtx.z());
-        aida.histogram1D(apdir + vertex + " vertex sigma Z", 50, 0, 0.1).fill(Math.sqrt(vtxcov.e(2, 2)));
-        aida.histogram1D(apdir + vertex + " e+e- Invariant Mass", 100, 0.05, 0.25).fill(invMass);
-        aida.histogram1D(apdir + vertex + " vertex deltaPhi", 50, -0.2, 0.2).fill(deltaPhi);
-        aida.histogram1D(apdir + vertex + " vertex cos(opening angle)", 50, 0.8, 1).fill(oAngle);
-        aida.histogram1D(apdir + vertex + " vertex cos(Alpha)", 100, 0.5, 1).fill(cosAlpha);
-
-    }
-
-    private double getInvMass(Track track1, StraightLineTrack slt1, Track track2, StraightLineTrack slt2) {
-        double esum = 0.;
-        double pxsum = 0.;
-        double pysum = 0.;
-        double pzsum = 0.;
-        double chargesum = 0.;
-        double me = 0.000511;
-        // Loop over jets
-
-        double p1x = track1.getPX();
-        double p1y = track1.getPY();
-        double p1z = track1.getPZ();
-        double p1mag2 = p1x * p1x + p1y * p1y + p1z * p1z;
-        double e1 = Math.sqrt(p1mag2 + me * me);
-        double dydx1 = slt1.dydx();
-        double dzdx1 = slt1.dzdx();
-        double s1sq = 1 + 1 / (dydx1 * dydx1) + (dzdx1 * dzdx1) / (dydx1 * dydx1);
-        double truep1y = Math.sqrt(p1mag2 / s1sq);
-        if (dydx1 < 0) {
-            truep1y = -truep1y;
-        }
-        double truep1x = truep1y / dydx1;
-        double truep1z = dzdx1 * truep1x;
-
-        double p2x = track2.getPX();
-        double p2y = track2.getPY();
-        double p2z = track2.getPZ();
-        double p2mag2 = p2x * p2x + p2y * p2y + p2z * p2z;
-        double e2 = Math.sqrt(p2mag2 + me * me);
-
-        double dydx2 = slt2.dydx();
-        double dzdx2 = slt2.dzdx();
-        double s2sq = 1 + 1 / (dydx2 * dydx2) + (dzdx2 * dzdx2) / (dydx2 * dydx2);
-        double truep2y = Math.sqrt(p2mag2 / s2sq);
-        if (dydx2 < 0) {
-            truep2y = -truep2y;
-        }
-        double truep2x = truep2y / dydx2;
-        double truep2z = dzdx2 * truep2x;
-
-        pxsum =
-                truep1x + truep2x;
-        pysum =
-                truep1y + truep2y;
-        pzsum =
-                truep1z + truep2z;
-
-        esum =
-                e1 + e2;
-//        double p1dotp2 = p1x * p2x + p1y * p2y + p1z * p2z;
-        double p1dotp2 = truep1x * truep2x + truep1y * truep2y + truep1z * truep2z;
-        double e1e2 = e1 * e2;
-        double invmass = Math.sqrt(2 * me * me + 2 * (e1e2 - p1dotp2));
-        // Compute total momentum and hence event mass
-        double psum = Math.sqrt(pxsum * pxsum + pysum * pysum + pzsum * pzsum);
-        double evtmass = Math.sqrt(esum * esum - psum * psum);
-//        System.out.println("invmass= " + invmass + "; evtmass=" + evtmass);
-        return invmass;
-    }
-
-//find the DOCA to the beamline extrpolating linearly from the reference point
-    private double findDoca(double y, double z, double px, double py, double pz) {
-        double xoca = 0;
-        double sy = py / px;
-        double sz = pz / px;
-        xoca =
-                -(y * sy + z * sz) / (sy * sy + sz + sz);
-        double doca = Math.sqrt(Math.pow(y + sy * xoca, 2) + Math.pow(z + sz * xoca, 2));
-        return doca;
-    }
-
-//find the XOCA to the beamline extrpolating linearly from the reference point
-    private double findXoca(double y, double z, double px, double py, double pz) {
-        double xoca = 0;
-        double sy = py / px;
-        double sz = pz / px;
-        xoca =
-                -(y * sy + z * sz) / (sy * sy + sz + sz);
-        return xoca;
-    }
-
-    private double[] findPoca(double y, double z, double px, double py, double pz) {
-        double poca[] = {0, 0, 0};
-        double sy = py / px;
-        double sz = pz / px;
-        poca[0] = -(y * sy + z * sz) / (sy * sy + sz * sz);
-        poca[1] = y + sy * poca[0];
-        poca[2] = z + sz * poca[0];
-        return poca;
-    }
-
-    private Hep3Vector getV0Momentum(Track track1, StraightLineTrack slt1, Track track2, StraightLineTrack slt2) {
-
-
-        Hep3Vector p1 = getTrueMomentum(track1, slt1);
-        Hep3Vector p2 = getTrueMomentum(track2, slt2);
-        Hep3Vector pV0 = VecOp.add(p1, p2);
-
-        return pV0;
-
-    }
-
-    private double getV0OpeningAngle(Track track1, StraightLineTrack slt1, Track track2, StraightLineTrack slt2) {
-
-        Hep3Vector p1 = getTrueMomentum(track1, slt1);
-        Hep3Vector p2 = getTrueMomentum(track2, slt2);
-
-        return VecOp.dot(p1, p2) / (p1.magnitude() * p2.magnitude());
-
-    }
-
-    private Hep3Vector getTrueMomentum(Track track1, StraightLineTrack slt1) {
-        double[] truep = {0, 0, 0};
-        double me = 0.000511;
-        double p1x = track1.getPX();
-        double p1y = track1.getPY();
-        double p1z = track1.getPZ();
-        double p1mag2 = p1x * p1x + p1y * p1y + p1z * p1z;
-        double e1 = Math.sqrt(p1mag2 + me * me);
-        double dydx1 = slt1.dydx();
[truncated at 1000 lines; 20 more skipped]

java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham
KalmanFilterDriver.java removed after 382
--- java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/KalmanFilterDriver.java	2014-03-26 05:43:58 UTC (rev 382)
+++ java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/KalmanFilterDriver.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,249 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.lcsim.hps.users.mgraham;
-
-import hep.physics.vec.Hep3Vector;
-
-import java.util.List;
-
-import org.hps.recon.tracking.TrackAnalysis;
-import org.hps.recon.tracking.kalman.FullFitKalman;
-import org.hps.recon.tracking.kalman.ShapeDispatcher;
-import org.hps.recon.tracking.kalman.TrackUtils;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.LCRelation;
-import org.lcsim.event.MCParticle;
-import org.lcsim.event.RelationalTable;
-import org.lcsim.event.Track;
-import org.lcsim.event.TrackerHit;
-import org.lcsim.event.base.BaseRelationalTable;
-import org.lcsim.fit.helicaltrack.HelicalTrackFit;
-import org.lcsim.fit.helicaltrack.HelixUtils;
-import org.lcsim.geometry.Detector;
-import org.lcsim.recon.tracking.trfbase.ETrack;
-import org.lcsim.recon.tracking.trfbase.PropDir;
-import org.lcsim.recon.tracking.trfbase.Propagator;
-import org.lcsim.recon.tracking.trfbase.TrackError;
-import org.lcsim.recon.tracking.trfbase.TrackVector;
-import org.lcsim.recon.tracking.trfbase.VTrack;
-import org.lcsim.recon.tracking.trfdca.SurfDCA;
-import org.lcsim.recon.tracking.trffit.HTrack;
-import org.lcsim.util.Driver;
-import org.lcsim.util.aida.AIDA;
-
-/**
- *
- * @author ecfine ([log in to unmask])
- */
-/* Takes Matched Tracks from the Track Reconstruction Driver, and makes TRF
- * HTracks. Adds hits from the original tracks to the new HTrack, and runs a
- * Kalman filter over the HTrack.
- *
- * This only does a forward fit, and multiple scattering is only included at
- * interacting planes, and just by assuming that each plane is .01 radiation
- * lengths. Energy loss is not accounted for. Additionally, the method for
- * constructing hits assumes that every hit occurs at an XY plane, while ideally,
- * there would be a method which checks the lcsim detector geometry and then
- * decides what kind of surface to model the shape as. There may be some methods
- * in the ShapeHelper interface (particularly in TrdHelper) that would be useful
- * for this, but nothing completed. Additionally, to run realistic multiple
- * scattering with non-interacting detector elements, there would need to be a
- * way to find the intercepts between a specific track and the detector elements.
- *
- * Also, magnetic field is just set at 1.0 in each class. It should be taken from
- * the detector geometry. */
-public class KalmanFilterDriver extends Driver {
-
-    boolean _debug = false;
-    private AIDA aida = AIDA.defaultInstance();
-    ShapeDispatcher shapeDis = new ShapeDispatcher();
-    TrackUtils trackUtils = new TrackUtils();
-    Propagator prop = null;
-    FullFitKalman fitk = null;
-    KalmanGeom geom = null;
-    Detector detector = null;
-    HTrack ht = null;
-    double bz = 0.5;
-
-    public void detectorChanged(Detector det) {
-        detector = det;
-        geom = new KalmanGeom(detector); // new geometry containing detector info
-        prop = geom.newPropagator();
-        trackUtils.setBZ(geom.bz);
-        System.out.println("geom field = " + geom.bz + ", trackUtils field = " + trackUtils.bz);
-
-        fitk = new FullFitKalman(prop);
-//        PropXYXY_Test foobar = new PropXYXY_Test();
-//        foobar.testPropXYXY();
-        //
-    }
-
-    public void process(EventHeader event) {
-        /* Get the tracklist for each event, and then for each track
-         * get the starting track parameters and covariance matrix for an
-         * outward fit from the seedtracker. */
-        String kaldir = "KalmanFit/";
-        String kaldirPos = "KalmanFit/GoodChi2/";
-        String kaldirBad = "KalmanFit/BadChi2/";
-        String bkwdkaldir = "KalmanFit/BackwardFit/";
-        RelationalTable hittomc = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
-        List<LCRelation> mcrelations = event.get(LCRelation.class, "HelicalTrackMCRelations");
-
-        for (LCRelation relation : mcrelations)
-            if (relation != null && relation.getFrom() != null && relation.getTo() != null)
-                hittomc.add(relation.getFrom(), relation.getTo());
-
-        if (event.hasItem("MatchedTracks")) {
-            List<Track> trklist = (List<Track>) event.get("MatchedTracks");
-            if (_debug)
-                System.out.println("number of tracks: " + trklist.size());
-            for (int i = 0; i < trklist.size(); i++) {
-
-                /* Start with a HelicalTrackFit, turn it into a VTrack,
-                 * turn that into an ETrack, and turn that into an HTrack.
-                 * Then add detector hits from the original track. */
-                if (_debug)
-                    System.out.println("Making tracks...");
-                Track track = trklist.get(i);
-                TrackAnalysis tkanal = new TrackAnalysis(track, hittomc);
-                HelicalTrackFit helicalTrack = shapeDis.trackToHelix(track);
-                VTrack vt = trackUtils.makeVTrack(helicalTrack);
-                TrackError initialError = trackUtils.getInitalError(helicalTrack);
-                ETrack et = new ETrack(vt, initialError);
-                ht = new HTrack(et);
-
-                /* Add hits from original track */
-                for (int k = 0; k < track.getTrackerHits().size(); k++) {
-                    TrackerHit thit = track.getTrackerHits().get(k);
-//                    System.out.println("Adding hit...");
-                    ht = geom.addTrackerHit(thit, ht, helicalTrack, vt);
-                }
-                /* Once we have an HTrack with the ordered list of hits, we pass
-                 * this to the Kalman fitter. */
-//                System.out.println("Running Kalman fit...");
-
-
-
-                /*
-
-                int fstarf = fitk.fit(ht);
-                double kfchi2 = ht.chisquared();
-
-
-                SurfXYPlane srfc = new SurfXYPlane(0.001, 0);
-                 */
-
-                //                System.out.println("Nominal Fit Vector : "+vt.toString());
-                TrackVector nomFit = vt.vector();
-                double nomDCA = nomFit.get(0);
-                double nomz0 = nomFit.get(1);
-                double nomphi0 = Math.sin(nomFit.get(2));
-                double nomslope = nomFit.get(3);
-                double nomqOverpt = nomFit.get(4);
-
-
-                /*
-                ETrack fitET = ht.newTrack();
-                if (kfchi2 < 10000 && kfchi2 > 0) {
-                //                    ht.propagate(prop, srfc);
-                if(_debug)  System.out.println("Fitted Track Before Propagation:  "+ht.toString());
-                //                    ht.propagate(prop, srfc, PropDir.BACKWARD_MOVE);
-                ht.propagate(prop, s, PropDir.BACKWARD);
-
-                if(_debug)    System.out.println("Fitted Track After Propagation:  "+ht.toString());
-
-                TrackError fitErr = fitET.error();
-                double kfDCA = fitET.vector().get(0);
-                double kfz0 = fitET.vector().get(1);
-                double kfphi0 = Math.sin(fitET.vector().get(2));
-                double kfslope = fitET.vector().get(3);
-                double kfqOverpt = fitET.vector().get(4);
-                aida.histogram1D(kaldir + "Kalman Fit Chi2", 50, 0, 100).fill(kfchi2);
-                aida.histogram1D(kaldir + "Kalman Fit DCA", 50, -0.5, 0.5).fill(kfDCA);
-                aida.histogram1D(kaldir + "Kalman Fit z0", 50, -0.25, 0.25).fill(kfz0);
-                aida.histogram1D(kaldir + "Kalman Fit sin(phi0)", 50, -0.2, 0.2).fill(kfphi0);
-                aida.histogram1D(kaldir + "Kalman Fit tanlambda", 50, -0.1, 0.1).fill(kfslope);
-                aida.histogram1D(kaldir + "Kalman Fit qOverpt", 50, -5, 5).fill(kfqOverpt);
-                aida.histogram1D(kaldir + "Kalman-Nominal DCA", 50, -.5, 0.5).fill(kfDCA - nomDCA);
-                aida.histogram1D(kaldir + "Kalman-Nominal z0", 50, -0.5, 0.5).fill(kfz0 - nomz0);
-                aida.histogram1D(kaldir + "Kalman-Nominal sin(phi0)", 50, -0.05, 0.05).fill(kfphi0 - nomphi0);
-                aida.histogram1D(kaldir + "Kalman-Nominal slope", 50, -0.05, 0.05).fill(kfslope - nomslope);
-                aida.histogram1D(kaldir + "Kalman-Nominal qOverpt", 50, -0.1, 0.1).fill(kfqOverpt - nomqOverpt);
-
-
-                }
-                 */
-
-                double d0 = helicalTrack.dca();
-                double z0 = helicalTrack.z0();
-                double slope = helicalTrack.slope();
-                double phi0 = helicalTrack.phi0();
-                double R = helicalTrack.R();
-                double sTarg = HelixUtils.PathToXPlane(helicalTrack, 0, 1e4, 1).get(0);
-                double phi = sTarg / R - phi0;
-
-
-                int fstarfBkg = fitk.fitBackward(ht);
-                double bkwdkfchi2 = ht.chisquared();
-
-                double mmTocm = 0.1;
-                double dcaX = mmTocm * HelixUtils.PointOnHelix(helicalTrack, 0).x();
-                double dcaY = mmTocm * HelixUtils.PointOnHelix(helicalTrack, 0).y();
-                if (_debug)
-                    System.out.println("Kalman Filter Driver:  DCA X=" + dcaX + "; Y=" + dcaY);
-//                SurfDCA s = new SurfDCA(dcaX, dcaY);
-                SurfDCA s = new SurfDCA(0, 0);
-//                 SurfXYPlane srfc = new SurfXYPlane(0.001, 0);
-
-                ht.propagate(prop, s, PropDir.BACKWARD);
-                ETrack bkwdET = ht.newTrack();
-                TrackError bkwdfitErr = bkwdET.error();
-                double bkwdkfDCA = bkwdET.vector().get(0);
-                double bkwdkfz0 = bkwdET.vector().get(1);
-                double bkwdkfphi0 = Math.sin(bkwdET.vector().get(2));
-                double bkwdkfslope = bkwdET.vector().get(3);
-                double bkwdkfqOverpt = bkwdET.vector().get(4);
-
-                aida.histogram1D(bkwdkaldir + "Kalman Fit Chi2", 50, 0, 100).fill(bkwdkfchi2);
-                aida.histogram1D(kaldir + "Nominal Fit Chi2", 50, 0, 100).fill(track.getChi2());
-                if (bkwdkfchi2 > 0) {
-
-                    aida.histogram1D(bkwdkaldir + "Kalman Fit DCA", 50, -0.1, 0.1).fill(bkwdkfDCA);
-                    aida.histogram1D(bkwdkaldir + "Kalman Fit z0", 50, -0.1, 0.1).fill(bkwdkfz0);
-                    aida.histogram1D(bkwdkaldir + "Kalman Fit sin(phi0)", 50, -0.2, 0.2).fill(bkwdkfphi0);
-                    aida.histogram1D(bkwdkaldir + "Kalman Fit tanlambda", 50, -0.1, 0.1).fill(bkwdkfslope);
-                    aida.histogram1D(bkwdkaldir + "Kalman Fit qOverpt", 50, -5, 5).fill(bkwdkfqOverpt);
-                    aida.histogram1D(bkwdkaldir + "Kalman-Nominal DCA", 50, -.1, 0.1).fill(bkwdkfDCA - nomDCA);
-                    aida.histogram1D(bkwdkaldir + "Kalman-Nominal z0", 50, -0.1, 0.1).fill(bkwdkfz0 - nomz0);
-                    aida.histogram1D(bkwdkaldir + "Kalman-Nominal sin(phi0)", 50, -0.05, 0.05).fill(bkwdkfphi0 - nomphi0);
-                    aida.histogram1D(bkwdkaldir + "Kalman-Nominal slope", 50, -0.05, 0.05).fill(bkwdkfslope - nomslope);
-                    aida.histogram1D(bkwdkaldir + "Kalman-Nominal qOverpt", 50, -0.1, 0.1).fill(bkwdkfqOverpt - nomqOverpt);
-                    aida.histogram1D(kaldir + "Nominal Fit DCA", 50, -0.1, 0.1).fill(nomDCA);
-                    aida.histogram1D(kaldir + "Nominal Fit z0", 50, -0.1, 0.1).fill(nomz0);
-                    aida.histogram1D(kaldir + "Nominal Fit sin(phi0)", 50, -0.2, 0.2).fill(nomphi0);
-                    aida.histogram1D(kaldir + "Nominal Fit tanlambda", 50, -0.1, 0.1).fill(nomslope);
-                    aida.histogram1D(kaldir + "Nominal Fit qOverpt", 50, -5, 5).fill(nomqOverpt);
-                }
-
-                MCParticle mcp=tkanal.getMCParticle();
-                VTrack vmcp=trackUtils.makeVTrack(mcp);
-                Hep3Vector pmc=trackUtils.getMomentum(vmcp);
-                Hep3Vector pkal=trackUtils.getMomentum(bkwdET);
-                Hep3Vector pnom=trackUtils.getMomentum(vt);
-
-                double pkaldiff=pkal.magnitude()-pmc.magnitude();
-                double pnomdiff=pnom.magnitude()-pmc.magnitude();
-                 aida.histogram1D(kaldir + "Kalman-MC Momentum Difference", 50, -0.2, 0.2).fill(pkaldiff);
-                    aida.histogram1D(kaldir + "Nominal-MC Momentum Difference", 50, -0.2, 0.2).fill(pnomdiff);
-                    
-            }
-        }
-
-
-    }
-//        } else {
-//            System.out.println("No tracks!");
-//        }
-}

java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham
KalmanGeom.java removed after 382
--- java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/KalmanGeom.java	2014-03-26 05:43:58 UTC (rev 382)
+++ java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/KalmanGeom.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,564 +0,0 @@
-package org.lcsim.hps.users.mgraham;
-
-import hep.physics.matrix.SymmetricMatrix;
-import hep.physics.vec.Hep3Vector;
-import hep.physics.vec.VecOp;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.hps.recon.tracking.kalman.KalmanSurface;
-import org.hps.recon.tracking.kalman.PropDCAXY;
-import org.hps.recon.tracking.kalman.PropXYDCA;
-import org.hps.recon.tracking.kalman.ShapeDispatcher;
-import org.hps.recon.tracking.kalman.util.PropDCAZ;
-import org.lcsim.detector.IDetectorElement;
-import org.lcsim.detector.ILogicalVolume;
-import org.lcsim.detector.IPhysicalVolume;
-import org.lcsim.detector.IReadout;
-import org.lcsim.detector.ITransform3D;
-import org.lcsim.detector.identifier.IIdentifier;
-import org.lcsim.detector.solids.ISolid;
-import org.lcsim.detector.solids.Point3D;
-import org.lcsim.detector.tracker.silicon.ChargeCarrier;
-import org.lcsim.detector.tracker.silicon.SiSensor;
-import org.lcsim.detector.tracker.silicon.SiSensorElectrodes;
-import org.lcsim.event.RawTrackerHit;
-import org.lcsim.event.TrackerHit;
-import org.lcsim.fit.helicaltrack.HelicalTrackCross;
-import org.lcsim.fit.helicaltrack.HelicalTrackFit;
-import org.lcsim.fit.helicaltrack.HelicalTrackStrip;
-import org.lcsim.geometry.Detector;
-import org.lcsim.recon.tracking.trfbase.ETrack;
-import org.lcsim.recon.tracking.trfbase.PropDispatch;
-import org.lcsim.recon.tracking.trfbase.Propagator;
-import org.lcsim.recon.tracking.trfbase.VTrack;
-import org.lcsim.recon.tracking.trfcyl.PropCyl;
-import org.lcsim.recon.tracking.trfcyl.SurfCylinder;
-import org.lcsim.recon.tracking.trfcylplane.PropCylZ;
-import org.lcsim.recon.tracking.trfcylplane.PropZCyl;
-import org.lcsim.recon.tracking.trfdca.PropCylDCA;
-import org.lcsim.recon.tracking.trfdca.PropDCACyl;
-import org.lcsim.recon.tracking.trfdca.SurfDCA;
-import org.lcsim.recon.tracking.trffit.HTrack;
-import org.lcsim.recon.tracking.trfxyp.ClusXYPlane2;
-import org.lcsim.recon.tracking.trfxyp.HitXYPlane2;
-import org.lcsim.recon.tracking.trfxyp.PropXYXY;
-import org.lcsim.recon.tracking.trfxyp.SurfXYPlane;
-import org.lcsim.recon.tracking.trfzp.PropZZ;
-import org.lcsim.recon.tracking.trfzp.SurfZPlane;
-
-/**
- *
- * Extract needed information from the geometry system and serve it
- * to the callers in a convenient form.
- *
- *
- *@author $Author: mgraham $
- *@version $Id: KalmanGeom.java,v 1.5 2011/11/16 18:00:04 mgraham Exp $
- *
- * Date $Date: 2011/11/16 18:00:04 $
- *
- */
-/* To make the Kalman filter work for any detector, the type of hit that is
- * added to the HTrack has to be determined based on the lcsim detector
- * geometry. Additionally, this class has to be able to find the intersections
- * between a track and the detector elements to be able to implement more
- * realistic multiple scattering. Currently this class does not support
- * any of this functionality, and just adds hits. However there are methods for
- * looping through detector elements, etc. that may be useful for finding
- * intersections at some point. (ecfine) */
-public class KalmanGeom {
-    boolean _DEBUG=false;
-//      boolean _DEBUG=true;
-    // TRF wants distances in cm, not mm.
-    private double mmTocm = 0.1;
-    // this flag is a temporary fix to avoid making a surface behind the origin in x.
-    private double flag = 0;
-//    //    private Array radius = null;
-//    private Subdetector sd_tbar  = null;
-//    private Subdetector sd_vbar  = null;
-//    private Subdetector sd_tec   = null;
-//    private Subdetector sd_vec   = null;
-//    private Subdetector sd_tfor  = null;
-//    private Subdetector sd_bpipe = null;
-//
-//    private IDetectorElement de_tbar  = null;
-//    private IDetectorElement de_vbar  = null;
-//    private IDetectorElement de_tec   = null;
-//    private IDetectorElement de_vec   = null;
-//    private IDetectorElement de_tfor  = null;
-    // Nominal magnetic field.
-    public double bz = 0.5;
-    // Lists of interesting surfaces.
-    public List<KalmanSurface> Surf = new ArrayList<KalmanSurface>();
-    KalmanSurface surf = null;
-    // Specific surface type A to surface type B propagators.
-    private PropCyl propcyl = null;
-    private PropZZ propzz = null;
-    private PropDCACyl propdcacyl = null;
-    private PropCylDCA propcyldca = null;
-    private PropZCyl propzcyl = null;
-    private PropCylZ propcylz = null;
-    private PropXYXY propxyxy = null;
-    private PropDCAZ propdcaz = null;
-    private PropDCAXY propdcaxy = null;
-    private PropXYDCA propxydca = null;
-//    private PropZDCA propzdca     = null;
-    // The master propagator that can go between any pair of surfaces.
-    private PropDispatch pDispatch = null;
-    // The run time configuration system.
-    //ToyConfig config;
-    // Information from the run time configuration system.
-//    double  respixel;
-//    double  resstrip;
-//    boolean trackerbarrel2d;         
-//    double  zres2dTrackerBarrel;
-//    boolean vtxFwdEquivStrips;
-    // Does this detector have forward tracking.
-    boolean hasforward = false;
-    // Stuff for adding surfaces
-    static ArrayList physicalVolumes = new ArrayList();
-    ILogicalVolume logical;
-    ShapeDispatcher shapeDispatcher = new ShapeDispatcher();
-    Detector detector = null;
-
-    public KalmanGeom(Detector det) {
-        detector = det;
-        System.out.println("New detector: " + detector.getName());
-        logical = detector.getTrackingVolume().getLogicalVolume();
-
-        // Extract information from the run time configuration system.
-        //	try{
-        //	    ToyConfig config = ToyConfig.getInstance();
-        //	    respixel            = config.getDouble("respixel");
-        //	    resstrip            = config.getDouble("resstrip");
-        //	    trackerbarrel2d     = config.getBoolean("trackerbarrel2d");
-        //	    zres2dTrackerBarrel = config.getDouble("zres2dTrackerBarrel");
-        //	    vtxFwdEquivStrips   = config.getBoolean("vtxFwdEquivStrips");
-        //
-        //	} catch (ToyConfigException e){
-        //            System.out.println (e.getMessage() );
-        //            System.out.println ("Stopping now." );
-        //            System.exit(-1);
-        //        }
-
-
-
-        //	Map<String, Subdetector> subDetMap = detector.getSubdetectors();
-        //
-        //	Subdetector sd_tbar = subDetMap.get("TrackerBarrel");
-        //	Subdetector sd_vbar = subDetMap.get("VertexBarrel");
-        //	Subdetector sd_tec  = subDetMap.get("TrackerEndcap");
-        //	Subdetector sd_vec  = subDetMap.get("VertexEndcap");
-        //	Subdetector sd_tfor = subDetMap.get("TrackerForward");
-        //	Subdetector sd_bpipe  = subDetMap.get("BeamPipe");
-        //	System.out.println ("Checking .... " + sd_tbar + " | " + sd_tfor);
-        // Don't use subdetectors anymore...
-
-        //	 Check for forward tracking system.
-        //	if ( sd_tfor == null ) {
-        //	    System.out.println ("Checking 1 .... " );
-        //	    if ( detector.getName().compareTo("sid00") != 0 ){
-        //		System.out.println("Expected to find a TrackerForward Subdetector but did not!");
-        //		System.exit(-1);
-        //	    }
-        //	}else{
-        //	    System.out.println ("Checking 2  .... " );
-        //
-        //	    hasforward = true;
-        //	}           // I may want to implement something like this at some point but not now.
-
-        //	if ( hasforward ){
-        //	    de_tfor = sd_tfor.getDetectorElement();
-        //	}
-
-        /* Cycle through detector and add all surfaces to the surface list. */
-        //    addAllSurfaces();
-
-        System.out.println("Number of surfaces: " + Surf.size());
-        for (KalmanSurface surf : Surf) {
-            surf.Print();
-        }
-
-
-        double[] origin = {0., 0., 0.};
-
-//    	Map<String,Field> fields = detector.getFields();
-//    	Set<String> keys = fields.keySet();
-//    	for ( String key : keys ){
-//    	    Field field = fields.get(key);
-//    	    String classname = field.getClass().getName();
-//    	    String shortname = classname.replaceAll( "org.lcsim.geometry.field.", "");
-//    	    if ( shortname.compareTo("Solenoid") != 0 ){
-//    		System.out.println("Expected, but did not find, a solenoid: " + shortname );
-////    		System.exit(-1);
-//    	    }
-//    	    Solenoid s = (Solenoid)field;
-//    	    bz = s.getInnerField()[2];
-//    	    if ( bz == 0. ){
-//    		System.out.println("This code will not work with a magnetic field of 0: " + shortname );
-////    		System.exit(-1);
-//    	    }
-//    	    break;
-//    	}
-
-        // Instantiate surface-pair specific propagators.
-        propcyl = new PropCyl(bz);
-        propzz = new PropZZ(bz);
-        propdcacyl = new PropDCACyl(bz);
-        propcyldca = new PropCylDCA(bz);
-        propzcyl = new PropZCyl(bz);
-        propcylz = new PropCylZ(bz);
-        propxyxy = new PropXYXY(bz);
-        propdcaxy = new PropDCAXY(bz);
-        propxydca = new PropXYDCA(bz);
-        //	propdcaz   = new PropDCAZ(bz);
-        //	propzdca   = new PropZDCA(bz);
-        // Again, need xy plane propagators!
-
-        // Instantiate and configure the general purpose propagator.
-        pDispatch = new PropDispatch();
-        pDispatch.addPropagator(SurfZPlane.staticType(), SurfZPlane.staticType(), propzz);
-        pDispatch.addPropagator(SurfCylinder.staticType(), SurfCylinder.staticType(), propcyl);
-        pDispatch.addPropagator(SurfDCA.staticType(), SurfCylinder.staticType(), propdcacyl);
-        pDispatch.addPropagator(SurfCylinder.staticType(), SurfDCA.staticType(), propcyldca);
-        pDispatch.addPropagator(SurfZPlane.staticType(), SurfCylinder.staticType(), propzcyl);
-        pDispatch.addPropagator(SurfCylinder.staticType(), SurfZPlane.staticType(), propcylz);
-        pDispatch.addPropagator(SurfXYPlane.staticType(), SurfXYPlane.staticType(), propxyxy);
-        pDispatch.addPropagator(SurfDCA.staticType(), SurfXYPlane.staticType(), propdcaxy);
-        pDispatch.addPropagator(SurfXYPlane.staticType(), SurfDCA.staticType(), propxydca);
-        //	pDispatch.addPropagator( SurfDCA.staticType(),      SurfZPlane.staticType(),   propdcaz);
-        //	pDispatch.addPropagator( SurfZPlane.staticType(),   SurfDCA.staticType(),      propzdca);
-
-    }
-
-    public Propagator newPropagator() {
-        // Clone not supported for pDispatch.
-        //return pDispatch.newPropagator();
-        return (Propagator) pDispatch;
-    }
-
-//    public List<RKSurf> getCylinders(){
-//	return Surf;
-//    }
-//    public List<RKSurf> getZplus(){
-//	return ZSurfplus;
-//    }
-//
-//    public List<RKSurf> getZMinus(){
-//	return ZSurfminus;
-//    }   
-    public double getBz() {
-        return bz;
-    }
-
-    public void setBz(double bfield) {
-        bz = bfield;
-    }
-
-//   Return a list of z surfaces, going foward along the track.
-//    public List<RKSurf> getZ( double z0, double cz ){
-//	List<RKSurf> zlist = new ArrayList<RKSurf>();
-//	if ( cz > 0 ){
-//	    for ( Iterator ihit=ZSurfAll.iterator(); ihit.hasNext(); ){
-//		RKSurf s = (RKSurf) ihit.next();
-//		if ( s.zc >= z0 ){
-//		    zlist.add(s);
-//		}
-//	    }
-//	} else if ( cz < 0 ){
-//	    for ( ListIterator ihit=ZSurfAll.listIterator(ZSurfAll.size());
-//		  ihit.hasPrevious(); ){
-//		RKSurf s = (RKSurf) ihit.previous();
-//		if ( s.zc <= z0 ){
-//		    zlist.add(s);
-//		}
-//	    }
-//	}
-//
-//	return zlist;
-//    }  
-    // Adds all surfaces to the surface list
-    private void addAllSurfaces() {
-        addDaughterSurfaces(logical);
-    }
-
-    private void addDaughterSurfaces(ILogicalVolume logical) {
-        if (logical.getDaughters().size() == 0) {
-            // need to avoid making surface for target. for now, flag..
-            flag++;
-            if (flag > 5) {
-                surf = shapeDispatcher.getKalmanSurf(logical.getSolid());
-                Surf.add(surf);
-            }
-        }
-        for (int n = 0; n < logical.getNumberOfDaughters(); n++) {
-            IPhysicalVolume physical = logical.getDaughter(n);
-            addDaughterSurfaces(physicalToLogical(physical));
-            physicalVolumes.remove(physicalVolumes.size() - 1);
-        }
-    }
-
-    // Given a point, find the solid that contains it. Doesn't work.
-    private ISolid findSolidFromPoint(Point3D hitPoint) {
-        ISolid solid = checkDaughterSurfaces(logical, hitPoint);
-        return solid;
-    }
-
-    private ISolid checkDaughterSurfaces(ILogicalVolume logical, Point3D hitPoint) {
-        if (logical.getDaughters().size() == 0) {
-            if (pointIsOnSolid(logical.getSolid(), hitPoint)) {
-                return logical.getSolid();
-            }
-        }
-        for (int n = 0; n < logical.getNumberOfDaughters(); n++) {
-            IPhysicalVolume physical = logical.getDaughter(n);
-            checkDaughterSurfaces(physicalToLogical(physical), hitPoint);
-            physicalVolumes.remove(physicalVolumes.size() - 1);
-        }
-        System.out.print("This hit isn't on a solid!");
-        return null;
-    }
-
-    // Given a TrackerHit, return the surface the hit should be placed on. Doesn't work.
-    private KalmanSurface findTrackerHitSurface(TrackerHit thit) {
-        double[] position = thit.getPosition();
-        Point3D hitPoint = new Point3D(position[0], position[1], position[2]);
-        ISolid hitSolid = findSolidFromPoint(hitPoint);
-        KalmanSurface hitSurf = getKSurfFromSolid(hitSolid);
-        return hitSurf;
-    }
-
-    private KalmanSurface getKSurfFromSolid(ISolid hitSolid) {
-        throw new UnsupportedOperationException("Not yet implemented");
-    }
-
-    // Adds the physical volume to the physicalVolumes ArrayList.
-    private ILogicalVolume physicalToLogical(IPhysicalVolume physical) {
-        physicalVolumes.add(physical.getTransform());
-        return physical.getLogicalVolume();
-    }
-
-    // Adds intercepts between a HTrack and the detector. Doesn't work.
-    public void addIntercepts(HTrack ht, Detector detector) {
-        logical = detector.getTrackingVolume().getLogicalVolume();
-        addDaughterIntercepts(logical, ht);
-    }
-
-    private void addDaughterIntercepts(ILogicalVolume logical, HTrack ht) {
-        if (logical.getDaughters().size() == 0) {
-            ht = shapeDispatcher.addIntercept(logical.getSolid(), ht);
-        }
-        for (int n = 0; n < logical.getNumberOfDaughters(); n++) {
-            IPhysicalVolume physical = logical.getDaughter(n);
-            addDaughterIntercepts(physicalToLogical(physical), ht);
-            physicalVolumes.remove(physicalVolumes.size() - 1);
-        }
-    }
-
-    // Add a hit from an lcsim Track to a trf HTrack.
-    public HTrack addTrackerHit(TrackerHit thit, HTrack htrack, HelicalTrackFit track,
-            VTrack vtrack) {
-        /* This should check the kind of solid that got hit and model it as the
-         * correct surface based on the solid dimensions. For now it just
-         * assumes XY planes. */
-
-        double[] position = thit.getPosition();
-        if (position.length != 3) {
-            System.out.println("Position has more than 3 coordinates?!");
-        }
-
-
-//        // For checking surfaces
-//        KalmanSurface surface= findTrackerHitSurface(thit);
-//        PropStat prop = new PropStat();
-//        prop.setForward();
-//        double path = (position[2] - track.z0())/track.slope();
-//        KalmanHit khit = new KalmanHit(track, surface, vtrack, prop, path);
-//        Hit hit = khit.MakeHit();
-//        Point3D hitPoint = new Point3D(position[0], position[1], position[2]);
-//        ISolid hitSolid = findSolidFromPoint(hitPoint);
-
-        // Need an ETrack to add hits from clusters.
-        ETrack tre = htrack.newTrack();
-
-        // This also assumes the hit in question is a Helical Track Cross.
-        HelicalTrackCross htrackcross = (HelicalTrackCross) thit;
-        HelicalTrackStrip strip1 = (HelicalTrackStrip) htrackcross.getStrips().get(0);
-        HelicalTrackStrip strip2 = (HelicalTrackStrip) htrackcross.getStrips().get(1);
-
-        double dist1 = dotProduct(strip1.origin(), strip1.w());
-        double dist2 = dotProduct(strip2.origin(), strip2.w());
-      
-            if(_DEBUG)System.out.println("TrackerHit Position = [" + thit.getPosition()[0] + "," + thit.getPosition()[1] + "," + thit.getPosition()[2]);
-
-
-
-
-        /*
-        double phi1 = Math.atan2(strip1.w().y()*dist1*strip1.origin().y(), strip1.w().x()*dist1*strip1.origin().x());
-        double phi2 = Math.atan2(strip2.w().y()*dist2*strip2.origin().y(), strip2.w().x()*dist2*strip2.origin().x());
-        // phi needs to be between 0 and 2PI. Additionally, it seemed like
-        // rounding errors caused problems for very small negative values of phi,
-        // so these are approximated as 0.
-        if (phi1 < 0){
-        if (phi1 > -0.00000001){
-        phi1 = 0;
-        } else{
-        phi1 = phi1 + 2*Math.PI;
-        }
-        }
-        if(phi2 < 0 ){
-        if(phi2 > -0.00000001) {
-        phi2 = 0;
-        } else{
-        phi2 = phi2 + 2*Math.PI;
-        }
-        }
-         */
-        //set phis to 0 ... normal parallel to x-axis (mis-alignment can change this)
-        double phi1 = 0;
-        double phi2 = 0;
-
-        if(_DEBUG){
-        System.out.println("Origin of strip1: " + strip1.origin());
-        System.out.println("Origin of strip2: " + strip2.origin());
-        System.out.println("dist1: " + dist1 + ", phi1: " + phi1);
-        System.out.println("dist2: " + dist2 + ", phi2: " + phi2);
-        System.out.println("Strip 1 Measurement   "+strip1.umeas());
-        System.out.println("Strip 2 Measurement   "+strip2.umeas());
-        }
-        /*
-        // ClusXYPlane needs wz, wv, avz, phi and dist to create a cluster.
-        double wz1 = strip1.u().z();
-        double wz2 = strip2.u().z();
-        double wv1 = strip1.u().x() * (-Math.sin(phi1)) + strip1.u().y() * Math.cos(phi1);
-        double wv2 = strip2.u().x() * (-Math.sin(phi2)) + strip2.u().y() * Math.cos(phi2);         
-         */
-/*
-
-        double avz1 = strip1.umeas()
-                - (dist1 * (Math.cos(phi1) * strip1.u().x() + Math.sin(phi1) * strip1.u().y())
-                - (strip1.origin().x() * strip1.u().x() + strip1.origin().y() * strip1.u().y()
-                + strip1.origin().z() * strip1.u().z()));
-        double avz2 = strip2.umeas()
-                - (dist2 * (Math.cos(phi2) * strip2.u().x() + Math.sin(phi2) * strip2.u().y())
-                - (strip2.origin().x() * strip2.u().x() + strip2.origin().y() * strip2.u().y()
-                + strip2.origin().z() * strip2.u().z()));
-        double davz1 = strip1.du();
-        double davz2 = strip2.du();
-
-*/
-//        if(_DEBUG)System.out.println("wz1 = " + wz1 + ", wv1 = " + wv1 + ", avz1 = " + avz1 + ", davz1 =" + davz1);
-//        if(_DEBUG)System.out.println("wz2 = " + wz2 + ", wv2 = " + wv2 + ", avz2 = " + avz2 + ", davz2 =" + davz2);
-//        ClusXYPlane1 cluster1 = new ClusXYPlane1(dist1, phi1, wv1, wz1, avz1, davz1);
-//        ClusXYPlane1 cluster2 = new ClusXYPlane1(dist2, phi2, wv2, wz2, avz2, davz2);
-
-        //Creat a ClusXYPlane2 ... needs v(=y),z, dy,dz
-        Hep3Vector sorigin1 = strip1.origin();
-        Hep3Vector u1 = strip1.u();
-        double umeas1 = strip1.umeas();
-        Hep3Vector uvec1 = VecOp.mult(umeas1, u1);
-        Hep3Vector clvec1 = VecOp.add(sorigin1, uvec1);
-        double dumeas1 = strip1.du();
-        double dustrip1 = (strip1.vmax() - strip1.vmin()) / Math.sqrt(12);
-
-        Hep3Vector sorigin2 = strip2.origin();
-        Hep3Vector u2 = strip2.u();
-        double umeas2 = strip2.umeas();
-        Hep3Vector uvec2 = VecOp.mult(umeas2, u2);
-        Hep3Vector clvec2 = VecOp.add(sorigin2, uvec2);
-        double dumeas2 = strip2.du();
-        double dustrip2 = (strip2.vmax() - strip2.vmin()) / Math.sqrt(12);
-
-        double z1 = clvec1.z();
-        double z2 = clvec2.z();
-        //this is the non-z distance of the cluster (in our case, phi=0, so it's just y)
-        double v1 = clvec1.x() * (-Math.sin(phi1)) + clvec1.y() * Math.cos(phi1);
-        double v2 = clvec2.x() * (-Math.sin(phi2)) + clvec2.y() * Math.cos(phi2);
-
-        //transform umeas, ustrip to z and v
-        ITransform3D t1 = getLocalToGlobal((RawTrackerHit) strip1.rawhits().get(0));
-        ITransform3D t2 = getLocalToGlobal((RawTrackerHit) strip2.rawhits().get(0));
-        SymmetricMatrix tmpcov1 = new SymmetricMatrix(3);
-        tmpcov1.setElement(0, 0, dumeas1 * dumeas1);
-        tmpcov1.setElement(2, 2, dustrip1 * dustrip1);
-        SymmetricMatrix tmpcov2 = new SymmetricMatrix(3);
-        tmpcov2.setElement(0, 0, dumeas2 * dumeas2);
-        tmpcov2.setElement(2, 2, dustrip2 * dustrip2);
-
-
-
-        t1.rotate(tmpcov1);
-        t2.rotate(tmpcov2);
-        double dz1 = tmpcov1.e(2, 2);
-        double dz2 = tmpcov2.e(2, 2);
-        double dv1 = tmpcov1.e(1, 1);
-        double dv2 = tmpcov2.e(1, 1);
-
-        double dzv1 = tmpcov1.e(1, 2);
-        double dzv2 = tmpcov2.e(1, 2);
-        if(_DEBUG){
-            System.out.println("z1 = " + z1 + "+/-" + Math.sqrt(dz1) + ", v1 = " + v1 + "+/-" + Math.sqrt(dv1) + ", cov(z,v) = " + dzv1);
-            System.out.println("z2 = " + z2 + "+/-" + Math.sqrt(dz2) + ", v2 = " + v2 + "+/-" + Math.sqrt(dv2) + ", cov(z,v) = " + dzv2);
-        }
-//        ClusXYPlane2 cluster1 = new ClusXYPlane2(dist1, phi1, v1, z1, dv1, dz1,dzv1);
-//        ClusXYPlane2 cluster2 = new ClusXYPlane2(dist2, phi2, v2, z2, dv2, dz2,dzv2);
-
-        ClusXYPlane2 cluster1 = new ClusXYPlane2(dist1 * mmTocm, phi1, v1 * mmTocm, z1 * mmTocm, dv1 * mmTocm * mmTocm, dz1 * mmTocm * mmTocm, dzv1 * mmTocm * mmTocm);
-        ClusXYPlane2 cluster2 = new ClusXYPlane2(dist2 * mmTocm, phi2, v2 * mmTocm, z2 * mmTocm, dv2 * mmTocm * mmTocm, dz2 * mmTocm * mmTocm, dzv2 * mmTocm * mmTocm);
-        // Create new clusters and get hit predictions.
-        
-        List hits1 = cluster1.predict(tre);
-        List hits2 = cluster2.predict(tre);
-        HitXYPlane2 hit1 = (HitXYPlane2) hits1.get(0);
-        HitXYPlane2 hit2 = (HitXYPlane2) hits2.get(0);
-        hit1.setParentPointer(cluster1);
-        hit2.setParentPointer(cluster2);
-        if(_DEBUG){
-            System.out.println("Cluster 1:\n"+cluster1.toString());
-        System.out.println("Cluster 2:\n"+cluster2.toString());
-           System.out.println("hit1 predicted vector: " + hit1.toString());
-          System.out.println("hit2 predicted vector: " + hit2.toString());
-            System.out.println("hit position from trackerhit: [" + thit.getPosition()[0] + ", " +
-                thit.getPosition()[1] + ", " + thit.getPosition()[2] + "]");
-        }
-
-        htrack.addHit(hit1);
-        htrack.addHit(hit2);
-
-        return htrack;
-
-    }
-
-    private boolean pointIsOnSolid(ISolid solid, Point3D hitPoint) {
-        return shapeDispatcher.pointIsOnSolid(solid, hitPoint);
-    }
-
-    private double dotProduct(Hep3Vector v1, Hep3Vector v2) {
-        double dotProduct = v1.x() * v2.x() + v1.y() * v2.y() + v1.z() * v2.z();
-        return dotProduct;
-    }
-
-    private ITransform3D getLocalToGlobal(RawTrackerHit raw_hit) {
-        ITransform3D foobar = null;
-        IIdentifier id = raw_hit.getIdentifier();
-
-        IDetectorElement detector_de = detector.getDetectorElement();
-        Set<SiSensor> _process_sensors = new HashSet<SiSensor>();
-        _process_sensors.addAll(detector_de.findDescendants(SiSensor.class));
-        for (SiSensor sensor : _process_sensors) {
-            SiSensorElectrodes electrodes = sensor.getReadoutElectrodes(ChargeCarrier.HOLE);
-            IReadout readout = sensor.getReadout();
-            List<RawTrackerHit> raw_hits = readout.getHits(RawTrackerHit.class);
-            for (RawTrackerHit rh : raw_hits)
-                if (rh.equals(raw_hit))
-                    return ((SiSensor) electrodes.getDetectorElement()).getGeometry().getLocalToGlobal();
-        }
-        System.out.println("KalmanGeom:  Didn't find the hit!");
-        return foobar;
-    }
-}

java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham
MainJASDriver.java removed after 382
--- java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/MainJASDriver.java	2014-03-26 05:43:58 UTC (rev 382)
+++ java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/MainJASDriver.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,57 +0,0 @@
-package org.lcsim.hps.users.mgraham;
-
-import org.hps.conditions.deprecated.CalibrationDriver;
-import org.hps.recon.tracking.DataTrackerHitDriver;
-import org.hps.recon.tracking.HPSRawTrackerHitFitterDriver;
-import org.hps.recon.tracking.HelicalTrackHitDriver;
-import org.hps.recon.tracking.TrackerReconDriver;
-import org.lcsim.recon.tracking.digitization.sisim.config.RawTrackerHitSensorSetup;
-import org.lcsim.util.Driver;
-
-/**
- * Driver for track reconstruction and analysis of HPS detector for execution in JAS.
- *
- * @author M. Graham 
- */
-public final class MainJASDriver extends Driver {
-
-
-
-    public MainJASDriver() {
-//        add(new HPSSVTSensorSetup());
-        add(new CalibrationDriver());
-        add(new RawTrackerHitSensorSetup());
-        //   Can remove HPSRawTrackerHitFitterDriver and DataTrackerHitDriver for integrated MC
-        HPSRawTrackerHitFitterDriver hitfitter=new HPSRawTrackerHitFitterDriver();
-        hitfitter.setCorrectT0Shift(true);
-        hitfitter.setFitAlgorithm("Analytic");
-        add(hitfitter);
-        add(new DataTrackerHitDriver());
-        
-//        add(new TrackerDigiDriver());  //add for integrated MC
-        HelicalTrackHitDriver hth = new HelicalTrackHitDriver();
-        hth.setClusterTimeCut(8.0);
-        
-//        SingleSensorHelicalTrackHitDriver hth = new SingleSensorHelicalTrackHitDriver();
-        hth.setMaxSeperation(20.0);
-        hth.setTolerance(1.0);
-        add(hth);
-        TrackerReconDriver trd=new TrackerReconDriver();
-        
-//          trd.setStrategyResource("/org/lcsim/hps/recon/tracking/strategies/HPS-SingleSensors.xml");
-        trd.setStrategyResource("/org/lcsim/hps/recon/tracking/strategies/HPS-Full.xml");
-//    trd.setStrategyResource("/org/lcsim/hps/recon/tracking/strategies/HPS-Test-Lyr50.xml");
-        trd.setDebug(true);
-        add(trd);
-//
-        DetailedAnalysisDriver dad=new DetailedAnalysisDriver(12);
-        dad.setRawHitsName("SVTRawTrackerHits");
-        add(dad);
-
-//        add(new FastTrackAnalysisDriver());
-        
-       
-    }
-
-  
-}

java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham
MyLCIOWriterDriver.java removed after 382
--- java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/MyLCIOWriterDriver.java	2014-03-26 05:43:58 UTC (rev 382)
+++ java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/MyLCIOWriterDriver.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,91 +0,0 @@
-package org.lcsim.hps.users.mgraham;
-
-import java.io.IOException;
-
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.Track;
-import org.lcsim.lcio.LCIOWriter;
-import org.lcsim.util.Driver;
-
-/**
- *
- * @author mgraham Created 5/17/2012 really the same as
- * org.lcsim.util.LCIODriver but only write events that pass some condition
- * (e.g. has a reconstructed track)
- */
-public class MyLCIOWriterDriver extends Driver {
-
-    private String outputFile;
-    private LCIOWriter writer;
-    private String trackCollectionName = "MatchedTracks";
-
-    public MyLCIOWriterDriver() {
-    }
-
-    public void setOutputFilePath(String output) {
-        this.outputFile = output;
-    }
-    
-      public void setTrackCollectionNamePath(String trackCollection) {
-        this.trackCollectionName = trackCollection;
-    }
-
-    private void setupWriter() {
-        // Cleanup existing writer.
-        if (writer != null) {
-            try {
-                writer.flush();
-                writer.close();
-                writer = null;
-            } catch (IOException x) {
-                System.err.println(x.getMessage());
-            }
-        }
-
-        // Setup new writer.
-        try {
-            writer = new LCIOWriter(outputFile);
-        } catch (IOException x) {
-            throw new RuntimeException("Error creating writer", x);
-        }
-
-
-        try {
-            writer.reOpen();
-        } catch (IOException x) {
-            throw new RuntimeException("Error rewinding LCIO file", x);
-        }
-    }
-
-    protected void startOfData() {
-        setupWriter();
-    }
-
-    protected void endOfData() {
-        try {
-            writer.close();
-        } catch (IOException x) {
-            throw new RuntimeException("Error rewinding LCIO file", x);
-        }
-    }
-
-    protected void process(EventHeader event) {
-        if (event.get(Track.class, trackCollectionName).size()>1) {
-            System.out.println("found a two track event...writing to lcio file");
-            try {
-                
-                writer.write(event);
-            } catch (IOException x) {
-                throw new RuntimeException("Error writing LCIO file", x);
-            }
-        }
-    }
-
-    protected void suspend() {
-        try {
-            writer.flush();
-        } catch (IOException x) {
-            throw new RuntimeException("Error flushing LCIO file", x);
-        }
-    }
-}

java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham
PropXYXY_Test.java removed after 382
--- java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/PropXYXY_Test.java	2014-03-26 05:43:58 UTC (rev 382)
+++ java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/PropXYXY_Test.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,530 +0,0 @@
-/*
- * PropXYXY_Test.java
- *
- * Created on July 24, 2007, 10:15 PM
- *
- * $Id: PropXYXY_Test.java,v 1.2 2011/07/07 20:57:39 mgraham Exp $
- */
-
-package org.lcsim.hps.users.mgraham;
-
-//import junit.framework.TestCase;
-import org.lcsim.recon.tracking.spacegeom.SpacePath;
-import org.lcsim.recon.tracking.spacegeom.SpacePoint;
-import org.lcsim.recon.tracking.trfbase.ETrack;
-import org.lcsim.recon.tracking.trfbase.PropDir;
-import org.lcsim.recon.tracking.trfbase.PropStat;
-import org.lcsim.recon.tracking.trfbase.Propagator;
-import org.lcsim.recon.tracking.trfbase.Surface;
-import org.lcsim.recon.tracking.trfbase.TrackDerivative;
-import org.lcsim.recon.tracking.trfbase.TrackError;
-import org.lcsim.recon.tracking.trfbase.TrackVector;
-import org.lcsim.recon.tracking.trfbase.VTrack;
-import org.lcsim.recon.tracking.trfutil.Assert;
-import org.lcsim.recon.tracking.trfxyp.PropXYXY;
-import org.lcsim.recon.tracking.trfxyp.SurfXYPlane;
-import org.lcsim.util.Driver;
-
-/**
- *
- * @author Norman Graf
- */
-public class PropXYXY_Test extends Driver
-{
-    private boolean debug=true;
-    /** Creates a new instance of PropXYXY_Test */
-    public void testPropXYXY()
-    {
-        String ok_prefix = "PropXYXY (I): ";
-        String error_prefix = "PropXYXY test (E): ";
-        
-        if(debug) System.out.println( ok_prefix
-                + "-------- Testing component PropXYXY. --------" );
-        
-        
-        //********************************************************************
-        
-        if(debug) System.out.println( ok_prefix + "Test constructor." );
-        PropXYXY prop = new PropXYXY(0.5);
-        if(debug) System.out.println( prop );
-        
-        //********************************************************************
-        
-        // Here we propagate some tracks both forward and backward and then
-        // each back to the original track.  We check that the returned
-        // track parameters match those of the original track.
-        if(debug) System.out.println( ok_prefix + "Check reversibility." );
-        
-        double u1[]  ={10.,      10.,     10.,     10.,     10.,     10.,10.,10.};
-        double u2[]  ={10.,      10.,     10.,     10.,     10.,     10.,11.,11.};
-//        double phi1[]={  Math.PI/2.,    Math.PI/2.,   Math.PI/2.,   Math.PI/2.,   Math.PI/2.,   Math.PI/2., Math.PI/2.,0};
-//        double phi2[]={5*Math.PI/6.,  5*Math.PI/6., 5*Math.PI/6., 5*Math.PI/6., 5*Math.PI/6., 5*Math.PI/6., 5*Math.PI/6.,0};
-        double phi1[]={  Math.PI/2.,    Math.PI/2.,   Math.PI/2.,   Math.PI/2.,   Math.PI/2.,   Math.PI/2., 0,0};
-        double phi2[]={5*Math.PI/6.,  5*Math.PI/6., 5*Math.PI/6., 5*Math.PI/6., 5*Math.PI/6., 5*Math.PI/6., 0,0};
-        int sign_du[]={  1,       -1,      -1,       1,       1,       1 ,  1  ,1};
-        double v[]   ={ -2.,       2.,     40.,     40.,     -2.,     -2.,  2. ,2 };
-        double z[]   ={  3.,       3.,      3.,      3.,      3.,      3.,  3. ,3};
-        double dvdu[]={-1.5,     -1.5,     1.5,     1.5,    -1.5,      0.,  1.5 ,1.5 };
-        double dzdu[]={ 2.3,     -2.3,    -2.3,     2.3,     0.,       2.3,  2.3   ,-2.3};
-        double qp[]  ={ 0.05,    -0.05,    0.05,   -0.05,    0.05,     0.05, 0.05  ,0.5};
-        
-        double maxdiff = 1.e-7;
-        int ntrk = 8;
-        int i;
-        for ( i=0; i<ntrk; ++i )
-        {
-            if(debug) System.out.println( "********** Propagate track " + i + ". **********" );
-            PropStat pstat = new PropStat();
-            SurfXYPlane sxyp1 = new SurfXYPlane(u1[i],phi1[i]);
-            SurfXYPlane sxyp2= new SurfXYPlane(u2[i],phi2[i]);
-            TrackVector vec1 = new TrackVector();
-            vec1.set(SurfXYPlane.IV     ,v[i]);     // v
-            vec1.set(SurfXYPlane.IZ     ,z[i]);     // z
-            vec1.set(SurfXYPlane.IDVDU  ,dvdu[i]);  // dv/du
-            vec1.set(SurfXYPlane.IDZDU  ,dzdu[i]);  // dz/du
-            vec1.set(SurfXYPlane.IQP    ,qp[i]);    //  q/p
-            
-            VTrack trv1 = new VTrack(sxyp1.newPureSurface(),vec1);
-            if (sign_du[i]==1) trv1.setForward();
-            else trv1.setBackward();
-            if(debug) System.out.println( " starting: " + trv1 );
-            System.out.println("PropDir.FORWARD_MOVE");
-            VTrack trv2f = new VTrack(trv1);
-            pstat = prop.vecDirProp(trv2f,sxyp2,PropDir.FORWARD_MOVE);
-            if(debug) System.out.println( pstat );
-            if(debug) System.out.println("pstat= "+pstat);
-            Assert.assertTrue( pstat.forward() );
-            if(debug) System.out.println( "  forward: " + trv2f );
-            Assert.assertTrue(check_dz(trv1,trv2f)>=0.);
-
-              System.out.println("PropDir.BACKWARD");
-            VTrack trv2b = new VTrack(trv1);
-            pstat = prop.vecDirProp(trv2b,sxyp2,PropDir.BACKWARD);
-            if(debug) System.out.println( pstat );
-            Assert.assertTrue( pstat.backward() );
-            if(debug) System.out.println( " backward: " + trv2b );
-            Assert.assertTrue(check_dz(trv1,trv2b)<=0.);
-
-             System.out.println("PropDir.BACKWARD_MOVE");
-            VTrack trv2fb = new VTrack(trv2f);
-            pstat = prop.vecDirProp(trv2fb,sxyp1,PropDir.BACKWARD_MOVE);
-            if(debug) System.out.println( pstat );
-            Assert.assertTrue( pstat.backward() );
-            if(debug) System.out.println( " f return: " + trv2fb );
-            Assert.assertTrue(check_dz(trv2f,trv2fb)<=0.);
-            
-             System.out.println("PropDir.FORWARD");
-            VTrack trv2bf = new VTrack(trv2b);
-            pstat = prop.vecDirProp(trv2bf,sxyp1,PropDir.FORWARD);
-            if(debug) System.out.println( pstat );
-            Assert.assertTrue( pstat.forward() );
-            if(debug) System.out.println( " b return: " + trv2bf );
-            Assert.assertTrue(check_dz(trv2b,trv2bf)>=0.);
-            
-            double difff =
-                    sxyp1.vecDiff(trv2fb.vector(),trv1.vector()).amax();
-            double diffb =
-                    sxyp1.vecDiff(trv2bf.vector(),trv1.vector()).amax();
-            if(debug) System.out.println( "diffs: " + difff + ' ' + diffb );
-            Assert.assertTrue( difff < maxdiff );
-            Assert.assertTrue( diffb < maxdiff );
-            
-        }
-        
-        //********************************************************************
-        
-        // Repeat the above with errors.
-        if(debug) System.out.println( ok_prefix + "Check reversibility with errors." );
-        double evv[] =   {  0.01,   0.01,   0.01,   0.01,   0.01,   0.01  };
-        double evz[] =   {  0.01,  -0.01,   0.01,  -0.01,   0.01,  -0.01  };
-        double ezz[] =   {  0.25,   0.25,   0.25,   0.25,   0.25,   0.25, };
-        double evdv[] =  {  0.004, -0.004,  0.004, -0.004,  0.004, -0.004 };
-        double ezdv[] =  {  0.04,  -0.04,   0.04,  -0.04,   0.04,  -0.04, };
-        double edvdv[] = {  0.01,   0.01,   0.01,   0.01,   0.01,   0.01  };
-        double evdz[] =  {  0.004, -0.004,  0.004, -0.004,  0.004, -0.004 };
-        double edvdz[] = {  0.004, -0.004,  0.004, -0.004,  0.004, -0.004 };
-        double ezdz[] =  {  0.04,  -0.04,   0.04,  -0.04,   0.04,  -0.04  };
-        double edzdz[] = {  0.02,   0.02,   0.02,   0.02,   0.02,   0.02  };
-        double evqp[] =  {  0.004, -0.004,  0.004, -0.004,  0.004, -0.004 };
-        double ezqp[] =  {  0.004, -0.004,  0.004, -0.004,  0.004, -0.004 };
-        double edvqp[] = {  0.004, -0.004,  0.004, -0.004,  0.004, -0.004 };
-        double edzqp[] = {  0.004, -0.004,  0.004, -0.004,  0.004, -0.004 };
-        double eqpqp[] = {  0.01,   0.01,   0.01,   0.01,   0.01,   0.01  };
-        
-        maxdiff = 1.e-6;
-        
-        for ( i=0; i<ntrk; ++i )
-        {
-            if(debug) System.out.println( "********** Propagate track " + i + ". **********" );
-            PropStat pstat = new PropStat();
-            SurfXYPlane sxyp1 = new SurfXYPlane(u1[i],phi1[i]);
-            SurfXYPlane sxyp2 = new SurfXYPlane(u2[i],phi2[i]);
-            TrackVector vec1 = new TrackVector();
-            vec1.set(SurfXYPlane.IV,    v[i]);     // v
-            vec1.set(SurfXYPlane.IZ,    z[i]);     // z
-            vec1.set(SurfXYPlane.IDVDU, dvdu[i]);  // dv/du
-            vec1.set(SurfXYPlane.IDZDU, dzdu[i]);  // dz/du
-            vec1.set(SurfXYPlane.IQP,   qp[i]);    //  q/p
-            
-            TrackError err1 = new TrackError();
-            err1.set(SurfXYPlane.IV,SurfXYPlane.IV,       evv[i]);
-            err1.set(SurfXYPlane.IV,SurfXYPlane.IZ,       evz[i]);
-            err1.set(SurfXYPlane.IZ,SurfXYPlane.IZ,       ezz[i]);
-            err1.set(SurfXYPlane.IV,SurfXYPlane.IDVDU,    evdv[i]);
-            err1.set(SurfXYPlane.IZ,SurfXYPlane.IDVDU,    ezdv[i]);
-            err1.set(SurfXYPlane.IDVDU,SurfXYPlane.IDVDU, edvdv[i]);
-            err1.set(SurfXYPlane.IV,SurfXYPlane.IDZDU,    evdz[i]);
-            err1.set(SurfXYPlane.IZ,SurfXYPlane.IDZDU,    ezdz[i]);
-            err1.set(SurfXYPlane.IDVDU,SurfXYPlane.IDZDU, edvdz[i]);
-            err1.set(SurfXYPlane.IDZDU,SurfXYPlane.IDZDU, edzdz[i]);
-            err1.set(SurfXYPlane.IV,SurfXYPlane.IQP,      evqp[i]);
-            err1.set(SurfXYPlane.IZ,SurfXYPlane.IQP,      ezqp[i]);
-            err1.set(SurfXYPlane.IDVDU,SurfXYPlane.IQP,   edvqp[i]);
-            err1.set(SurfXYPlane.IDZDU,SurfXYPlane.IQP,   edzqp[i]);
-            err1.set(SurfXYPlane.IQP,SurfXYPlane.IQP,     eqpqp[i]);
-            ETrack trv1 = new ETrack(sxyp1.newPureSurface(),vec1,err1);
-            if(sign_du[i]==1) trv1.setForward();
-            else trv1.setBackward();
-            if(debug) System.out.println( " starting: " + trv1 );
-            
-            ETrack trv2f = new ETrack(trv1);
-            pstat = prop.errDirProp(trv2f,sxyp2,PropDir.FORWARD);
-            Assert.assertTrue( pstat.forward() );
-            if(debug) System.out.println( "  forward: " + trv2f );
-            ETrack trv2b = new ETrack(trv1);
-            pstat = prop.errDirProp(trv2b,sxyp2,PropDir.BACKWARD);
-            Assert.assertTrue( pstat.backward() );
-            if(debug) System.out.println( " backward: " + trv2b );
-            ETrack trv2fb = new ETrack(trv2f);
-            pstat = prop.errDirProp(trv2fb,sxyp1,PropDir.BACKWARD);
-            Assert.assertTrue( pstat.backward() );
-            if(debug) System.out.println( " f return: " + trv2fb );
-            ETrack trv2bf = new ETrack(trv2b);
-            pstat = prop.errDirProp(trv2bf,sxyp1,PropDir.FORWARD);
-            Assert.assertTrue( pstat.forward() );
-            if(debug) System.out.println( " b return: " + trv2bf );
-            double difff =
-                    sxyp1.vecDiff(trv2fb.vector(),trv1.vector()).amax();
-            double diffb =
-                    sxyp1.vecDiff(trv2bf.vector(),trv1.vector()).amax();
-            if(debug) System.out.println( "vec diffs: " + difff + ' ' + diffb );
-            Assert.assertTrue( difff < maxdiff );
-            Assert.assertTrue( diffb < maxdiff );
-            TrackError dfb = trv2fb.error().minus(trv1.error());
-            TrackError dbf = trv2bf.error().minus(trv1.error());
-            double edifff = dfb.amax();
-            double ediffb = dbf.amax();
-            if(debug) System.out.println( "err diffs: " + edifff + ' ' + ediffb );
-            Assert.assertTrue( edifff < maxdiff );
-            Assert.assertTrue( ediffb < maxdiff );
-        }
-        
-        //********************************************************************
-        
-        if(debug) System.out.println( ok_prefix + "Test Nearest Propagation" );
-        
-        PropStat pstat = new PropStat();
-        SurfXYPlane sxyp1 = new SurfXYPlane(2.,Math.PI/3.);
-        SurfXYPlane sxyp2 = new SurfXYPlane(3.,Math.PI/3.);
-        
-        TrackVector vec1 = new TrackVector();
-        
-        vec1.set(SurfXYPlane.IV     ,1.);     // v
-        vec1.set(SurfXYPlane.IZ     ,1.);     // z
-        vec1.set(SurfXYPlane.IDVDU  ,1.);     // dv/du
-        vec1.set(SurfXYPlane.IDZDU  ,1.);     // dz/du
-        vec1.set(SurfXYPlane.IQP    ,0.01);   //  q/p
-        
-        VTrack trv1 = new VTrack(sxyp1.newPureSurface(),vec1);
-        trv1.setForward();
-        
-        if(debug) System.out.println( " starting: " + trv1 );
-        VTrack trv2n = new VTrack(trv1);
-        pstat = prop.vecDirProp(trv2n,sxyp2,PropDir.NEAREST);
-        Assert.assertTrue( pstat.forward() );
-        if(debug) System.out.println( " nearest: " + trv2n );
-        
-        trv1.setBackward();
-        
-        if(debug) System.out.println( " starting: " + trv1 );
-        trv2n = new VTrack(trv1);
-        pstat = prop.vecDirProp(trv2n,sxyp2,PropDir.NEAREST);
-        Assert.assertTrue( pstat.backward() );
-        if(debug) System.out.println( " nearest: " + trv2n );
-        
-        //********************************************************************
-        
-        if(debug) System.out.println( ok_prefix + "Test XXX_MOVE and Same Surface Propagation." );
-        
-        VTrack trvt0 = new VTrack(sxyp1.newPureSurface(),vec1);
-        trvt0.setForward();
-        VTrack trvt1 = new VTrack(trvt0);
-        PropStat tst = prop.vecDirProp(trvt1,sxyp1,PropDir.NEAREST);
-        Assert.assertTrue( tst.success() && trvt1.equals(trvt0) );
-        tst = prop.vecDirProp(trvt1,sxyp1,PropDir.FORWARD);
-        Assert.assertTrue( tst.success() && trvt1.equals(trvt0) );
-        tst = prop.vecDirProp(trvt1,sxyp1,PropDir.BACKWARD);
-        Assert.assertTrue( tst.success() && trvt1.equals(trvt0) );
-        
-        trvt1 =  new VTrack(trvt0);
-        tst = prop.vecDirProp(trvt1,sxyp1,PropDir.NEAREST_MOVE);
-        Assert.assertTrue( tst.success() && !trvt1.equals(trvt0) );
-        trvt1 = new VTrack(trvt0);
-        tst = prop.vecDirProp(trvt1,sxyp1,PropDir.FORWARD_MOVE);
-        Assert.assertTrue( tst.success() && !trvt1.equals(trvt0) );
-        trvt1 = new VTrack(trvt0);
-        tst = prop.vecDirProp(trvt1,sxyp1,PropDir.BACKWARD_MOVE);
-        Assert.assertTrue( tst.success() && !trvt1.equals(trvt0) );
-        
-        //********************************************************************
-        
-        if(debug) System.out.println( ok_prefix + "Test Zero B field propagation" );
-        {
-            
-            PropXYXY prop0 = new PropXYXY(0.);
-            if(debug) System.out.println( prop0 );
-            Assert.assertTrue( prop0.bField() == 0. );
-            
-            double u=10.,phi=0.;
-            Surface srf = new SurfXYPlane(u,phi);
-            VTrack trv0 = new VTrack(srf);
-            TrackVector vec = new TrackVector();
-            vec.set(SurfXYPlane.IV, 2.);
-            vec.set(SurfXYPlane.IZ, 10.);
-            vec.set(SurfXYPlane.IDVDU, 4.);
-            vec.set(SurfXYPlane.IDZDU, 2.);
-            trv0.setVector(vec);
-            trv0.setForward();
-            u=4.;
-            
-            Surface srf_to = new SurfXYPlane(u,phi);
-            
-            VTrack trv = new VTrack(trv0);
-            pstat = prop0.vecDirProp(trv,srf_to,PropDir.FORWARD);
-            Assert.assertTrue( !pstat.success() );
-            
-            trv = new VTrack(trv0);
-            pstat = prop0.vecDirProp(trv,srf_to,PropDir.BACKWARD);
-            Assert.assertTrue( pstat.success() );
-            
-            trv = new VTrack(trv0);
-            trv.setBackward();
-            pstat = prop0.vecDirProp(trv,srf_to,PropDir.BACKWARD);
-            Assert.assertTrue( !pstat.success() );
-            
-            trv = new VTrack(trv0);
-            trv.setBackward();
-            pstat = prop0.vecDirProp(trv,srf_to,PropDir.FORWARD);
-            Assert.assertTrue( pstat.success() );
-            
-            trv = new VTrack(trv0);
-            trv.setForward();
-            pstat = prop0.vecDirProp(trv,srf_to,PropDir.NEAREST);
-            Assert.assertTrue( pstat.success() );
-            
-            Assert.assertTrue( pstat.backward() );
-            Assert.assertTrue( trv.vector(SurfXYPlane.IDVDU) == trv0.vector(SurfXYPlane.IDVDU) );
-            Assert.assertTrue( trv.vector(SurfXYPlane.IDZDU) == trv0.vector(SurfXYPlane.IDZDU) );
-            Assert.assertTrue(trv.surface().pureEqual(srf_to));
-            
-            check_zero_propagation(trv0,trv,pstat);
-            
-            srf_to = new SurfXYPlane(4.,Math.PI/16.);
-            trv = new VTrack(trv0);
-            trv.setForward();
-            pstat = prop0.vecDirProp(trv,srf_to,PropDir.NEAREST);
-            Assert.assertTrue( pstat.success() );
-            check_zero_propagation(trv0,trv,pstat);
-            
-            srf_to = new SurfXYPlane(14.,Math.PI/4.);
-            trv = new VTrack(trv0);
-            trv.setForward();
-            pstat = prop0.vecDirProp(trv,srf_to,PropDir.NEAREST);
-            Assert.assertTrue( pstat.success() );
-            check_zero_propagation(trv0,trv,pstat);
-            
-            srf_to = new SurfXYPlane(14.,Math.PI/2.);
-            trv = new VTrack(trv0);
-            trv.setForward();
-            pstat = prop0.vecDirProp(trv,srf_to,PropDir.NEAREST);
-            Assert.assertTrue( pstat.success() );
-            check_zero_propagation(trv0,trv,pstat);
-            
-            srf_to = new SurfXYPlane(14.,Math.PI);
-            trv = new VTrack(trv0);
-            trv.setForward();
-            pstat = prop0.vecDirProp(trv,srf_to,PropDir.NEAREST);
-            Assert.assertTrue( pstat.success() );
-            check_zero_propagation(trv0,trv,pstat);
-            
-            srf_to = new SurfXYPlane(14.,Math.PI*5./4.);
-            trv = new VTrack(trv0);
-            trv.setSurface(new SurfXYPlane(14.,Math.PI*7./4.));
-            trv.setForward();
-            VTrack tmp = new VTrack(trv);
-            VTrack der = new VTrack(trv);
-            pstat = prop0.vecDirProp(trv,srf_to,PropDir.NEAREST);
-            Assert.assertTrue( pstat.success() );
-            check_zero_propagation(tmp,trv,pstat);
-            check_derivatives(prop0,der,srf_to);
-            
-        }
-        
-        
-        //********************************************************************
-        
-        if(debug) System.out.println( ok_prefix + "Test cloning." );
-        Assert.assertTrue( prop.newPropagator() != null);
-        
-        //********************************************************************
-        
-        if(debug) System.out.println( ok_prefix + "Test the field." );
-        Assert.assertTrue( prop.bField() == 2.0 );
-        
-        //********************************************************************
-        
-        {
-            if(debug) System.out.println("===========================================\n");
-            PropXYXY p1 = new PropXYXY(2.);
-            PropXYXY p2 = new PropXYXY(-2.);
-            SurfXYPlane xy1 = new SurfXYPlane(5.,0.);
-            SurfXYPlane xy2 = new SurfXYPlane(3.,0.);
-            ETrack tre0 = new ETrack( xy2.newSurface() );
-            TrackVector vec = new TrackVector();
-            TrackError err = new TrackError();
-            
-            vec.set(0, 0.);
-            vec.set(1, 0.);
-            vec.set(2, 0.0);
-            vec.set(3, 0.1);
-            vec.set(4, -0.1);
-            err.set(0,0, 0.1);
-            err.set(1,1, 0.1);
-            err.set(2,2, 0.1);
-            err.set(3,3, 0.1);
-            err.set(4,4, 0.1);
-            tre0.setVector(vec);
-            tre0.setError(err);
-            tre0.setBackward();
-            
-            ETrack tre1 = new ETrack(tre0);
-            ETrack tre2 = new ETrack(tre0);
-            PropStat pstat2=p1.errDirProp(tre1,xy1,PropDir.BACKWARD);
-            Assert.assertTrue(pstat2.success());
-            pstat2=p2.errDirProp(tre2,xy1,PropDir.BACKWARD);
-            Assert.assertTrue(pstat2.success());
-            
-            if(debug) System.out.println("tre1= \n"+tre1+'\n'+"tre2= \n"+tre2+'\n');
-            if(debug) System.out.println("===========================================\n");
-            
-            
-            
-            
-            
-            
-            //********************************************************************
-            
-            if(debug) System.out.println( ok_prefix
-                    + "------------- All tests passed. -------------" );
-        }
-    }
-    
-    static void  check_zero_propagation(  VTrack trv0,  VTrack trv,  PropStat  pstat)
-    {
-        
-        SpacePoint sp = trv.spacePoint();
-        SpacePoint sp0 = trv0.spacePoint();
-        
-        SpacePath sv = trv.spacePath();
-        SpacePath sv0 = trv0.spacePath();
-        
-        Assert.assertTrue( Math.abs(sv0.dx() - sv.dx())<1e-7 );
-        Assert.assertTrue( Math.abs(sv0.dy() - sv.dy())<1e-7 );
-        Assert.assertTrue( Math.abs(sv0.dz() - sv.dz())<1e-7 );
-        
-        double x0 = sp0.x();
-        double y0 = sp0.y();
-        double z0 = sp0.z();
-        double x1 = sp.x();
-        double y1 = sp.y();
-        double z1 = sp.z();
-        
-        double dx = sv.dx();
-        double dy = sv.dy();
-        double dz = sv.dz();
-        
-        double prod = dx*(x1-x0)+dy*(y1-y0)+dz*(z1-z0);
-        double moda = Math.sqrt((x1-x0)*(x1-x0)+(y1-y0)*(y1-y0) + (z1-z0)*(z1-z0));
-        double modb = Math.sqrt(dx*dx+dy*dy+dz*dz);
-        double st = pstat.pathDistance();
-        Assert.assertTrue( Math.abs(prod-st) < 1.e-7 );
-        Assert.assertTrue( Math.abs(Math.abs(prod) - moda*modb) < 1.e-7 );
-    }
-    
-    static void check_derivatives(  Propagator prop,  VTrack trv0,  Surface srf)
-    {
-        for(int i=0;i<4;++i)
-            for(int j=0;j<4;++j)
-                check_derivative(prop,trv0,srf,i,j);
-    }
-    
-    static void check_derivative(  Propagator  prop,  VTrack  trv0,  Surface  srf,int i,int j)
-    {
-        
-        double dx = 1.e-3;
-        VTrack trv = new VTrack(trv0);
-        TrackVector vec = trv.vector();
-        boolean forward = trv0.isForward();
-        
-        VTrack trv_0 = new VTrack(trv0);
-        TrackDerivative der = new TrackDerivative();
-        PropStat pstat = prop.vecProp(trv_0,srf,der);
-        Assert.assertTrue(pstat.success());
-        
-        TrackVector tmp= new TrackVector(vec);
-        tmp.set(j, tmp.get(j)+dx);
-        trv.setVector(tmp);
-        if(forward) trv.setForward();
-        else trv.setBackward();
-        
-        VTrack trv_pl = new VTrack(trv);
-        pstat = prop.vecProp(trv_pl,srf);
-        Assert.assertTrue(pstat.success());
-        
-        TrackVector vecpl = trv_pl.vector();
-        
-        tmp= new TrackVector(vec);
-        tmp.set(j,tmp.get(j)-dx);
-        trv.setVector(tmp);
-        if(forward) trv.setForward();
-        else trv.setBackward();
-        
-        VTrack trv_mn = new VTrack(trv);
-        pstat = prop.vecProp(trv_mn,srf);
-        Assert.assertTrue(pstat.success());
-        
-        TrackVector vecmn = trv_mn.vector();
-        
-        double dy = (vecpl.get(i)-vecmn.get(i))/2.;
-        
-        double dydx = dy/dx;
-        
-        double didj = der.get(i,j);
-        
-        if( Math.abs(didj) > 1e-10 )
-            Assert.assertTrue( Math.abs((dydx - didj)/didj) < 1e-4 );
-        else
-            Assert.assertTrue( Math.abs(dydx) < 1e-4 );
-    }
-    //**********************************************************************
-    //Checker of correct z propagation
-    
-    static double check_dz(VTrack trv1, VTrack trv2)
-    {
-        double z1    = trv1.vector().get(SurfXYPlane.IZ);
-        double z2    = trv2.vector().get(SurfXYPlane.IZ);
-        double dzdu  = trv1.vector().get(SurfXYPlane.IDZDU);
-        int sign_du = (trv1.isForward())?1:-1;
-        return (z2-z1)*dzdu*sign_du;
-    }
-}

java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham
SingleSensorHelicalTrackHitDriver.java removed after 382
--- java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/SingleSensorHelicalTrackHitDriver.java	2014-03-26 05:43:58 UTC (rev 382)
+++ java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/SingleSensorHelicalTrackHitDriver.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,384 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.lcsim.hps.users.mgraham;
-
-import hep.physics.vec.Hep3Vector;
-import hep.physics.vec.VecOp;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.hps.recon.tracking.HPSTransformations;
-import org.lcsim.detector.IDetectorElement;
-import org.lcsim.detector.ITransform3D;
-import org.lcsim.detector.tracker.silicon.SiTrackerModule;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.LCRelation;
-import org.lcsim.event.MCParticle;
-import org.lcsim.event.RawTrackerHit;
-import org.lcsim.event.base.MyLCRelation;
-import org.lcsim.fit.helicaltrack.HelicalTrackCross;
-import org.lcsim.fit.helicaltrack.HelicalTrackHit;
-import org.lcsim.fit.helicaltrack.HelicalTrackStrip;
-import org.lcsim.geometry.Detector;
-import org.lcsim.geometry.subdetector.BarrelEndcapFlag;
-import org.lcsim.recon.tracking.digitization.sisim.SiTrackerHit;
-import org.lcsim.recon.tracking.digitization.sisim.SiTrackerHitStrip1D;
-import org.lcsim.recon.tracking.digitization.sisim.TrackerHitType;
-
-/**
- *
- * @author phansson, mgraham
- */
-public class SingleSensorHelicalTrackHitDriver extends org.lcsim.fit.helicaltrack.HelicalTrackHitDriver {
-    private boolean _debug = false;
-    private String subdetectorName = "Tracker";
-    private Map<String,String> _stereomap = new HashMap<String,String>();
-    private List<String> _colnames = new ArrayList<String>();
-    private boolean _doTransformToTracking = true;
-    public enum LayerGeometryType { 
-        /*
-         * Each Layer in the geometry is a separate sensor
-         */
-        Split, 
-        /*
-         * Each layer in the geometry comprises top and bottom sensor
-         */
-        Common
-    }
-    private LayerGeometryType _layerGeometryType;
-
-    public SingleSensorHelicalTrackHitDriver() {
-        this.setLayerGeometryType("Common");
-        this.addCollection("StripClusterer_SiTrackerHitStrip1D");
-    }
-    public void setLayerGeometryType(String geomType) {
-        this._layerGeometryType = LayerGeometryType.valueOf(geomType);
-    }
-    
-    public void setSubdetectorName(String subdetectorName) {
-        this.subdetectorName = subdetectorName;
-    }
-    
-    public void setDebug(boolean debug) {
-        this._debug = debug;
-    }
-    
-    public void setTransformToTracking(boolean trans) {
-        this._doTransformToTracking = trans;
-    }
-    
-    public void setStripHitsCollectionName(String stripHitsCollectionName) {
-        HitRelationName(stripHitsCollectionName);
-    }
-
-    public void setHelicalTrackHitRelationsCollectionName(String helicalTrackHitRelationsCollectionName) {
-        HitRelationName(helicalTrackHitRelationsCollectionName);
-    }
-
-    public void setHelicalTrackMCRelationsCollectionName(String helicalTrackMCRelationsCollectionName) {
-        MCRelationName(helicalTrackMCRelationsCollectionName);
-    }
-
-    public void setOutputHitCollectionName(String outputHitCollectionName) {
-        OutputCollection(outputHitCollectionName);
-    }
-   
-    
-    @Override
-    public void process(EventHeader event) {
-        //super.process(event);
-
-        //  Initialize the list of HelicalTrackHits
-        List<HelicalTrackCross> stereoCrosses = new ArrayList<HelicalTrackCross>();
-        List<HelicalTrackHit> helhits = new ArrayList<HelicalTrackHit>();
-        
-        //  Create a List of LCRelations to relate HelicalTrackHits to the original hits
-        List<LCRelation> hitrelations = new ArrayList<LCRelation>();
-        //  Create a List of LCRelations to relate HelicalTrackHits to the MC particle
-        List<LCRelation> mcrelations = new ArrayList<LCRelation>();
-
-        
-        
-        for(String _colname : this._colnames) {
-            
-            if (!event.hasCollection(SiTrackerHit.class, _colname)) {
-                continue;
-            }
-
-            //  Get the list of SiTrackerHits for this collection
-            List<SiTrackerHit> hitlist = (List<SiTrackerHit>) event.get(_colname);
-            if (_debug) System.out.printf("%s: found %d SiTrackerHits = ",this.getClass().getSimpleName(),hitlist.size());
-            
-            //  Create collections for strip hits by layer and hit cross references
-            Map<String, List<HelicalTrackStrip>> striplistmap = new HashMap<String, List<HelicalTrackStrip>>();
-            Map<HelicalTrackStrip, SiTrackerHitStrip1D> stripmap = new HashMap<HelicalTrackStrip, SiTrackerHitStrip1D>();
-            
-            for(SiTrackerHit hit : hitlist) {
-                
-                if( hit instanceof SiTrackerHitStrip1D) {
-                    
-                    //  Cast the hit as a 1D strip hit and find the identifier for the detector/layer combo
-                    SiTrackerHitStrip1D h = (SiTrackerHitStrip1D) hit;
-                    IDetectorElement de = h.getSensor();
-                    String id = this.makeID(_ID.getName(de), _ID.getLayer(de));
-
-                    //  This hit should be a on a stereo pair!
-                    if (!_stereomap.containsKey(id) &&! _stereomap.containsValue(id)) {
-                        throw new RuntimeException(this.getClass().getSimpleName() + ": this " + id + " was not among the stereo modules!");
-                    }
-                    
-                    //  Create a HelicalTrackStrip for this hit
-                    HelicalTrackStrip strip = makeDigiStrip(h);
-
-                    //  Get the list of strips for this layer - create a new list if one doesn't already exist
-                    List<HelicalTrackStrip> lyrhits = striplistmap.get(id);
-                    if (lyrhits == null) {
-                        lyrhits = new ArrayList<HelicalTrackStrip>();
-                        striplistmap.put(id, lyrhits);
-                    }
-
-                    //  Add the strip to the list of strips on this sensor
-                    lyrhits.add(strip);
-
-                    //  Map a reference back to the hit needed to create the stereo hit LC relations
-                    stripmap.put(strip, h);
-
-                    if(_debug) System.out.printf("%s: added strip (org=%s,umeas=%.3f) at layer %d ",this.getClass().getSimpleName(),strip.origin().toString(),strip.umeas(),strip.layer());
-                    
-                } else {
-
-                    //  If not a 1D strip hit, make a pixel hit
-                    HelicalTrackHit hit3d = this.makeDigi3DHit(hit);
-                    helhits.add(hit3d);
-                    hitrelations.add(new MyLCRelation(hit3d, hit));
-                }
-                
-            } // Loop over SiTrackerHits
-            
-            
-            //  Create a list of stereo hits
-            //List<HelicalTrackCross> stereohits = new ArrayList<HelicalTrackCross>();
-            
-            if (_debug) System.out.println(this.getClass().getSimpleName() + ": Create stereo hits from " + striplistmap.size() + " strips (map size)");
-                        
-            //  Loop over the stereo layer pairs
-            for (String id1 : _stereomap.keySet()) {
-
-                //  Get the second layer
-                String id2 = _stereomap.get(id1);
-
-                if (_debug) {
-                    if (striplistmap.get(id1) != null && striplistmap.get(id2) != null) {
-                        System.out.println(this.getClass().getSimpleName() + ": Form stereo hits from " + id1 + " and " + id2);
-                        //for(HelicalTrackStrip strip: striplistmap.get(id1)) System.out.printf("%s: stripid1 at origin %s\n",this.getClass().getSimpleName(),strip.origin().toString());
-                        //for(HelicalTrackStrip strip: striplistmap.get(id2)) System.out.printf("%s: stripid2 at origin %s\n",this.getClass().getSimpleName(),strip.origin().toString());
-                    }
-                }
-                
-                /*
-                 * Form the stereo hits and add them to our hit list
-                 * Add LC relations for stereo hit to SiTrackHitStrip1D object 
-                 * Add LC relation between MC particle and stereo hit
-                 */
-                
-                List<HelicalTrackCross> cross_list =  _crosser.MakeHits(striplistmap.get(id1), striplistmap.get(id2));
-                
-                for(HelicalTrackCross cross : cross_list) {
-                    stereoCrosses.add(cross);
-                    if(cross.getMCParticles()!=null) {
-                        for(MCParticle mcp : cross.getMCParticles()) {
-                            mcrelations.add(new MyLCRelation((HelicalTrackHit)cross,mcp));
-                        }
-                    }
-                    for(HelicalTrackStrip strip : cross.getStrips()) {
-                        hitrelations.add(new MyLCRelation(cross,stripmap.get(strip)));
-                    }
-                    
-                }
-                
-            } // Loop over stereo pairs
-
-            if (_debug) {
-                System.out.printf("%s: added %d stereo hits from %s collection ",this.getClass().getSimpleName(),stereoCrosses.size(),_colname);
-            }
-            
-            
-        } // Loop over collection names
-        
-        
-        
-        // Add things to the event
-        // Cast crosses to HTH
-        helhits.addAll(stereoCrosses);
-        event.put(_outname, helhits, HelicalTrackHit.class, 0);
-        event.put(_hitrelname,hitrelations,LCRelation.class,0);
-        event.put(_mcrelname,mcrelations,LCRelation.class,0);       
-        if(_doTransformToTracking) addRotatedHitsToEvent(event, stereoCrosses);
-        
-        
-        
-    } //Process()
-    
-
-    public void addCollection(String colname) {
-        _colnames.add(colname);
-    }
-    public void setCollection(String colname) {
-        _colnames.clear();
-        this.addCollection(colname);
-    }
-    private String makeID(String detname, int lyr) {
-        return detname + lyr;
-    }
-    
-    public void setStereoPair(String detname, int lyr1, int lyr2) {
-        this._stereomap.put(this.makeID(detname, lyr1), this.makeID(detname, lyr2));
-    }
-    
-    @Override
-    protected void detectorChanged(Detector detector) {
-        /*
-         * Setup default pairing
-         */
-        if (_debug) System.out.printf("%s: Setup stereo hit pair modules ",this.getClass().getSimpleName());
-        
-        List<SiTrackerModule> modules = detector.getSubdetector(this.subdetectorName).getDetectorElement().findDescendants(SiTrackerModule.class);
-        if (modules.isEmpty()) {
-            throw new RuntimeException(this.getClass().getName() + ": No SiTrackerModules found in detector.");
-        }
-        int nLayersTotal = detector.getSubdetector(subdetectorName).getLayering().getLayers().getNumberOfLayers();
-        if (_debug) System.out.printf("%s: %d layers ",this.getClass().getSimpleName(),nLayersTotal);
-        if (nLayersTotal % 2 != 0) {
-            throw new RuntimeException(this.getClass().getName() + ": Don't know how to do stereo pairing for odd number of modules.");
-        }
-        if(this._layerGeometryType==LayerGeometryType.Split) {
-            int nLayers = nLayersTotal/2;
-            for(int i=1;i<=nLayers;++i) {
-                int ly1 = i;
-                int ly2 = i+10;
-                if (_debug) System.out.printf("%s: adding stereo pair from layer %d and %d ",this.getClass().getSimpleName(),ly1,ly2);
-                this.setStereoPair(subdetectorName, ly1, ly2);
-            }            
-        } else if(this._layerGeometryType==LayerGeometryType.Common) {
-            List<int[]> pairs = new ArrayList<int[]>();
-            for (int i = 1; i <= (nLayersTotal) - 1; i += 2) {
-                int[] pair = {i, i + 1};
-                if (_debug)
-                    System.out.println("Adding stereo pair: " + pair[0] + ", " + pair[1]);
-                pairs.add(pair);
-            }
-            for (int[] pair : pairs) {
-                if (_debug) System.out.printf("%s: adding stereo pair from layer %d and %d ",this.getClass().getSimpleName(),pair[0],pair[1]);
-                setStereoPair(subdetectorName, pair[0], pair[1]);
-            }
-        } else {
-            throw new RuntimeException(this.getClass().getSimpleName() + ": this layer geometry is not implemented!");
-        }
-
-        if (_debug) System.out.printf("%s: %d stereo modules added",this.getClass().getSimpleName(),this._stereomap.size());
-        
-    }
-    
-     private HelicalTrackStrip makeDigiStrip(SiTrackerHitStrip1D h) {
-        
-        if(_debug) System.out.println(this.getClass().getSimpleName() + ": makeDigiStrip--");
-        
-        SiTrackerHitStrip1D local = h.getTransformedHit(TrackerHitType.CoordinateSystem.SENSOR);
-        SiTrackerHitStrip1D global = h.getTransformedHit(TrackerHitType.CoordinateSystem.GLOBAL);
-    
-        ITransform3D trans = local.getLocalToGlobal();
-        Hep3Vector org = trans.transformed(_orgloc);
-        Hep3Vector u = global.getMeasuredCoordinate();
-        Hep3Vector v = global.getUnmeasuredCoordinate();
-         
-       
-        
-        double umeas = local.getPosition()[0];
-        double vmin = VecOp.dot(local.getUnmeasuredCoordinate(), local.getHitSegment().getStartPoint());
-        double vmax = VecOp.dot(local.getUnmeasuredCoordinate(), local.getHitSegment().getEndPoint());
-        double du = Math.sqrt(local.getCovarianceAsMatrix().diagonal(0));
-
-       
-        
-        IDetectorElement de = h.getSensor();
-        String det = _ID.getName(de);
-        int lyr = _ID.getLayer(de);
-        BarrelEndcapFlag be = _ID.getBarrelEndcapFlag(de);
-
-        double dEdx = h.getdEdx();
-        double time = h.getTime();
-        List<RawTrackerHit> rawhits = h.getRawHits();
-        HelicalTrackStrip strip = new HelicalTrackStrip(org, u, v, umeas, du,
-                vmin, vmax, dEdx, time, rawhits, det, lyr, be);
-
-        try {
-            if (h.getMCParticles() != null) {
-                for (MCParticle p : h.getMCParticles()) {
-                    strip.addMCParticle(p);
-                }
-            }
-        } catch (RuntimeException e) {
-            // Okay when MC info not present.
-        }
-       
-        if(_debug) {
-            System.out.println(this.getClass().getSimpleName() + ": produced HelicalTrackStrip with origin " + strip.origin().toString());
-        }
-
-        return strip;
-    }
-
-     private void addRotatedHitsToEvent(EventHeader event, List<HelicalTrackCross> stereohits) {
-
-        List<HelicalTrackHit> rotatedhits = new ArrayList<HelicalTrackHit>();
-        List<LCRelation> hthrelations = new ArrayList<LCRelation>();
-        List<LCRelation> mcrelations = new ArrayList<LCRelation>();
-        for (HelicalTrackCross cross : stereohits) {
-            List<HelicalTrackStrip> rotatedstriphits = new ArrayList<HelicalTrackStrip>();
-            for (HelicalTrackStrip strip : cross.getStrips()) {
-
-                Hep3Vector origin = strip.origin();
-                Hep3Vector u = strip.u();
-                Hep3Vector v = strip.v();
-                double umeas = strip.umeas();
-                double du = strip.du();
-                double vmin = strip.vmin();
-                double vmax = strip.vmax();
-                double dedx = strip.dEdx();
-                double time = strip.time();
-                List<RawTrackerHit> rthList = strip.rawhits();
-                String detname = strip.detector();
-                int layer = strip.layer();
-                BarrelEndcapFlag bec = strip.BarrelEndcapFlag();
-                Hep3Vector neworigin = HPSTransformations.transformVectorToTracking(origin);
-                Hep3Vector newu = HPSTransformations.transformVectorToTracking(u);
-                Hep3Vector newv = HPSTransformations.transformVectorToTracking(v);
-                HelicalTrackStrip newstrip = new HelicalTrackStrip(neworigin, newu, newv, umeas, du, vmin, vmax, dedx, time, rthList, detname, layer, bec);
-                for (MCParticle p : strip.MCParticles()) {
-                    newstrip.addMCParticle(p);
-                }
-                rotatedstriphits.add(newstrip);
-            }
-            HelicalTrackCross newhit = new HelicalTrackCross(rotatedstriphits.get(0), rotatedstriphits.get(1));
-            rotatedhits.add(newhit);
-            hthrelations.add(new MyLCRelation(cross, newhit));
-            for (MCParticle mcp : newhit.getMCParticles()) {
-                mcrelations.add(new MyLCRelation(newhit, mcp));
-            }
-        }
-        
-        event.put("Rotated"+_outname, rotatedhits, HelicalTrackHit.class, 0);
-        event.put("Rotated"+_hitrelname, hthrelations, LCRelation.class, 0);
-        event.put("Rotated"+_mcrelname, mcrelations, LCRelation.class, 0);
-        
-        
-        //  Create the LCRelations between HelicalTrackHits and MC particles
-
-    }
-    
-}

java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham
SingleSensorTrackerReconDriver.java removed after 382
--- java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/SingleSensorTrackerReconDriver.java	2014-03-26 05:43:58 UTC (rev 382)
+++ java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/SingleSensorTrackerReconDriver.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,173 +0,0 @@
-package org.lcsim.hps.users.mgraham;
-
-import hep.physics.vec.BasicHep3Vector;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.hps.recon.tracking.HPSTransformations;
-import org.hps.recon.tracking.SeedTracker;
-import org.hps.recon.tracking.TrackerDigiDriver;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.Track;
-import org.lcsim.fit.helicaltrack.HelicalTrackHit;
-import org.lcsim.geometry.Detector;
-import org.lcsim.recon.tracking.digitization.sisim.config.ReadoutCleanupDriver;
-import org.lcsim.recon.tracking.seedtracker.SeedStrategy;
-import org.lcsim.recon.tracking.seedtracker.StrategyXMLUtils;
-import org.lcsim.recon.tracking.seedtracker.diagnostic.SeedTrackerDiagnostics;
-import org.lcsim.util.Driver;
-
-/**
- * This class runs the Track Reconstruction for the HPS Test Proposal detector.
- * The tracker digitization must be run in front of it. It is intended to work
- * with the {@link TrackerDigiDriver} digitization Driver.
- *
- * @author jeremym
- * @version $Id: TrackerReconDriver.java,v 1.18 2012/05/03 20:50:29 mgraham Exp
- * $
- */
-public final class SingleSensorTrackerReconDriver extends Driver {
-
-    // Debug flag.
-    private boolean debug = false;
-    // Tracks found across all events.
-    int ntracks = 0;
-    // Number of events processed.
-    int nevents = 0;
-    // Cache detector object.
-    Detector detector = null;
-    // Default B-field value.
-    private double bfield = 0.5;
-    // TrackerHit readout name for readout cleanup.
-    private String trackerReadoutName = "TrackerHits";
-    // Tracking strategies resource path.
-    private String strategyResource = "HPS-Test-4pt1.xml";
-    // Output track collection.
-    private String trackCollectionName = "MatchedTracks";
-    // HelicalTrackHit input collection.
-    private String stInputCollectionName = "RotatedHelicalTrackHits";
-    // Include MS (done by removing XPlanes from the material manager results)
-    private boolean includeMS = true;
-    
-    public SingleSensorTrackerReconDriver() {
-    }
-
-    public void setDebug(boolean debug) {
-        this.debug = debug;
-    }
-
-    /**
-     * Set the tracking strategy resource.
-     *
-     * @param strategyResource The absolute path to the strategy resource in the
-     * hps-java jar.
-     */
-    public void setStrategyResource(String strategyResource) {
-        this.strategyResource = strategyResource;
-    }
-
-    public void setInputHitCollectionName(String inputHitCollectionName) {
-        this.stInputCollectionName = inputHitCollectionName;
-    }
-
-    public void setTrackCollectionName(String trackCollectionName) {
-        this.trackCollectionName = trackCollectionName;
-    }
-
-    public void setIncludeMS(boolean incMS) {
-        this.includeMS = incMS;
-    }
-   
-    /**
-     * This is used to setup the Drivers after XML config.
-     */
-    @Override
-    public void detectorChanged(Detector detector) {
-        // Cache Detector object.
-        this.detector = detector;
-
-        // Get B-field Y with no sign. Seed Tracker doesn't like signed B-field components.
-        // FIXME Is this always right?
-        this.bfield = Math.abs((detector.getFieldMap().getField(new BasicHep3Vector(0, 0, 0)).y()));
-        if (debug) {
-            System.out.printf("%s: Set B-field to %.3f",this.getClass().getSimpleName(),this.bfield);
-        }
-
-        initialize();
-
-        super.detectorChanged(detector);
-    }
-
-    /**
-     * Setup all the child Drivers necessary for track reconstruction.
-     */
-    private void initialize() {
-
-        //
-        // 1) Driver to run Seed Tracker.
-        //
-
-        if (!strategyResource.startsWith("/")) {
-            strategyResource = "/org/lcsim/hps/recon/tracking/strategies/" + strategyResource;
-        }
-        List<SeedStrategy> sFinallist = StrategyXMLUtils.getStrategyListFromInputStream(this.getClass().getResourceAsStream(strategyResource));
-        SeedTracker stFinal = new SeedTracker(sFinallist,this.includeMS);
-        stFinal.setMaterialManagerTransform(HPSTransformations.getTransform());
-        stFinal.setInputCollectionName(stInputCollectionName);
-        stFinal.setTrkCollectionName(trackCollectionName);
-        stFinal.setBField(bfield);
-        stFinal.setDiagnostics(new SeedTrackerDiagnostics());
-//        stFinal.setSectorParams(false); //this doesn't actually seem to do anything
-        stFinal.setSectorParams(1, 10000);
-        add(stFinal);
-
-        //
-        // 2) Cleanup the readouts for next event.
-        //
-        add(new ReadoutCleanupDriver(Arrays.asList(this.trackerReadoutName)));
-    }
-
-    /**
-     * This method is used to run the reconstruction and print debug
-     * information.
-     */
-    @Override
-    public void process(EventHeader event) {
-        // This call runs the track reconstruction using the sub-Drivers.
-        super.process(event);
-
-        // Debug printouts.
-        if (debug) {
-            if(event.hasCollection(HelicalTrackHit.class,stInputCollectionName)) {
-                System.out.println(this.getClass().getSimpleName() + ": The HelicalTrackHit collection " + stInputCollectionName + " has " + event.get(HelicalTrackHit.class, stInputCollectionName).size() + " hits.");
-            } else {
-                System.out.println(this.getClass().getSimpleName() + ": No HelicalTrackHit collection for this event");
-            }
-            // Check for Tracks.
-            List<Track> tracks = event.get(Track.class, trackCollectionName);
-            System.out.println(this.getClass().getSimpleName() + ": The Track collection " + trackCollectionName + " has " + tracks.size() + " tracks.");
-
-            // Print out track info.
-            for (Track track : tracks) {
-                System.out.println(this.getClass().getSimpleName() + ": " + track.toString());
-                System.out.println(this.getClass().getSimpleName() + ": number of layers = " + track.getTrackerHits().size());
-                System.out.println(this.getClass().getSimpleName() + ": chi2 = " + track.getChi2());
-            }
-        }
-
-        // Increment number of events.
-        ++nevents;
-
-        // Add to tracks found.
-        ntracks += event.get(Track.class, trackCollectionName).size();
-    }
-
-    @Override
-    public void endOfData() {
-        if (debug) {
-            System.out.println("-------------------------------------------");
-            System.out.println(this.getName() + " found " + ntracks + " tracks in " + nevents + " events which is " + ((double) ntracks / (double) nevents) + " tracks per event.");
-        }
-    }
-}
\ No newline at end of file

java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham
TestAnalysisDriver.java removed after 382
--- java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/TestAnalysisDriver.java	2014-03-26 05:43:58 UTC (rev 382)
+++ java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/TestAnalysisDriver.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,135 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.lcsim.hps.users.mgraham;
-
-import hep.aida.IAnalysisFactory;
-import hep.aida.IProfile1D;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.hps.recon.tracking.HPSFittedRawTrackerHit;
-import org.hps.recon.tracking.TrackAnalysis;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.RawTrackerHit;
-import org.lcsim.event.RelationalTable;
-import org.lcsim.event.Track;
-import org.lcsim.event.base.BaseRelationalTable;
-import org.lcsim.recon.tracking.digitization.sisim.SiTrackerHitStrip1D;
-import org.lcsim.util.Driver;
-import org.lcsim.util.aida.AIDA;
-
-/**
- *
- * @author mgraham
- */
-public class TestAnalysisDriver extends Driver {
-
-    int nevents = 0;
-    int naccepted = 0;
-    private AIDA aida = AIDA.defaultInstance();
-    private IAnalysisFactory af = aida.analysisFactory();
-    public String outputPlots = "myplots.aida";
-    Map<String, IProfile1D> clsizeMap = new HashMap<String, IProfile1D>();
-    String[] detNames = {"Tracker"};
-    Integer[] nlayers = {10};
-
-    public void process(
-            EventHeader event) {
-        nevents++;
-
-        List<RawTrackerHit> rawHits = event.get(RawTrackerHit.class, "SVTRawTrackerHits");
-        List<HPSFittedRawTrackerHit> fittedrawHits = event.get(HPSFittedRawTrackerHit.class, "SVTFittedRawTrackerHits");
-
-        List<SiTrackerHitStrip1D> stripHits = event.get(SiTrackerHitStrip1D.class, "StripClusterer_SiTrackerHitStrip1D");
-    
-       
-       
-Map<Track, TrackAnalysis> tkanalMap = new HashMap<Track, TrackAnalysis>();
-        RelationalTable nearestHitToTrack = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
-        Map<Track, Double> l1Isolation = new HashMap<Track, Double>();
-        Map<Track, Double> l1DeltaZ = new HashMap<Track, Double>();
-        
-        String fittedHitsDir = "FittedHits/";
-        for(HPSFittedRawTrackerHit hrth:fittedrawHits){
-            double fittedAmp=hrth.getAmp();
-            double fittedT0=hrth.getT0();
-            String sensorName=hrth.getRawTrackerHit().getDetectorElement().getName();
-            aida.cloud1D(fittedHitsDir + sensorName+" fitted Amplitude").fill(fittedAmp);
-            aida.cloud1D(fittedHitsDir + sensorName+"fitted T0").fill(fittedT0);
-        }
-        
-        
-        /*
-         List<Track> tracklist = event.get(Track.class, "MatchedTracks");
-        List<HelicalTrackHit> hthits = event.get(HelicalTrackHit.class, "HelicalTrackHits");
-        aida.cloud1D("HelicalTrackHits per Event").fill(hthits.size());
-        aida.cloud1D("Matched Tracks per Event").fill(tracklist.size());
-        String trackdir = "TrackInfo/";
-        //  Analyze the tracks in the event
-        for (Track track : tracklist) {
-            //  Calculate the track pT and cos(theta)
-            double d0 = track.getTrackParameter(HelicalTrackFit.dcaIndex);
-            double z0 = track.getTrackParameter(HelicalTrackFit.z0Index);
-            double phi0 = track.getTrackParameter(HelicalTrackFit.phi0Index);
-            double slope = track.getTrackParameter(HelicalTrackFit.slopeIndex);
-            double curve = track.getTrackParameter(HelicalTrackFit.curvatureIndex);
-            double d0Err = Math.sqrt(track.getErrorMatrix().e(HelicalTrackFit.dcaIndex, HelicalTrackFit.dcaIndex));
-            double z0Err = Math.sqrt(track.getErrorMatrix().e(HelicalTrackFit.z0Index, HelicalTrackFit.z0Index));
-            double phi0Err = Math.sqrt(track.getErrorMatrix().e(HelicalTrackFit.phi0Index, HelicalTrackFit.phi0Index));
-            double slopeErr = Math.sqrt(track.getErrorMatrix().e(HelicalTrackFit.slopeIndex, HelicalTrackFit.slopeIndex));
-            double curveErr = Math.sqrt(track.getErrorMatrix().e(HelicalTrackFit.curvatureIndex, HelicalTrackFit.curvatureIndex));
-             SeedTrack stEle = (SeedTrack) track;
-            SeedCandidate seedEle = stEle.getSeedCandidate();
-            HelicalTrackFit ht = seedEle.getHelix();
-            
-            double xoca = ht.x0();
-            double yoca = ht.y0();
-            double[] poca = {xoca, yoca, z0};
-            double mom[] = track.getMomentum();
-            double px = mom[0];
-            double py = mom[1];
-            double pz = mom[2];
-            double pperp = Math.sqrt(py * py + pz * pz);
-            double pt = Math.sqrt(px * px + py * py);
-            double p = Math.sqrt(pt * pt + pz * pz);
-            double phi = Math.atan2(py, px);
-            double cth = pz / Math.sqrt(pt * pt + pz * pz);
-            double sth = pt / Math.sqrt(pt * pt + pz * pz);
-            double th = Math.atan2(pt, pz);
-             fillTrackInfo(trackdir, "all tracks", track.getChi2(), p, pperp, px, py, pz, phi, cth, d0, xoca, yoca, z0);
-        }        
-        */
-    }
-  private void fillTrackInfo(String dir, String species, double chi2,  double p, double pperp, double px, double py, double pz, double phi, double cth, double doca, double xoca, double yoca, double zoca) {
-        aida.cloud1D(dir + "total chi^2 for  " + species).fill(chi2);
-
-//                aida.cloud1D(trackdir + "circle chi^2 for  " + species).fill(ht.chisq()[0]);
-//                aida.cloud1D(trackdir + "linear chi^2 for  " + species).fill(ht.chisq()[1]       
-        aida.cloud1D(dir + "p for  " + species).fill(p);
-        aida.cloud1D(dir + "pperp for  " + species).fill(pperp);
-        aida.cloud1D(dir + "px for  " + species).fill(px);
-        aida.cloud1D(dir + "py for  " + species).fill(py);
-        aida.cloud1D(dir + "pz for  " + species).fill(pz);
-        aida.cloud1D(dir + "phi for  " + species).fill(phi);
-        aida.cloud1D(dir + "cos(theta) for  " + species).fill(cth);
-        aida.cloud1D(dir + "DOCA for  " + species).fill(doca);
-        aida.cloud1D(dir + "XOCA for  " + species).fill(xoca);
-        aida.cloud1D(dir + "YOCA for  " + species).fill(yoca);
-        aida.cloud1D(dir + "ZOCA for  " + species).fill(zoca);
-        aida.cloud2D(dir + "doca vs xoca for  " + species).fill(xoca, doca);
-    }
-    public void endOfData() {
-   try {
-            aida.saveAs(outputPlots);
-        } catch (IOException ex) {
-            Logger.getLogger(DetailedAnalysisDriver.class.getName()).log(Level.SEVERE, null, ex);
-        }      
-    }
-}

java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham
TrackExtrapolationAnalysis.java removed after 382
--- java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/TrackExtrapolationAnalysis.java	2014-03-26 05:43:58 UTC (rev 382)
+++ java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/TrackExtrapolationAnalysis.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,475 +0,0 @@
-package org.lcsim.hps.users.mgraham;
-
-import hep.aida.IAnalysisFactory;
-import hep.aida.IHistogram1D;
-import hep.aida.IHistogram2D;
-import hep.aida.IPlotter;
-import hep.aida.IPlotterStyle;
-import hep.physics.vec.Hep3Vector;
-
-import java.util.List;
-import java.util.Map;
-
-import org.hps.conditions.deprecated.BeamlineConstants;
-import org.hps.recon.ecal.HPSEcalCluster;
-import org.hps.recon.tracking.HPSTrack;
-import org.hps.recon.tracking.HelixConverter;
-import org.hps.recon.tracking.StraightLineTrack;
-import org.hps.recon.tracking.TrackUtils;
-import org.hps.util.AIDAFrame;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.Track;
-import org.lcsim.fit.helicaltrack.HelicalTrackFit;
-import org.lcsim.geometry.Detector;
-import org.lcsim.recon.tracking.seedtracker.SeedCandidate;
-import org.lcsim.recon.tracking.seedtracker.SeedTrack;
-import org.lcsim.util.Driver;
-import org.lcsim.util.aida.AIDA;
-
-/**
-
- @author mgraham
- */
-public class TrackExtrapolationAnalysis extends Driver {
-
-    private AIDAFrame extrapFrame;
-    private AIDA aida = AIDA.defaultInstance();
-    private String rawTrackerHitCollectionName = "SVTRawTrackerHits";
-    private String fittedTrackerHitCollectionName = "SVTFittedRawTrackerHits";
-    private String trackerHitCollectionName = "StripClusterer_SiTrackerHitStrip1D";
-    private String helicalTrackHitCollectionName = "HelicalTrackHits";
-    private String rotatedTrackHitCollectionName = "RotatedHelicalTrackHits";
-    private String helicalTrackHitRelationsCollectionName = "HelicalTrackHitRelations";
-    private String trackCollectionName = "MatchedTracks";
-    String ecalSubdetectorName = "Ecal";
-    String ecalCollectionName = "EcalClusters";
-    private Detector detector = null;
-    IPlotter extrap0;
-    IPlotter extrap1;
-    IPlotter extrap2;
-    IPlotter extrap3;
-    IPlotter extrap4;
-    IPlotter extrap5;
-    IPlotter extrap6;
-    IPlotter extrap7;
-    IPlotter extrap8;
-    IPlotter extrap9;
-    IPlotter extrap10;
-    IPlotter extrap11;
-    IPlotter extrap12;
-    IPlotter extrap13;
-    IAnalysisFactory fac = aida.analysisFactory();
-
-    protected void detectorChanged(Detector detector) {
-        this.detector = detector;
-        aida.tree().cd("/");
-        extrapFrame = new AIDAFrame();
-        extrapFrame.setTitle("Extrapolation Debugging Plots");
-        makeExtrapolationPlots();
-
-        extrapFrame.pack();
-        extrapFrame.setVisible(true);
-
-    }
-
-    public TrackExtrapolationAnalysis() {
-    }
-
-    public void process(EventHeader event) {
-        aida.tree().cd("/");
-
-
-        List<Track> tracks = event.get(Track.class, trackCollectionName);
-        for (Track trk : tracks) {
-            double trackP = trk.getPX();
-            SeedTrack stEle = (SeedTrack) trk;
-            SeedCandidate seedEle = stEle.getSeedCandidate();
-            HelicalTrackFit ht = seedEle.getHelix();
-            HelixConverter converter = new HelixConverter(0);
-            StraightLineTrack slt = converter.Convert(ht);
-
-            Hep3Vector posAtEcal = TrackUtils.getTrackPositionAtEcal(trk);
-            Hep3Vector extendAtConverter = TrackUtils.extrapolateTrack(trk,BeamlineConstants.HARP_POSITION_TESTRUN);
-
-
-            int isTop = -1;
-            if (trk.getTrackerHits().get(0).getPosition()[2] > 0)
-                isTop = 0;//make plot look pretty
-            int charge = trk.getCharge();
-            if (charge > 0)
-                charge = 0;//make plot look pretty
-//            System.out.println("Charge = " + charge + "; isTop = " + isTop);
-
-            HPSTrack hpstrk=null;
-                hpstrk = new HPSTrack(ht);
-//            Hep3Vector posAtConv = hpstrk.getPositionAtZ(zAtConverter, -101, -100, 0.1);
-            Hep3Vector posAtConv = hpstrk.getPositionAtZMap(100,BeamlineConstants.HARP_POSITION_TESTRUN , 5.0)[0];
-            double useThisx=posAtConv.x();
-            double useThisy=posAtConv.y();
-            
-//             double useThisx=extendAtConverter.y();
-//            double useThisy=extendAtConverter.z();
-            
-            aida.histogram1D("New X (mm) @ Converter").fill(useThisx);  //this is in the JLAB frame already
-            aida.histogram1D("New Y (mm) @ Converter").fill(useThisy);
-            if (isTop == 0) {
-                aida.histogram1D("Top X (mm) @ Converter").fill(useThisx);  //this is in the JLAB frame already
-                aida.histogram1D("Top Y (mm) @ Converter").fill(useThisy);
-            } else {
-                aida.histogram1D("Bottom X (mm) @ Converter").fill(useThisx);  //this is in the JLAB frame already
-                aida.histogram1D("Bottom Y (mm) @ Converter").fill(useThisy);
-            }
-            if (charge < 0) {
-                aida.histogram1D("Negative X (mm) @ Converter").fill(useThisx);  //this is in the JLAB frame already
-                aida.histogram1D("Negative Y (mm) @ Converter").fill(useThisy);
-            }
-//            Hep3Vector posAtConvShort = hpstrk.getPositionAtZ(zAtConverter, -0.1, 0, 0.01);
-            Hep3Vector posAtConvShort = hpstrk.getPositionAtZMap(0,BeamlineConstants.HARP_POSITION_TESTRUN, 5.0)[0];
-            aida.histogram2D("Extrapolated X: short vs long fringe").fill(posAtConvShort.x(), posAtConv.x());
-            aida.histogram2D("Extrapolated Y: short vs long fringe").fill(posAtConvShort.y(), posAtConv.y());
-
-            aida.histogram2D("Extrapolated X: HPS vs SLT").fill(posAtConv.x(), slt.getYZAtX(BeamlineConstants.HARP_POSITION_TESTRUN)[0]);
-            aida.histogram2D("Extrapolated Y: HPS vs SLT").fill(posAtConv.y(), slt.getYZAtX(BeamlineConstants.HARP_POSITION_TESTRUN)[1]);
-
-            aida.histogram2D("Extrapolated X: Extend vs SLT").fill(extendAtConverter.y(), slt.getYZAtX(BeamlineConstants.HARP_POSITION_TESTRUN)[0]);
-            aida.histogram2D("Extrapolated Y: Extend vs SLT").fill(extendAtConverter.z(), slt.getYZAtX(BeamlineConstants.HARP_POSITION_TESTRUN)[1]);
-
-            List<HPSEcalCluster> clusters = event.get(HPSEcalCluster.class, ecalCollectionName);
-            HPSEcalCluster clust = findClosestCluster(posAtEcal, clusters);
-
-            if (clust != null) {
- //               System.out.println("Cluster Position = ("+clust.getPosition()[0]+","+clust.getPosition()[1]+","+clust.getPosition()[2]+")");
-                double minFringe=BeamlineConstants.DIPOLE_EDGE_TESTRUN-10;
-                double maxFringe=BeamlineConstants.DIPOLE_EDGE_TESTRUN+50;
-//                Hep3Vector posAtEcalHPS = hpstrk.getPositionAtZ(zCluster, minFringe,maxFringe, 0.1);
-//                Hep3Vector posAtEcalHPS = hpstrk.getPositionAtZMap(750,zCluster, 5.0);
-                double zCluster=clust.getPosition()[2];
- //               double zCluster=1450.0;
-                 Hep3Vector posAtEcalHPS = hpstrk.getPositionAtZMap(750,zCluster, 5.0)[0];
-                Hep3Vector posAtEcalExtend= TrackUtils.extrapolateTrack(trk,zCluster);
-                aida.histogram2D("ECal Extrapolation X :  HPS vs Extend").fill( posAtEcalExtend.y(),posAtEcalHPS.x()-posAtEcalExtend.y());
-                aida.histogram2D("ECal Extrapolation Y :  HPS vs Extend").fill( posAtEcalExtend.z(),posAtEcalHPS.y()-posAtEcalExtend.z());
-                double dX = posAtEcalHPS.x() - clust.getPosition()[0];
-                double dY = posAtEcalHPS.y() - clust.getPosition()[1];
-//                double dX = posAtEcalExtend.y() - clust.getPosition()[0];
-//                double dY = posAtEcalExtend.z() - clust.getPosition()[1];
-                
-                
-                aida.histogram2D("ECal Extrapolation HPS vs Cluster X").fill( clust.getPosition()[0],posAtEcalHPS.x() - clust.getPosition()[0]);
-                aida.histogram2D("ECal Extrapolation HPS vs Cluster Y").fill( clust.getPosition()[1],posAtEcalHPS.y() - clust.getPosition()[1]);
-
-                if (isTop == 0) {
-                    if (charge < 0) {
-                        aida.histogram1D("Track - Cluster X:  Top -ive").fill(dX);
-                        aida.histogram1D("Track - Cluster Y:  Top -ive").fill(dY);
-                    } else {
-                        aida.histogram1D("Track - Cluster X:  Top +ive").fill(dX);
-                        aida.histogram1D("Track - Cluster Y:  Top +ive").fill(dY);
-                    }
-                } else {
-                    if (charge < 0) {
-                        aida.histogram1D("Track - Cluster X:  Bottom -ive").fill(dX);
-                        aida.histogram1D("Track - Cluster Y:  Bottom -ive").fill(dY);
-                    } else {
-                        aida.histogram1D("Track - Cluster X:  Bottom +ive").fill(dX);
-                        aida.histogram1D("Track - Cluster Y:  Bottom +ive").fill(dY);
-                    }
-                }
-
-            }
-            double zmin = 0;
-            double zmax = 500.0;
-            int nstep = 100;
-            Map<Integer, Double[]> traj = hpstrk.trackTrajectory(zmin, zmax, nstep);
-            Map<Integer, Double[]> dir = hpstrk.trackDirection(zmin, zmax, nstep);
-            for (int i = 0; i < nstep; i++) {
-                Double[] xyz = traj.get(i);
-                Double[] dxdyz = dir.get(i);
-//                System.out.println("z = " + xyz[2]
-//                        + "  (x,y) = (" + xyz[0] + "," + xyz[1] + ")"
-//                        + "  (dx,dy) = (" + dxdyz[0] + "," + dxdyz[1] + ")");
-                if (i == 0) {
-                    aida.histogram2D("Track @ 0: X vs dX").fill(xyz[0], dxdyz[0]);
-                    aida.histogram2D("Track @ 0: Y vs dY").fill(xyz[1], dxdyz[1]);
-                    if (isTop == 0) {
-                        if (charge < 0) {
-                            aida.histogram2D("X vs dX:  Top -ive").fill(xyz[0], dxdyz[0]);
-                            aida.histogram2D("X vs P:  Top -ive").fill(xyz[0], trackP);
-                            aida.histogram2D("dX vs P:  Top -ive").fill(dxdyz[0], trackP);
-                        } else {
-                            aida.histogram2D("X vs dX:  Top +ive").fill(xyz[0], dxdyz[0]);
-                            aida.histogram2D("X vs P:  Top +ive").fill(xyz[0], trackP);
-                            aida.histogram2D("dX vs P:  Top +ive").fill(dxdyz[0], trackP);
-                        }
-                    } else {
-                        if (charge < 0) {
-                            aida.histogram2D("X vs dX:  Bottom -ive").fill(xyz[0], dxdyz[0]);
-                            aida.histogram2D("X vs P:  Bottom -ive").fill(xyz[0], trackP);
-                            aida.histogram2D("dX vs P:  Bottom -ive").fill(dxdyz[0], trackP);
-                        } else {
-                            aida.histogram2D("X vs dX:  Bottom +ive").fill(xyz[0], dxdyz[0]);
-                            aida.histogram2D("X vs P:  Bottom +ive").fill(xyz[0], trackP);
-                            aida.histogram2D("dX vs P:  Bottom +ive").fill(dxdyz[0], trackP);
-                        }
-                    }
-                }
-                aida.histogram2D("Track Trajectory:  Z vs X").fill(xyz[2], xyz[0]);
-                aida.histogram2D("Track Trajectory:  Z vs Y").fill(xyz[2], xyz[1]);
-                aida.histogram2D("Track Direction:  Z vs dX").fill(dxdyz[2], dxdyz[0]);
-                aida.histogram2D("Track Direction:  Z vs dY").fill(dxdyz[2], dxdyz[1]);
-            }
-
-        }
-
-    }
-
-    private void makeExtrapolationPlots() {
-
-        extrap0 = fac.createPlotterFactory().create("HPS Tracking Plots");
-        extrap0.setTitle("New Track extrapolation");
-        extrapFrame.addPlotter(extrap0);
-        IPlotterStyle style0 = extrap0.style();
-        style0.dataStyle().fillStyle().setColor("yellow");
-        style0.dataStyle().errorBarStyle().setVisible(false);
-        extrap0.createRegions(2, 4);
-        IHistogram1D xAtConverterNew = aida.histogram1D("New X (mm) @ Converter", 50, -20, 80);
-        IHistogram1D yAtConverterNew = aida.histogram1D("New Y (mm) @ Converter", 50, -20, 20);
-        IHistogram1D xAtCollNew = aida.histogram1D("Top X (mm) @ Converter", 50, -20, 80);
-        IHistogram1D yAtCollNew = aida.histogram1D("Top Y (mm) @ Converter", 50, -20, 20);
-        IHistogram1D xAtEcalNew = aida.histogram1D("Bottom X (mm) @ Converter", 50, -20, 80);
-        IHistogram1D yAtEcalNew = aida.histogram1D("Bottom Y (mm) @ Converter", 50, -20, 20);
-        IHistogram1D xAtEcal2New = aida.histogram1D("Negative X (mm) @ Converter", 50, -20, 80);
-        IHistogram1D yAtEcal2New = aida.histogram1D("Negative Y (mm) @ Converter", 50, -20, 20);
-
-        extrap0.region(0).plot(xAtConverterNew);
-        extrap0.region(4).plot(yAtConverterNew);
-        extrap0.region(1).plot(xAtCollNew);
-        extrap0.region(5).plot(yAtCollNew);
-        extrap0.region(2).plot(xAtEcalNew);
-        extrap0.region(6).plot(yAtEcalNew);
-        extrap0.region(3).plot(xAtEcal2New);
-        extrap0.region(7).plot(yAtEcal2New);
-
-        extrap1 = fac.createPlotterFactory().create("Extrapolation Debug Plots");
-        extrap1.setTitle("HPSTrack Plots");
-        extrapFrame.addPlotter(extrap1);
-        set2DStyle(extrap1.style());
-        extrap1.createRegions(1, 2);
-
-//        IHistogram2D quadrants = aida.histogram2D("Charge vs Slope", 2, -1, 1, 2, -1, 1);
-        IHistogram2D plot11 = aida.histogram2D("Extrapolated X: short vs long fringe", 50, -50, 50, 50, -50, 50);
-        IHistogram2D plot12 = aida.histogram2D("Extrapolated Y: short vs long fringe", 50, -20, 20, 50, -20, 20);
-        extrap1.region(0).plot(plot11);
-        extrap1.region(1).plot(plot12);
-
-
-        extrap2 = fac.createPlotterFactory().create("Extrapolation Debug Plots");
-        extrap2.setTitle("HPSTrack vs SLT Plots");
-        extrapFrame.addPlotter(extrap2);
-        set2DStyle(extrap2.style());
-        extrap2.createRegions(1, 2);
-
-//        IHistogram2D quadrants = aida.histogram2D("Charge vs Slope", 2, -1, 1, 2, -1, 1);
-        IHistogram2D plot21 = aida.histogram2D("Extrapolated X: HPS vs SLT", 50, -50, 50, 50, -50, 50);
-        IHistogram2D plot22 = aida.histogram2D("Extrapolated Y: HPS vs SLT", 50, -20, 20, 50, -20, 20);
-        extrap2.region(0).plot(plot21);
-        extrap2.region(1).plot(plot22);
-
-
-        extrap3 = fac.createPlotterFactory().create("Extrapolation Debug Plots");
-        extrap3.setTitle("Extend vs SLT Plots");
-        extrapFrame.addPlotter(extrap3);
-        set2DStyle(extrap3.style());
-        extrap3.createRegions(1, 2);
-
-        IHistogram2D plot31 = aida.histogram2D("Extrapolated X: Extend vs SLT", 50, -50, 50, 50, -50, 50);
-        IHistogram2D plot32 = aida.histogram2D("Extrapolated Y: Extend vs SLT", 50, -20, 20, 50, -20, 20);
-        extrap3.region(0).plot(plot31);
-        extrap3.region(1).plot(plot32);
-
-
-        extrap4 = fac.createPlotterFactory().create("Extrapolation Debug Plots");
-        extrap4.setTitle("Nominal Track Trajectory");
-        extrapFrame.addPlotter(extrap4);
-        set2DStyle(extrap4.style());
-        extrap4.createRegions(1, 2);
-
-        IHistogram2D plot41 = aida.histogram2D("Track Trajectory:  Z vs X", 100, 0, 500, 100, -100, 100);
-        IHistogram2D plot42 = aida.histogram2D("Track Trajectory:  Z vs Y", 100, 0, 500, 100, -75, 75);
-        extrap4.region(0).plot(plot41);
-        extrap4.region(1).plot(plot42);
-
-        extrap5 = fac.createPlotterFactory().create("Extrapolation Debug Plots");
-        extrap5.setTitle("Nominal Direction");
-        extrapFrame.addPlotter(extrap5);
-        set2DStyle(extrap5.style());
-        extrap5.createRegions(1, 2);
-
-        IHistogram2D plot51 = aida.histogram2D("Track Direction:  Z vs dX", 100, 0, 500, 100, -0.1, 0.1);
-        IHistogram2D plot52 = aida.histogram2D("Track Direction:  Z vs dY", 100, 0, 500, 100, -0.1, 0.1);
-        extrap5.region(0).plot(plot51);
-        extrap5.region(1).plot(plot52);
-
-
-
-        extrap7 = fac.createPlotterFactory().create("Extrapolation Debug Plots");
-        extrap7.setTitle("Track @ 0");
-        extrapFrame.addPlotter(extrap7);
-        set2DStyle(extrap7.style());
-
-        extrap7.createRegions(1, 2);
-
-        IHistogram2D plot71 = aida.histogram2D("Track @ 0: X vs dX", 50, -50, 50, 50, -0.04, 0.04);
-        IHistogram2D plot72 = aida.histogram2D("Track @ 0: Y vs dY", 50, -50, 50, 50, -0.04, 0.04);
-        extrap7.region(0).plot(plot71);
-        extrap7.region(1).plot(plot72);
-
-
-        extrap8 = fac.createPlotterFactory().create("Extrapolation Debug Plots");
-        extrap8.setTitle("Track X vs dX");
-        extrapFrame.addPlotter(extrap8);
-        set2DStyle(extrap8.style());
-
-        extrap8.createRegions(2, 2);
-
-        IHistogram2D plot81 = aida.histogram2D("X vs dX:  Top -ive", 50, -50, 50, 50, -0.04, 0.04);
-        IHistogram2D plot82 = aida.histogram2D("X vs dX:  Bottom -ive", 50, -50, 50, 50, -0.04, 0.04);
-        IHistogram2D plot83 = aida.histogram2D("X vs dX:  Top +ive", 50, -50, 50, 50, -0.04, 0.04);
-        IHistogram2D plot84 = aida.histogram2D("X vs dX:  Bottom +ive", 50, -50, 50, 50, -0.04, 0.04);
-        extrap8.region(0).plot(plot81);
-        extrap8.region(1).plot(plot82);
-        extrap8.region(2).plot(plot83);
-        extrap8.region(3).plot(plot84);
-
-        extrap9 = fac.createPlotterFactory().create("Extrapolation Debug Plots");
-        extrap9.setTitle("Track X vs P");
-        extrapFrame.addPlotter(extrap9);
-        set2DStyle(extrap9.style());
-
-        extrap9.createRegions(2, 2);
-
-        IHistogram2D plot91 = aida.histogram2D("X vs P:  Top -ive", 50, -50, 50, 50, 0.5, 2.0);
-        IHistogram2D plot92 = aida.histogram2D("X vs P:  Bottom -ive", 50, -50, 50, 50, 0.5, 2.0);
-        IHistogram2D plot93 = aida.histogram2D("X vs P:  Top +ive", 50, -50, 50, 50, 0.5, 2.0);
-        IHistogram2D plot94 = aida.histogram2D("X vs P:  Bottom +ive", 50, -50, 50, 50, 0.5, 2.0);
-        extrap9.region(0).plot(plot91);
-        extrap9.region(1).plot(plot92);
-        extrap9.region(2).plot(plot93);
-        extrap9.region(3).plot(plot94);
-
-        extrap10 = fac.createPlotterFactory().create("Extrapolation Debug Plots");
-        extrap10.setTitle("Track dX vs P");
-        extrapFrame.addPlotter(extrap10);
-        set2DStyle(extrap10.style());
-
-        extrap10.createRegions(2, 2);
-
-        IHistogram2D plot101 = aida.histogram2D("dX vs P:  Top -ive", 50, -0.04, 0.04, 50, 0.5, 2.0);
-        IHistogram2D plot102 = aida.histogram2D("dX vs P:  Bottom -ive", 50, -0.04, 0.04, 50, 0.5, 2.0);
-        IHistogram2D plot103 = aida.histogram2D("dX vs P:  Top +ive", 50, -0.04, 0.04, 50, 0.5, 2.0);
-        IHistogram2D plot104 = aida.histogram2D("dX vs P:  Bottom +ive", 50, -0.04, 0.04, 50, 0.5, 2.0);
-        extrap10.region(0).plot(plot101);
-        extrap10.region(1).plot(plot102);
-        extrap10.region(2).plot(plot103);
-        extrap10.region(3).plot(plot104);
-
-
-
-        extrap6 = fac.createPlotterFactory().create("Extrapolation Debug Plots");
-        extrap6.setTitle("@ ECal HPS vs Extend");
-        extrapFrame.addPlotter(extrap6);
-        set2DStyle(extrap6.style());
-
-        extrap6.createRegions(1, 2);
-
-        IHistogram2D plot61 = aida.histogram2D("ECal Extrapolation X :  HPS vs Extend", 50, -350, 350, 50, -50, 50);
-        IHistogram2D plot62 = aida.histogram2D("ECal Extrapolation Y :  HPS vs Extend", 50, -100, 100, 50, -20, 20);
-        extrap6.region(0).plot(plot61);
-        extrap6.region(1).plot(plot62);
-
-        extrap11 = fac.createPlotterFactory().create("Extrapolation Debug Plots");
-        extrap11.setTitle("@ ECal HPS vs Cluster");
-        extrapFrame.addPlotter(extrap11);
-        set2DStyle(extrap11.style());
-
-        extrap11.createRegions(1, 2);
-
-        IHistogram2D plot111 = aida.histogram2D("ECal Extrapolation HPS vs Cluster X", 50, -350, 350, 50, -50, 50);
-        IHistogram2D plot112 = aida.histogram2D("ECal Extrapolation HPS vs Cluster Y", 50, -100, 100, 50, -20, 20);
-        extrap11.region(0).plot(plot111);
-        extrap11.region(1).plot(plot112);
-
-
-
-        extrap12 = fac.createPlotterFactory().create("Extrapolation Debug Plots");
-        extrap12.setTitle("Cluster Resid X");
-        extrapFrame.addPlotter(extrap12);
-        set1DStyle(extrap10.style());
-
-        extrap12.createRegions(2, 2);
-
-        IHistogram1D plot121 = aida.histogram1D("Track - Cluster X:  Top -ive", 50, -50, 50);
-        IHistogram1D plot122 = aida.histogram1D("Track - Cluster X:  Bottom -ive", 50, -50, 50);
-        IHistogram1D plot123 = aida.histogram1D("Track - Cluster X:  Top +ive", 50, -50, 50);
-        IHistogram1D plot124 = aida.histogram1D("Track - Cluster X:  Bottom +ive", 50, -50, 50);
-        extrap12.region(0).plot(plot121);
-        extrap12.region(1).plot(plot122);
-        extrap12.region(2).plot(plot123);
-        extrap12.region(3).plot(plot124);
-
-
-        extrap13 = fac.createPlotterFactory().create("Extrapolation Debug Plots");
-        extrap13.setTitle("Cluster Resid Y");
-        extrapFrame.addPlotter(extrap13);
-        set1DStyle(extrap10.style());
-
-        extrap13.createRegions(2, 2);
-
-        IHistogram1D plot131 = aida.histogram1D("Track - Cluster Y:  Top -ive", 50, -20, 20);
-        IHistogram1D plot132 = aida.histogram1D("Track - Cluster Y:  Bottom -ive", 50, -20, 20);
-        IHistogram1D plot133 = aida.histogram1D("Track - Cluster Y:  Top +ive", 50, -20, 20);
-        IHistogram1D plot134 = aida.histogram1D("Track - Cluster Y:  Bottom +ive", 50, -20, 20);
-        extrap13.region(0).plot(plot131);
-        extrap13.region(1).plot(plot132);
-        extrap13.region(2).plot(plot133);
-        extrap13.region(3).plot(plot134);
-
-
-
-
-
-
-    }
-
-    private void set2DStyle(IPlotterStyle style) {
-        style.setParameter("hist2DStyle", "colorMap");
-        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-        style.dataStyle().fillStyle().setColor("yellow");
-        style.dataStyle().errorBarStyle().setVisible(false);
-        style.statisticsBoxStyle().setVisible(false);
-    }
-
-    private void set1DStyle(IPlotterStyle style) {
-        style.setParameter("hist2DStyle", "colorMap");
-        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-        style.dataStyle().fillStyle().setColor("yellow");
-        style.dataStyle().errorBarStyle().setVisible(false);
-        style.statisticsBoxStyle().setVisible(true);
-    }
-
-    private HPSEcalCluster findClosestCluster(Hep3Vector posonhelix, List<HPSEcalCluster> clusters) {
-        HPSEcalCluster closest = null;
-        double minDist = 9999;
-        for (HPSEcalCluster cluster : clusters) {
-            double[] clPos = cluster.getPosition();
-            double clEne = cluster.getEnergy();
-//            double dist = Math.sqrt(Math.pow(clPos[0] - posonhelix.y(), 2) + Math.pow(clPos[1] - posonhelix.z(), 2)); //coordinates!!!
-            double dist = Math.sqrt(Math.pow(clPos[1] - posonhelix.z(), 2)); //coordinates!!!
-            if (dist < minDist && clEne > 50) {
-                closest = cluster;
-                minDist = dist;
-            }
-        }
-        return closest;
-    }
-}

java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham
TwoTrackAnalysis.java removed after 382
--- java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/TwoTrackAnalysis.java	2014-03-26 05:43:58 UTC (rev 382)
+++ java/trunk/users/src/main/java/org/lcsim/hps/users/mgraham/TwoTrackAnalysis.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -1,989 +0,0 @@
-package org.lcsim.hps.users.mgraham;
-
-import hep.aida.IAnalysisFactory;
-import hep.aida.IHistogram1D;
-import hep.aida.IHistogram2D;
-import hep.aida.IPlotter;
-import hep.aida.IPlotterStyle;
-import hep.physics.matrix.SymmetricMatrix;
-import hep.physics.vec.BasicHep3Vector;
-import hep.physics.vec.Hep3Vector;
-
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.hps.conditions.deprecated.BeamlineConstants;
-import org.hps.recon.tracking.HPSTrack;
-import org.hps.recon.tracking.HelixConverter;
-import org.hps.recon.tracking.StraightLineTrack;
-import org.hps.util.AIDAFrame;
-import org.hps.util.Resettable;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.Track;
-import org.lcsim.event.TrackerHit;
-import org.lcsim.fit.helicaltrack.HelicalTrackFit;
-import org.lcsim.fit.helicaltrack.HelicalTrackHit;
-import org.lcsim.geometry.Detector;
-import org.lcsim.recon.tracking.seedtracker.SeedCandidate;
-import org.lcsim.recon.tracking.seedtracker.SeedTrack;
-import org.lcsim.util.Driver;
-import org.lcsim.util.aida.AIDA;
-
-import Jama.Matrix;
-import Jama.SingularValueDecomposition;
-
-/**
- *
- * @author mgraham
- */
-public class TwoTrackAnalysis extends Driver implements Resettable {
-
-    public String outputTextName = "myevents.txt";
-    FileWriter fw;
-    PrintWriter pw;
-    private AIDAFrame plotterFrame;
-    private AIDA aida = AIDA.defaultInstance();
-    IPlotter plotter;
-    IPlotter plotter2;
-    IPlotter plotter3;
-    IPlotter plotter4;
-    IPlotter plotter5;
-    IPlotter plotter6;
-    IPlotter plotter7;
-    IPlotter plotter8;
-    IAnalysisFactory fac = aida.analysisFactory();
-    private String trackCollectionName = "MatchedTracks";
-    private String outputPlots = null;
-    private boolean isMC = true;
-    private boolean showPlots = false;
-    int nevt = 0;
-
-    protected void detectorChanged(Detector detector) {
-        aida.tree().cd("/");
-        if (showPlots) {
-            plotterFrame = new AIDAFrame();
-            plotterFrame.setTitle("HPS Tracking Plots");
-        }
-        plotter = fac.createPlotterFactory().create("HPS Tracking Plots");
-        plotter.setTitle("Momentum");
-        IPlotterStyle style = plotter.style();
-        style.dataStyle().fillStyle().setColor("yellow");
-        style.dataStyle().errorBarStyle().setVisible(false);
-        plotter.createRegions(2, 2);
-        if (showPlots) {
-            plotterFrame.addPlotter(plotter);
-        }
-
-        IHistogram1D trkPx = aida.histogram1D("Track Momentum (Px)", 25, -0.25, 0.25);
-        IHistogram1D trkPy = aida.histogram1D("Track Momentum (Py)", 25, -0.1, 0.1);
-        IHistogram1D trkPz = aida.histogram1D("Track Momentum (Pz)", 25, 0, 3.5);
-        IHistogram1D trkChi2 = aida.histogram1D("Track Chi2", 25, 0, 25.0);
-
-        plotter.region(0).plot(trkPx);
-        plotter.region(1).plot(trkPy);
-        plotter.region(2).plot(trkPz);
-        plotter.region(3).plot(trkChi2);
-
-////////////////////////////////////////////////////////////////////
-
-        plotter2 = fac.createPlotterFactory().create("HPS Tracking Plots");
-        plotter2.setTitle("Vertex");
-
-        plotter2.style().dataStyle().fillStyle().setColor("yellow");
-        plotter2.style().dataStyle().errorBarStyle().setVisible(false);
-        plotter2.createRegions(2, 2);
-        if (showPlots) {
-            plotterFrame.addPlotter(plotter2);
-        }
-
-        IHistogram1D xvert = aida.histogram1D("XVertex", 40, -30, 50);
-        IHistogram1D yvert = aida.histogram1D("YVertex", 40, -35, 30);
-        IHistogram1D zvert = aida.histogram1D("ZVertex", 40, -800, -450);
-        IHistogram1D dist = aida.histogram1D("Distance btwn Trks @ Solution", 40, 0, 20);
-        plotter2.region(0).plot(xvert);
-        plotter2.region(1).plot(yvert);
-        plotter2.region(2).plot(zvert);
-        plotter2.region(3).plot(dist);
-        ////////////////////////////////////////////////////////////////////
-
-        plotter4 = fac.createPlotterFactory().create("HPS Tracking Plots");
-        plotter4.setTitle("Vertex w/cut");
-        plotter4.style().dataStyle().fillStyle().setColor("yellow");
-        plotter4.style().dataStyle().errorBarStyle().setVisible(false);
-        plotter4.createRegions(2, 2);
-        if (showPlots) {
-            plotterFrame.addPlotter(plotter4);
-        }
-
-        IHistogram1D xvertns = aida.histogram1D("XVertex with y cut", 40, -30, 50);
-        IHistogram1D yvertns = aida.histogram1D("YVertex with y cut", 40, -35, 30);
-        IHistogram1D zvertns = aida.histogram1D("ZVertex with y cut", 40, -800, -450);
-        IHistogram1D distns = aida.histogram1D("Distance btwn Trks with y cut", 40, 0, 20);
-        plotter4.region(0).plot(xvertns);
-        plotter4.region(1).plot(yvertns);
-        plotter4.region(2).plot(zvertns);
-        plotter4.region(3).plot(distns);
-////////////////////////////////////////////////////////////////////
-
-        plotter3 = fac.createPlotterFactory().create("HPS Tracking Plots");
-        plotter3.setTitle("Track @ Converter");
-
-        plotter3.style().dataStyle().fillStyle().setColor("yellow");
-        plotter3.style().dataStyle().errorBarStyle().setVisible(false);
-        plotter3.createRegions(2, 2);
-        if (showPlots) {
-            plotterFrame.addPlotter(plotter3);
-        }
-        IHistogram1D xAtConvert = aida.histogram1D("X (mm) @ Converter using Map", 50, -50, 50);
-        IHistogram1D yAtConvert = aida.histogram1D("Y (mm) @ Converter using Map", 50, -20, 20);
-        IHistogram1D xAtConvertSLT = aida.histogram1D("X (mm) @ Converter using SLT", 50, -50, 50);
-        IHistogram1D yAtConvertSLT = aida.histogram1D("Y (mm) @ Converter using SLT", 50, -20, 20);
-        plotter3.region(0).plot(xAtConvert);
-        plotter3.region(1).plot(yAtConvert);
-        plotter3.region(2).plot(xAtConvertSLT);
-        plotter3.region(3).plot(yAtConvertSLT);
-
-        plotter5 = fac.createPlotterFactory().create("HPS Tracking Plots");
-        plotter5.setTitle("Mass");
-        plotter5.style().dataStyle().fillStyle().setColor("yellow");
-        plotter5.style().dataStyle().errorBarStyle().setVisible(false);
-        //plotter5.createRegions(2, 2);
-        if (showPlots) {
-            plotterFrame.addPlotter(plotter5);
-        }
-        IHistogram1D invMass = aida.histogram1D("Invariant Mass", 50, 0, .4);
-
-        plotter5.region(0).plot(invMass);
-
-        plotter6 = fac.createPlotterFactory().create("HPS Tracking Plots");
-        plotter6.setTitle("correlations");
-        plotter6.style().setParameter("hist2DStyle", "colorMap");
-        plotter6.style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-        plotter6.createRegions(1, 3);
-        IHistogram2D xy = aida.histogram2D("X v Y", 50, -30, 50, 50, -35, 30);
-        IHistogram2D xz = aida.histogram2D("X v Z", 50, -30, 50, 50, -800, -450);
-        IHistogram2D yz = aida.histogram2D("Y v Z", 50, -35, 30, 50, -800, -450);
-        plotter6.region(0).plot(xy);
-        plotter6.region(1).plot(xz);
-        plotter6.region(2).plot(yz);
-
-
-
-        IHistogram1D trkbins = aida.histogram1D("Track Distributions", 5, -2, 3);
-        IHistogram2D twtrkptot = aida.histogram2D("Total P+ vs. P-", 60, 0, 4, 60, 0, 4);
-        IHistogram1D sumtrks = aida.histogram1D("Sum of Track's Momentums", 100, -1, 7);
-        IHistogram1D perptrks = aida.histogram1D("Perpendicular Momentum", 100, 0, .1);
-        IHistogram2D pyppm = aida.histogram2D("Py+ vs. Py-", 60, -.1, .1, 60, -.1, .1);
-        IHistogram2D pzppm = aida.histogram2D("Pz+ vs. Pz-", 60, -.1, .1, 60, -.1, .1);
-        IHistogram1D px = aida.histogram1D("Two Track X Momentum", 40, 0, 4);
-        IHistogram1D py = aida.histogram1D("Two Track Y Momentum", 40, -.1, .1);
-        IHistogram1D pz = aida.histogram1D("Two Track Z Momentum", 40, -.1, .1);
-        IHistogram1D chi2 = aida.histogram1D("Tracks Chi2", 25, 0, 25.0);
-        IHistogram1D bbpx = aida.histogram1D("Big Bump Track Momenta (Px)", 40, 0, 4);
-        IHistogram1D bbpy = aida.histogram1D("Big Bump Track Momenta (Py)", 40, -.1, .1);
-        IHistogram1D bbpz = aida.histogram1D("Big Bump Track Momenta (Pz)", 40, -.1, .1);
-        IHistogram1D bbchi2 = aida.histogram1D("Big Bump Tracks Chi2", 25, 0, 25.0);
-        IHistogram1D spx = aida.histogram1D("Split Track Momenta (Px)", 40, 0, 4);
-        IHistogram1D spy = aida.histogram1D("Split Track Momenta (Py)", 40, -.1, .1);
-        IHistogram1D spz = aida.histogram1D("Split Track Momenta (Pz)", 40, -.1, .1);
-        IHistogram1D schi2 = aida.histogram1D("Split Tracks Chi2", 25, 0, 25.0);
-        IHistogram1D bbsumtrks = aida.histogram1D("Big Bump Sum of Track's Momentums", 50, -1, 7);
-        IHistogram2D bbpppm = aida.histogram2D("Big Bump P+ vs. P-", 50, 0, 4, 50, 0, 4);
-        IHistogram2D lbpppm = aida.histogram2D("Little Bump P+ vs. P-", 50, 0, 4, 50, 0, 4);
-        IHistogram1D lbsumtrks = aida.histogram1D("Little Bump Sum of Track's Momentums", 50, -1, 7);
-        IHistogram1D lbpx = aida.histogram1D("Little Bump Track Momenta (Px)", 40, 0, 4);
-        IHistogram1D lbpy = aida.histogram1D("Little Bump Track Momenta (Py)", 40, -.1, .1);
-        IHistogram1D lbpz = aida.histogram1D("Little Bump Track Momenta (Pz)", 40, -.1, .1);
-        IHistogram1D lbchi2 = aida.histogram1D("Little Bump Tracks Chi2", 25, 0, 25.0);
-        IHistogram2D xyemt = aida.histogram2D("X v Y - e- Top", 50, -30, 50, 50, -35, 30);
-        IHistogram2D xzemt = aida.histogram2D("X v Z - e- Top", 50, -30, 50, 50, -800, -450);
-        IHistogram2D yzemt = aida.histogram2D("Y v Z - e- Top", 50, -35, 30, 50, -800, -450);
-        IHistogram1D qbins = aida.histogram1D("Charge Distributions", 5, -2, 3);
-        IHistogram1D lbtp = aida.histogram1D("Little Bump Track Parity", 7, 0, 7);
-        IHistogram1D bbtp = aida.histogram1D("Big Bump Track Parity", 7, 0, 7);
-        IHistogram1D xres = aida.histogram1D("X Res Trk1", 40, -0.25, 0.25);
-        IHistogram1D yres = aida.histogram1D("Y Res Trk1", 40, -0.25, 0.25);
-        IHistogram1D xres2 = aida.histogram1D("X Res Trk2", 40, -0.25, 0.25);
-        IHistogram1D yres2 = aida.histogram1D("Y Res Trk2", 40, -0.25, 0.25);
-        IHistogram1D unx1 = aida.histogram1D("Uncert X Trk 1", 50, 0, 10);
-        IHistogram1D uny1 = aida.histogram1D("Uncert Y Trk 1", 50, 0, 10);
-        IHistogram1D unz1 = aida.histogram1D("Uncert Z Trk 1", 50, 0, 40);
-        IHistogram1D unx2 = aida.histogram1D("Uncert X Trk 2", 50, 0, 10);
-        IHistogram1D uny2 = aida.histogram1D("Uncert Y Trk 2", 50, 0, 10);
-        IHistogram1D unz2 = aida.histogram1D("Uncert Z Trk 2", 50, 0, 40);
-        IHistogram2D xyept = aida.histogram2D("X v Y - e+ Top", 50, -30, 50, 50, -35, 30);
-        IHistogram2D xzept = aida.histogram2D("X v Z - e+ Top", 50, -30, 50, 50, -800, -450);
-        IHistogram2D yzept = aida.histogram2D("Y v Z - e+ Top", 50, -35, 30, 50, -800, -450);
-        IHistogram1D three = aida.histogram1D("Three Track Invariant Mass", 50, 0, .4);
-
-        plotter7 = fac.createPlotterFactory().create("HPS Tracking Plots");
-        plotter7.setTitle("correlations e+ Top");
-        plotter7.style().setParameter("hist2DStyle", "colorMap");
-        plotter7.style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-        plotter7.createRegions(1, 3);
-        plotter7.region(0).plot(xyept);
-        plotter7.region(1).plot(xzept);
-        plotter7.region(2).plot(yzept);
-
-        plotter8 = fac.createPlotterFactory().create("HPS Tracking Plots");
-        plotter8.setTitle("correlations e- Top");
-        plotter8.style().setParameter("hist2DStyle", "colorMap");
-        plotter8.style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-        plotter8.createRegions(1, 3);
-        plotter8.region(0).plot(xyemt);
-        plotter8.region(1).plot(xzemt);
-        plotter8.region(2).plot(yzemt);
-
-        if (showPlots) {
-            plotterFrame.pack();
-            plotterFrame.setVisible(true);
-        }
-    }
-
-    public void setIsMC(boolean setit) {
-        isMC = setit;
-    }
-
-    public void process(EventHeader event) {
-
-        if (nevt == 0) {
-            try {
-//open things up
-                fw = new FileWriter(outputTextName);
-                pw = new PrintWriter(fw);
-            } catch (IOException ex) {
-                Logger.getLogger(TwoTrackAnalysis.class.getName()).log(Level.SEVERE, null, ex);
-            }
-        }
-        nevt++;
-        aida.tree().cd("/");
-        List<Track> tracks = event.get(Track.class, trackCollectionName);
-        System.out.println("Staring TwoTrackAnalysis");
-        for (Track trk : tracks) {
-            aida.histogram1D("Track Momentum (Px)").fill(trk.getPY());
-            aida.histogram1D("Track Momentum (Py)").fill(trk.getPZ());
-            aida.histogram1D("Track Momentum (Pz)").fill(trk.getPX());
-            aida.histogram1D("Track Chi2").fill(trk.getChi2());
-
-            SeedTrack stEle = (SeedTrack) trk;
-            SeedCandidate seedEle = stEle.getSeedCandidate();
-            HelicalTrackFit ht = seedEle.getHelix();
-            HelixConverter converter = new HelixConverter(0);
-            StraightLineTrack slt = converter.Convert(ht);
-            HPSTrack hpstrack = new HPSTrack(ht);
-            Hep3Vector[] trkatconver = hpstrack.getPositionAtZMap(100, BeamlineConstants.HARP_POSITION_TESTRUN, 1);
-            aida.histogram1D("X (mm) @ Converter using Map").fill(trkatconver[0].x()); // y tracker frame?
-            aida.histogram1D("Y (mm) @ Converter using Map").fill(trkatconver[0].y()); // z tracker frame?
-            if (slt != null) {
-                aida.histogram1D("X (mm) @ Converter using SLT").fill(slt.getYZAtX(BeamlineConstants.HARP_POSITION_TESTRUN)[0]); // y tracker frame?
-                aida.histogram1D("Y (mm) @ Converter using SLT").fill(slt.getYZAtX(BeamlineConstants.HARP_POSITION_TESTRUN)[1]); // z tracker frame?
-            }
-        }
-
-        System.out.println("...checking if two tracks...");
-
-        if (tracks.size() == 2) { //uncert can be used here  && (Ytrue || Ytrue2) && (Xtrue || Xtrue2)
-            System.out.println("               ...yes!");
-
-            Track trk1 = tracks.get(0);
-            Track trk2 = tracks.get(1);
-            int isTrk1Top = -1;
-            if (trk1.getTrackerHits().get(0).getPosition()[2] > 0) {
-                isTrk1Top = 1;
-            }
-            int isTrk2Top = -1;
-            if (trk2.getTrackerHits().get(0).getPosition()[2] > 0) {
-                isTrk2Top = 1;
-            }
-            boolean topbot = false;
-            if ((isTrk1Top + isTrk2Top) == 0) {
-                topbot = true;
-            }
-
-            SeedTrack stEle1 = (SeedTrack) trk1;
-            SeedCandidate seedEle1 = stEle1.getSeedCandidate();
-            HelicalTrackFit ht1 = seedEle1.getHelix();
-            HelixConverter converter1 = new HelixConverter(0);
-            StraightLineTrack slt1 = converter1.Convert(ht1);
-
-            SeedTrack stEle2 = (SeedTrack) trk2;
-            SeedCandidate seedEle2 = stEle2.getSeedCandidate();
-            HelicalTrackFit ht2 = seedEle2.getHelix();
-            HelixConverter converter2 = new HelixConverter(0);
-            StraightLineTrack slt2 = converter2.Convert(ht2);
-
-//            HPSTrack hpstrack1 = new HPSTrack(ht1);
-//            Hep3Vector[] trkatconver1 = hpstrack1.getPositionAtZMap(100, BeamlineConstants.HARP_POSITION, 1);
-//            HPSTrack hpstrack2 = new HPSTrack(ht2);
-//            Hep3Vector[] trkatconver2 = hpstrack2.getPositionAtZMap(100, BeamlineConstants.HARP_POSITION, 1);
-
-            HPSTrack hpstrack1 = new HPSTrack(ht1);
-            Hep3Vector[] trkatconver1 = {new BasicHep3Vector(), new BasicHep3Vector(0, 0, 0)};
-            HPSTrack hpstrack2 = new HPSTrack(ht2);
-            Hep3Vector[] trkatconver2 = {new BasicHep3Vector(), new BasicHep3Vector(0, 0, 0)};;
-            if (isMC) {
-                double[] t1 = slt1.getYZAtX(BeamlineConstants.HARP_POSITION_TESTRUN);
-                double[] t2 = slt2.getYZAtX(BeamlineConstants.HARP_POSITION_TESTRUN);
-                trkatconver1[0] = new BasicHep3Vector(t1[0], t1[1], BeamlineConstants.HARP_POSITION_TESTRUN);
-                trkatconver2[0] = new BasicHep3Vector(t2[0], t2[1], BeamlineConstants.HARP_POSITION_TESTRUN);
-            } else {
-                trkatconver1 = hpstrack1.getPositionAtZMap(100, BeamlineConstants.HARP_POSITION_TESTRUN, 1);
-                trkatconver2 = hpstrack2.getPositionAtZMap(100, BeamlineConstants.HARP_POSITION_TESTRUN, 1);
-            }
-            List<TrackerHit> hitsOnTrack1 = trk1.getTrackerHits();
-            int layer1;
-            double y1 = 0;
-            double y2 = 0;
-            double z1 = 0;
-            double z2 = 0;
-            double dely1 = 0;
-            double dely2 = 0;
-            for (TrackerHit hit : hitsOnTrack1) {
-                HelicalTrackHit htc1 = (HelicalTrackHit) hit;
-                layer1 = htc1.Layer();
-                int y1layer = 0;
-                int y2layer = 0;
-                if (y1 == 0) {
-                    y1 = htc1.getPosition()[2]; //
-                    z1 = htc1.getPosition()[0]; // z1 is jlab but the get position refers to hps-tracking
-                    y1layer = layer1;
-                    SymmetricMatrix ErrorHitOne = htc1.getCorrectedCovMatrix();
-                    dely1 = Math.sqrt(ErrorHitOne.diagonal(2)); //y in jlab is z in hps
-                } else {
-
-                    if ((layer1 > y1layer) && (y2layer == 0)) {
-                        y2 = htc1.getPosition()[2]; //
-                        z2 = htc1.getPosition()[0]; // see above comments!
-                        y2layer = layer1;
-                        SymmetricMatrix ErrorHitTwo = htc1.getCorrectedCovMatrix();
-                        dely2 = Math.sqrt(ErrorHitTwo.diagonal(2));
-                    }
-
-                }
-
-            }
-            List<TrackerHit> hitsOnTrack2 = trk2.getTrackerHits();
-
-            double my1 = 0;
-            double my2 = 0;
-            double mz1 = 0;
-            double mz2 = 0;
-            double delymy1 = 0;
-            double delymy2 = 0;
-            int layer2;
-            for (TrackerHit hit : hitsOnTrack2) {
-                HelicalTrackHit htc2 = (HelicalTrackHit) hit;
-//            if (htc.getPosition()[2] < 0) {
-
-                layer2 = htc2.Layer();
-                int my1layer = 0;
-                int my2layer = 0;
-                if (my1 == 0) {
-                    my1 = htc2.getPosition()[2]; //see above comments
-                    mz1 = htc2.getPosition()[0];
-                    my1layer = layer2;
-                    SymmetricMatrix ErrorHitOne = htc2.getCorrectedCovMatrix();
-                    delymy1 = Math.sqrt(ErrorHitOne.diagonal(2));
-                } else {
-                    if ((layer2 > my1layer) && (my2layer == 0)) {
-                        my2 = htc2.getPosition()[2];
-                        mz2 = htc2.getPosition()[0];
-                        my2layer = layer2;
-                        SymmetricMatrix ErrorHitTwo = htc2.getCorrectedCovMatrix();
-                        delymy2 = Math.sqrt(ErrorHitTwo.diagonal(2));
-                    }
-                }
-            }
-            //   double dely = .00001; //mm
-            double b1;
-            double m1;
-            double b2;
-            double m2;
-            boolean check1 = true;
-            if (y1 == 0) {
-                check1 = false;
-            }
-            boolean check2 = true;
-            if (my1 == 0) {
-                check2 = false;
-            }
-            boolean check3 = true;
-            if (my2 == 0) {
-                check3 = false;
-            }
-
-
-
-            double X1 = -99, Y1 = -99;
-            if (slt1 != null) {
-                X1 = slt1.getYZAtX(BeamlineConstants.HARP_POSITION_TESTRUN)[0];
-                Y1 = slt1.getYZAtX(BeamlineConstants.HARP_POSITION_TESTRUN)[1];
-            }
-
-            boolean X1cent = false;
-            boolean Y1cent = false; //for simulation
-
-            if (11 < X1 && X1 < 29) {
-                X1cent = true;
-            }
-            if (-3.5 < Y1 && Y1 < 3.5) {
-                Y1cent = true;
-            }
-
-            double X2 = 99, Y2 = 99;
-            if (slt2 != null) {
-                X2 = slt2.getYZAtX(BeamlineConstants.HARP_POSITION_TESTRUN)[0];
-                Y2 = slt2.getYZAtX(BeamlineConstants.HARP_POSITION_TESTRUN)[1];
-            }
-
-            boolean X2cent = false;
-            boolean Y2cent = false; //for simulation
-            if (11 < X2 && X2 < 29) {
-                X2cent = true;
-            }
-            if (-3.5 < Y2 && Y2 < 3.5) {
-                Y2cent = true;
-            }
-
-            int qtrk1 = trk1.getCharge();
-            int qtrk2 = trk2.getCharge();
-            boolean pm = false;
-            if ((qtrk1 + qtrk2) == 0) {
-                pm = true;
-            }
-
-
-            if (topbot && pm) {
-
-                double b1p;
-                double b2p;
-                double m1p;
-                double m2p;
-
-                if (check1 && check2 && check3) {
-                    if (isTrk1Top == 1) {
-                        double zc = -1 * z1 / (z2 - z1);
-                        b1 = (zc * (y2 - y1 + .5 * (dely2 + dely1))) + y1 - (.5 * dely1);
-                        m1 = (y2 - y1 + .5 * (dely2 + dely1)) / (z2 - z1);
-                        m1p = (y2 - y1 - .5 * (dely2 + dely1)) / (z2 - z1);
-                        b1p = y1 - (m1p * z1) + (.5 * dely1);
-                    } else {
-                        double zc = -1 * z1 / (z2 - z1);
-                        b1 = (zc * (y2 - y1 - .5 * (dely2 + dely1))) + y1 + (.5 * dely1);
-                        m1 = (y2 - y1 - .5 * (dely2 + dely1)) / (z2 - z1);
-                        m1p = (y2 - y1 + .5 * (dely2 + dely1)) / (z2 - z1);
-                        b1p = y1 - (m1p * z1) - (.5 * dely1);
-                    }
-
-                    if (isTrk2Top == 1) {
-                        double zc = -1 * mz1 / (mz2 - mz1);
-                        b2 = (zc * (my2 - my1 + .5 * (delymy2 + delymy1))) + my1 - (.5 * delymy1);
-                        m2 = (my2 - my1 + .5 * (delymy2 + delymy1)) / (mz2 - mz1);
-                        m2p = (my2 - my1 - .5 * (delymy2 + delymy1)) / (mz2 - mz1);
-                        b2p = my1 - (m2p * mz1) + (.5 * delymy1);
-                    } else {
-                        double zc = -1 * mz1 / (mz2 - mz1);
-                        b2 = (zc * (my2 - my1 - .5 * (delymy2 + delymy1))) + my1 + (.5 * delymy1);
-                        m2 = (my2 - my1 - .5 * (delymy2 + delymy1)) / (mz2 - mz1);
-                        m2p = (my2 - my1 + .5 * (delymy2 + delymy1)) / (mz2 - mz1);
-                        b2p = my1 - (m2p * mz1) - (.5 * delymy1);
-                    }
-
-                    double zi = (b2 - b1) / (m1 - m2);
-                    double zr = Math.abs(zi - BeamlineConstants.HARP_POSITION_TESTRUN);
-                    double zs = 2 * zr / 100;
-                    //      System.out.println("Closest Possible Z to Tracker");
-                    //      System.out.println(zi);
-
-
-                    List<double[]> Trk1 = new ArrayList<double[]>();
-                    for (int i = 0; i < 100; i++) {
-                        double z = BeamlineConstants.HARP_POSITION_TESTRUN - zr + (zs * i);
-                        double[] posvec = new double[3];
-                        if (isMC) {
-                            posvec[0] = slt1.getYZAtX(z)[0];
-                            posvec[1] = slt1.getYZAtX(z)[1];
-                            posvec[2] = z;
-                        } else {
-                            Hep3Vector[] trk1atz = hpstrack1.getPositionAtZMap(100, z, 1);
-                            posvec[0] = trk1atz[0].x();
-                            posvec[1] = trk1atz[0].y();
-                            posvec[2] = z;
-                        }
-                        Trk1.add(posvec);
-                    }
-                    //  System.out.println("Vectors ");
-
-                    //  System.out.println(Trk1);
-
-                    double xbar = 0;
-                    double ybar = 0;
-                    double zbar = 0;
-                    double xsqbar = 0;
-                    double ysqbar = 0;
-                    double zsqbar = 0;
-                    int n = 0;
-                    for (double[] inttrk : Trk1) {
-                        //      System.out.println(inttrk[0]);
-                        //    System.out.println(inttrk[1]);
-                        //    System.out.println(inttrk[2]);
-                        xbar = xbar + inttrk[0];
-                        ybar = ybar + inttrk[1];
-                        zbar = zbar + inttrk[2];
-                        n = n + 1;
-                    }
-                    //   System.out.println("n " + n);
-                    xbar = xbar / n;
-                    ybar = ybar / n;
-                    zbar = zbar / n;
-                    //    System.out.println("Xbar is " + xbar);
-                    //    System.out.println("Ybar is " + ybar);
-                    //    System.out.println("Zbar is " + zbar);
-                    Matrix d;
-                    Matrix A = Matrix.random(n, 3);
-                    int j1 = 0;
-                    for (double[] inttrk : Trk1) {
-                        A.set(j1, 0, inttrk[0] - xbar);
-                        A.set(j1, 1, inttrk[1] - ybar);
-                        A.set(j1, 2, inttrk[2] - zbar);
-                        j1++;
-                    }
-
-                    //           System.out.println("Matrix A");
-                    //           A.print(9, 6);
-                    A.svd();
-                    SingularValueDecomposition s = A.svd();
-                    Matrix S = s.getS();
-                    //         System.out.println("S Matrix");
-                    //         S.print(9, 6);
-                    Matrix V = s.getV();
-                    //         System.out.println("V Matrix");
-                    //         V.print(9, 6);
-                    d = V.getMatrix(0, 2, 0, 0);
-                    double[] dd;
-                    dd = new double[3];
-
-                    dd[0] = d.get(0, 0);
-                    dd[1] = d.get(1, 0);
-                    dd[2] = d.get(2, 0);
-                    double nd = Math.sqrt((Math.pow(dd[0], 2)) + (Math.pow(dd[1], 2)) + (Math.pow(dd[2], 2)));
-
-                    for (double[] inttrk : Trk1) {
-                        double t1 = (inttrk[2] - zbar) / dd[2];
-                        double restrk1[];
-                        restrk1 = new double[3];
-                        restrk1[0] = xbar + (t1) * dd[0] - inttrk[0];
-                        restrk1[1] = ybar + (t1) * dd[1] - inttrk[1];
-                        restrk1[2] = zbar + (t1) * dd[2] - inttrk[2];
-                        //aida.histogram1D("X Res Trk1").fill(restrk1[0]);
-                        //aida.histogram1D("Y Res Trk1").fill(restrk1[1]);
-                    }
-
-                    List<double[]> Trk2 = new ArrayList<double[]>();
-                    for (int i = 0; i < 100; i++) {
-                        double z = BeamlineConstants.HARP_POSITION_TESTRUN - zr + (zs * i);
-                        double[] posvec2 = new double[3];
-
-                        if (isMC) {
-                            posvec2[0] = slt2.getYZAtX(z)[0];
-                            posvec2[1] = slt2.getYZAtX(z)[1];
-                            posvec2[2] = z;
-                        } else {
-                            Hep3Vector[] trk2atz = hpstrack2.getPositionAtZMap(100, z, 1);
-                            posvec2[0] = trk2atz[0].x();
-                            posvec2[1] = trk2atz[0].y();
-                            posvec2[2] = z;
-                        }
-                        Trk2.add(posvec2);
-                        //      System.out.println("Components");
-                        //      System.out.println(posvec2[0]);
-                        //      System.out.println(posvec2[1]);
-                        //      System.out.println(posvec2[2]);
-                    }
-                    double xbar2 = 0;
-                    double ybar2 = 0;
-                    double zbar2 = 0;
-                    int n2 = 0;
-                    for (double[] trk : Trk2) {
-                        xbar2 = xbar2 + trk[0];
-                        ybar2 = ybar2 + trk[1];
-                        zbar2 = zbar2 + trk[2];
-                        n2 = n2 + 1;
-                    }
-                    xbar2 = xbar2 / n2;
-                    ybar2 = ybar2 / n2;
-                    zbar2 = zbar2 / n2;
-                    Matrix d2;
-                    Matrix A2 = Matrix.random(n, 3);
-
-                    int j2 = 0;
-                    for (double[] inttrk : Trk2) {
-                        A2.set(j2, 0, inttrk[0] - xbar2);
-                        A2.set(j2, 1, inttrk[1] - ybar2);
-                        A2.set(j2, 2, inttrk[2] - zbar2);
-                        j2++;
-                    }
-
-                    A2.svd();
-                    SingularValueDecomposition s2 = A2.svd();
-                    Matrix V2 = s2.getV();
-                    d2 = V2.getMatrix(0, 2, 0, 0);
-                    double[] d22;
-                    d22 = new double[3];
-                    d22[0] = d2.get(0, 0);
-                    d22[1] = d2.get(1, 0);
-                    d22[2] = d2.get(2, 0);
-                    double nd2 = Math.sqrt((Math.pow(d22[0], 2)) + (Math.pow(d22[1], 2)) + (Math.pow(d22[2], 2)));
-
-                    for (double[] inttrk : Trk2) {
-                        double t2 = (inttrk[2] - zbar2) / d22[2];
-                        double restrk2[];
-                        restrk2 = new double[3];
-                        restrk2[0] = xbar2 + (t2) * d22[0] - inttrk[0];
-                        restrk2[1] = ybar2 + (t2) * d22[1] - inttrk[1];
-                        restrk2[2] = zbar2 + (t2) * d22[2] - inttrk[2];
-                        //aida.histogram1D("X Res Trk2").fill(restrk2[0]);
-                        //aida.histogram1D("Y Res Trk2").fill(restrk2[1]);
-
-                    }
-
-                    //solution for intersection below!! 
-
-                    //starting with costant matrix b
-                    double x11 = Math.pow(nd, 2) - Math.pow(dd[0], 2);
-                    double y11 = Math.pow(nd, 2) - Math.pow(dd[1], 2);
-                    double z11 = Math.pow(nd, 2) - Math.pow(dd[2], 2);
-                    double x22 = Math.pow(nd2, 2) - Math.pow(d22[0], 2);
-                    double y22 = Math.pow(nd2, 2) - Math.pow(d22[1], 2);
-                    double z22 = Math.pow(nd2, 2) - Math.pow(d22[2], 2);
-                    double xy1 = -1 * dd[0] * dd[1];
-                    double xz1 = -1 * dd[0] * dd[2];
-                    double yz1 = -1 * dd[1] * dd[2];
-                    double xy2 = -1 * d22[0] * d22[1];
-                    double xz2 = -1 * d22[0] * d22[2];
-                    double yz2 = -1 * d22[1] * d22[2];
-                    Matrix Intersect = Matrix.random(6, 3);
-                    Intersect.set(0, 0, x11);
-                    Intersect.set(1, 0, xy1);
-                    Intersect.set(2, 0, xz1);
-                    Intersect.set(0, 1, xy1);
-                    Intersect.set(1, 1, y11);
-                    Intersect.set(2, 1, yz1);
-                    Intersect.set(0, 2, xz1);
-                    Intersect.set(1, 2, yz1);
-                    Intersect.set(2, 2, z11);
-
-                    Intersect.set(3, 0, x22);
-                    Intersect.set(4, 0, xy2);
-                    Intersect.set(5, 0, xz2);
-                    Intersect.set(3, 1, xy2);
-                    Intersect.set(4, 1, y22);
-                    Intersect.set(5, 1, yz2);
-                    Intersect.set(3, 2, xz2);
-                    Intersect.set(4, 2, yz2);
-                    Intersect.set(5, 2, z22);
-                    Matrix b = Matrix.random(6, 1);
-                    b.set(0, 0, (x11 * xbar) + (xy1 * ybar) + (xz1 * zbar));
-                    b.set(1, 0, (y11 * ybar) + (xy1 * xbar) + (yz1 * zbar));
-                    b.set(2, 0, (z11 * zbar) + (xz1 * xbar) + (yz1 * ybar));
-                    b.set(3, 0, (x22 * xbar2) + (xy2 * ybar2) + (xz2 * zbar2));
-                    b.set(4, 0, (y22 * ybar2) + (xy2 * xbar2) + (yz2 * zbar2));
-                    b.set(5, 0, (z22 * zbar2) + (xz2 * xbar2) + (yz2 * ybar2));
-
-                    Intersect.svd();
-                    SingularValueDecomposition s3 = Intersect.svd();
-                    Matrix Vint = s3.getV();
-                    Matrix Uint = s3.getU();
-                    Matrix Sint = s3.getS();
-                    //       System.out.println("S Matrix");
-                    //       Sint.print(9, 6);
-                    Matrix VT = Vint.transpose();
-                    Matrix UT = Uint.transpose();
-                    Matrix SI = Sint.inverse();
-                    //      System.out.println("Inverted S Matrix");
-                    //      SI.print(9, 6);
-                    Matrix C1 = VT.times(SI);
-                    Matrix C2 = C1.times(UT);
-                    Matrix C = C2.times(b);
-                    C.print(9, 6);
-                    aida.histogram1D("XVertex").fill(C.get(0, 0));
-                    aida.histogram1D("YVertex").fill(C.get(1, 0));
-                    aida.histogram1D("ZVertex").fill(C.get(2, 0));
-
-                    aida.histogram2D("X v Y").fill(C.get(0, 0), C.get(1, 0));
-                    aida.histogram2D("X v Z").fill(C.get(0, 0), C.get(2, 0));
-                    aida.histogram2D("Y v Z").fill(C.get(1, 0), C.get(2, 0));
-
-                    double zint = C.get(2, 0);
-                    double t1 = (zint - zbar) / dd[2];
-                    double t2 = (zint - zbar2) / d22[2];
-                    double postrk1[];
-                    postrk1 = new double[3];
-                    postrk1[0] = xbar + (t1) * dd[0];
-                    postrk1[1] = ybar + (t1) * dd[1];
-                    postrk1[2] = zbar + (t1) * dd[2];
-                    double postrk2[];
-                    postrk2 = new double[3];
-                    postrk2[0] = xbar2 + (t2) * d22[0];
-                    postrk2[1] = ybar2 + (t2) * d22[1];
-                    postrk2[2] = zbar2 + (t2) * d22[2];
-                    double distance = Math.sqrt(Math.pow(postrk2[0] - postrk1[0], 2) + Math.pow(postrk2[1] - postrk1[1], 2) + Math.pow(postrk2[2] - postrk1[2], 2));
-                    //     double distancex = Math.sqrt(Math.pow(postrk2[0] - postrk1[0], 2));
-                    //   double distancey = Math.sqrt(Math.pow(postrk2[1] - postrk1[1], 2));
-                    aida.histogram1D("Distance btwn Trks @ Solution").fill(distance);
-
-                    double pxE, pyE, pzE;
-                    double pxP, pyP, pzP;
-                    Hep3Vector[] trkatconvE;
-                    Hep3Vector[] trkatconvP;
-                    if (trk1.getCharge() > 0) {
-                        pxP = trk1.getPX();
-                        pyP = trk1.getPY();
-                        pzP = trk1.getPZ();
-                        pxE = trk2.getPX();
-                        pyE = trk2.getPY();
-                        pzE = trk2.getPZ();
-                        trkatconvP = trkatconver1;
-                        trkatconvE = trkatconver2;
-                    } else {
-                        pxP = trk2.getPX();
-                        pyP = trk2.getPY();
-                        pzP = trk2.getPZ();
-                        pxE = trk1.getPX();
-                        pyE = trk1.getPY();
-                        pzE = trk1.getPZ();
-                        trkatconvP = trkatconver2;
-                        trkatconvE = trkatconver1;
-                    }
-                    double vX = C.get(0, 0);
-                    double vY = C.get(1, 0);
-                    double vZ = C.get(2, 0);
-                    pw.format("%d %5.5f %5.5f %5.5f %5.5f %5.5f %5.5f ", nevt, pxE, pyE, pzE,trkatconvE[0].x(),trkatconvE[0].y(),trkatconvE[0].z());
-                    pw.format("%5.5f %5.5f %5.5f %5.5f %5.5f %5.5f ", pxP, pyP, pzP,trkatconvP[0].x(),trkatconvP[0].y(),trkatconvP[0].z());
-                    pw.format("%5.5f %5.5f %5.5f %5.5f ",distance,vX,vY,vZ);
-                    pw.println();
-
-                    if (trk1.getPX() > 0.25 && trk2.getPX() > 0.25 && Math.abs(C.get(1, 0)) < 6.0) {
-                        aida.histogram1D("XVertex with y cut").fill(C.get(0, 0));
-                        aida.histogram1D("YVertex with y cut").fill(C.get(1, 0));
-                        aida.histogram1D("ZVertex with y cut").fill(C.get(2, 0));
-                        aida.histogram1D("Distance btwn Trks with y cut").fill(distance);
-                    }
-                    double tt1 = (BeamlineConstants.HARP_POSITION_TESTRUN - zbar) / dd[2]; //target
-                    double tt2 = (BeamlineConstants.HARP_POSITION_TESTRUN - zbar2) / d22[2]; //target
-                    double postrk1att[];
-                    postrk1att = new double[3]; //target
-                    postrk1att[0] = xbar + (tt1) * dd[0];
-                    postrk1att[1] = ybar + (tt1) * dd[1];
-                    postrk1att[2] = zbar + (tt1) * dd[2];
-                    double postrk2att[]; //target
-                    postrk2att = new double[3];
-                    postrk2att[0] = xbar2 + (tt2) * d22[0];
-                    postrk2att[1] = ybar2 + (tt2) * d22[1];
-                    postrk2att[2] = zbar2 + (tt2) * d22[2];
-
-                    //aida.histogram1D("Trk1 X @ Target").fill(postrk1att[0]);
-                    //aida.histogram1D("Trk1 Y @ Target").fill(postrk1att[1]);
-                    //aida.histogram1D("Trk2 X @ Target").fill(postrk2att[0]);
-                    //aida.histogram1D("Trk2 Y @ Target").fill(postrk2att[1]);
-                    double distanceatt = Math.sqrt(Math.pow(postrk2att[0] - postrk1att[0], 2) + Math.pow(postrk2att[1] - postrk1att[1], 2) + Math.pow(postrk2att[2] - postrk1att[2], 2));
-                    // double zdiff = postrk2att[2] - postrk1att[2];
-                    //aida.histogram1D("Distance btwn Trks @ Target").fill(distanceatt);
-                    // aida.histogram1D("Z Diff").fill(zdiff);
-
-
-                    double uncerty = Math.abs((m1 - m2) * zint + (b1 - b2));
-                    //   double uncertx1 = Math.sqrt(uncertx1sq);
-                    double uncertz1 = Math.sqrt(zr);
-                    //   double uncertx2 = Math.sqrt(uncertx2sq);
-                    double uncertz2 = Math.sqrt(zr);
-                    //   aida.histogram1D("Uncert X Trk 1").fill(uncertx1);
-                    //aida.histogram1D("Uncert Y Trk 1").fill(uncerty);
-                    //aida.histogram1D("Uncert Z Trk 1").fill(uncertz1);
-                    // aida.histogram1D("Uncert X Trk 2").fill(uncerty2);
-                    //aida.histogram1D("Uncert Y Trk 2").fill(uncerty);
-                    //aida.histogram1D("Uncert Z Trk 2").fill(uncertz2);
-                    boolean yzbump1 = false;
-                    if (-18 < C.get(1, 0) && C.get(1, 0) < -12 && -645 < C.get(2, 0) && C.get(2, 0) < -600) {
-                        yzbump1 = true;
-                    }
-                    boolean yzbump2 = false;
-                    if (-4 < C.get(1, 0) && C.get(1, 0) < 4 && -720 < C.get(2, 0) && C.get(2, 0) < -605) {
-                        yzbump2 = true;
-                    }
-                    boolean xybump1 = false;
-                    if (-1 < C.get(0, 0) && C.get(0, 0) < 11 && -20 < C.get(1, 0) && C.get(1, 0) < -13) {
-                        xybump1 = true;
-                    }
-                    boolean xybump2 = false;
-                    if (11 < C.get(0, 0) && C.get(0, 0) < 25 && -4 < C.get(1, 0) && C.get(1, 0) < 3) {
-                        xybump2 = true;
-                    }
-                    int trksparity = 0;
-                    if (isTrk1Top == 1 && qtrk1 == 1) { //top e+ will be far right
-                        trksparity = 6;
-                    }
-                    if (isTrk1Top == 1 && qtrk1 == -1) { //top e- will be right of middle two
-                        trksparity = 4;
-                    }
-                    if (isTrk1Top == -1 && qtrk1 == 1) { // bot e+ will be left of middle two
-                        trksparity = 2;
-                    }
-                    if (isTrk1Top == -1 && qtrk1 == -1) { //bot e- will be far left
-                        trksparity = 0;
-                    }
-                    boolean eplustop = false;
-                    if ((isTrk1Top == 1 && qtrk1 == 1) || (isTrk2Top == 1 && qtrk2 == 1)) {
-                        eplustop = true;
-                    }
-                    if (yzbump1 && xybump1) {
-                        // aida.histogram1D("Little Bump Track Parity").fill(trksparity);
-                    }
-                    if (yzbump2 && xybump2) {
-                        // aida.histogram1D("Big Bump Track Parity").fill(trksparity);
-                    }
-                    if (eplustop) { //read Little bump as e+ top
-                        // aida.histogram1D("Little Bump Track Momenta (Px)").fill(trk1.getPX());
-                        // aida.histogram1D("Little Bump Track Momenta (Py)").fill(trk1.getPY());
-                        // aida.histogram1D("Little Bump Track Momenta (Pz)").fill(trk1.getPZ());
-                        // aida.histogram1D("Little Bump Tracks Chi2").fill(trk1.getChi2());
-                        // aida.histogram1D("Little Bump Track Momenta (Px)").fill(trk2.getPX());
-                        // aida.histogram1D("Little Bump Track Momenta (Py)").fill(trk2.getPY());
-                        // aida.histogram1D("Little Bump Track Momenta (Pz)").fill(trk2.getPZ());
-                        // aida.histogram1D("Little Bump Tracks Chi2").fill(trk2.getChi2());
-                        // aida.histogram1D("Little Bump Sum of Track's Momentums").fill(Math.sqrt(Math.pow((trk1.getPY() + trk2.getPY()), 2) + Math.pow((trk1.getPX() + trk2.getPX()), 2) + Math.pow((trk1.getPZ() + trk2.getPZ()), 2)));
-                        double Etrk1sq = (Math.pow(trkatconver1[1].x(), 2) + Math.pow(trkatconver1[1].y(), 2) + Math.pow(trkatconver1[1].z(), 2));
-                        double Etrk2sq = (Math.pow(trkatconver2[1].x(), 2) + Math.pow(trkatconver2[1].y(), 2) + Math.pow(trkatconver2[1].z(), 2));
-                        double Etrk1 = Math.sqrt(Etrk1sq);
-                        double Etrk2 = Math.sqrt(Etrk2sq);
-                        double p1dotp2 = (trkatconver1[1].x() * trkatconver2[1].x() + trkatconver1[1].y() * trkatconver2[1].y() + trkatconver1[1].z() * trkatconver2[1].z());
-                        aida.histogram1D("Invariant Mass").fill(Math.sqrt(2 * Etrk1 * Etrk2 - 2 * p1dotp2));
-                        if (qtrk1 == 1) {
-                            //       aida.histogram2D("Little Bump P+ vs. P-").fill(Math.sqrt((Math.pow((trk1.getPY()), 2) + Math.pow((trk1.getPX()), 2) + Math.pow((trk1.getPZ()), 2))), Math.sqrt((Math.pow((trk2.getPY()), 2) + Math.pow((trk2.getPX()), 2) + Math.pow((trk2.getPZ()), 2))));
-                        } else {
-                            //      aida.histogram2D("Little Bump P+ vs. P-").fill(Math.sqrt((Math.pow((trk2.getPY()), 2) + Math.pow((trk2.getPX()), 2) + Math.pow((trk2.getPZ()), 2))), Math.sqrt((Math.pow((trk1.getPY()), 2) + Math.pow((trk1.getPX()), 2) + Math.pow((trk1.getPZ()), 2))));
-                        }
-                        aida.histogram2D("X v Y - e+ Top").fill(C.get(0, 0), C.get(1, 0));
-                        aida.histogram2D("X v Z - e+ Top").fill(C.get(0, 0), C.get(2, 0));
-                        aida.histogram2D("Y v Z - e+ Top").fill(C.get(1, 0), C.get(2, 0));
-                    } else { //read Big bump as e- top
-//                        aida.histogram1D("Big Bump Track Momenta (Px)").fill(trk1.getPX());
-//                        aida.histogram1D("Big Bump Track Momenta (Py)").fill(trk1.getPY());
-//                        aida.histogram1D("Big Bump Track Momenta (Pz)").fill(trk1.getPZ());
-//                        aida.histogram1D("Big Bump Tracks Chi2").fill(trk1.getChi2());
-//                        aida.histogram1D("Big Bump Track Momenta (Px)").fill(trk2.getPX());
-//                        aida.histogram1D("Big Bump Track Momenta (Py)").fill(trk2.getPY());
-//                        aida.histogram1D("Big Bump Track Momenta (Pz)").fill(trk2.getPZ());
-//                        aida.histogram1D("Big Bump Tracks Chi2").fill(trk2.getChi2());
-//                        aida.histogram1D("Big Bump Sum of Track's Momentums").fill(Math.sqrt(Math.pow((trk1.getPY() + trk2.getPY()), 2) + Math.pow((trk1.getPX() + trk2.getPX()), 2) + Math.pow((trk1.getPZ() + trk2.getPZ()), 2)));
-                        double Etrk1sq = (Math.pow(trkatconver1[1].x(), 2) + Math.pow(trkatconver1[1].y(), 2) + Math.pow(trkatconver1[1].z(), 2));
-                        double Etrk2sq = (Math.pow(trkatconver2[1].x(), 2) + Math.pow(trkatconver2[1].y(), 2) + Math.pow(trkatconver2[1].z(), 2));
-                        double Etrk1 = Math.sqrt(Etrk1sq);
-                        double Etrk2 = Math.sqrt(Etrk2sq);
-                        double p1dotp2 = (trkatconver1[1].x() * trkatconver2[1].x() + trkatconver1[1].y() * trkatconver2[1].y() + trkatconver1[1].z() * trkatconver2[1].z());
-                        aida.histogram1D("Invariant Mass").fill(Math.sqrt(2 * Etrk1 * Etrk2 - 2 * p1dotp2));
-                        if (qtrk1 == 1) {
-                            //  aida.histogram2D("Big Bump P+ vs. P-").fill(Math.sqrt((Math.pow((trk1.getPY()), 2) + Math.pow((trk1.getPX()), 2) + Math.pow((trk1.getPZ()), 2))), Math.sqrt((Math.pow((trk2.getPY()), 2) + Math.pow((trk2.getPX()), 2) + Math.pow((trk2.getPZ()), 2))));
-                        } else {
-                            // aida.histogram2D("Big Bump P+ vs. P-").fill(Math.sqrt((Math.pow((trk2.getPY()), 2) + Math.pow((trk2.getPX()), 2) + Math.pow((trk2.getPZ()), 2))), Math.sqrt((Math.pow((trk1.getPY()), 2) + Math.pow((trk1.getPX()), 2) + Math.pow((trk1.getPZ()), 2))));
-                        }
-                        aida.histogram2D("X v Y - e- Top").fill(C.get(0, 0), C.get(1, 0));
-                        aida.histogram2D("X v Z - e- Top").fill(C.get(0, 0), C.get(2, 0));
-                        aida.histogram2D("Y v Z - e- Top").fill(C.get(1, 0), C.get(2, 0));
-                    }
-                }
-                boolean check4 = true;
-                if (my2 == 0) {
-                    check4 = false;
-                }
-
-//                aida.histogram1D("Track Distributions").fill(isTrk2Top + isTrk1Top);
-//                aida.histogram1D("Charge Distributions").fill(qtrk1 + qtrk2);
-
-
-                if ((isTrk2Top + isTrk1Top) == 0) {
-//                    aida.histogram1D("Split Track Momenta (Px)").fill(trk1.getPX());
-//                    aida.histogram1D("Split Track Momenta (Py)").fill(trk1.getPY());
-//                    aida.histogram1D("Split Track Momenta (Pz)").fill(trk1.getPZ());
-//                    aida.histogram1D("Split Tracks Chi2").fill(trk1.getChi2());
-//                    aida.histogram1D("Split Track Momenta (Px)").fill(trk2.getPX());
-//                    aida.histogram1D("Split Track Momenta (Py)").fill(trk2.getPY());
-//                    aida.histogram1D("Split Track Momenta (Pz)").fill(trk2.getPZ());
-//                    aida.histogram1D("Split Tracks Chi2").fill(trk2.getChi2());
-                    //     aida.histogram1D("Charge Distributions Split Tracks").fill(qtrk1 + qtrk2);
-                }
-
-                if ((isTrk2Top + isTrk1Top) == 2) {
-//                    aida.histogram1D("Top-Top Track Momenta (Px)").fill(trk1.getPX());
-//                    aida.histogram1D("Top-Top Track Momenta (Py)").fill(trk1.getPY());
-//                    aida.histogram1D("Top-Top Track Momenta (Pz)").fill(trk1.getPZ());
-//                    aida.histogram1D("Top-Top Tracks Chi2").fill(trk1.getChi2());
-//                    aida.histogram1D("Top-Top Track Momenta (Px)").fill(trk2.getPX());
-//                    aida.histogram1D("Top-Top Track Momenta (Py)").fill(trk2.getPY());
-//                    aida.histogram1D("Top-Top Track Momenta (Pz)").fill(trk2.getPZ());
-//                    aida.histogram1D("Top-Top Tracks Chi2").fill(trk2.getChi2());
-                    //     aida.histogram1D("Charge Distributions Non-Split Tracks").fill(qtrk1 + qtrk2);
-                }
-
-
-//                if ((qtrk1 + qtrk2) == 0) {
-//                    aida.histogram1D("Perpendicular Momentum").fill(Math.sqrt(Math.pow((trk1.getPY() + trk2.getPY()), 2) + Math.pow((trk1.getPZ() + trk2.getPZ()), 2)));
-//
-//                    if (qtrk1 == 1) {
-//                        aida.histogram2D("Py+ vs. Py-").fill(trk1.getPY(), trk2.getPY());
-//                        aida.histogram2D("Pz+ vs. Pz-").fill(trk1.getPZ(), trk2.getPZ());
-//                        aida.histogram2D("Total P+ vs. P-").fill(Math.sqrt((Math.pow((trk1.getPY()), 2) + Math.pow((trk1.getPX()), 2) + Math.pow((trk1.getPZ()), 2))), Math.sqrt((Math.pow((trk2.getPY()), 2) + Math.pow((trk2.getPX()), 2) + Math.pow((trk2.getPZ()), 2))));
-//
-//                    } else {
-//                        aida.histogram2D("Py+ vs. Py-").fill(trk2.getPY(), trk1.getPY());
-//                        aida.histogram2D("Pz+ vs. Pz-").fill(trk2.getPZ(), trk1.getPZ());
-//                        aida.histogram2D("Total P+ vs. P-").fill(Math.sqrt((Math.pow((trk2.getPY()), 2) + Math.pow((trk2.getPX()), 2) + Math.pow((trk2.getPZ()), 2))), Math.sqrt((Math.pow((trk1.getPY()), 2) + Math.pow((trk1.getPX()), 2) + Math.pow((trk1.getPZ()), 2))));
-//                    }
-//                }
-
-            }
-
-
-        }
-    }
-
-    @Override
-    public void reset() {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-
-    public void setOutputPlots(String output) {
-        this.outputPlots = output;
-    }
-
-    public void setShowPlots(boolean showem) {
-        this.showPlots = showem;
-    }
-
-    public void setOutputTextName(String output) {
-        this.outputTextName = output;
-    }
-
-    public void endOfData() {
-
-        pw.close();
-        try {
-            fw.close();
-        } catch (IOException ex) {
-            Logger.getLogger(TwoTrackAnalysis.class.getName()).log(Level.SEVERE, null, ex);
-        }
-        System.out.println("Output");
-        if (outputPlots != null) {
-            try {
-                aida.saveAs(outputPlots);
-            } catch (IOException ex) {
-                Logger.getLogger(ElwinsTrackingRecon.class.getName()).log(Level.SEVERE, null, ex);
-            }
-        }
-    }
-}

java/trunk/users/src/test/java/org/lcsim/hps/users/ngraf
NearestNeighborClusterDriverTest.java 382 -> 383
--- java/trunk/users/src/test/java/org/lcsim/hps/users/ngraf/NearestNeighborClusterDriverTest.java	2014-03-26 05:43:58 UTC (rev 382)
+++ java/trunk/users/src/test/java/org/lcsim/hps/users/ngraf/NearestNeighborClusterDriverTest.java	2014-03-26 06:16:27 UTC (rev 383)
@@ -4,7 +4,10 @@
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.List;
+
 import junit.framework.TestCase;
+
+import org.hps.users.ngraf.NearestNeighborClusterDriver;
 import org.lcsim.event.CalorimeterHit;
 import org.lcsim.event.Cluster;
 import org.lcsim.event.EventHeader;
@@ -16,6 +19,7 @@
 
 import hep.aida.IAnalysisFactory;
 import hep.aida.IPlotter;
+
 import java.io.BufferedReader;
 import java.io.InputStreamReader;
 
SVNspam 0.1